Search Unity

New allocation free APIs?

Discussion in '2019.1 Beta' started by Alloc, Jan 4, 2019.

  1. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    214
    Hi,

    was going to reply to the thread about the GC changes (because there was talk about new allocation free APIs already) but as that is from the 2018.3 beta I can no longer do this :)

    Would it be possible to get allocation free APIs for Texture2D.GetPixels(32)?
    Like void GetPixels32 (IList<Color32> target) and void GetPixels (IList<Color> target) etc?
    Also, GetPixels32 is currently missing the override to get just a specific area like GetPixels does ( Color[] GetPixels(int x, int y, int blockWidth, int blockHeight, int miplevel) ). Would be nice to get that for GetPixels32 too (as well as non-allocating versions for those two overrides) :)

    We're working with reading textures for a bunch of data a lot (maps related mostly) and having these APIs create arrays for up to 16k*16k images is obviously quite annoying ;)

    Regards,
    Chris
     
    Cromfeli likes this.
  2. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,068
    PixelJ and hippocoder like this.
  3. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    214
    Yeah, but that data will depend on the input format. GetPixels(32) will always give me the same results, no matter how the texture was encoded :)
     
  4. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    24,690
    Try https://feedback.unity3d.com/ also.

    Btw due to a report I should point out that it's actually OK to provide feedback or ask for improvement on existing alpha features so long as its related and on topic with the alpha. This thread is *very* loosely related to GC in alpha, so it'll be up to Unity staff to respond or not, but I wouldn't stray too far nor press too hard for this.

    Regarding the GC thing, it will not work under editor so if you're doing editor side processing, then there's nothing Unity can do, and you can no longer disable GC under the editor as of latest Alpha as a heads up.

    As 2019+ is also about reducing allocations, seems a valid place to ask for peripheral improvement.
     
  5. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    680
    Then, to add to this:

    Gc alloc free APIs for Renderer material arrays and keywords, please!

    There is currently no way to manage the list of materials on a renderer without generating arrays, and same issue with material keywords.
     
  6. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    3,235
    I wonder if these API issues should be considered as a bug. Sooo... should we submit bug-reports for these kind of problems? Unity Technologies can then address those eventually and the community can see whether or not UT has an open ticket for it in the issue tracker.

    The problem with the feedback tracker is that it's an one-way-street. You post something and never hear anything.
     
  7. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    24,690
    Please post bug reports if you care for it, and double them up on the tracker. It's all about if you have time. If sufficient reports come in moaning about renderer material allocations, then this has to go on their radar, and indeed I don't see this being actually something hard for them to fix (it's probably just a backing field).
     
    Cromfeli likes this.
  8. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    214
    Yeah, exactly my points. Unity Feedback seems useless as I have rarely (never?) seen a statement to an entry from Unity saying they are even looking at it. And not sure if stuff like this counts as bugs so no idea if we should use the bug report system.
    A clear statement from the Unity team on this would be really welcome.

    Or a statement on the mentioned things in here :D

    Regards,
    Chris
     
  9. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    589
    I see they added Mesh.SetBoneWeights (which was missing from their List<> versions) with a Native Array argument. Are we actually going to get the rest of the Mesh methods with Native Array support?

    Absolutely agree that Unity Feedback site is useless, I've never seen any evidence that any of the developers actually read it.