Jump to content
  • Advertisement
Nikita Sidorenko

Can't compile HLSL pixel shader with StructuredBuffer

Recommended Posts

Posted (edited)

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:


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?


Edited by Nikita Sidorenko

Share this post

Link to post
Share on other sites
Posted (edited)

You seem to have forgotten a semicolon on line 76.

struct LightGrid {
    uint offset;
    uint lightsCount;
    uint projectorsCount;
} /*HERE*/

StructuredBuffer<LightGrid> lightGridBuffer : register(t3);

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

Edited by simco50

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!