Can't compile HLSL pixel shader with StructuredBuffer

Started by
2 comments, last by Nikita Sidorenko 5 years ago

Hi, I'm porting my non-production tiled forward render from OpenGL to Direct3D11.

I want to store the light tiles data in the structured buffer but pixel shader doesn't compile with the following error:

Quote

error X3000: syntax error: unexpected token 'StructuredBuffer'

 

Shader source: https://gist.github.com/Division/2e7b53775eceb88a3472981571009531

It's failing on the line 78 (may have other errors too, tile debug stuff is untested):


StructuredBuffer<LightGrid> lightGridBuffer : register(t3);

 

I tried to compile both ps_4_0 and ps_5_0 - no difference

What can be wrong with it?

 

Advertisement

You seem to have forgotten a semicolon on line 76.


#if defined (RESOURCE_LIGHT_GRID)
struct LightGrid {
    uint offset;
    uint lightsCount;
    uint projectorsCount;
} /*HERE*/

StructuredBuffer<LightGrid> lightGridBuffer : register(t3);
#endif

Confusingly, cbuffer declarations don't need semicolons at the end AFAIK

Oh, such a dumb mistake! Thanks for pointing this out!

This topic is closed to new replies.

Advertisement