Smithay / smithay

A smithy for rusty wayland compositors
MIT License
1.9k stars 168 forks source link

`glBlitFramebuffer` fails if default framebuffer doesn't use `STENCIL_INDEX8` #1083

Open ids1024 opened 1 year ago

ids1024 commented 1 year ago

This seems to be an issue running with ANGLE: https://github.com/Smithay/smithay/pull/1082.

Changing STENCIL_INDEX8 to DEPTH24_STENCIL8 makes it run without errors and render correctly.

Should Smithay somehow detect the format to use here? Or avoid blitting depth to the default framebuffer?

Drakulix commented 1 year ago

STENCIL_INDEX8 is in general not as widely supported as DEPTH24_STENCIL8, but might be more performant and safes us from accidentally doing expensive DEPTH-buffer operations. But I guess we could easily fallback, since all we care for is having an 8-bit stencil buffer. But we would have to make sure, that we either never use the depth-test were we don't need to (hard) or never blit the depth buffer (easier).

ids1024 commented 1 year ago

In this case, both are supported, but you can't blit a STENCIL_INDEX8 to a DEPTH24_STENCIL8. Maybe that could be tested by doing a test glBlitFrameBuffer and seeing if it results in a GL error... I don't see a way to detect what the default framebuffer is using.