scene, render: use Gamma 2.2 TF as default

This commit is contained in:
Félix Poisot 2025-08-17 15:57:16 +00:00
parent c2d9ae2142
commit d8fb7adcf0
5 changed files with 14 additions and 16 deletions

View file

@ -57,10 +57,7 @@ static void convert_pixman_box_to_vk_rect(const pixman_box32_t *box, VkRect2D *r
}
static float color_to_linear(float non_linear) {
// See https://www.w3.org/Graphics/Color/srgb
return (non_linear > 0.04045) ?
pow((non_linear + 0.055) / 1.055, 2.4) :
non_linear / 12.92;
return pow(non_linear, 2.2);
}
static float color_to_linear_premult(float non_linear, float alpha) {
@ -229,7 +226,7 @@ static bool render_pass_submit(struct wlr_render_pass *wlr_pass) {
if (pass->color_transform && pass->color_transform->type != COLOR_TRANSFORM_INVERSE_EOTF) {
pipeline = render_buffer->two_pass.render_setup->output_pipe_lut3d;
} else {
enum wlr_color_transfer_function tf = WLR_COLOR_TRANSFER_FUNCTION_SRGB;
enum wlr_color_transfer_function tf = WLR_COLOR_TRANSFER_FUNCTION_GAMMA22;
if (pass->color_transform && pass->color_transform->type == COLOR_TRANSFORM_INVERSE_EOTF) {
struct wlr_color_transform_inverse_eotf *inverse_eotf =
wlr_color_transform_inverse_eotf_from_base(pass->color_transform);
@ -779,7 +776,7 @@ static void render_pass_add_texture(struct wlr_render_pass *wlr_pass,
enum wlr_color_transfer_function tf = options->transfer_function;
if (tf == 0) {
tf = WLR_COLOR_TRANSFER_FUNCTION_SRGB;
tf = WLR_COLOR_TRANSFER_FUNCTION_GAMMA22;
}
bool srgb_image_view = false;
@ -1186,7 +1183,7 @@ struct wlr_vk_render_pass *vulkan_begin_render_pass(struct wlr_vk_renderer *rend
}
} else {
// This is the default when unspecified
inv_eotf = WLR_COLOR_TRANSFER_FUNCTION_SRGB;
inv_eotf = WLR_COLOR_TRANSFER_FUNCTION_GAMMA22;
}
bool using_linear_pathway = inv_eotf == WLR_COLOR_TRANSFER_FUNCTION_EXT_LINEAR;