Data structure packing

I have this structure:

struct SVONode
    uint child[8];

And I am binding it like so:

layout(binding = 5) readonly buffer SVONodeBlock { SVONode svonodes[]; };

I am expecting this to be a tightly packed array where each element is 32 bytes (eight 32-bit unsigned integers) so I can upload an array of the identical structures declared in C++.

Am I making any mistakes here? The shader does not seem to be getting the right data.

Try again using std430 layout explicitly. You shouldn’t have to, since the extension says that this will be the default for buffer variables.

Alternatively, look at the SPIR-V assembly output.

The results are identical when I add that, so I think the problem is probably somewhere else.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.