Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Structured Buffer Issues In Unity 2018

Discussion in 'General Graphics' started by brilliantgames, Jun 5, 2018.

  1. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    Ever since I upgraded to 2018, I've been having a huge issue with my shader. In my shader I declare a structured buffer.

    #ifdef SHADER_API_D3D11
    uniform StructuredBuffer<float3> vertanim : register(t1);
    #endif

    It worked perfectly in 2017. But now it claims "vertanim" is undeclared. It's as if "#ifdef SHADER_API_D3D11" is not being met. How is this possible? Did you guys change the "SHADER_API_D3D11" keyword without updating documentation?

    Please respond. The project is on hold because of this.

    Regards,

    Robert.
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,836
    No, we didn't.

    What happens if you remove the `#ifdef/#endif` around it?
     
  3. brilliantgames

    brilliantgames

    Joined:
    Jan 7, 2012
    Posts:
    1,937
    It turns out that Unity 2018 requires that any code referencing "vertanim" (or any buffer) later in the script needs to have the #ifdef/#endif around it as well. Strange. I think you guys may need to look into this. It's very unpredictable behavior and it was guess work that solved it. Seems like a bug.
     
    Last edited: Jun 6, 2018
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,836
    It rather sounds to me like there was a bug in the version you were using previously, which got fixed.