Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

New allocation free APIs?

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

  1. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    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,394
    PixelJ and hippocoder like this.
  3. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    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

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    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:
    1,123
    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.
     
    DaveL99 likes this.
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    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

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    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:
    241
    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:
    640
    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.
     
  10. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    So, can anyone from Unity Technologies give any feedback on how to proceed on stuff like this? Pretty please? :)
     
  11. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    I really waiting for Mesh API with Native Arrays. Copying data around is so annoying.
     
  12. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Right now the recommended way to submit feedback is to start a thread in a subforum related to the area and adding the "Feedback" prefix to it.

    https://forum.unity.com/threads/the-future-of-unity-feedback.633241/
     
  13. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
  14. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    The Feedback prefix doesn't help as much as you'd hope, I've been lucky 1/5 times, heres 4 with absolutely 0 movement - some threads have been up for months, and 2 of which I put a lot of effort in to. Also, the first link here is regarding non-alloc API's too

    https://forum.unity.com/threads/missing-nonalloc-api-to-fetch-material-shaderkeywords.686371/

    https://forum.unity.com/threads/nes...-public-but-new-close-previewscene-is.680935/

    https://forum.unity.com/threads/materialpropertyblock-equivalent-for-shaderkeywords.636517/

    https://forum.unity.com/threads/gra...he-renderer-with-a-different-material.636490/
     
    myloran likes this.