Is it Impossible to Use Arbitrary Length Buffers in GLSL ES 3.0?

I’m investigating porting a shader of mine from GLSL 4.5 to GLSL ES 3.0 for the purpose of targeting WebGL2. I was able to use shaderc and spirv-cross to automatically convert my shader, but one of shader blocks fails because it uses a layout(std430) ( because it is a buffer, I’m guessing ):

Source:

layout(set = 2, binding = 5) buffer LdtkTilemapLayer_tiles {
    TileInfo[] map_tiles;
};

Translated:

layout(std430) buffer LdtkTilemapLayer_tiles
{
    TileInfo map_tiles[];
} _143

I don’t have any way to know how many tiles will be in the map ahead of time, which is why I’m using the buffer instead of a normal array uniform. Is there no way in GLSL ES 3.0 to do arbitrary length buffers?

Pardon me if my terminology is off in some of this, I’m still figuring it out.

ES 3.0 doesn’t have SSBOs and ES 3.0 GLSL doesn’t have “buffer” variables. Those were added in ES 3.1.

1 Like

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