mirror of
https://github.com/brl/mutter.git
synced 2024-11-30 03:50:47 -05:00
multi-texture-format: Generalize shader names
These shaders can be used for similar formats with other component sizes since the values are represented as floats. So whether the source value was stored in 8bit, 10bit or 16bit doesn't matter - the driver will covert it for us. Thus use a Weston-inspired, more general naming scheme. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3244>
This commit is contained in:
parent
6be2add1b0
commit
66799c1aa0
@ -65,14 +65,14 @@ static const char y_xuxv_shader[] =
|
|||||||
"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 nv12_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_coord1_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 yuv420_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_coord1_in.st).x; \n"
|
||||||
@ -132,7 +132,7 @@ static MetaMultiTextureFormatInfo multi_format_table[] = {
|
|||||||
.plane_indices = { 0, 1 },
|
.plane_indices = { 0, 1 },
|
||||||
.hsub = { 1, 2 },
|
.hsub = { 1, 2 },
|
||||||
.vsub = { 1, 2 },
|
.vsub = { 1, 2 },
|
||||||
.rgb_shader = nv12_shader,
|
.rgb_shader = y_uv_shader,
|
||||||
.snippet_once = G_ONCE_INIT,
|
.snippet_once = G_ONCE_INIT,
|
||||||
},
|
},
|
||||||
/* 3 plane YUV */
|
/* 3 plane YUV */
|
||||||
@ -143,7 +143,7 @@ static MetaMultiTextureFormatInfo multi_format_table[] = {
|
|||||||
.plane_indices = { 0, 1, 2 },
|
.plane_indices = { 0, 1, 2 },
|
||||||
.hsub = { 1, 2, 2 },
|
.hsub = { 1, 2, 2 },
|
||||||
.vsub = { 1, 2, 2 },
|
.vsub = { 1, 2, 2 },
|
||||||
.rgb_shader = yuv420_shader,
|
.rgb_shader = y_u_v_shader,
|
||||||
.snippet_once = G_ONCE_INIT,
|
.snippet_once = G_ONCE_INIT,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user