Closed kcbanner closed 1 month ago
Good fix, but while looking at the existing pixelformat init code and the GLES3/WebGL2 spec, it would be better to do a small code cleanup first, because the initialization of SG_PIXELFORMAT_RG11B10F
is in the wrong place...
Basically: SG_PIXELFORMAT_RG11B10F is also renderable on GLES3 and WebGL3 if the EXT_color_buffer_float extension is present (and sokol-gfx already checks for that)...
But that needs some code cleanup, maybe you could do this as part of the PR?
The initialization for SG_PIXELFORMAT_RG11B10F
needs to be moved down into the function _sg_gl_init_pixelformats_float
and apart from renderable we also need find out under what conditions the format is blendable (but I guess for a start we can just use the same conventions as for the other float pixel formats in that function - I wouldn't be surprised though if RG11B10 is a special case and might never be blendable (need to check the OES_texture_float_linear
and EXT_float_blend
extensions...
The rest should then work automatically, e.g. that function _sg_gl_init_pixelformats_float
is called with all values true on GLCORE, and with the actually available extensions on GLES3/WebGL2.
Thanks!
MDN docs for the extensions:
That makes sense! I've updated the branch to reflect those changes.
EXT_float_blend
only specifies that buffers with 32-bit floating point components are blendable, so I didn't mark it as blendable.
...and merged, thanks! I'll also write a short blurb in the changelog.
...here it is in the pixelformats-sapp sample btw (the red cross is for the missing 'blending' feature, as expected). It also looks the same on WebGL2 (on desktop at least):
Page 209 of https://registry.khronos.org/OpenGL/specs/gl/glspec46.core.pdf (and page 181 of https://registry.khronos.org/OpenGL/specs/gl/glspec43.core.pdf for 4.3) show
R11F_G11F_B10F
as color renderable.