Can SSBO be read/write within the same shader?

Started by
0 comments, last by virtualpaul 2 years, 9 months ago

Hi,

I wrote a small tessellation shader and I can write to a SSBO (checked using RenderDoc) but reading the data back right away does not seem to work. If I set the tessellation levels directly, I can see that my code works, but going through the SSBO data does not.

Here is the SSBO:

struct SSBO_Data {

float Inside; // Inside Tessellation factor

float Edges[3]; // Tessellation factor

};

layout(std430, binding=2) volatile buffer Tiling {

SSBO_Data Tiles[];

};

// main of the Tessellation Control shader

Tiles[0].Inside = 1;

Tiles[0].Edges[0] = 1;

Tiles[0].Edges[1] = 2;

Tiles[0].Edges[2] = 4;

gl_TessLevelInner[0] = Tiles[0].Inside;

gl_TessLevelOuter[0] = Tiles[0].Edges[0];

gl_TessLevelOuter[1] = Tiles[0].Edges[1];

gl_TessLevelOuter[2] = Tiles[0].Edges[2];

But if I just set the values directly it works:

gl_TessLevelInner[0] = 1;

gl_TessLevelOuter[0] = 1;

gl_TessLevelOuter[1] = 2;

gl_TessLevelOuter[2] = 4;

This topic is closed to new replies.

Advertisement