Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Bug Attempting to bind Texture ID as UAV, the texture wasn't created with the UAV usage flag set!

Discussion in '2020.1 Beta' started by Quatum1000, Feb 2, 2020.

  1. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    805
    Hi,

    happens after initializing a serialized RT and use a compute shader during the Serialization 2.0 convert, I think.

    Code (CSharp):
    1.         int baseKernel = Compute.FindKernel("CopyBase");
    2.  
    3.         // ... Attempting to bind Texture ID xxx as UAV, the texture wasn't created with the UAV usage flag set!
    4.         Compute.SetTexture(baseKernel, "AmbientRT", RT_0);
    5.  
    The solution was to completely re-new all used RT_0 = new RenderTexture(....);
    Can not reproduce the issue after this fix.
     
    PuzzledBoy and h0neyfr0g like this.
  2. h0neyfr0g

    h0neyfr0g

    Joined:
    Jul 13, 2019
    Posts:
    17
    I'm also experiencing this bug. Could you help me understand your fix? Thanks you very much!
     
  3. PuzzledBoy

    PuzzledBoy

    Joined:
    Sep 9, 2014
    Posts:
    23
    new RenderTexture via code, and set enableRandomWrite=true can work.
     
  4. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    1,974
    Could you please submit a bug report for this issue if you're able to reproduce it?
     
  5. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    805
    Sorry for the late reply.

    Normally you can use a simple checkmate sniped to initialize an RT by
    If (RT==default) RT = new RenderTexture(...);
    The serialization process knows about the RT declaration and stores the RT initialization.
    As long as the RT is not default the RT will not being renewed.

    Now with the update process of the serialization system 2.0, the RT was updated into a new internal version with any missing ID reference, (or what every they do internally)

    So when calling If (RT==default) RT = new RenderTexture(...); in the new version of Unity Ser. 2 ,
    RT stays != default.
    The computeshader.set... compares the new serialization 2 properties with some old fragments from the previous serialization 1 fragments.

    If you force a renew by a temporal:
    RT.Release(); If (RT==default) RT = new RenderTexture(...);
    It's simply fixed in my case.
     
unityunity