Vulkan: Format convert.glsl

This commit is contained in:
TellowKrinkle 2022-08-16 17:32:24 -05:00 committed by refractionpcsx2
parent 1d7a130bd1
commit 882c09b870
1 changed files with 26 additions and 26 deletions

View File

@ -266,21 +266,21 @@ layout(push_constant) uniform cb10
void ps_yuv() void ps_yuv()
{ {
vec4 i = sample_c(v_tex); vec4 i = sample_c(v_tex);
vec4 o; vec4 o;
mat3 rgb2yuv; mat3 rgb2yuv;
rgb2yuv[0] = vec3(0.587, -0.311, -0.419); rgb2yuv[0] = vec3(0.587, -0.311, -0.419);
rgb2yuv[1] = vec3(0.114, 0.500, -0.081); rgb2yuv[1] = vec3(0.114, 0.500, -0.081);
rgb2yuv[2] = vec3(0.299, -0.169, 0.500); rgb2yuv[2] = vec3(0.299, -0.169, 0.500);
vec3 yuv = rgb2yuv * i.gbr; vec3 yuv = rgb2yuv * i.gbr;
float Y = float(0xDB)/255.0f * yuv.x + float(0x10)/255.0f; float Y = float(0xDB)/255.0f * yuv.x + float(0x10)/255.0f;
float Cr = float(0xE0)/255.0f * yuv.y + float(0x80)/255.0f; float Cr = float(0xE0)/255.0f * yuv.y + float(0x80)/255.0f;
float Cb = float(0xE0)/255.0f * yuv.z + float(0x80)/255.0f; float Cb = float(0xE0)/255.0f * yuv.z + float(0x80)/255.0f;
switch(EMODA) { switch(EMODA) {
case 0: case 0:
o.a = i.a; o.a = i.a;
break; break;
@ -293,22 +293,22 @@ void ps_yuv()
case 3: case 3:
o.a = 0.0f; o.a = 0.0f;
break; break;
} }
switch(EMODC) { switch(EMODC) {
case 0: case 0:
o.rgb = i.rgb; o.rgb = i.rgb;
break; break;
case 1: case 1:
o.rgb = vec3(Y); o.rgb = vec3(Y);
break; break;
case 2: case 2:
o.rgb = vec3(Y, Cb, Cr); o.rgb = vec3(Y, Cb, Cr);
break; break;
case 3: case 3:
o.rgb = vec3(i.a); o.rgb = vec3(i.a);
break; break;
} }
o_col0 = o; o_col0 = o;
} }