Skip to content

render/gles2: produce 16f screencopy data

M. Stoeckl requested to merge mstoeckl/wlroots:16f-scrsht into master

This MR makes it possible for wlroots to read pixel data from XBGR16161616F buffers in the exact same format, instead of needing to fall back to reading XRGB8888 data. This did not work before, because the GL_IMPLEMENTATION_COLOR_READ_TYPE provided by Mesa was GL_HALF_FLOAT (0x140b) instead of GL_HALF_FLOAT_OES (0x8D61). See comments in the code, and the commit message, for more details.

Note: another alternative to the approach taken in this PR is to make wlroots require GL ES 3.0 to create half float textures and render buffers, in which case GL_HALF_FLOAT would be the format used both to create GL textures and to read from render buffers.

To test this code, build Sway from the branch at PR https://github.com/swaywm/sway/pull/7108 -- and run swaymsg output 'output-name' render_bit_depth 16f. Assuming the graphics driver and hardware support it, this should change the format of the output buffer to XBGR16161616F. If this succeeds, trying to take a screenshot using grim will produce the error unsupported format 1211384408 = 0x48344258, indicating that wlroots would provide a screenshot in format XBGR16161616F. With a build of grim from a branch made to support 16f formats, https://git.sr.ht/~mstoeckl/grim/log/16f-direct , taking screenshots should work and give normal looking output.

Edited by M. Stoeckl

Merge request reports