Apparently gamma22 gives incorrect colors or at least colors different from rendering without color management. srgb transfer function gives expected colors.

This commit is contained in:
Kovid Goyal
2025-07-31 19:07:28 +05:30
parent caa654b6b8
commit 2ffa8cd7c2
2 changed files with 5 additions and 3 deletions

6
glfw/wl_init.c vendored
View File

@@ -483,6 +483,8 @@ on_supported_color_feature(void *data UNUSED, struct wp_color_manager_v1 *wp_col
static void static void
on_supported_color_transfer_function(void *data UNUSED, struct wp_color_manager_v1 *wp_color_manager_v1 UNUSED, uint32_t x) { on_supported_color_transfer_function(void *data UNUSED, struct wp_color_manager_v1 *wp_color_manager_v1 UNUSED, uint32_t x) {
switch(x) { switch(x) {
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB:
_glfw.wl.color_manager.supported_transfer_functions.srgb = true; break;
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22: case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22:
_glfw.wl.color_manager.supported_transfer_functions.gamma22 = true; break; _glfw.wl.color_manager.supported_transfer_functions.gamma22 = true; break;
case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR: case WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR:
@@ -861,13 +863,13 @@ int _glfwPlatformInit(bool *supports_window_occlusion)
if (_glfw.wl.wp_color_manager_v1) { if (_glfw.wl.wp_color_manager_v1) {
while (!_glfw.wl.color_manager.capabilities_reported) wl_display_roundtrip(_glfw.wl.display); while (!_glfw.wl.color_manager.capabilities_reported) wl_display_roundtrip(_glfw.wl.display);
_glfw.wl.color_manager.has_needed_capabilities = \ _glfw.wl.color_manager.has_needed_capabilities = \
_glfw.wl.color_manager.supported_transfer_functions.gamma22 && _glfw.wl.color_manager.supported_transfer_functions.srgb &&
_glfw.wl.color_manager.supported_features.parametric && _glfw.wl.color_manager.supported_features.parametric &&
_glfw.wl.color_manager.supported_features.set_primaries; _glfw.wl.color_manager.supported_features.set_primaries;
if (_glfw.wl.color_manager.has_needed_capabilities) { if (_glfw.wl.color_manager.has_needed_capabilities) {
struct wp_image_description_creator_params_v1 *c = wp_color_manager_v1_create_parametric_creator( struct wp_image_description_creator_params_v1 *c = wp_color_manager_v1_create_parametric_creator(
_glfw.wl.wp_color_manager_v1); _glfw.wl.wp_color_manager_v1);
wp_image_description_creator_params_v1_set_tf_named(c, WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22); wp_image_description_creator_params_v1_set_tf_named(c, WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB);
wp_image_description_creator_params_v1_set_primaries_named(c, WP_COLOR_MANAGER_V1_PRIMARIES_SRGB); wp_image_description_creator_params_v1_set_primaries_named(c, WP_COLOR_MANAGER_V1_PRIMARIES_SRGB);
wp_image_description_v1_add_listener(wp_image_description_creator_params_v1_create(c), wp_image_description_v1_add_listener(wp_image_description_creator_params_v1_create(c),
&image_description_listener, NULL); &image_description_listener, NULL);

2
glfw/wl_platform.h vendored
View File

@@ -397,7 +397,7 @@ typedef struct _GLFWlibraryWayland
} egl; } egl;
struct { struct {
struct { bool gamma22, ext_linear; } supported_transfer_functions; struct { bool gamma22, ext_linear, srgb; } supported_transfer_functions;
struct { bool srgb; } supported_primaries; struct { bool srgb; } supported_primaries;
struct { bool parametric, set_primaries; } supported_features; struct { bool parametric, set_primaries; } supported_features;
bool capabilities_reported, image_description_done, has_needed_capabilities; bool capabilities_reported, image_description_done, has_needed_capabilities;