single-pixel-buffer: add support for floating-point buffers

This allows clients to create buffers with channel values smaller than
0.0 or larger than 1.0. This allows clients to use single pixel buffers
with surfaces with an extended color space.

The conversion between floating point values and uints can be performed
with a memcpy.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
This commit is contained in:
Julian Orth 2025-04-14 16:30:58 +02:00
parent 4313a51a17
commit abbbc25b3c

View file

@ -36,7 +36,7 @@
only be done by creating a new major version of the extension.
</description>
<interface name="wp_single_pixel_buffer_manager_v1" version="1">
<interface name="wp_single_pixel_buffer_manager_v1" version="2">
<description summary="global factory for single-pixel buffers">
The wp_single_pixel_buffer_manager_v1 interface is a factory for
single-pixel buffers.
@ -65,5 +65,19 @@
<arg name="b" type="uint" summary="value of the buffer's blue channel"/>
<arg name="a" type="uint" summary="value of the buffer's alpha channel"/>
</request>
<request name="create_f32_rgba_buffer" since="2">
<description summary="create a 1×1 buffer from 32-bit IEEE 754 values">
The compositor interprets each value as the binary representation of a
IEEE 754 binary32 (also known as float, also known as f32) number.
The width and height of the buffer are 1.
</description>
<arg name="id" type="new_id" interface="wl_buffer"/>
<arg name="r" type="uint" summary="value of the buffer's red channel"/>
<arg name="g" type="uint" summary="value of the buffer's green channel"/>
<arg name="b" type="uint" summary="value of the buffer's blue channel"/>
<arg name="a" type="uint" summary="value of the buffer's alpha channel"/>
</request>
</interface>
</protocol>