render/vulkan: add color transformation matrix

This commit is contained in:
Simon Ser 2025-01-27 18:04:53 +01:00
parent a30c102163
commit 2ea0e386c4
3 changed files with 12 additions and 3 deletions

View file

@ -8,8 +8,9 @@ layout(location = 0) in vec2 uv;
layout(location = 0) out vec4 out_color;
/* struct wlr_vk_frag_output_pcr_data */
layout(push_constant) uniform UBO {
layout(offset = 80) float lut_3d_offset;
layout(push_constant, row_major) uniform UBO {
layout(offset = 80) mat4 matrix;
float lut_3d_offset;
float lut_3d_scale;
} data;
@ -43,6 +44,8 @@ void main() {
rgb = in_color.rgb / alpha;
}
rgb = mat3(data.matrix) * rgb;
if (OUTPUT_TRANSFORM == OUTPUT_TRANSFORM_LUT_3D) {
// Apply 3D LUT
vec3 pos = data.lut_3d_offset + rgb * data.lut_3d_scale;