Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow SG_PIXELFORMAT_RG11B10F to be a render target on SOKOL_GLCORE #1121

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

kcbanner
Copy link
Contributor

@floooh
Copy link
Owner

floooh commented Oct 13, 2024

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_floatand 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:

@kcbanner
Copy link
Contributor Author

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.

@floooh floooh merged commit 2b62043 into floooh:master Oct 14, 2024
32 checks passed
@floooh
Copy link
Owner

floooh commented Oct 14, 2024

...and merged, thanks! I'll also write a short blurb in the changelog.

@floooh
Copy link
Owner

floooh commented Oct 14, 2024

...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):

Screenshot 2024-10-14 at 11 33 30

floooh added a commit that referenced this pull request Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants