pex-gl / pex-context

Modern WebGL state wrapper for PEX: allocate GPU resources (textures, buffers), setup state pipelines and passes, and combine them into commands.
http://pex-gl.github.io/pex-context/
MIT License
160 stars 12 forks source link

ctx.PixelFormat.RGBA32F is not renderable in WebGL2? #122

Closed vorg closed 3 months ago

vorg commented 2 years ago

Can't make any rg.* node work with pixelFormat: ctx.PixelFormat.RGBA32F. I get empty texture. ctx.PixelFormat.RGBA16F works fine. Tried both Linear and Nearest filtering.

Not needed (i can change older r.g. node to use 16F) but i wonder why is that?

dmnsgn commented 2 years ago

You need to enable EXT_color_buffer_float: https://developer.mozilla.org/en-US/docs/Web/API/EXT_color_buffer_float

https://github.com/pex-gl/pex-renderer/blob/f642330f86157dd7169843f44482a5b0b634124b/index.js#L82-L85

vorg commented 2 years ago

Oh that's so confusing because EXT_color_buffer_float seems to be handling both 32F and 16F. Fine.

dmnsgn commented 1 year ago

Should we add this as in ctx.capabilities?

vorg commented 1 year ago

Yes

dmnsgn commented 1 year ago

FYI, the list of renderable formats is long: https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/renderbufferStorage

So I removed the check in renderBuffer (b736415) but if you prefer I can do a big [...renderableFormats].includes(renderbuffer.pixelFormat) instead.

vorg commented 1 year ago

FYI, the list of renderable formats is long:

And we have not, are not and will not use them. I would prefer go back to top 10 used and add more if ever needed (i doubt it).

dmnsgn commented 1 year ago

b41b2bde10789c2ea785c233da3469a382efa13e actually broke support for WebGL1 float texture2D as I am overriding gl.RGBA16F and gl.RGBA32F with ext.RGBA32F_EXT and this is not how it should work for texture: these should only be used in renderbuffer.

Fixed in 588bfedde7e9515e79e005bec9798731d52913a0 with added test