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

Re: [Public WebGL] WebGL 2.0 uniform block layout



Hi Gregg,

Thanks for pointing this out; it's an oversight. FiledĀ https://github.com/KhronosGroup/WebGL/issues/1534 to track it. Not sure which is the best direction; to require that WebGL 2.0 shaders explicitly state they are using the std140 layout, or treat the default layout as std140. I wonder whether auto-upgrading shaders to std140 could potentially cause compatibility issues between native ES 3.0 apps and WebGL 2.0 apps (at least, if porting WebGL 2.0 apps back to ES 3.0).

-Ken


On Sat, Mar 5, 2016 at 12:14 AM, Gregg Tavares <khronos@greggman.com> wrote:
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