multi-texture-format: Always use the tex coords of the first plane

The texture coordinates of all planes should be the same in theory so
using the coordinates of the first plane works.

The reason for this change is that Cogl somehow doesn't manage to get us
the correct coordinates for the 3rd plane in some circumstances. This is
really a workaround but not wrong in any way.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3176
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3469>
This commit is contained in:
Sebastian Wick 2023-12-19 21:41:02 +01:00 committed by Marge Bot
parent 33088d59db
commit c0832b99d8

View File

@ -61,22 +61,22 @@ static const char rgba_shader[] =
static const char y_xuxv_shader[] = static const char y_xuxv_shader[] =
"vec4 yuva = vec4(0.0, 0.0, 0.0, cogl_color_in.a); \n" "vec4 yuva = vec4(0.0, 0.0, 0.0, cogl_color_in.a); \n"
"yuva.x = texture2D(cogl_sampler0, cogl_tex_coord0_in.st).x; \n" "yuva.x = texture2D(cogl_sampler0, cogl_tex_coord0_in.st).x; \n"
"yuva.yz = texture2D(cogl_sampler1, cogl_tex_coord1_in.st).ga; \n" "yuva.yz = texture2D(cogl_sampler1, cogl_tex_coord0_in.st).ga; \n"
"cogl_color_out = yuv_to_rgb(yuva); \n"; "cogl_color_out = yuv_to_rgb(yuva); \n";
/* Shader for 1 Y-plane and 1 UV-plane */ /* Shader for 1 Y-plane and 1 UV-plane */
static const char y_uv_shader[] = static const char y_uv_shader[] =
"vec4 yuva = vec4(0.0, 0.0, 0.0, cogl_color_in.a); \n" "vec4 yuva = vec4(0.0, 0.0, 0.0, cogl_color_in.a); \n"
"yuva.x = texture2D(cogl_sampler0, cogl_tex_coord0_in.st).x; \n" "yuva.x = texture2D(cogl_sampler0, cogl_tex_coord0_in.st).x; \n"
"yuva.yz = texture2D(cogl_sampler1, cogl_tex_coord1_in.st).rg; \n" "yuva.yz = texture2D(cogl_sampler1, cogl_tex_coord0_in.st).rg; \n"
"cogl_color_out = yuv_to_rgb(yuva); \n"; "cogl_color_out = yuv_to_rgb(yuva); \n";
/* Shader for 1 Y-plane, 1 U-plane and 1 V-plane */ /* Shader for 1 Y-plane, 1 U-plane and 1 V-plane */
static const char y_u_v_shader[] = static const char y_u_v_shader[] =
"vec4 yuva = vec4(0.0, 0.0, 0.0, cogl_color_in.a); \n" "vec4 yuva = vec4(0.0, 0.0, 0.0, cogl_color_in.a); \n"
"yuva.x = texture2D(cogl_sampler0, cogl_tex_coord0_in.st).x; \n" "yuva.x = texture2D(cogl_sampler0, cogl_tex_coord0_in.st).x; \n"
"yuva.y = texture2D(cogl_sampler1, cogl_tex_coord1_in.st).x; \n" "yuva.y = texture2D(cogl_sampler1, cogl_tex_coord0_in.st).x; \n"
"yuva.z = texture2D(cogl_sampler2, cogl_tex_coord2_in.st).x; \n" "yuva.z = texture2D(cogl_sampler2, cogl_tex_coord0_in.st).x; \n"
"cogl_color_out = yuv_to_rgb(yuva); \n"; "cogl_color_out = yuv_to_rgb(yuva); \n";
typedef struct _MetaMultiTextureFormatFullInfo typedef struct _MetaMultiTextureFormatFullInfo