wip video device

This commit is contained in:
2025-09-21 23:31:09 +02:00
parent 432f05cc56
commit 616b2af44b
6 changed files with 78 additions and 47 deletions
+14 -1
View File
@@ -1923,4 +1923,17 @@ subroutine(mix_stage_sub) vec4 mix_16(vec2 vUV, sampler2D ta, sampler2D tb, int
// TODO temp
const mat4x4 yuv_to_rgb = {{1,0,1.13983,0},{1,-0.39465,-0.5806,0},{1,2.03211,0,0},{0,0,0,1}};
const mat3x3 yuv_to_rgb = {{1,1,1},{0,-0.39465,2.03211},{1.13983,-0.5806,0}};
vec4 yuyvTex(sampler2D tex, vec2 vUV, int base_width) {
float w = base_width - 1;
int x = int(vUV.x * w);
int xU = x - x % 2;
int xV = x - x % 2 + 1;
vec3 yuv = vec3(
texture(tex, vec2(vUV.x, 1 - vUV.y)).x,
texture(tex, vec2(xU / w, 1 - vUV.y)).y - 0.5,
texture(tex, vec2(xV / w, 1 - vUV.y)).y - 0.5
);
return vec4(yuv_to_rgb * yuv, 1.0);
}