#SHADER_API_D3D11 doesnt work on 2018.1.0b2

Hey guys,

I have a shader which uses StructuredBuffer.
Usually I wrote this to make it work

         #ifdef SHADER_API_D3D11
         StructuredBuffer<Vert> _verticesOutput;
         #endif

         #ifdef SHADER_API_D3D11
         RWStructuredBuffer<int> _ArcPartsEvent;
         #endif

i had to mentioned SHADER_API_D3D11 because there’s no StructuredBuffer on DirectX9. I also excluded it from the project. But now when I loaded my project in Unity 2018.1.0b2. Its saying that _verticesOutput is undeclared which means SHADER_API_D3D11 is not defined. Please, tell me how to fix it.

Support for DirectX 9 was dropped in 2017.3. That said the SHADER_API_D3D11 should still exist since it is still used by Unity’s internal shader code.

The “real” issue is why is the code that uses _verticesOutput not also wrapped in an #ifdef block?

i use #ifdef SHADER_API_D3D11 because otherwise compiler cant find StructuredBuffer type . Same with RWStructuredBuffer. Do you know how to fix it other way?

That’s not what that error means. It means _verticesOutput is being accessed in code that isn’t also inside an #ifdef SHADER_API_D3D11 block.

but before it worked. maybe they changed sth.
before i only had to wrap StructuredBuffer declaration in SHADER_API_D3D11

No idea why it would have worked before, because it shouldn’t have.