[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] WebGL 2.0 uniform block layout



AFAICT from the specs

* WebGL 2.0 layout only supports std140

* The layout in GLSL default is implementation specific packed

From the ES 3.0 spec 2.11

> By default, uniforms contained within a uniform block are extracted from buffer storage in an implementation-dependent manner

That means currently it is unspecified what the WebGL 2.0 uniform block layout is if the user does not manually specify std140

I assume the intent is that the default for all WebGL 2.0 is the same as std140 but that's not specified AFAICT.

Also because of the current spec it's unclear if an shader that hasn't specified std140 is even allowed to compile. It seems like no.

On top of that, if I understand correctly, *packed* is the default in OpenGL ES 3? If so, would it better if WebGL basically defined a standard packed format that equals std140? In that case shaders would run as is without each shader having to explicitly declare every uniform block as std140

WebGL implementations would just have to re-write shaders to that say layout(packed, ...) to layout(std140, ...) before compiling (or whatever they do now)

Am I making any sense or am I missing something?

-gregg