render: introduce Gamma 2.2 color transform

This commit is contained in:
Félix Poisot 2025-08-17 15:51:26 +00:00
parent 6978509f64
commit c2d9ae2142
9 changed files with 31 additions and 1 deletions

View file

@ -18,6 +18,7 @@ layout (constant_id = 0) const int TEXTURE_TRANSFORM = 0;
#define TEXTURE_TRANSFORM_IDENTITY 0
#define TEXTURE_TRANSFORM_SRGB 1
#define TEXTURE_TRANSFORM_ST2084_PQ 2
#define TEXTURE_TRANSFORM_GAMMA22 3
float srgb_channel_to_linear(float x) {
return mix(x / 12.92,
@ -60,6 +61,8 @@ void main() {
rgb = srgb_color_to_linear(rgb);
} else if (TEXTURE_TRANSFORM == TEXTURE_TRANSFORM_ST2084_PQ) {
rgb = pq_color_to_linear(rgb);
} else if (TEXTURE_TRANSFORM == TEXTURE_TRANSFORM_GAMMA22) {
rgb = pow(rgb, vec3(2.2));
}
rgb *= data.luminance_multiplier;