blob: 2fd2ef43251554635ac4a89d5d8d0f07e4c344f5 [file] [log] [blame]
Ben Claytonda5424b2022-10-24 23:58:53 +00001#version 310 es
2
Ben Clayton2657b922023-03-08 22:29:38 +00003vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
4 return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
5}
6
7
Ben Claytonda5424b2022-10-24 23:58:53 +00008struct GammaTransferParams {
9 float G;
10 float A;
11 float B;
12 float C;
13 float D;
14 float E;
15 float F;
16 uint padding;
17};
18
19struct ExternalTextureParams {
20 uint numPlanes;
21 uint doYuvToRgbConversionOnly;
Ben Clayton03de0e82023-03-02 20:48:48 +000022 uint pad;
23 uint pad_1;
Ben Claytonda5424b2022-10-24 23:58:53 +000024 mat3x4 yuvToRgbConversionMatrix;
25 GammaTransferParams gammaDecodeParams;
26 GammaTransferParams gammaEncodeParams;
27 mat3 gamutConversionMatrix;
Ben Claytonbe367b72023-01-04 12:29:56 +000028 mat3x2 coordTransformationMatrix;
Ben Clayton03de0e82023-03-02 20:48:48 +000029 uint pad_2;
30 uint pad_3;
Ben Claytonda5424b2022-10-24 23:58:53 +000031};
32
Ben Claytonbe367b72023-01-04 12:29:56 +000033struct ExternalTextureParams_std140 {
34 uint numPlanes;
35 uint doYuvToRgbConversionOnly;
Ben Clayton03de0e82023-03-02 20:48:48 +000036 uint pad;
37 uint pad_1;
Ben Claytonbe367b72023-01-04 12:29:56 +000038 mat3x4 yuvToRgbConversionMatrix;
39 GammaTransferParams gammaDecodeParams;
40 GammaTransferParams gammaEncodeParams;
41 mat3 gamutConversionMatrix;
42 vec2 coordTransformationMatrix_0;
43 vec2 coordTransformationMatrix_1;
44 vec2 coordTransformationMatrix_2;
Ben Clayton03de0e82023-03-02 20:48:48 +000045 uint pad_2;
46 uint pad_3;
Ben Claytonbe367b72023-01-04 12:29:56 +000047};
48
49layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo {
50 ExternalTextureParams_std140 inner;
Ben Claytonda5424b2022-10-24 23:58:53 +000051} ext_tex_params;
52
53vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
54 bvec3 cond = lessThan(abs(v), vec3(params.D));
55 vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
56 vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
Ben Clayton2657b922023-03-08 22:29:38 +000057 return tint_select(f, t, cond);
Ben Claytonda5424b2022-10-24 23:58:53 +000058}
59
60vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
jchen1039b73302023-02-23 13:03:52 +000061 uvec2 coord1 = (coord >> uvec2(1u));
Ben Claytonda5424b2022-10-24 23:58:53 +000062 vec3 color = vec3(0.0f, 0.0f, 0.0f);
63 if ((params.numPlanes == 1u)) {
Ben Clayton2e376a92022-10-26 18:47:02 +000064 color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
Ben Claytonda5424b2022-10-24 23:58:53 +000065 } else {
jchen1039b73302023-02-23 13:03:52 +000066 color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
Ben Claytonda5424b2022-10-24 23:58:53 +000067 }
68 if ((params.doYuvToRgbConversionOnly == 0u)) {
69 color = gammaCorrection(color, params.gammaDecodeParams);
70 color = (params.gamutConversionMatrix * color);
71 color = gammaCorrection(color, params.gammaEncodeParams);
72 }
73 return vec4(color, 1.0f);
74}
75
76uniform highp sampler2D arg_0_1;
77uniform highp sampler2D ext_tex_plane_1_1;
Ben Claytonbe367b72023-01-04 12:29:56 +000078ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) {
Ben Clayton03de0e82023-03-02 20:48:48 +000079 return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3);
Ben Claytonbe367b72023-01-04 12:29:56 +000080}
81
Ben Clayton77a90cb2023-03-06 18:25:08 +000082layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
83 vec4 inner;
84} prevent_dce;
85
Ben Claytonda5424b2022-10-24 23:58:53 +000086void textureLoad_1bfdfb() {
Ben Claytonbe367b72023-01-04 12:29:56 +000087 vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, uvec2(1u), conv_ExternalTextureParams(ext_tex_params.inner));
Ben Clayton77a90cb2023-03-06 18:25:08 +000088 prevent_dce.inner = res;
Ben Claytonda5424b2022-10-24 23:58:53 +000089}
90
91vec4 vertex_main() {
92 textureLoad_1bfdfb();
93 return vec4(0.0f);
94}
95
96void main() {
97 gl_PointSize = 1.0;
98 vec4 inner_result = vertex_main();
99 gl_Position = inner_result;
100 gl_Position.y = -(gl_Position.y);
101 gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
102 return;
103}
104#version 310 es
Ben Claytonf1f56b22023-03-09 19:58:23 +0000105precision highp float;
Ben Claytonda5424b2022-10-24 23:58:53 +0000106
Ben Clayton2657b922023-03-08 22:29:38 +0000107vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
108 return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
109}
110
111
Ben Claytonda5424b2022-10-24 23:58:53 +0000112struct GammaTransferParams {
113 float G;
114 float A;
115 float B;
116 float C;
117 float D;
118 float E;
119 float F;
120 uint padding;
121};
122
123struct ExternalTextureParams {
124 uint numPlanes;
125 uint doYuvToRgbConversionOnly;
Ben Clayton03de0e82023-03-02 20:48:48 +0000126 uint pad;
127 uint pad_1;
Ben Claytonda5424b2022-10-24 23:58:53 +0000128 mat3x4 yuvToRgbConversionMatrix;
129 GammaTransferParams gammaDecodeParams;
130 GammaTransferParams gammaEncodeParams;
131 mat3 gamutConversionMatrix;
Ben Claytonbe367b72023-01-04 12:29:56 +0000132 mat3x2 coordTransformationMatrix;
Ben Clayton03de0e82023-03-02 20:48:48 +0000133 uint pad_2;
134 uint pad_3;
Ben Claytonda5424b2022-10-24 23:58:53 +0000135};
136
Ben Claytonbe367b72023-01-04 12:29:56 +0000137struct ExternalTextureParams_std140 {
138 uint numPlanes;
139 uint doYuvToRgbConversionOnly;
Ben Clayton03de0e82023-03-02 20:48:48 +0000140 uint pad;
141 uint pad_1;
Ben Claytonbe367b72023-01-04 12:29:56 +0000142 mat3x4 yuvToRgbConversionMatrix;
143 GammaTransferParams gammaDecodeParams;
144 GammaTransferParams gammaEncodeParams;
145 mat3 gamutConversionMatrix;
146 vec2 coordTransformationMatrix_0;
147 vec2 coordTransformationMatrix_1;
148 vec2 coordTransformationMatrix_2;
Ben Clayton03de0e82023-03-02 20:48:48 +0000149 uint pad_2;
150 uint pad_3;
Ben Claytonbe367b72023-01-04 12:29:56 +0000151};
152
153layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo {
154 ExternalTextureParams_std140 inner;
Ben Claytonda5424b2022-10-24 23:58:53 +0000155} ext_tex_params;
156
157vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
158 bvec3 cond = lessThan(abs(v), vec3(params.D));
159 vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
160 vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
Ben Clayton2657b922023-03-08 22:29:38 +0000161 return tint_select(f, t, cond);
Ben Claytonda5424b2022-10-24 23:58:53 +0000162}
163
164vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
jchen1039b73302023-02-23 13:03:52 +0000165 uvec2 coord1 = (coord >> uvec2(1u));
Ben Claytonda5424b2022-10-24 23:58:53 +0000166 vec3 color = vec3(0.0f, 0.0f, 0.0f);
167 if ((params.numPlanes == 1u)) {
Ben Clayton2e376a92022-10-26 18:47:02 +0000168 color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
Ben Claytonda5424b2022-10-24 23:58:53 +0000169 } else {
jchen1039b73302023-02-23 13:03:52 +0000170 color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
Ben Claytonda5424b2022-10-24 23:58:53 +0000171 }
172 if ((params.doYuvToRgbConversionOnly == 0u)) {
173 color = gammaCorrection(color, params.gammaDecodeParams);
174 color = (params.gamutConversionMatrix * color);
175 color = gammaCorrection(color, params.gammaEncodeParams);
176 }
177 return vec4(color, 1.0f);
178}
179
180uniform highp sampler2D arg_0_1;
181uniform highp sampler2D ext_tex_plane_1_1;
Ben Claytonbe367b72023-01-04 12:29:56 +0000182ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) {
Ben Clayton03de0e82023-03-02 20:48:48 +0000183 return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3);
Ben Claytonbe367b72023-01-04 12:29:56 +0000184}
185
Ben Clayton77a90cb2023-03-06 18:25:08 +0000186layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
187 vec4 inner;
188} prevent_dce;
189
Ben Claytonda5424b2022-10-24 23:58:53 +0000190void textureLoad_1bfdfb() {
Ben Claytonbe367b72023-01-04 12:29:56 +0000191 vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, uvec2(1u), conv_ExternalTextureParams(ext_tex_params.inner));
Ben Clayton77a90cb2023-03-06 18:25:08 +0000192 prevent_dce.inner = res;
Ben Claytonda5424b2022-10-24 23:58:53 +0000193}
194
195void fragment_main() {
196 textureLoad_1bfdfb();
197}
198
199void main() {
200 fragment_main();
201 return;
202}
203#version 310 es
204
Ben Clayton2657b922023-03-08 22:29:38 +0000205vec3 tint_select(vec3 param_0, vec3 param_1, bvec3 param_2) {
206 return vec3(param_2[0] ? param_1[0] : param_0[0], param_2[1] ? param_1[1] : param_0[1], param_2[2] ? param_1[2] : param_0[2]);
207}
208
209
Ben Claytonda5424b2022-10-24 23:58:53 +0000210struct GammaTransferParams {
211 float G;
212 float A;
213 float B;
214 float C;
215 float D;
216 float E;
217 float F;
218 uint padding;
219};
220
221struct ExternalTextureParams {
222 uint numPlanes;
223 uint doYuvToRgbConversionOnly;
Ben Clayton03de0e82023-03-02 20:48:48 +0000224 uint pad;
225 uint pad_1;
Ben Claytonda5424b2022-10-24 23:58:53 +0000226 mat3x4 yuvToRgbConversionMatrix;
227 GammaTransferParams gammaDecodeParams;
228 GammaTransferParams gammaEncodeParams;
229 mat3 gamutConversionMatrix;
Ben Claytonbe367b72023-01-04 12:29:56 +0000230 mat3x2 coordTransformationMatrix;
Ben Clayton03de0e82023-03-02 20:48:48 +0000231 uint pad_2;
232 uint pad_3;
Ben Claytonda5424b2022-10-24 23:58:53 +0000233};
234
Ben Claytonbe367b72023-01-04 12:29:56 +0000235struct ExternalTextureParams_std140 {
236 uint numPlanes;
237 uint doYuvToRgbConversionOnly;
Ben Clayton03de0e82023-03-02 20:48:48 +0000238 uint pad;
239 uint pad_1;
Ben Claytonbe367b72023-01-04 12:29:56 +0000240 mat3x4 yuvToRgbConversionMatrix;
241 GammaTransferParams gammaDecodeParams;
242 GammaTransferParams gammaEncodeParams;
243 mat3 gamutConversionMatrix;
244 vec2 coordTransformationMatrix_0;
245 vec2 coordTransformationMatrix_1;
246 vec2 coordTransformationMatrix_2;
Ben Clayton03de0e82023-03-02 20:48:48 +0000247 uint pad_2;
248 uint pad_3;
Ben Claytonbe367b72023-01-04 12:29:56 +0000249};
250
251layout(binding = 2, std140) uniform ext_tex_params_block_std140_ubo {
252 ExternalTextureParams_std140 inner;
Ben Claytonda5424b2022-10-24 23:58:53 +0000253} ext_tex_params;
254
255vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
256 bvec3 cond = lessThan(abs(v), vec3(params.D));
257 vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
258 vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
Ben Clayton2657b922023-03-08 22:29:38 +0000259 return tint_select(f, t, cond);
Ben Claytonda5424b2022-10-24 23:58:53 +0000260}
261
262vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
jchen1039b73302023-02-23 13:03:52 +0000263 uvec2 coord1 = (coord >> uvec2(1u));
Ben Claytonda5424b2022-10-24 23:58:53 +0000264 vec3 color = vec3(0.0f, 0.0f, 0.0f);
265 if ((params.numPlanes == 1u)) {
Ben Clayton2e376a92022-10-26 18:47:02 +0000266 color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
Ben Claytonda5424b2022-10-24 23:58:53 +0000267 } else {
jchen1039b73302023-02-23 13:03:52 +0000268 color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
Ben Claytonda5424b2022-10-24 23:58:53 +0000269 }
270 if ((params.doYuvToRgbConversionOnly == 0u)) {
271 color = gammaCorrection(color, params.gammaDecodeParams);
272 color = (params.gamutConversionMatrix * color);
273 color = gammaCorrection(color, params.gammaEncodeParams);
274 }
275 return vec4(color, 1.0f);
276}
277
278uniform highp sampler2D arg_0_1;
279uniform highp sampler2D ext_tex_plane_1_1;
Ben Claytonbe367b72023-01-04 12:29:56 +0000280ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) {
Ben Clayton03de0e82023-03-02 20:48:48 +0000281 return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat3x2(val.coordTransformationMatrix_0, val.coordTransformationMatrix_1, val.coordTransformationMatrix_2), val.pad_2, val.pad_3);
Ben Claytonbe367b72023-01-04 12:29:56 +0000282}
283
Ben Clayton77a90cb2023-03-06 18:25:08 +0000284layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
285 vec4 inner;
286} prevent_dce;
287
Ben Claytonda5424b2022-10-24 23:58:53 +0000288void textureLoad_1bfdfb() {
Ben Claytonbe367b72023-01-04 12:29:56 +0000289 vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, uvec2(1u), conv_ExternalTextureParams(ext_tex_params.inner));
Ben Clayton77a90cb2023-03-06 18:25:08 +0000290 prevent_dce.inner = res;
Ben Claytonda5424b2022-10-24 23:58:53 +0000291}
292
293void compute_main() {
294 textureLoad_1bfdfb();
295}
296
297layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
298void main() {
299 compute_main();
300 return;
301}