Scale SDR content to SDR whitelevel when HDR is enabled

This commit is contained in:
Sam Lantinga
2024-02-05 10:23:25 -08:00
parent e97b2061b4
commit 240158f3e8
15 changed files with 3295 additions and 2410 deletions

252
src/render/direct3d11/D3D11_PixelShader_Colors.h Executable file → Normal file
View File

@@ -3,6 +3,30 @@
// Generated by Microsoft (R) HLSL Shader Compiler 10.1 // Generated by Microsoft (R) HLSL Shader Compiler 10.1
// //
// //
// Buffer Definitions:
//
// cbuffer Constants
// {
//
// float scRGB_output; // Offset: 0 Size: 4
// float SDR_whitelevel; // Offset: 4 Size: 4
// float HDR_whitelevel; // Offset: 8 Size: 4 [unused]
// float maxCLL; // Offset: 12 Size: 4 [unused]
// float4 Yoffset; // Offset: 16 Size: 16 [unused]
// float4 Rcoeff; // Offset: 32 Size: 16 [unused]
// float4 Gcoeff; // Offset: 48 Size: 16 [unused]
// float4 Bcoeff; // Offset: 64 Size: 16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim HLSL Bind Count
// ------------------------------ ---------- ------- ----------- -------------- ------
// Constants cbuffer NA NA cb0 1
//
//
// //
// Input signature: // Input signature:
// //
@@ -20,62 +44,133 @@
// SV_TARGET 0 xyzw 0 TARGET float xyzw // SV_TARGET 0 xyzw 0 TARGET float xyzw
// //
// //
// Constant buffer to DX9 shader constant mappings:
//
// Target Reg Buffer Start Reg # of Regs Data Conversion
// ---------- ------- --------- --------- ----------------------
// c0 cb0 0 1 ( FLT, FLT, FLT, FLT)
//
//
// Level9 shader bytecode: // Level9 shader bytecode:
// //
ps_2_0 ps_2_0
def c1, 0.0125000002, 1, 0, 0
dcl t1 dcl t1
mov oC0, t1 mul r0.w, c0.x, c0.x
mov r0.x, c1.x
mul r0.x, r0.x, c0.y
cmp r0.xyz, -r0.w, c1.y, r0.x
mov r0.w, c1.y
mul r0, r0, t1
mov oC0, r0
// approximately 1 instruction slot used // approximately 7 instruction slots used
ps_4_0 ps_4_0
dcl_constantbuffer CB0[1], immediateIndexed
dcl_input_ps linear v2.xyzw dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw dcl_output o0.xyzw
mov o0.xyzw, v2.xyzw dcl_temps 1
ne r0.x, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[0].x
mul r0.y, cb0[0].y, l(0.012500)
movc r0.xyz, r0.xxxx, r0.yyyy, l(1.000000,1.000000,1.000000,0)
mov r0.w, l(1.000000)
mul o0.xyzw, r0.xyzw, v2.xyzw
ret ret
// Approximately 2 instruction slots used // Approximately 6 instruction slots used
#endif #endif
const BYTE g_main[] = const BYTE g_main[] =
{ {
68, 88, 66, 67, 226, 124, 68, 88, 66, 67, 132, 13,
10, 63, 141, 181, 49, 167, 165, 35, 17, 157, 163, 217,
218, 135, 248, 147, 77, 222, 158, 71, 117, 171, 46, 252,
95, 123, 1, 0, 0, 0, 9, 215, 1, 0, 0, 0,
52, 2, 0, 0, 6, 0, 224, 4, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0, 0, 0, 56, 0, 0, 0,
132, 0, 0, 0, 196, 0, 4, 1, 0, 0, 244, 1,
0, 0, 64, 1, 0, 0, 0, 0, 112, 2, 0, 0,
140, 1, 0, 0, 0, 2, 56, 4, 0, 0, 172, 4,
0, 0, 65, 111, 110, 57, 0, 0, 65, 111, 110, 57,
68, 0, 0, 0, 68, 0, 196, 0, 0, 0, 196, 0,
0, 0, 0, 2, 255, 255, 0, 0, 0, 2, 255, 255,
32, 0, 0, 0, 36, 0, 148, 0, 0, 0, 48, 0,
0, 0, 0, 0, 36, 0, 0, 0, 1, 0, 36, 0,
0, 0, 36, 0, 0, 0, 0, 0, 48, 0, 0, 0,
36, 0, 0, 0, 36, 0, 48, 0, 0, 0, 36, 0,
0, 0, 36, 0, 0, 2, 0, 0, 48, 0, 0, 0,
255, 255, 31, 0, 0, 2, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 2,
255, 255, 81, 0, 0, 5,
1, 0, 15, 160, 205, 204,
76, 60, 0, 0, 128, 63,
0, 0, 0, 0, 0, 0,
0, 0, 31, 0, 0, 2,
0, 0, 0, 128, 1, 0, 0, 0, 0, 128, 1, 0,
15, 176, 1, 0, 0, 2, 15, 176, 5, 0, 0, 3,
0, 8, 15, 128, 1, 0, 0, 0, 8, 128, 0, 0,
228, 176, 255, 255, 0, 0, 0, 160, 0, 0, 0, 160,
83, 72, 68, 82, 56, 0, 1, 0, 0, 2, 0, 0,
0, 0, 64, 0, 0, 0, 1, 128, 1, 0, 0, 160,
14, 0, 0, 0, 98, 16, 5, 0, 0, 3, 0, 0,
1, 128, 0, 0, 0, 128,
0, 0, 85, 160, 88, 0,
0, 4, 0, 0, 7, 128,
0, 0, 255, 129, 1, 0,
85, 160, 0, 0, 0, 128,
1, 0, 0, 2, 0, 0,
8, 128, 1, 0, 85, 160,
5, 0, 0, 3, 0, 0,
15, 128, 0, 0, 228, 128,
1, 0, 228, 176, 1, 0,
0, 2, 0, 8, 15, 128,
0, 0, 228, 128, 255, 255,
0, 0, 83, 72, 68, 82,
232, 0, 0, 0, 64, 0,
0, 0, 58, 0, 0, 0,
89, 0, 0, 4, 70, 142,
32, 0, 0, 0, 0, 0,
1, 0, 0, 0, 98, 16,
0, 3, 242, 16, 16, 0, 0, 3, 242, 16, 16, 0,
2, 0, 0, 0, 101, 0, 2, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0, 0, 3, 242, 32, 16, 0,
0, 0, 0, 0, 104, 0,
0, 2, 1, 0, 0, 0,
57, 0, 0, 11, 18, 0,
16, 0, 0, 0, 0, 0,
2, 64, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 10, 128, 32, 0,
0, 0, 0, 0, 0, 0,
0, 0, 56, 0, 0, 8,
34, 0, 16, 0, 0, 0,
0, 0, 26, 128, 32, 0,
0, 0, 0, 0, 0, 0,
0, 0, 1, 64, 0, 0,
205, 204, 76, 60, 55, 0,
0, 12, 114, 0, 16, 0,
0, 0, 0, 0, 6, 0,
16,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 0, 0, 0, 0, 0, 0, 0, 0, 0,
82, 68, 69, 70, 192, 1,
0, 0, 1, 0, 0, 0,
72, 0, 0, 0, 1, 0,
0, 0, 28, 0, 0, 0,
0, 4, 255, 255, 0, 1,
0, 0, 149, 1, 0, 0,
60, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 82, 68, 69, 70,
68, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 4, 255, 255, 1, 0, 0, 0, 1, 0,
0, 1, 0, 0, 28, 0, 0, 0, 67, 111, 110, 115,
0, 0, 77, 105, 99, 114, 116, 97, 110, 116, 115, 0,
111, 115, 111, 102, 116, 32, 171, 171, 60, 0, 0, 0,
40, 82, 41, 32, 72, 76, 8, 0, 0, 0, 96, 0,
83, 76, 32, 83, 104, 97, 0, 0, 80, 0, 0, 0,
100, 101, 114, 32, 67, 111, 0, 0, 0, 0, 0, 0,
109, 112, 105, 108, 101, 114, 0, 0, 32, 1, 0, 0,
32, 49, 48, 46, 49, 0, 0, 0, 0, 0, 4, 0,
0, 0, 2, 0, 0, 0,
48, 1, 0, 0, 0, 0,
0, 0, 64, 1, 0, 0,
4, 0, 0, 0, 4, 0,
0, 0, 2, 0, 0, 0,
48, 1, 0, 0, 0, 0,
0, 0, 79, 1, 0, 0,
8, 0, 0, 0, 4, 0,
0, 0, 0, 0, 0, 0,
48, 1, 0, 0, 0, 0,
0, 0, 94, 1, 0, 0,
12, 0, 0, 0, 4, 0,
0, 0, 0, 0, 0, 0,
48, 1, 0, 0, 0, 0,
0, 0, 101, 1, 0, 0,
16, 0, 0, 0, 16, 0,
0, 0, 0, 0, 0, 0,
112, 1, 0, 0, 0, 0,
0, 0, 128, 1, 0, 0,
32, 0, 0, 0, 16, 0,
0, 0, 0, 0, 0, 0,
112, 1, 0, 0, 0, 0,
0, 0, 135, 1, 0, 0,
48, 0, 0, 0, 16, 0,
0, 0, 0, 0, 0, 0,
112, 1, 0, 0, 0, 0,
0, 0, 142, 1, 0, 0,
64, 0, 0, 0, 16, 0,
0, 0, 0, 0, 0, 0,
112, 1, 0, 0, 0, 0,
0, 0, 115, 99, 82, 71,
66, 95, 111, 117, 116, 112,
117, 116, 0, 171, 171, 171,
0, 0, 3, 0, 1, 0,
1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 83, 68,
82, 95, 119, 104, 105, 116,
101, 108, 101, 118, 101, 108,
0, 72, 68, 82, 95, 119,
104, 105, 116, 101, 108, 101,
118, 101, 108, 0, 109, 97,
120, 67, 76, 76, 0, 89,
111, 102, 102, 115, 101, 116,
0, 171, 171, 171, 1, 0,
3, 0, 1, 0, 4, 0,
0, 0, 0, 0, 0, 0,
0, 0, 82, 99, 111, 101,
102, 102, 0, 71, 99, 111,
101, 102, 102, 0, 66, 99,
111, 101, 102, 102, 0, 77,
105, 99, 114, 111, 115, 111,
102, 116, 32, 40, 82, 41,
32, 72, 76, 83, 76, 32,
83, 104, 97, 100, 101, 114,
32, 67, 111, 109, 112, 105,
108, 101, 114, 32, 49, 48,
46, 49, 0, 171, 171, 171,
73, 83, 71, 78, 108, 0, 73, 83, 71, 78, 108, 0,
0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0,
8, 0, 0, 0, 80, 0, 8, 0, 0, 0, 80, 0,

View File

@@ -1,11 +1,7 @@
struct PixelShaderInput
{ #include "D3D11_PixelShader_Common.incl"
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
float4 main(PixelShaderInput input) : SV_TARGET float4 main(PixelShaderInput input) : SV_TARGET
{ {
return input.color; return GetOutputColor(1.0) * input.color;
} }

View File

@@ -0,0 +1,75 @@
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
cbuffer Constants : register(b0)
{
float scRGB_output;
float SDR_whitelevel;
float HDR_whitelevel;
float maxCLL;
float4 Yoffset;
float4 Rcoeff;
float4 Gcoeff;
float4 Bcoeff;
};
float3 scRGBtoNits(float3 v)
{
return v * 80.0;
}
float3 scRGBfromNits(float3 v)
{
return v / 80.0;
}
float sRGBtoLinear(float v)
{
if (v <= 0.04045) {
v = (v / 12.92);
} else {
v = pow(abs(v + 0.055) / 1.055, 2.4);
}
return v;
}
float sRGBfromLinear(float v)
{
if (v <= 0.0031308) {
v = (v * 12.92);
} else {
v = (pow(abs(v), 1.0 / 2.4) * 1.055 - 0.055);
}
return v;
}
float4 GetOutputColor(float4 rgba)
{
if (scRGB_output) {
rgba.rgb = scRGBfromNits(rgba.rgb * SDR_whitelevel);
}
return rgba;
}
float4 GetOutputColorFromSRGB(float3 rgb)
{
float4 output;
if (scRGB_output) {
output.r = sRGBtoLinear(rgb.r);
output.g = sRGBtoLinear(rgb.g);
output.b = sRGBtoLinear(rgb.b);
rgb = scRGBfromNits(rgb * SDR_whitelevel);
} else {
output.rgb = rgb.rgb;
}
output.a = 1.0;
return output;
}

150
src/render/direct3d11/D3D11_PixelShader_HDR10.h Executable file → Normal file
View File

@@ -8,14 +8,14 @@
// cbuffer Constants // cbuffer Constants
// { // {
// //
// float4 Yoffset; // Offset: 0 Size: 16 // float scRGB_output; // Offset: 0 Size: 4
// float4 Rcoeff; // Offset: 16 Size: 16 // float SDR_whitelevel; // Offset: 4 Size: 4 [unused]
// float4 Gcoeff; // Offset: 32 Size: 16 // float HDR_whitelevel; // Offset: 8 Size: 4
// float4 Bcoeff; // Offset: 48 Size: 16 // float maxCLL; // Offset: 12 Size: 4
// float scRGB_output; // Offset: 64 Size: 4 // float4 Yoffset; // Offset: 16 Size: 16
// float SDR_whitelevel; // Offset: 68 Size: 4 [unused] // float4 Rcoeff; // Offset: 32 Size: 16
// float HDR_whitelevel; // Offset: 72 Size: 4 // float4 Gcoeff; // Offset: 48 Size: 16
// float maxCLL; // Offset: 76 Size: 4 // float4 Bcoeff; // Offset: 64 Size: 16
// //
// } // }
// //
@@ -58,10 +58,10 @@ dcl_output o0.xyzw
dcl_temps 4 dcl_temps 4
sample_indexable(texture2d)(float,float,float,float) r0.x, v1.xyxx, t0.xyzw, s0 sample_indexable(texture2d)(float,float,float,float) r0.x, v1.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r0.yz, v1.xyxx, t1.zxyw, s0 sample_indexable(texture2d)(float,float,float,float) r0.yz, v1.xyxx, t1.zxyw, s0
add r0.xyz, r0.xyzx, cb0[0].xyzx add r0.xyz, r0.xyzx, cb0[1].xyzx
dp3 r1.x, r0.xyzx, cb0[1].xyzx dp3 r1.x, r0.xyzx, cb0[2].xyzx
dp3 r1.y, r0.xyzx, cb0[2].xyzx dp3 r1.y, r0.xyzx, cb0[3].xyzx
dp3 r1.z, r0.xyzx, cb0[3].xyzx dp3 r1.z, r0.xyzx, cb0[4].xyzx
log r0.xyz, |r1.xyzx| log r0.xyz, |r1.xyzx|
mul r0.xyz, r0.xyzx, l(0.012683, 0.012683, 0.012683, 0.000000) mul r0.xyz, r0.xyzx, l(0.012683, 0.012683, 0.012683, 0.000000)
exp r0.xyz, r0.xyzx exp r0.xyz, r0.xyzx
@@ -76,10 +76,10 @@ mul r0.xyz, r0.xyzx, l(10000.000000, 10000.000000, 10000.000000, 0.000000)
dp3 r1.x, l(1.660496, -0.587656, -0.072840, 0.000000), r0.xyzx dp3 r1.x, l(1.660496, -0.587656, -0.072840, 0.000000), r0.xyzx
dp3 r1.y, l(-0.124547, 1.132895, -0.008348, 0.000000), r0.xyzx dp3 r1.y, l(-0.124547, 1.132895, -0.008348, 0.000000), r0.xyzx
dp3 r1.z, l(-0.018154, -0.100597, 1.118751, 0.000000), r0.xyzx dp3 r1.z, l(-0.018154, -0.100597, 1.118751, 0.000000), r0.xyzx
div r0.xyz, r1.xyzx, cb0[4].wwww div r0.xyz, r1.xyzx, cb0[0].wwww
mul r0.xyz, r0.xyzx, cb0[4].zzzz mul r0.xyz, r0.xyzx, cb0[0].zzzz
mul r1.xyz, r0.xyzx, l(0.012500, 0.012500, 0.012500, 0.000000) mul r1.xyz, r0.xyzx, l(0.012500, 0.012500, 0.012500, 0.000000)
ne r0.w, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[4].x ne r0.w, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[0].x
if_z r0.w if_z r0.w
ge r2.xyz, l(0.250464, 0.250464, 0.250464, 0.000000), r0.xyzx ge r2.xyz, l(0.250464, 0.250464, 0.250464, 0.000000), r0.xyzx
mul r0.xyz, r0.xyzx, l(0.161500, 0.161500, 0.161500, 0.000000) mul r0.xyz, r0.xyzx, l(0.161500, 0.161500, 0.161500, 0.000000)
@@ -97,10 +97,10 @@ ret
const BYTE g_main[] = const BYTE g_main[] =
{ {
68, 88, 66, 67, 110, 205, 68, 88, 66, 67, 39, 74,
144, 108, 2, 231, 108, 209, 221, 114, 82, 86, 93, 130,
128, 137, 101, 210, 29, 69, 9, 184, 52, 173, 245, 104,
41, 122, 1, 0, 0, 0, 96, 202, 1, 0, 0, 0,
184, 9, 0, 0, 5, 0, 184, 9, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 0, 0, 52, 0, 0, 0,
80, 3, 0, 0, 196, 3, 80, 3, 0, 0, 196, 3,
@@ -151,86 +151,86 @@ const BYTE g_main[] =
0, 0, 80, 0, 0, 0, 0, 0, 80, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 68, 2, 0, 0, 0, 0, 68, 2, 0, 0,
0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 4, 0,
0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0,
84, 2, 0, 0, 0, 0, 88, 2, 0, 0, 0, 0,
0, 0, 255, 255, 255, 255, 0, 0, 255, 255, 255, 255,
0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255,
255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0,
120, 2, 0, 0, 16, 0, 124, 2, 0, 0, 4, 0,
0, 0, 16, 0, 0, 0, 0, 0, 4, 0, 0, 0,
2, 0, 0, 0, 84, 2, 0, 0, 0, 0, 88, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 0, 0,
0, 0, 255, 255, 255, 255, 0, 0, 255, 255, 255, 255,
0, 0, 0, 0, 127, 2, 0, 0, 0, 0, 139, 2,
0, 0, 8, 0, 0, 0,
4, 0, 0, 0, 2, 0,
0, 0, 88, 2, 0, 0,
0, 0, 0, 0, 255, 255,
255, 255, 0, 0, 0, 0,
255, 255, 255, 255, 0, 0,
0, 0, 154, 2, 0, 0,
12, 0, 0, 0, 4, 0,
0, 0, 2, 0, 0, 0,
88, 2, 0, 0, 0, 0,
0, 0, 255, 255, 255, 255,
0, 0, 0, 0, 255, 255,
255, 255, 0, 0, 0, 0,
161, 2, 0, 0, 16, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 176, 2,
0, 0, 0, 0, 0, 0,
255, 255, 255, 255, 0, 0,
0, 0, 255, 255, 255, 255,
0, 0, 0, 0, 212, 2,
0, 0, 32, 0, 0, 0, 0, 0, 32, 0, 0, 0,
16, 0, 0, 0, 2, 0, 16, 0, 0, 0, 2, 0,
0, 0, 84, 2, 0, 0, 0, 0, 176, 2, 0, 0,
0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255,
255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0,
255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 0, 0,
0, 0, 134, 2, 0, 0, 0, 0, 219, 2, 0, 0,
48, 0, 0, 0, 16, 0, 48, 0, 0, 0, 16, 0,
0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0,
84, 2, 0, 0, 0, 0, 176, 2, 0, 0, 0, 0,
0, 0, 255, 255, 255, 255, 0, 0, 255, 255, 255, 255,
0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 255, 255,
255, 255, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0,
141, 2, 0, 0, 64, 0, 226, 2, 0, 0, 64, 0,
0, 0, 4, 0, 0, 0, 0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 160, 2, 2, 0, 0, 0, 176, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 0, 0,
0, 0, 255, 255, 255, 255, 0, 0, 255, 255, 255, 255,
0, 0, 0, 0, 196, 2, 0, 0, 0, 0, 115, 99,
0, 0, 68, 0, 0, 0, 82, 71, 66, 95, 111, 117,
4, 0, 0, 0, 0, 0, 116, 112, 117, 116, 0, 102,
0, 0, 160, 2, 0, 0, 108, 111, 97, 116, 0, 171,
0, 0, 0, 0, 255, 255,
255, 255, 0, 0, 0, 0,
255, 255, 255, 255, 0, 0,
0, 0, 211, 2, 0, 0,
72, 0, 0, 0, 4, 0,
0, 0, 2, 0, 0, 0,
160, 2, 0, 0, 0, 0,
0, 0, 255, 255, 255, 255,
0, 0, 0, 0, 255, 255,
255, 255, 0, 0, 0, 0,
226, 2, 0, 0, 76, 0,
0, 0, 4, 0, 0, 0,
2, 0, 0, 0, 160, 2,
0, 0, 0, 0, 0, 0,
255, 255, 255, 255, 0, 0,
0, 0, 255, 255, 255, 255,
0, 0, 0, 0, 89, 111,
102, 102, 115, 101, 116, 0,
102, 108, 111, 97, 116, 52,
0, 171, 1, 0, 3, 0,
1, 0, 4, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 76, 2,
0, 0, 82, 99, 111, 101,
102, 102, 0, 71, 99, 111,
101, 102, 102, 0, 66, 99,
111, 101, 102, 102, 0, 115,
99, 82, 71, 66, 95, 111,
117, 116, 112, 117, 116, 0,
102, 108, 111, 97, 116, 0,
0, 0, 3, 0, 1, 0, 0, 0, 3, 0, 1, 0,
1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 154, 2, 0, 0, 0, 0, 81, 2, 0, 0,
83, 68, 82, 95, 119, 104, 83, 68, 82, 95, 119, 104,
105, 116, 101, 108, 101, 118, 105, 116, 101, 108, 101, 118,
101, 108, 0, 72, 68, 82, 101, 108, 0, 72, 68, 82,
95, 119, 104, 105, 116, 101, 95, 119, 104, 105, 116, 101,
108, 101, 118, 101, 108, 0, 108, 101, 118, 101, 108, 0,
109, 97, 120, 67, 76, 76, 109, 97, 120, 67, 76, 76,
0, 89, 111, 102, 102, 115,
101, 116, 0, 102, 108, 111,
97, 116, 52, 0, 1, 0,
3, 0, 1, 0, 4, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
169, 2, 0, 0, 82, 99,
111, 101, 102, 102, 0, 71,
99, 111, 101, 102, 102, 0,
66, 99, 111, 101, 102, 102,
0, 77, 105, 99, 114, 111, 0, 77, 105, 99, 114, 111,
115, 111, 102, 116, 32, 40, 115, 111, 102, 116, 32, 40,
82, 41, 32, 72, 76, 83, 82, 41, 32, 72, 76, 83,
@@ -306,23 +306,23 @@ const BYTE g_main[] =
0, 0, 0, 0, 70, 2, 0, 0, 0, 0, 70, 2,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
70, 130, 32, 0, 0, 0, 70, 130, 32, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
16, 0, 0, 8, 18, 0, 16, 0, 0, 8, 18, 0,
16, 0, 1, 0, 0, 0, 16, 0, 1, 0, 0, 0,
70, 2, 16, 0, 0, 0, 70, 2, 16, 0, 0, 0,
0, 0, 70, 130, 32, 0, 0, 0, 70, 130, 32, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0,
0, 0, 16, 0, 0, 8, 0, 0, 16, 0, 0, 8,
34, 0, 16, 0, 1, 0, 34, 0, 16, 0, 1, 0,
0, 0, 70, 2, 16, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 70, 130, 0, 0, 0, 0, 70, 130,
32, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0,
2, 0, 0, 0, 16, 0, 3, 0, 0, 0, 16, 0,
0, 8, 66, 0, 16, 0, 0, 8, 66, 0, 16, 0,
1, 0, 0, 0, 70, 2, 1, 0, 0, 0, 70, 2,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
70, 130, 32, 0, 0, 0, 70, 130, 32, 0, 0, 0,
0, 0, 3, 0, 0, 0, 0, 0, 4, 0, 0, 0,
47, 0, 0, 6, 114, 0, 47, 0, 0, 6, 114, 0,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
70, 2, 16, 128, 129, 0, 70, 2, 16, 128, 129, 0,
@@ -411,12 +411,12 @@ const BYTE g_main[] =
0, 0, 70, 2, 16, 0, 0, 0, 70, 2, 16, 0,
1, 0, 0, 0, 246, 143, 1, 0, 0, 0, 246, 143,
32, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0,
4, 0, 0, 0, 56, 0, 0, 0, 0, 0, 56, 0,
0, 8, 114, 0, 16, 0, 0, 8, 114, 0, 16, 0,
0, 0, 0, 0, 70, 2, 0, 0, 0, 0, 70, 2,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
166, 138, 32, 0, 0, 0, 166, 138, 32, 0, 0, 0,
0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56, 0, 0, 10, 114, 0, 56, 0, 0, 10, 114, 0,
16, 0, 1, 0, 0, 0, 16, 0, 1, 0, 0, 0,
70, 2, 16, 0, 0, 0, 70, 2, 16, 0, 0, 0,
@@ -430,7 +430,7 @@ const BYTE g_main[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10, 128, 32, 0, 0, 0, 10, 128, 32, 0, 0, 0,
0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
31, 0, 0, 3, 58, 0, 31, 0, 0, 3, 58, 0,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
29, 0, 0, 10, 114, 0, 29, 0, 0, 10, 114, 0,

View File

@@ -2,41 +2,7 @@ Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1); Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0); SamplerState theSampler : register(s0);
struct PixelShaderInput #include "D3D11_PixelShader_Common.incl"
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
cbuffer Constants : register(b0)
{
float4 Yoffset;
float4 Rcoeff;
float4 Gcoeff;
float4 Bcoeff;
float scRGB_output;
float SDR_whitelevel;
float HDR_whitelevel;
float maxCLL;
};
float3 scRGBfromNits(float3 v)
{
return v / 80.0;
}
float sRGBfromLinear(float v)
{
if (v <= 0.0031308) {
v = (v * 12.92);
} else {
v = (pow(abs(v), 1.0 / 2.4) * 1.055 - 0.055);
}
return v;
}
float3 PQtoNits(float3 v) float3 PQtoNits(float3 v)
{ {
@@ -58,6 +24,7 @@ float4 main(PixelShaderInput input) : SV_TARGET
-0.124547, 1.132895, -0.008348, -0.124547, 1.132895, -0.008348,
-0.018154, -0.100597, 1.118751 -0.018154, -0.100597, 1.118751
}; };
float4 Output;
float3 yuv; float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r; yuv.x = theTextureY.Sample(theSampler, input.tex).r;
@@ -84,9 +51,8 @@ float4 main(PixelShaderInput input) : SV_TARGET
rgb.rgb = clamp(rgb.rgb, 0.0, 1.0); rgb.rgb = clamp(rgb.rgb, 0.0, 1.0);
} }
float4 Output;
Output.rgb = rgb.rgb; Output.rgb = rgb.rgb;
Output.a = 1.0f; Output.a = 1.0;
return Output * input.color; return Output * input.color;
} }

524
src/render/direct3d11/D3D11_PixelShader_NV12.h Executable file → Normal file
View File

@@ -8,10 +8,14 @@
// cbuffer Constants // cbuffer Constants
// { // {
// //
// float4 Yoffset; // Offset: 0 Size: 16 // float scRGB_output; // Offset: 0 Size: 4
// float4 Rcoeff; // Offset: 16 Size: 16 // float SDR_whitelevel; // Offset: 4 Size: 4 [unused]
// float4 Gcoeff; // Offset: 32 Size: 16 // float HDR_whitelevel; // Offset: 8 Size: 4 [unused]
// float4 Bcoeff; // Offset: 48 Size: 16 // float maxCLL; // Offset: 12 Size: 4 [unused]
// float4 Yoffset; // Offset: 16 Size: 16
// float4 Rcoeff; // Offset: 32 Size: 16
// float4 Gcoeff; // Offset: 48 Size: 16
// float4 Bcoeff; // Offset: 64 Size: 16
// //
// } // }
// //
@@ -47,7 +51,7 @@
// //
// Target Reg Buffer Start Reg # of Regs Data Conversion // Target Reg Buffer Start Reg # of Regs Data Conversion
// ---------- ------- --------- --------- ---------------------- // ---------- ------- --------- --------- ----------------------
// c0 cb0 0 4 ( FLT, FLT, FLT, FLT) // c0 cb0 0 5 ( FLT, FLT, FLT, FLT)
// //
// //
// Sampler/Resource to DX9 shader sampler mappings: // Sampler/Resource to DX9 shader sampler mappings:
@@ -61,7 +65,8 @@
// Level9 shader bytecode: // Level9 shader bytecode:
// //
ps_2_0 ps_2_0
def c4, 1, 0, 0, 0 def c5, 0.0404499993, 0.0773993805, 0.0549999997, 0.947867334
def c6, 2.4000001, 1, 0, 0
dcl t0.xy dcl t0.xy
dcl t1 dcl t1
dcl_2d s0 dcl_2d s0
@@ -69,63 +74,101 @@
texld r0, t0, s0 texld r0, t0, s0
texld r1, t0, s1 texld r1, t0, s1
mov r0.yz, r1.zxyw mov r0.yz, r1.zxyw
add r0.xyz, r0, c0 add r0.xyz, r0, c1
dp3 r1.x, r0, c1 dp3 r1.x, r0, c2
dp3 r1.y, r0, c2 add r0.w, r1.x, c5.z
dp3 r1.z, r0, c3 abs r0.w, r0.w
mov r1.w, c4.x mul r0.w, r0.w, c5.w
mul r0, r1, t1 pow r1.w, r0.w, c6.x
add r0.w, -r1.x, c5.x
mul r2.w, r1.x, c5.y
cmp r2.x, r0.w, r2.w, r1.w
dp3 r1.y, r0, c3
dp3 r1.z, r0, c4
add r1.w, r1.y, c5.z
abs r1.w, r1.w
mul r1.w, r1.w, c5.w
pow r2.w, r1.w, c6.x
add r1.w, -r1.y, c5.x
mul r0.x, r1.y, c5.y
cmp r2.y, r1.w, r0.x, r2.w
add r1.w, r1.z, c5.z
abs r1.w, r1.w
mul r1.w, r1.w, c5.w
pow r2.w, r1.w, c6.x
add r1.w, -r1.z, c5.x
mul r0.x, r1.z, c5.y
cmp r2.z, r1.w, r0.x, r2.w
mul r1.w, c0.x, c0.x
cmp r0.xyz, -r1.w, r1, r2
mov r0.w, c6.y
mul r0, r0, t1
mov oC0, r0 mov oC0, r0
// approximately 10 instruction slots used (2 texture, 8 arithmetic) // approximately 39 instruction slots used (2 texture, 37 arithmetic)
ps_4_0 ps_4_0
dcl_constantbuffer CB0[4], immediateIndexed dcl_constantbuffer CB0[5], immediateIndexed
dcl_sampler s0, mode_default dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0 dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1 dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear v1.xy dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyzw dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw dcl_output o0.xyzw
dcl_temps 2 dcl_temps 4
sample r0.xyzw, v1.xyxx, t0.xyzw, s0 sample r0.xyzw, v1.xyxx, t0.xyzw, s0
sample r1.xyzw, v1.xyxx, t1.xyzw, s0 sample r1.xyzw, v1.xyxx, t1.zxyw, s0
mov r0.yz, r1.xxyx mov r1.x, r0.x
add r0.xyz, r0.xyzx, cb0[0].xyzx add r0.xyz, r1.xyzx, cb0[1].xyzx
dp3 r1.x, r0.xyzx, cb0[1].xyzx dp3 r1.x, r0.xyzx, cb0[2].xyzx
dp3 r1.y, r0.xyzx, cb0[2].xyzx dp3 r1.y, r0.xyzx, cb0[3].xyzx
dp3 r1.z, r0.xyzx, cb0[3].xyzx dp3 r1.z, r0.xyzx, cb0[4].xyzx
ne r0.x, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[0].x
if_nz r0.x
ge r0.xyz, l(0.040450, 0.040450, 0.040450, 0.000000), r1.xyzx
mul r2.xyz, r1.xyzx, l(0.077399, 0.077399, 0.077399, 0.000000)
add r3.xyz, r1.xyzx, l(0.055000, 0.055000, 0.055000, 0.000000)
mul r3.xyz, |r3.xyzx|, l(0.947867, 0.947867, 0.947867, 0.000000)
log r3.xyz, r3.xyzx
mul r3.xyz, r3.xyzx, l(2.400000, 2.400000, 2.400000, 0.000000)
exp r3.xyz, r3.xyzx
movc r1.xyz, r0.xyzx, r2.xyzx, r3.xyzx
endif
mov r1.w, l(1.000000) mov r1.w, l(1.000000)
mul o0.xyzw, r1.xyzw, v2.xyzw mul o0.xyzw, r1.xyzw, v2.xyzw
ret ret
// Approximately 10 instruction slots used // Approximately 21 instruction slots used
#endif #endif
const BYTE g_main[] = const BYTE g_main[] =
{ {
68, 88, 66, 67, 141, 213, 68, 88, 66, 67, 57, 206,
118, 74, 78, 95, 162, 4, 5, 226, 160, 185, 110, 25,
201, 30, 199, 78, 91, 203, 70, 167, 109, 22, 187, 226,
113, 9, 1, 0, 0, 0, 244, 122, 1, 0, 0, 0,
172, 5, 0, 0, 6, 0, 52, 9, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0, 0, 0, 56, 0, 0, 0,
92, 1, 0, 0, 228, 2, 232, 2, 0, 0, 196, 5,
0, 0, 96, 3, 0, 0, 0, 0, 64, 6, 0, 0,
4, 5, 0, 0, 120, 5, 140, 8, 0, 0, 0, 9,
0, 0, 65, 111, 110, 57, 0, 0, 65, 111, 110, 57,
28, 1, 0, 0, 28, 1, 168, 2, 0, 0, 168, 2,
0, 0, 0, 2, 255, 255, 0, 0, 0, 2, 255, 255,
228, 0, 0, 0, 56, 0, 112, 2, 0, 0, 56, 0,
0, 0, 1, 0, 44, 0, 0, 0, 1, 0, 44, 0,
0, 0, 56, 0, 0, 0, 0, 0, 56, 0, 0, 0,
56, 0, 2, 0, 36, 0, 56, 0, 2, 0, 36, 0,
0, 0, 56, 0, 0, 0, 0, 0, 56, 0, 0, 0,
0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0,
0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 5, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 255, 255, 81, 0, 0, 2, 255, 255, 81, 0,
0, 5, 4, 0, 15, 160, 0, 5, 5, 0, 15, 160,
0, 0, 128, 63, 0, 0, 230, 174, 37, 61, 145, 131,
0, 0, 0, 0, 0, 0, 158, 61, 174, 71, 97, 61,
111, 167, 114, 63, 81, 0,
0, 5, 6, 0, 15, 160,
154, 153, 25, 64, 0, 0,
128, 63, 0, 0, 0, 0,
0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 31, 0,
0, 2, 0, 0, 0, 128, 0, 2, 0, 0, 0, 128,
0, 0, 3, 176, 31, 0, 0, 0, 3, 176, 31, 0,
@@ -144,27 +187,89 @@ const BYTE g_main[] =
6, 128, 1, 0, 210, 128, 6, 128, 1, 0, 210, 128,
2, 0, 0, 3, 0, 0, 2, 0, 0, 3, 0, 0,
7, 128, 0, 0, 228, 128, 7, 128, 0, 0, 228, 128,
0, 0, 228, 160, 8, 0, 1, 0, 228, 160, 8, 0,
0, 3, 1, 0, 1, 128, 0, 3, 1, 0, 1, 128,
0, 0, 228, 128, 1, 0, 0, 0, 228, 128, 2, 0,
228, 160, 8, 0, 0, 3, 228, 160, 2, 0, 0, 3,
1, 0, 2, 128, 0, 0, 0, 0, 8, 128, 1, 0,
228, 128, 2, 0, 228, 160, 0, 128, 5, 0, 170, 160,
35, 0, 0, 2, 0, 0,
8, 128, 0, 0, 255, 128,
5, 0, 0, 3, 0, 0,
8, 128, 0, 0, 255, 128,
5, 0, 255, 160, 32, 0,
0, 3, 1, 0, 8, 128,
0, 0, 255, 128, 6, 0,
0, 160, 2, 0, 0, 3,
0, 0, 8, 128, 1, 0,
0, 129, 5, 0, 0, 160,
5, 0, 0, 3, 2, 0,
8, 128, 1, 0, 0, 128,
5, 0, 85, 160, 88, 0,
0, 4, 2, 0, 1, 128,
0, 0, 255, 128, 2, 0,
255, 128, 1, 0, 255, 128,
8, 0, 0, 3, 1, 0, 8, 0, 0, 3, 1, 0,
4, 128, 0, 0, 228, 128, 2, 128, 0, 0, 228, 128,
3, 0, 228, 160, 1, 0, 3, 0, 228, 160, 8, 0,
0, 3, 1, 0, 4, 128,
0, 0, 228, 128, 4, 0,
228, 160, 2, 0, 0, 3,
1, 0, 8, 128, 1, 0,
85, 128, 5, 0, 170, 160,
35, 0, 0, 2, 1, 0,
8, 128, 1, 0, 255, 128,
5, 0, 0, 3, 1, 0,
8, 128, 1, 0, 255, 128,
5, 0, 255, 160, 32, 0,
0, 3, 2, 0, 8, 128,
1, 0, 255, 128, 6, 0,
0, 160, 2, 0, 0, 3,
1, 0, 8, 128, 1, 0,
85, 129, 5, 0, 0, 160,
5, 0, 0, 3, 0, 0,
1, 128, 1, 0, 85, 128,
5, 0, 85, 160, 88, 0,
0, 4, 2, 0, 2, 128,
1, 0, 255, 128, 0, 0,
0, 128, 2, 0, 255, 128,
2, 0, 0, 3, 1, 0,
8, 128, 1, 0, 170, 128,
5, 0, 170, 160, 35, 0,
0, 2, 1, 0, 8, 128, 0, 2, 1, 0, 8, 128,
4, 0, 0, 160, 5, 0, 1, 0, 255, 128, 5, 0,
0, 3, 1, 0, 8, 128,
1, 0, 255, 128, 5, 0,
255, 160, 32, 0, 0, 3,
2, 0, 8, 128, 1, 0,
255, 128, 6, 0, 0, 160,
2, 0, 0, 3, 1, 0,
8, 128, 1, 0, 170, 129,
5, 0, 0, 160, 5, 0,
0, 3, 0, 0, 1, 128,
1, 0, 170, 128, 5, 0,
85, 160, 88, 0, 0, 4,
2, 0, 4, 128, 1, 0,
255, 128, 0, 0, 0, 128,
2, 0, 255, 128, 5, 0,
0, 3, 1, 0, 8, 128,
0, 0, 0, 160, 0, 0,
0, 160, 88, 0, 0, 4,
0, 0, 7, 128, 1, 0,
255, 129, 1, 0, 228, 128,
2, 0, 228, 128, 1, 0,
0, 2, 0, 0, 8, 128,
6, 0, 85, 160, 5, 0,
0, 3, 0, 0, 15, 128, 0, 3, 0, 0, 15, 128,
1, 0, 228, 128, 1, 0, 0, 0, 228, 128, 1, 0,
228, 176, 1, 0, 0, 2, 228, 176, 1, 0, 0, 2,
0, 8, 15, 128, 0, 0, 0, 8, 15, 128, 0, 0,
228, 128, 255, 255, 0, 0, 228, 128, 255, 255, 0, 0,
83, 72, 68, 82, 128, 1, 83, 72, 68, 82, 212, 2,
0, 0, 64, 0, 0, 0, 0, 0, 64, 0, 0, 0,
96, 0, 0, 0, 89, 0, 181, 0, 0, 0, 89, 0,
0, 4, 70, 142, 32, 0, 0, 4, 70, 142, 32, 0,
0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 5, 0,
0, 0, 90, 0, 0, 3, 0, 0, 90, 0, 0, 3,
0, 96, 16, 0, 0, 0, 0, 96, 16, 0, 0, 0,
0, 0, 88, 24, 0, 4, 0, 0, 88, 24, 0, 4,
@@ -179,7 +284,7 @@ const BYTE g_main[] =
2, 0, 0, 0, 101, 0, 2, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0, 0, 3, 242, 32, 16, 0,
0, 0, 0, 0, 104, 0, 0, 0, 0, 0, 104, 0,
0, 2, 2, 0, 0, 0, 0, 2, 4, 0, 0, 0,
69, 0, 0, 9, 242, 0, 69, 0, 0, 9, 242, 0,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
70, 16, 16, 0, 1, 0, 70, 16, 16, 0, 1, 0,
@@ -189,159 +294,244 @@ const BYTE g_main[] =
69, 0, 0, 9, 242, 0, 69, 0, 0, 9, 242, 0,
16, 0, 1, 0, 0, 0, 16, 0, 1, 0, 0, 0,
70, 16, 16, 0, 1, 0, 70, 16, 16, 0, 1, 0,
0, 0, 70, 126, 16, 0, 0, 0, 38, 125, 16, 0,
1, 0, 0, 0, 0, 96, 1, 0, 0, 0, 0, 96,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
54, 0, 0, 5, 98, 0, 54, 0, 0, 5, 18, 0,
16, 0, 0, 0, 0, 0, 16, 0, 1, 0, 0, 0,
6, 1, 16, 0, 1, 0, 10, 0, 16, 0, 0, 0,
0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 8,
114, 0, 16, 0, 0, 0, 114, 0, 16, 0, 0, 0,
0, 0, 70, 2, 16, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 70, 130, 1, 0, 0, 0, 70, 130,
32, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 16, 0, 1, 0, 0, 0, 16, 0,
0, 8, 18, 0, 16, 0, 0, 8, 18, 0, 16, 0,
1, 0, 0, 0, 70, 2, 1, 0, 0, 0, 70, 2,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
70, 130, 32, 0, 0, 0, 70, 130, 32, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0,
16, 0, 0, 8, 34, 0, 16, 0, 0, 8, 34, 0,
16, 0, 1, 0, 0, 0, 16, 0, 1, 0, 0, 0,
70, 2, 16, 0, 0, 0, 70, 2, 16, 0, 0, 0,
0, 0, 70, 130, 32, 0, 0, 0, 70, 130, 32, 0,
0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 3, 0,
0, 0, 16, 0, 0, 8, 0, 0, 16, 0, 0, 8,
66, 0, 16, 0, 1, 0, 66, 0, 16, 0, 1, 0,
0, 0, 70, 2, 16, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 70, 130, 0, 0, 0, 0, 70, 130,
32, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0,
3, 0, 0, 0, 54, 0, 4, 0, 0, 0, 57, 0,
0, 5, 130, 0, 16, 0, 0, 11, 18, 0, 16, 0,
1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 2, 64,
0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0,
56, 0, 0, 7, 242, 32, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
10, 128, 32, 0, 0, 0,
0, 0, 0, 0, 0, 0,
31, 0, 4, 3, 10, 0,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
70, 14, 16, 0, 1, 0, 29, 0, 0, 10, 114, 0,
0, 0, 70, 30, 16, 0, 16, 0, 0, 0, 0, 0,
2, 0, 0, 0, 62, 0, 2, 64, 0, 0, 230, 174,
0, 1, 83, 84, 65, 84, 37, 61, 230, 174, 37, 61,
116, 0, 0, 0, 10, 0, 230, 174, 37, 61, 0, 0,
0, 0, 2, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 56, 0,
0, 0, 5, 0, 0, 0, 0, 10, 114, 0, 16, 0,
0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 70, 2,
0, 0, 1, 0, 0, 0, 16, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 2, 64, 0, 0, 145, 131,
0, 0, 0, 0, 0, 0, 158, 61, 145, 131, 158, 61,
0, 0, 0, 0, 0, 0, 145, 131, 158, 61, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
2, 0, 0, 0, 0, 0, 114, 0, 16, 0, 3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 64,
0, 0, 2, 0, 0, 0, 0, 0, 174, 71, 97, 61,
0, 0, 0, 0, 0, 0, 174, 71, 97, 61, 174, 71,
0, 0, 0, 0, 0, 0, 97, 61, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 56, 0, 0, 11, 114, 0,
0, 0, 0, 0, 0, 0, 16, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 70, 2, 16, 128, 129, 0,
0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
82, 68, 69, 70, 156, 1, 2, 64, 0, 0, 111, 167,
0, 0, 1, 0, 0, 0, 114, 63, 111, 167, 114, 63,
204, 0, 0, 0, 4, 0, 111, 167, 114, 63, 0, 0,
0, 0, 28, 0, 0, 0, 0, 0, 47, 0, 0, 5,
0, 4, 255, 255, 0, 1, 114, 0, 16, 0, 3, 0,
0, 0, 113, 1, 0, 0, 0, 0, 70, 2, 16, 0,
156, 0, 0, 0, 3, 0, 3, 0, 0, 0, 56, 0,
0, 0, 0, 0, 0, 0, 0, 10, 114, 0, 16, 0,
0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 70, 2,
16, 0, 3, 0, 0, 0,
2, 64, 0, 0, 154, 153,
25, 64, 154, 153, 25, 64,
154, 153, 25, 64, 0, 0,
0, 0, 25, 0, 0, 5,
114, 0, 16, 0, 3, 0,
0, 0, 70, 2, 16, 0,
3, 0, 0, 0, 55, 0,
0, 9, 114, 0, 16, 0,
1, 0, 0, 0, 70, 2,
16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 2, 0,
0, 0, 70, 2, 16, 0,
3, 0, 0, 0, 21, 0,
0, 1, 54, 0, 0, 5,
130, 0, 16, 0, 1, 0,
0, 0, 1, 64, 0, 0,
0, 0, 128, 63, 56, 0,
0, 7, 242, 32, 16, 0,
0, 0, 0, 0, 70, 14,
16, 0, 1, 0, 0, 0,
70, 30, 16, 0, 2, 0,
0, 0, 62, 0, 0, 1,
83, 84, 65, 84, 116, 0,
0, 0, 21, 0, 0, 0,
4, 0, 0, 0, 0, 0,
0, 0,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0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0,
0, 0, 116, 104, 101, 83, 0, 0, 1, 0, 0, 0,
97, 109, 112, 108, 101, 114, 116, 104, 101, 83, 97, 109,
0, 116, 104, 101, 84, 101, 112, 108, 101, 114, 0, 116,
120, 116, 117, 114, 101, 89, 104, 101, 84, 101, 120, 116,
0, 116, 104, 101, 84, 101, 117, 114, 101, 89, 0, 116,
120, 116, 117, 114, 101, 85, 104, 101, 84, 101, 120, 116,
86, 0, 67, 111, 110, 115, 117, 114, 101, 85, 86, 0,
116, 97, 110, 116, 115, 0, 67, 111, 110, 115, 116, 97,
171, 171, 192, 0, 0, 0, 110, 116, 115, 0, 171, 171,
4, 0, 0, 0, 228, 0, 192, 0, 0, 0, 8, 0,
0, 0, 64, 0, 0, 0, 0, 0, 228, 0, 0, 0,
80, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 68, 1, 0, 0, 164, 1, 0, 0, 0, 0,
0, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0,
0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 180, 1,
76, 1, 0, 0, 0, 0,
0, 0, 92, 1, 0, 0,
16, 0, 0, 0, 16, 0,
0, 0, 2, 0, 0, 0,
76, 1, 0, 0, 0, 0,
0, 0, 99, 1, 0, 0,
32, 0, 0, 0, 16, 0,
0, 0, 2, 0, 0, 0,
76, 1, 0, 0, 0, 0,
0, 0, 106, 1, 0, 0,
48, 0, 0, 0, 16, 0,
0, 0, 2, 0, 0, 0,
76, 1, 0, 0, 0, 0,
0, 0, 89, 111, 102, 102,
115, 101, 116, 0, 1, 0,
3, 0, 1, 0, 4, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 82, 99, 111, 101, 196, 1, 0, 0, 4, 0,
102, 102, 0, 71, 99, 111, 0, 0, 4, 0, 0, 0,
101, 102, 102, 0, 66, 99, 0, 0, 0, 0, 180, 1,
111, 101, 102, 102, 0, 77, 0, 0, 0, 0, 0, 0,
105, 99, 114, 111, 115, 111, 211, 1, 0, 0, 8, 0,
102, 116, 32, 40, 82, 41, 0, 0, 4, 0, 0, 0,
32, 72, 76, 83, 76, 32, 0, 0, 0, 0, 180, 1,
83, 104, 97, 100, 101, 114, 0, 0, 0, 0, 0, 0,
32, 67, 111, 109, 112, 105, 226, 1, 0, 0, 12, 0,
108, 101, 114, 32, 49, 48, 0, 0, 4, 0, 0, 0,
46, 49, 0, 171, 171, 171, 0, 0, 0, 0, 180, 1,
73, 83, 71, 78, 108, 0, 0, 0, 0, 0, 0, 0,
233, 1, 0, 0, 16, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 244, 1,
0, 0, 0, 0, 0, 0,
4, 2, 0, 0, 32, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 244, 1,
0, 0, 0, 0, 0, 0,
11, 2, 0, 0, 48, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 244, 1,
0, 0, 0, 0, 0, 0,
18, 2, 0, 0, 64, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 244, 1,
0, 0, 0, 0, 0, 0,
115, 99, 82, 71, 66, 95,
111, 117, 116, 112, 117, 116,
0, 171, 171, 171, 0, 0,
3, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0,
0, 0, 83, 68, 82, 95,
119, 104, 105, 116, 101, 108,
101, 118, 101, 108, 0, 72,
68, 82, 95, 119, 104, 105,
116, 101, 108, 101, 118, 101,
108, 0, 109, 97, 120, 67,
76, 76, 0, 89, 111, 102,
102, 115, 101, 116, 0, 171,
171, 171, 1, 0, 3, 0,
1, 0, 4, 0, 0, 0,
0, 0, 0, 0, 0, 0,
82, 99, 111, 101, 102, 102,
0, 71, 99, 111, 101, 102,
102, 0, 66, 99, 111, 101,
102, 102, 0, 77, 105, 99,
114, 111, 115, 111, 102, 116,
32, 40, 82, 41, 32, 72,
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 49, 48, 46, 49,
0, 171, 171, 171, 73, 83,
71, 78, 108, 0, 0, 0,
3, 0, 0, 0, 8, 0,
0, 0, 80, 0, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0,
8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 15, 0,
0, 0, 92, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0,
1, 0, 0, 0, 3, 3,
0, 0, 101, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
15, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 15, 15,
0, 0, 0, 0, 3, 0, 0, 0, 83, 86, 95, 80,
79, 83, 73, 84, 73, 79,
78, 0, 84, 69, 88, 67,
79, 79, 82, 68, 0, 67,
79, 76, 79, 82, 0, 171,
79, 83, 71, 78, 44, 0,
0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
3, 3, 0, 0, 101, 0, 8, 0, 0, 0, 32, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0,
0, 0, 2, 0, 0, 0,
15, 15, 0, 0, 83, 86,
95, 80, 79, 83, 73, 84,
73, 79, 78, 0, 84, 69,
88, 67, 79, 79, 82, 68,
0, 67, 79, 76, 79, 82,
0, 171, 79, 83, 71, 78,
44, 0, 0, 0, 1, 0,
0, 0, 8, 0, 0, 0,
32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86,
0, 0, 15, 0, 0, 0, 95, 84, 65, 82, 71, 69,
83, 86, 95, 84, 65, 82, 84, 0, 171, 171
71, 69, 84, 0, 171, 171
}; };

View File

@@ -2,21 +2,7 @@ Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1); Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0); SamplerState theSampler : register(s0);
struct PixelShaderInput #include "D3D11_PixelShader_Common.incl"
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
cbuffer Constants : register(b0)
{
float4 Yoffset;
float4 Rcoeff;
float4 Gcoeff;
float4 Bcoeff;
};
float4 main(PixelShaderInput input) : SV_TARGET float4 main(PixelShaderInput input) : SV_TARGET
{ {
@@ -26,11 +12,11 @@ float4 main(PixelShaderInput input) : SV_TARGET
yuv.x = theTextureY.Sample(theSampler, input.tex).r; yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
float3 rgb;
yuv += Yoffset.xyz; yuv += Yoffset.xyz;
Output.r = dot(yuv, Rcoeff.xyz); rgb.r = dot(yuv, Rcoeff.xyz);
Output.g = dot(yuv, Gcoeff.xyz); rgb.g = dot(yuv, Gcoeff.xyz);
Output.b = dot(yuv, Bcoeff.xyz); rgb.b = dot(yuv, Bcoeff.xyz);
Output.a = 1.0f;
return Output * input.color; return GetOutputColorFromSRGB(rgb) * input.color;
} }

524
src/render/direct3d11/D3D11_PixelShader_NV21.h Executable file → Normal file
View File

@@ -8,10 +8,14 @@
// cbuffer Constants // cbuffer Constants
// { // {
// //
// float4 Yoffset; // Offset: 0 Size: 16 // float scRGB_output; // Offset: 0 Size: 4
// float4 Rcoeff; // Offset: 16 Size: 16 // float SDR_whitelevel; // Offset: 4 Size: 4 [unused]
// float4 Gcoeff; // Offset: 32 Size: 16 // float HDR_whitelevel; // Offset: 8 Size: 4 [unused]
// float4 Bcoeff; // Offset: 48 Size: 16 // float maxCLL; // Offset: 12 Size: 4 [unused]
// float4 Yoffset; // Offset: 16 Size: 16
// float4 Rcoeff; // Offset: 32 Size: 16
// float4 Gcoeff; // Offset: 48 Size: 16
// float4 Bcoeff; // Offset: 64 Size: 16
// //
// } // }
// //
@@ -47,7 +51,7 @@
// //
// Target Reg Buffer Start Reg # of Regs Data Conversion // Target Reg Buffer Start Reg # of Regs Data Conversion
// ---------- ------- --------- --------- ---------------------- // ---------- ------- --------- --------- ----------------------
// c0 cb0 0 4 ( FLT, FLT, FLT, FLT) // c0 cb0 0 5 ( FLT, FLT, FLT, FLT)
// //
// //
// Sampler/Resource to DX9 shader sampler mappings: // Sampler/Resource to DX9 shader sampler mappings:
@@ -61,7 +65,8 @@
// Level9 shader bytecode: // Level9 shader bytecode:
// //
ps_2_0 ps_2_0
def c4, 1, 0, 0, 0 def c5, 0.0404499993, 0.0773993805, 0.0549999997, 0.947867334
def c6, 2.4000001, 1, 0, 0
dcl t0.xy dcl t0.xy
dcl t1 dcl t1
dcl_2d s0 dcl_2d s0
@@ -70,63 +75,101 @@
texld r1, t0, s1 texld r1, t0, s1
mov r0.y, r1.y mov r0.y, r1.y
mov r0.z, r1.x mov r0.z, r1.x
add r0.xyz, r0, c0 add r0.xyz, r0, c1
dp3 r1.x, r0, c1 dp3 r1.x, r0, c2
dp3 r1.y, r0, c2 add r0.w, r1.x, c5.z
dp3 r1.z, r0, c3 abs r0.w, r0.w
mov r1.w, c4.x mul r0.w, r0.w, c5.w
mul r0, r1, t1 pow r1.w, r0.w, c6.x
add r0.w, -r1.x, c5.x
mul r2.w, r1.x, c5.y
cmp r2.x, r0.w, r2.w, r1.w
dp3 r1.y, r0, c3
dp3 r1.z, r0, c4
add r1.w, r1.y, c5.z
abs r1.w, r1.w
mul r1.w, r1.w, c5.w
pow r2.w, r1.w, c6.x
add r1.w, -r1.y, c5.x
mul r0.x, r1.y, c5.y
cmp r2.y, r1.w, r0.x, r2.w
add r1.w, r1.z, c5.z
abs r1.w, r1.w
mul r1.w, r1.w, c5.w
pow r2.w, r1.w, c6.x
add r1.w, -r1.z, c5.x
mul r0.x, r1.z, c5.y
cmp r2.z, r1.w, r0.x, r2.w
mul r1.w, c0.x, c0.x
cmp r0.xyz, -r1.w, r1, r2
mov r0.w, c6.y
mul r0, r0, t1
mov oC0, r0 mov oC0, r0
// approximately 11 instruction slots used (2 texture, 9 arithmetic) // approximately 40 instruction slots used (2 texture, 38 arithmetic)
ps_4_0 ps_4_0
dcl_constantbuffer CB0[4], immediateIndexed dcl_constantbuffer CB0[5], immediateIndexed
dcl_sampler s0, mode_default dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0 dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1 dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear v1.xy dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyzw dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw dcl_output o0.xyzw
dcl_temps 2 dcl_temps 4
sample r0.xyzw, v1.xyxx, t0.xyzw, s0 sample r0.xyzw, v1.xyxx, t0.xyzw, s0
sample r1.xyzw, v1.xyxx, t1.xyzw, s0 sample r1.xyzw, v1.xyxx, t1.zyxw, s0
mov r0.yz, r1.yyxy mov r1.x, r0.x
add r0.xyz, r0.xyzx, cb0[0].xyzx add r0.xyz, r1.xyzx, cb0[1].xyzx
dp3 r1.x, r0.xyzx, cb0[1].xyzx dp3 r1.x, r0.xyzx, cb0[2].xyzx
dp3 r1.y, r0.xyzx, cb0[2].xyzx dp3 r1.y, r0.xyzx, cb0[3].xyzx
dp3 r1.z, r0.xyzx, cb0[3].xyzx dp3 r1.z, r0.xyzx, cb0[4].xyzx
ne r0.x, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[0].x
if_nz r0.x
ge r0.xyz, l(0.040450, 0.040450, 0.040450, 0.000000), r1.xyzx
mul r2.xyz, r1.xyzx, l(0.077399, 0.077399, 0.077399, 0.000000)
add r3.xyz, r1.xyzx, l(0.055000, 0.055000, 0.055000, 0.000000)
mul r3.xyz, |r3.xyzx|, l(0.947867, 0.947867, 0.947867, 0.000000)
log r3.xyz, r3.xyzx
mul r3.xyz, r3.xyzx, l(2.400000, 2.400000, 2.400000, 0.000000)
exp r3.xyz, r3.xyzx
movc r1.xyz, r0.xyzx, r2.xyzx, r3.xyzx
endif
mov r1.w, l(1.000000) mov r1.w, l(1.000000)
mul o0.xyzw, r1.xyzw, v2.xyzw mul o0.xyzw, r1.xyzw, v2.xyzw
ret ret
// Approximately 10 instruction slots used // Approximately 21 instruction slots used
#endif #endif
const BYTE g_main[] = const BYTE g_main[] =
{ {
68, 88, 66, 67, 142, 144, 68, 88, 66, 67, 103, 251,
79, 192, 175, 21, 0, 8, 56, 113, 174, 118, 96, 85,
7, 119, 219, 202, 53, 69, 191, 91, 87, 213, 153, 143,
174, 234, 1, 0, 0, 0, 217, 253, 1, 0, 0, 0,
184, 5, 0, 0, 6, 0, 64, 9, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0, 0, 0, 56, 0, 0, 0,
104, 1, 0, 0, 240, 2, 244, 2, 0, 0, 208, 5,
0, 0, 108, 3, 0, 0, 0, 0, 76, 6, 0, 0,
16, 5, 0, 0, 132, 5, 152, 8, 0, 0, 12, 9,
0, 0, 65, 111, 110, 57, 0, 0, 65, 111, 110, 57,
40, 1, 0, 0, 40, 1, 180, 2, 0, 0, 180, 2,
0, 0, 0, 2, 255, 255, 0, 0, 0, 2, 255, 255,
240, 0, 0, 0, 56, 0, 124, 2, 0, 0, 56, 0,
0, 0, 1, 0, 44, 0, 0, 0, 1, 0, 44, 0,
0, 0, 56, 0, 0, 0, 0, 0, 56, 0, 0, 0,
56, 0, 2, 0, 36, 0, 56, 0, 2, 0, 36, 0,
0, 0, 56, 0, 0, 0, 0, 0, 56, 0, 0, 0,
0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0,
0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 5, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 255, 255, 81, 0, 0, 2, 255, 255, 81, 0,
0, 5, 4, 0, 15, 160, 0, 5, 5, 0, 15, 160,
0, 0, 128, 63, 0, 0, 230, 174, 37, 61, 145, 131,
0, 0, 0, 0, 0, 0, 158, 61, 174, 71, 97, 61,
111, 167, 114, 63, 81, 0,
0, 5, 6, 0, 15, 160,
154, 153, 25, 64, 0, 0,
128, 63, 0, 0, 0, 0,
0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 31, 0,
0, 2, 0, 0, 0, 128, 0, 2, 0, 0, 0, 128,
0, 0, 3, 176, 31, 0, 0, 0, 3, 176, 31, 0,
@@ -147,27 +190,89 @@ const BYTE g_main[] =
4, 128, 1, 0, 0, 128, 4, 128, 1, 0, 0, 128,
2, 0, 0, 3, 0, 0, 2, 0, 0, 3, 0, 0,
7, 128, 0, 0, 228, 128, 7, 128, 0, 0, 228, 128,
0, 0, 228, 160, 8, 0, 1, 0, 228, 160, 8, 0,
0, 3, 1, 0, 1, 128, 0, 3, 1, 0, 1, 128,
0, 0, 228, 128, 1, 0, 0, 0, 228, 128, 2, 0,
228, 160, 8, 0, 0, 3, 228, 160, 2, 0, 0, 3,
1, 0, 2, 128, 0, 0, 0, 0, 8, 128, 1, 0,
228, 128, 2, 0, 228, 160, 0, 128, 5, 0, 170, 160,
35, 0, 0, 2, 0, 0,
8, 128, 0, 0, 255, 128,
5, 0, 0, 3, 0, 0,
8, 128, 0, 0, 255, 128,
5, 0, 255, 160, 32, 0,
0, 3, 1, 0, 8, 128,
0, 0, 255, 128, 6, 0,
0, 160, 2, 0, 0, 3,
0, 0, 8, 128, 1, 0,
0, 129, 5, 0, 0, 160,
5, 0, 0, 3, 2, 0,
8, 128, 1, 0, 0, 128,
5, 0, 85, 160, 88, 0,
0, 4, 2, 0, 1, 128,
0, 0, 255, 128, 2, 0,
255, 128, 1, 0, 255, 128,
8, 0, 0, 3, 1, 0, 8, 0, 0, 3, 1, 0,
4, 128, 0, 0, 228, 128, 2, 128, 0, 0, 228, 128,
3, 0, 228, 160, 1, 0, 3, 0, 228, 160, 8, 0,
0, 3, 1, 0, 4, 128,
0, 0, 228, 128, 4, 0,
228, 160, 2, 0, 0, 3,
1, 0, 8, 128, 1, 0,
85, 128, 5, 0, 170, 160,
35, 0, 0, 2, 1, 0,
8, 128, 1, 0, 255, 128,
5, 0, 0, 3, 1, 0,
8, 128, 1, 0, 255, 128,
5, 0, 255, 160, 32, 0,
0, 3, 2, 0, 8, 128,
1, 0, 255, 128, 6, 0,
0, 160, 2, 0, 0, 3,
1, 0, 8, 128, 1, 0,
85, 129, 5, 0, 0, 160,
5, 0, 0, 3, 0, 0,
1, 128, 1, 0, 85, 128,
5, 0, 85, 160, 88, 0,
0, 4, 2, 0, 2, 128,
1, 0, 255, 128, 0, 0,
0, 128, 2, 0, 255, 128,
2, 0, 0, 3, 1, 0,
8, 128, 1, 0, 170, 128,
5, 0, 170, 160, 35, 0,
0, 2, 1, 0, 8, 128, 0, 2, 1, 0, 8, 128,
4, 0, 0, 160, 5, 0, 1, 0, 255, 128, 5, 0,
0, 3, 1, 0, 8, 128,
1, 0, 255, 128, 5, 0,
255, 160, 32, 0, 0, 3,
2, 0, 8, 128, 1, 0,
255, 128, 6, 0, 0, 160,
2, 0, 0, 3, 1, 0,
8, 128, 1, 0, 170, 129,
5, 0, 0, 160, 5, 0,
0, 3, 0, 0, 1, 128,
1, 0, 170, 128, 5, 0,
85, 160, 88, 0, 0, 4,
2, 0, 4, 128, 1, 0,
255, 128, 0, 0, 0, 128,
2, 0, 255, 128, 5, 0,
0, 3, 1, 0, 8, 128,
0, 0, 0, 160, 0, 0,
0, 160, 88, 0, 0, 4,
0, 0, 7, 128, 1, 0,
255, 129, 1, 0, 228, 128,
2, 0, 228, 128, 1, 0,
0, 2, 0, 0, 8, 128,
6, 0, 85, 160, 5, 0,
0, 3, 0, 0, 15, 128, 0, 3, 0, 0, 15, 128,
1, 0, 228, 128, 1, 0, 0, 0, 228, 128, 1, 0,
228, 176, 1, 0, 0, 2, 228, 176, 1, 0, 0, 2,
0, 8, 15, 128, 0, 0, 0, 8, 15, 128, 0, 0,
228, 128, 255, 255, 0, 0, 228, 128, 255, 255, 0, 0,
83, 72, 68, 82, 128, 1, 83, 72, 68, 82, 212, 2,
0, 0, 64, 0, 0, 0, 0, 0, 64, 0, 0, 0,
96, 0, 0, 0, 89, 0, 181, 0, 0, 0, 89, 0,
0, 4, 70, 142, 32, 0, 0, 4, 70, 142, 32, 0,
0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 5, 0,
0, 0, 90, 0, 0, 3, 0, 0, 90, 0, 0, 3,
0, 96, 16, 0, 0, 0, 0, 96, 16, 0, 0, 0,
0, 0, 88, 24, 0, 4, 0, 0, 88, 24, 0, 4,
@@ -182,7 +287,7 @@ const BYTE g_main[] =
2, 0, 0, 0, 101, 0, 2, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0, 0, 3, 242, 32, 16, 0,
0, 0, 0, 0, 104, 0, 0, 0, 0, 0, 104, 0,
0, 2, 2, 0, 0, 0, 0, 2, 4, 0, 0, 0,
69, 0, 0, 9, 242, 0, 69, 0, 0, 9, 242, 0,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
70, 16, 16, 0, 1, 0, 70, 16, 16, 0, 1, 0,
@@ -192,159 +297,244 @@ const BYTE g_main[] =
69, 0, 0, 9, 242, 0, 69, 0, 0, 9, 242, 0,
16, 0, 1, 0, 0, 0, 16, 0, 1, 0, 0, 0,
70, 16, 16, 0, 1, 0, 70, 16, 16, 0, 1, 0,
0, 0, 70, 126, 16, 0, 0, 0, 102, 124, 16, 0,
1, 0, 0, 0, 0, 96, 1, 0, 0, 0, 0, 96,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
54, 0, 0, 5, 98, 0, 54, 0, 0, 5, 18, 0,
16, 0, 0, 0, 0, 0, 16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
0, 0, 0, 0, 0, 0,
31, 0, 4, 3, 10, 0,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
70, 14, 16, 0, 1, 0, 29, 0, 0, 10, 114, 0,
0, 0, 70, 30, 16, 0, 16, 0, 0, 0, 0, 0,
2, 0, 0, 0, 62, 0, 2, 64, 0, 0, 230, 174,
0, 1, 83, 84, 65, 84, 37, 61, 230, 174, 37, 61,
116, 0, 0, 0, 10, 0, 230, 174, 37, 61, 0, 0,
0, 0, 2, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 56, 0,
0, 0, 5, 0, 0, 0, 0, 10, 114, 0, 16, 0,
0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 70, 2,
0, 0, 1, 0, 0, 0, 16, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 2, 64, 0, 0, 145, 131,
0, 0, 0, 0, 0, 0, 158, 61, 145, 131, 158, 61,
0, 0, 0, 0, 0, 0, 145, 131, 158, 61, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
2, 0, 0, 0, 0, 0, 114, 0, 16, 0, 3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 64,
0, 0, 2, 0, 0, 0, 0, 0, 174, 71, 97, 61,
0, 0, 0, 0, 0, 0, 174, 71, 97, 61, 174, 71,
0, 0, 0, 0, 0, 0, 97, 61, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 56, 0, 0, 11, 114, 0,
0, 0, 0, 0, 0, 0, 16, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 70, 2, 16, 128, 129, 0,
0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
82, 68, 69, 70, 156, 1, 2, 64, 0, 0, 111, 167,
0, 0, 1, 0, 0, 0, 114, 63, 111, 167, 114, 63,
204, 0, 0, 0, 4, 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, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 82, 68,
69, 70, 68, 2, 0, 0,
1, 0, 0, 0, 204, 0,
0, 0, 4, 0, 0, 0,
28, 0, 0, 0, 0, 4,
255, 255, 0, 1, 0, 0,
25, 2, 0, 0, 156, 0,
0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 1, 0, 0, 0,
167, 0, 0, 0, 2, 0,
0, 0, 5, 0, 0, 0,
4, 0, 0, 0, 255, 255,
255, 255, 0, 0, 0, 0,
1, 0, 0, 0, 13, 0,
0, 0, 179, 0, 0, 0,
2, 0, 0, 0, 5, 0, 2, 0, 0, 0, 5, 0,
0, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 0,
255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 1, 0,
0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
13, 0, 0, 0, 179, 0, 13, 0, 0, 0, 192, 0,
0, 0, 2, 0, 0, 0,
5, 0, 0, 0, 4, 0,
0, 0, 255, 255, 255, 255,
1, 0, 0, 0, 1, 0,
0, 0, 13, 0, 0, 0,
192, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0,
0, 0, 116, 104, 101, 83, 0, 0, 1, 0, 0, 0,
97, 109, 112, 108, 101, 114, 116, 104, 101, 83, 97, 109,
0, 116, 104, 101, 84, 101, 112, 108, 101, 114, 0, 116,
120, 116, 117, 114, 101, 89, 104, 101, 84, 101, 120, 116,
0, 116, 104, 101, 84, 101, 117, 114, 101, 89, 0, 116,
120, 116, 117, 114, 101, 85, 104, 101, 84, 101, 120, 116,
86, 0, 67, 111, 110, 115, 117, 114, 101, 85, 86, 0,
116, 97, 110, 116, 115, 0, 67, 111, 110, 115, 116, 97,
171, 171, 192, 0, 0, 0, 110, 116, 115, 0, 171, 171,
4, 0, 0, 0, 228, 0, 192, 0, 0, 0, 8, 0,
0, 0, 64, 0, 0, 0, 0, 0, 228, 0, 0, 0,
80, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 68, 1, 0, 0, 164, 1, 0, 0, 0, 0,
0, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0,
0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 180, 1,
76, 1, 0, 0, 0, 0,
0, 0, 92, 1, 0, 0,
16, 0, 0, 0, 16, 0,
0, 0, 2, 0, 0, 0,
76, 1, 0, 0, 0, 0,
0, 0, 99, 1, 0, 0,
32, 0, 0, 0, 16, 0,
0, 0, 2, 0, 0, 0,
76, 1, 0, 0, 0, 0,
0, 0, 106, 1, 0, 0,
48, 0, 0, 0, 16, 0,
0, 0, 2, 0, 0, 0,
76, 1, 0, 0, 0, 0,
0, 0, 89, 111, 102, 102,
115, 101, 116, 0, 1, 0,
3, 0, 1, 0, 4, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 82, 99, 111, 101, 196, 1, 0, 0, 4, 0,
102, 102, 0, 71, 99, 111, 0, 0, 4, 0, 0, 0,
101, 102, 102, 0, 66, 99, 0, 0, 0, 0, 180, 1,
111, 101, 102, 102, 0, 77, 0, 0, 0, 0, 0, 0,
105, 99, 114, 111, 115, 111, 211, 1, 0, 0, 8, 0,
102, 116, 32, 40, 82, 41, 0, 0, 4, 0, 0, 0,
32, 72, 76, 83, 76, 32, 0, 0, 0, 0, 180, 1,
83, 104, 97, 100, 101, 114, 0, 0, 0, 0, 0, 0,
32, 67, 111, 109, 112, 105, 226, 1, 0, 0, 12, 0,
108, 101, 114, 32, 49, 48, 0, 0, 4, 0, 0, 0,
46, 49, 0, 171, 171, 171, 0, 0, 0, 0, 180, 1,
73, 83, 71, 78, 108, 0, 0, 0, 0, 0, 0, 0,
233, 1, 0, 0, 16, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 244, 1,
0, 0, 0, 0, 0, 0,
4, 2, 0, 0, 32, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 244, 1,
0, 0, 0, 0, 0, 0,
11, 2, 0, 0, 48, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 244, 1,
0, 0, 0, 0, 0, 0,
18, 2, 0, 0, 64, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 244, 1,
0, 0, 0, 0, 0, 0,
115, 99, 82, 71, 66, 95,
111, 117, 116, 112, 117, 116,
0, 171, 171, 171, 0, 0,
3, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0,
0, 0, 83, 68, 82, 95,
119, 104, 105, 116, 101, 108,
101, 118, 101, 108, 0, 72,
68, 82, 95, 119, 104, 105,
116, 101, 108, 101, 118, 101,
108, 0, 109, 97, 120, 67,
76, 76, 0, 89, 111, 102,
102, 115, 101, 116, 0, 171,
171, 171, 1, 0, 3, 0,
1, 0, 4, 0, 0, 0,
0, 0, 0, 0, 0, 0,
82, 99, 111, 101, 102, 102,
0, 71, 99, 111, 101, 102,
102, 0, 66, 99, 111, 101,
102, 102, 0, 77, 105, 99,
114, 111, 115, 111, 102, 116,
32, 40, 82, 41, 32, 72,
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 49, 48, 46, 49,
0, 171, 171, 171, 73, 83,
71, 78, 108, 0, 0, 0,
3, 0, 0, 0, 8, 0,
0, 0, 80, 0, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0,
8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 15, 0,
0, 0, 92, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0,
1, 0, 0, 0, 3, 3,
0, 0, 101, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
15, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 15, 15,
0, 0, 0, 0, 3, 0, 0, 0, 83, 86, 95, 80,
79, 83, 73, 84, 73, 79,
78, 0, 84, 69, 88, 67,
79, 79, 82, 68, 0, 67,
79, 76, 79, 82, 0, 171,
79, 83, 71, 78, 44, 0,
0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
3, 3, 0, 0, 101, 0, 8, 0, 0, 0, 32, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0,
0, 0, 2, 0, 0, 0,
15, 15, 0, 0, 83, 86,
95, 80, 79, 83, 73, 84,
73, 79, 78, 0, 84, 69,
88, 67, 79, 79, 82, 68,
0, 67, 79, 76, 79, 82,
0, 171, 79, 83, 71, 78,
44, 0, 0, 0, 1, 0,
0, 0, 8, 0, 0, 0,
32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86,
0, 0, 15, 0, 0, 0, 95, 84, 65, 82, 71, 69,
83, 86, 95, 84, 65, 82, 84, 0, 171, 171
71, 69, 84, 0, 171, 171
}; };

View File

@@ -2,21 +2,7 @@ Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1); Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0); SamplerState theSampler : register(s0);
struct PixelShaderInput #include "D3D11_PixelShader_Common.incl"
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
cbuffer Constants : register(b0)
{
float4 Yoffset;
float4 Rcoeff;
float4 Gcoeff;
float4 Bcoeff;
};
float4 main(PixelShaderInput input) : SV_TARGET float4 main(PixelShaderInput input) : SV_TARGET
{ {
@@ -26,11 +12,11 @@ float4 main(PixelShaderInput input) : SV_TARGET
yuv.x = theTextureY.Sample(theSampler, input.tex).r; yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
float3 rgb;
yuv += Yoffset.xyz; yuv += Yoffset.xyz;
Output.r = dot(yuv, Rcoeff.xyz); rgb.r = dot(yuv, Rcoeff.xyz);
Output.g = dot(yuv, Gcoeff.xyz); rgb.g = dot(yuv, Gcoeff.xyz);
Output.b = dot(yuv, Bcoeff.xyz); rgb.b = dot(yuv, Bcoeff.xyz);
Output.a = 1.0f;
return Output * input.color; return GetOutputColorFromSRGB(rgb) * input.color;
} }

297
src/render/direct3d11/D3D11_PixelShader_Textures.h Executable file → Normal file
View File

@@ -3,12 +3,30 @@
// Generated by Microsoft (R) HLSL Shader Compiler 10.1 // Generated by Microsoft (R) HLSL Shader Compiler 10.1
// //
// //
// Buffer Definitions:
//
// cbuffer Constants
// {
//
// float scRGB_output; // Offset: 0 Size: 4
// float SDR_whitelevel; // Offset: 4 Size: 4
// float HDR_whitelevel; // Offset: 8 Size: 4 [unused]
// float maxCLL; // Offset: 12 Size: 4 [unused]
// float4 Yoffset; // Offset: 16 Size: 16 [unused]
// float4 Rcoeff; // Offset: 32 Size: 16 [unused]
// float4 Gcoeff; // Offset: 48 Size: 16 [unused]
// float4 Bcoeff; // Offset: 64 Size: 16 [unused]
//
// }
//
//
// Resource Bindings: // Resource Bindings:
// //
// Name Type Format Dim HLSL Bind Count // Name Type Format Dim HLSL Bind Count
// ------------------------------ ---------- ------- ----------- -------------- ------ // ------------------------------ ---------- ------- ----------- -------------- ------
// theSampler sampler NA NA s0 1 // theSampler sampler NA NA s0 1
// theTexture texture float4 2d t0 1 // theTexture texture float4 2d t0 1
// Constants cbuffer NA NA cb0 1
// //
// //
// //
@@ -28,6 +46,13 @@
// SV_TARGET 0 xyzw 0 TARGET float xyzw // SV_TARGET 0 xyzw 0 TARGET float xyzw
// //
// //
// Constant buffer to DX9 shader constant mappings:
//
// Target Reg Buffer Start Reg # of Regs Data Conversion
// ---------- ------- --------- --------- ----------------------
// c0 cb0 0 1 ( FLT, FLT, FLT, FLT)
//
//
// Sampler/Resource to DX9 shader sampler mappings: // Sampler/Resource to DX9 shader sampler mappings:
// //
// Target Sampler Source Sampler Source Resource // Target Sampler Source Sampler Source Resource
@@ -38,47 +63,63 @@
// Level9 shader bytecode: // Level9 shader bytecode:
// //
ps_2_0 ps_2_0
def c1, 0.0125000002, 0, 0, 0
dcl t0.xy dcl t0.xy
dcl t1 dcl t1
dcl_2d s0 dcl_2d s0
texld r0, t0, s0 texld r0, t0, s0
mul r1.w, c0.x, c0.x
mul r1.xyz, r0, c0.y
mul r1.xyz, r1, c1.x
cmp r0.xyz, -r1.w, r0, r1
mul r0, r0, t1 mul r0, r0, t1
mov oC0, r0 mov oC0, r0
// approximately 3 instruction slots used (1 texture, 2 arithmetic) // approximately 7 instruction slots used (1 texture, 6 arithmetic)
ps_4_0 ps_4_0
dcl_constantbuffer CB0[1], immediateIndexed
dcl_sampler s0, mode_default dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0 dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xy dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyzw dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw dcl_output o0.xyzw
dcl_temps 1 dcl_temps 2
sample r0.xyzw, v1.xyxx, t0.xyzw, s0 ne r0.x, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[0].x
mul o0.xyzw, r0.xyzw, v2.xyzw sample r1.xyzw, v1.xyxx, t0.xyzw, s0
mul r0.yzw, r1.xxyz, cb0[0].yyyy
mul r0.yzw, r0.yyzw, l(0.000000, 0.012500, 0.012500, 0.012500)
movc r1.xyz, r0.xxxx, r0.yzwy, r1.xyzx
mul o0.xyzw, r1.xyzw, v2.xyzw
ret ret
// Approximately 3 instruction slots used // Approximately 7 instruction slots used
#endif #endif
const BYTE g_main[] = const BYTE g_main[] =
{ {
68, 88, 66, 67, 192, 209, 68, 88, 66, 67, 129, 29,
41, 173, 243, 223, 145, 48, 250, 77, 23, 118, 4, 254,
186, 133, 149, 213, 4, 163, 122, 59, 184, 144, 253, 202,
174, 97, 1, 0, 0, 0, 233, 166, 1, 0, 0, 0,
36, 3, 0, 0, 6, 0, 172, 5, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0, 0, 0, 56, 0, 0, 0,
192, 0, 0, 0, 92, 1, 40, 1, 0, 0, 108, 2,
0, 0, 216, 1, 0, 0, 0, 0, 232, 2, 0, 0,
124, 2, 0, 0, 240, 2, 4, 5, 0, 0, 120, 5,
0, 0, 65, 111, 110, 57, 0, 0, 65, 111, 110, 57,
128, 0, 0, 0, 128, 0, 232, 0, 0, 0, 232, 0,
0, 0, 0, 2, 255, 255, 0, 0, 0, 2, 255, 255,
88, 0, 0, 0, 40, 0, 180, 0, 0, 0, 52, 0,
0, 0, 0, 0, 40, 0, 0, 0, 1, 0, 40, 0,
0, 0, 40, 0, 0, 0, 0, 0, 52, 0, 0, 0,
40, 0, 1, 0, 36, 0, 52, 0, 1, 0, 36, 0,
0, 0, 40, 0, 0, 0, 0, 0, 52, 0, 0, 0,
0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 0, 2, 255, 255, 0, 0, 0, 2, 255, 255,
81, 0, 0, 5, 1, 0,
15, 160, 205, 204, 76, 60,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
31, 0, 0, 2, 0, 0, 31, 0, 0, 2, 0, 0,
0, 128, 0, 0, 3, 176, 0, 128, 0, 0, 3, 176,
31, 0, 0, 2, 0, 0, 31, 0, 0, 2, 0, 0,
@@ -88,14 +129,28 @@ const BYTE g_main[] =
66, 0, 0, 3, 0, 0, 66, 0, 0, 3, 0, 0,
15, 128, 0, 0, 228, 176, 15, 128, 0, 0, 228, 176,
0, 8, 228, 160, 5, 0, 0, 8, 228, 160, 5, 0,
0, 3, 0, 0, 15, 128, 0, 3, 1, 0, 8, 128,
0, 0, 228, 128, 1, 0, 0, 0, 0, 160, 0, 0,
228, 176, 1, 0, 0, 2, 0, 160, 5, 0, 0, 3,
0, 8, 15, 128, 0, 0, 1, 0, 7, 128, 0, 0,
228, 128, 255, 255, 0, 0, 228, 128, 0, 0, 85, 160,
83, 72, 68, 82, 148, 0, 5, 0, 0, 3, 1, 0,
0, 0, 64, 0, 0, 0, 7, 128, 1, 0, 228, 128,
37, 0, 0, 0, 90, 0, 1, 0, 0, 160, 88, 0,
0, 4, 0, 0, 7, 128,
1, 0, 255, 129, 0, 0,
228, 128, 1, 0, 228, 128,
5, 0, 0, 3, 0, 0,
15, 128, 0, 0, 228, 128,
1, 0, 228, 176, 1, 0,
0, 2, 0, 8, 15, 128,
0, 0, 228, 128, 255, 255,
0, 0, 83, 72, 68, 82,
60, 1, 0, 0, 64, 0,
0, 0, 79, 0, 0, 0,
89, 0, 0, 4, 70, 142,
32, 0, 0, 0, 0, 0,
1, 0, 0, 0, 90, 0,
0, 3, 0, 96, 16, 0, 0, 3, 0, 96, 16, 0,
0, 0, 0, 0, 88, 24, 0, 0, 0, 0, 88, 24,
0, 4, 0, 112, 16, 0, 0, 4, 0, 112, 16, 0,
@@ -107,66 +162,154 @@ const BYTE g_main[] =
0, 0, 101, 0, 0, 3, 0, 0, 101, 0, 0, 3,
242, 32, 16, 0, 0, 0, 242, 32, 16, 0, 0, 0,
0, 0, 104, 0, 0, 2, 0, 0, 104, 0, 0, 2,
1, 0, 0, 0, 69, 0, 2, 0, 0, 0, 57, 0,
0, 9, 242, 0, 16, 0, 0, 11, 18, 0, 16, 0,
0, 0, 0, 0, 70, 16, 0, 0, 0, 0, 2, 64,
0, 0, 0, 0, 0, 0,
0, 0, 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 0, 0, 0, 1, 0,
0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
103, 0, 0, 0, 2, 0, 116, 104, 101, 83, 97, 109,
0, 0, 5, 0, 0, 0, 112, 108, 101, 114, 0, 116,
4, 0, 0, 0, 255, 255, 104, 101, 84, 101, 120, 116,
255, 255, 0, 0, 0, 0, 117, 114, 101, 0, 67, 111,
1, 0, 0, 0, 13, 0, 110, 115, 116, 97, 110, 116,
0, 0, 116, 104, 101, 83, 115, 0, 146, 0, 0, 0,
97, 109, 112, 108, 101, 114, 8, 0, 0, 0, 180, 0,
0, 116, 104, 101, 84, 101, 0, 0, 80, 0, 0, 0,
120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0,
77, 105, 99, 114, 111, 115, 0, 0, 116, 1, 0, 0,
111, 102, 116, 32, 40, 82, 0, 0, 0, 0, 4, 0,
41, 32, 72, 76, 83, 76, 0, 0, 2, 0, 0, 0,
32, 83, 104, 97, 100, 101, 132, 1, 0, 0, 0, 0,
114, 32, 67, 111, 109, 112, 0, 0, 148, 1, 0, 0,
105, 108, 101, 114, 32, 49, 4, 0, 0, 0, 4, 0,
48, 46, 49, 0, 171, 171, 0, 0, 2, 0, 0, 0,
132, 1, 0, 0, 0, 0,
0, 0, 163, 1, 0, 0,
8, 0, 0, 0, 4, 0,
0, 0, 0, 0, 0, 0,
132, 1, 0, 0, 0, 0,
0, 0, 178, 1, 0, 0,
12, 0, 0, 0, 4, 0,
0, 0, 0, 0, 0, 0,
132, 1, 0, 0, 0, 0,
0, 0, 185, 1, 0, 0,
16, 0, 0, 0, 16, 0,
0, 0, 0, 0, 0, 0,
196, 1, 0, 0, 0, 0,
0, 0, 212, 1, 0, 0,
32, 0, 0, 0, 16, 0,
0, 0, 0, 0, 0, 0,
196, 1, 0, 0, 0, 0,
0, 0, 219, 1, 0, 0,
48, 0, 0, 0, 16, 0,
0, 0, 0, 0, 0, 0,
196, 1, 0, 0, 0, 0,
0, 0, 226, 1, 0, 0,
64, 0, 0, 0, 16, 0,
0, 0, 0, 0, 0, 0,
196, 1, 0, 0, 0, 0,
0, 0, 115, 99, 82, 71,
66, 95, 111, 117, 116, 112,
117, 116, 0, 171, 171, 171,
0, 0, 3, 0, 1, 0,
1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 83, 68,
82, 95, 119, 104, 105, 116,
101, 108, 101, 118, 101, 108,
0, 72, 68, 82, 95, 119,
104, 105, 116, 101, 108, 101,
118, 101, 108, 0, 109, 97,
120, 67, 76, 76, 0, 89,
111, 102, 102, 115, 101, 116,
0, 171, 171, 171, 1, 0,
3, 0, 1, 0, 4, 0,
0, 0, 0, 0, 0, 0,
0, 0, 82, 99, 111, 101,
102, 102, 0, 71, 99, 111,
101, 102, 102, 0, 66, 99,
111, 101, 102, 102, 0, 77,
105, 99, 114, 111, 115, 111,
102, 116, 32, 40, 82, 41,
32, 72, 76, 83, 76, 32,
83, 104, 97, 100, 101, 114,
32, 67, 111, 109, 112, 105,
108, 101, 114, 32, 49, 48,
46, 49, 0, 171, 171, 171,
73, 83, 71, 78, 108, 0, 73, 83, 71, 78, 108, 0,
0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0,
8, 0, 0, 0, 80, 0, 8, 0, 0, 0, 80, 0,

View File

@@ -1,14 +1,9 @@
Texture2D theTexture : register(t0); Texture2D theTexture : register(t0);
SamplerState theSampler : register(s0); SamplerState theSampler : register(s0);
struct PixelShaderInput #include "D3D11_PixelShader_Common.incl"
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
float4 main(PixelShaderInput input) : SV_TARGET float4 main(PixelShaderInput input) : SV_TARGET
{ {
return theTexture.Sample(theSampler, input.tex) * input.color; return GetOutputColor(theTexture.Sample(theSampler, input.tex)) * input.color;
} }

536
src/render/direct3d11/D3D11_PixelShader_YUV.h Executable file → Normal file
View File

@@ -8,10 +8,14 @@
// cbuffer Constants // cbuffer Constants
// { // {
// //
// float4 Yoffset; // Offset: 0 Size: 16 // float scRGB_output; // Offset: 0 Size: 4
// float4 Rcoeff; // Offset: 16 Size: 16 // float SDR_whitelevel; // Offset: 4 Size: 4 [unused]
// float4 Gcoeff; // Offset: 32 Size: 16 // float HDR_whitelevel; // Offset: 8 Size: 4 [unused]
// float4 Bcoeff; // Offset: 48 Size: 16 // float maxCLL; // Offset: 12 Size: 4 [unused]
// float4 Yoffset; // Offset: 16 Size: 16
// float4 Rcoeff; // Offset: 32 Size: 16
// float4 Gcoeff; // Offset: 48 Size: 16
// float4 Bcoeff; // Offset: 64 Size: 16
// //
// } // }
// //
@@ -48,7 +52,7 @@
// //
// Target Reg Buffer Start Reg # of Regs Data Conversion // Target Reg Buffer Start Reg # of Regs Data Conversion
// ---------- ------- --------- --------- ---------------------- // ---------- ------- --------- --------- ----------------------
// c0 cb0 0 4 ( FLT, FLT, FLT, FLT) // c0 cb0 0 5 ( FLT, FLT, FLT, FLT)
// //
// //
// Sampler/Resource to DX9 shader sampler mappings: // Sampler/Resource to DX9 shader sampler mappings:
@@ -63,7 +67,8 @@
// Level9 shader bytecode: // Level9 shader bytecode:
// //
ps_2_0 ps_2_0
def c4, 1, 0, 0, 0 def c5, 0.0404499993, 0.0773993805, 0.0549999997, 0.947867334
def c6, 2.4000001, 1, 0, 0
dcl t0.xy dcl t0.xy
dcl t1 dcl t1
dcl_2d s0 dcl_2d s0
@@ -74,17 +79,40 @@
texld r2, t0, s2 texld r2, t0, s2
mov r0.y, r1.x mov r0.y, r1.x
mov r0.z, r2.x mov r0.z, r2.x
add r0.xyz, r0, c0 add r0.xyz, r0, c1
dp3 r1.x, r0, c1 dp3 r1.x, r0, c2
dp3 r1.y, r0, c2 add r0.w, r1.x, c5.z
dp3 r1.z, r0, c3 abs r0.w, r0.w
mov r1.w, c4.x mul r0.w, r0.w, c5.w
mul r0, r1, t1 pow r1.w, r0.w, c6.x
add r0.w, -r1.x, c5.x
mul r2.x, r1.x, c5.y
cmp r2.x, r0.w, r2.x, r1.w
dp3 r1.y, r0, c3
dp3 r1.z, r0, c4
add r1.w, r1.y, c5.z
abs r1.w, r1.w
mul r1.w, r1.w, c5.w
pow r2.w, r1.w, c6.x
add r1.w, -r1.y, c5.x
mul r0.x, r1.y, c5.y
cmp r2.y, r1.w, r0.x, r2.w
add r1.w, r1.z, c5.z
abs r1.w, r1.w
mul r1.w, r1.w, c5.w
pow r2.w, r1.w, c6.x
add r1.w, -r1.z, c5.x
mul r0.x, r1.z, c5.y
cmp r2.z, r1.w, r0.x, r2.w
mul r1.w, c0.x, c0.x
cmp r0.xyz, -r1.w, r1, r2
mov r0.w, c6.y
mul r0, r0, t1
mov oC0, r0 mov oC0, r0
// approximately 12 instruction slots used (3 texture, 9 arithmetic) // approximately 41 instruction slots used (3 texture, 38 arithmetic)
ps_4_0 ps_4_0
dcl_constantbuffer CB0[4], immediateIndexed dcl_constantbuffer CB0[5], immediateIndexed
dcl_sampler s0, mode_default dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0 dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1 dcl_resource_texture2d (float,float,float,float) t1
@@ -92,48 +120,63 @@ dcl_resource_texture2d (float,float,float,float) t2
dcl_input_ps linear v1.xy dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyzw dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw dcl_output o0.xyzw
dcl_temps 2 dcl_temps 4
sample r0.xyzw, v1.xyxx, t0.xyzw, s0 sample r0.xyzw, v1.xyxx, t0.xyzw, s0
sample r1.xyzw, v1.xyxx, t1.xyzw, s0 sample r1.xyzw, v1.xyxx, t1.xyzw, s0
mov r0.y, r1.x sample r2.xyzw, v1.xyxx, t2.yzxw, s0
sample r1.xyzw, v1.xyxx, t2.xyzw, s0 mov r2.x, r0.x
mov r0.z, r1.x mov r2.y, r1.x
add r0.xyz, r0.xyzx, cb0[0].xyzx add r0.xyz, r2.xyzx, cb0[1].xyzx
dp3 r1.x, r0.xyzx, cb0[1].xyzx dp3 r1.x, r0.xyzx, cb0[2].xyzx
dp3 r1.y, r0.xyzx, cb0[2].xyzx dp3 r1.y, r0.xyzx, cb0[3].xyzx
dp3 r1.z, r0.xyzx, cb0[3].xyzx dp3 r1.z, r0.xyzx, cb0[4].xyzx
ne r0.x, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[0].x
if_nz r0.x
ge r0.xyz, l(0.040450, 0.040450, 0.040450, 0.000000), r1.xyzx
mul r2.xyz, r1.xyzx, l(0.077399, 0.077399, 0.077399, 0.000000)
add r3.xyz, r1.xyzx, l(0.055000, 0.055000, 0.055000, 0.000000)
mul r3.xyz, |r3.xyzx|, l(0.947867, 0.947867, 0.947867, 0.000000)
log r3.xyz, r3.xyzx
mul r3.xyz, r3.xyzx, l(2.400000, 2.400000, 2.400000, 0.000000)
exp r3.xyz, r3.xyzx
movc r1.xyz, r0.xyzx, r2.xyzx, r3.xyzx
endif
mov r1.w, l(1.000000) mov r1.w, l(1.000000)
mul o0.xyzw, r1.xyzw, v2.xyzw mul o0.xyzw, r1.xyzw, v2.xyzw
ret ret
// Approximately 12 instruction slots used // Approximately 23 instruction slots used
#endif #endif
const BYTE g_main[] = const BYTE g_main[] =
{ {
68, 88, 66, 67, 17, 27, 68, 88, 66, 67, 9, 92,
202, 87, 93, 193, 186, 139, 101, 235, 212, 83, 42, 215,
251, 175, 168, 151, 229, 182, 158, 193, 215, 73, 102, 13,
100, 211, 1, 0, 0, 0, 226, 183, 1, 0, 0, 0,
76, 6, 0, 0, 6, 0, 212, 9, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0, 0, 0, 56, 0, 0, 0,
136, 1, 0, 0, 88, 3, 20, 3, 0, 0, 56, 6,
0, 0, 212, 3, 0, 0, 0, 0, 180, 6, 0, 0,
164, 5, 0, 0, 24, 6, 44, 9, 0, 0, 160, 9,
0, 0, 65, 111, 110, 57, 0, 0, 65, 111, 110, 57,
72, 1, 0, 0, 72, 1, 212, 2, 0, 0, 212, 2,
0, 0, 0, 2, 255, 255, 0, 0, 0, 2, 255, 255,
12, 1, 0, 0, 60, 0, 152, 2, 0, 0, 60, 0,
0, 0, 1, 0, 48, 0, 0, 0, 1, 0, 48, 0,
0, 0, 60, 0, 0, 0, 0, 0, 60, 0, 0, 0,
60, 0, 3, 0, 36, 0, 60, 0, 3, 0, 36, 0,
0, 0, 60, 0, 0, 0, 0, 0, 60, 0, 0, 0,
0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0,
2, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, 0,
0, 0, 4, 0, 0, 0, 0, 0, 5, 0, 0, 0,
0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2,
255, 255, 81, 0, 0, 5, 255, 255, 81, 0, 0, 5,
4, 0, 15, 160, 0, 0, 5, 0, 15, 160, 230, 174,
128, 63, 0, 0, 0, 0, 37, 61, 145, 131, 158, 61,
174, 71, 97, 61, 111, 167,
114, 63, 81, 0, 0, 5,
6, 0, 15, 160, 154, 153,
25, 64, 0, 0, 128, 63,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 31, 0, 0, 2, 0, 0, 31, 0, 0, 2,
0, 0, 0, 128, 0, 0, 0, 0, 0, 128, 0, 0,
@@ -159,28 +202,90 @@ const BYTE g_main[] =
0, 0, 4, 128, 2, 0, 0, 0, 4, 128, 2, 0,
0, 128, 2, 0, 0, 3, 0, 128, 2, 0, 0, 3,
0, 0, 7, 128, 0, 0, 0, 0, 7, 128, 0, 0,
228, 128, 0, 0, 228, 160, 228, 128, 1, 0, 228, 160,
8, 0, 0, 3, 1, 0, 8, 0, 0, 3, 1, 0,
1, 128, 0, 0, 228, 128, 1, 128, 0, 0, 228, 128,
1, 0, 228, 160, 8, 0, 2, 0, 228, 160, 2, 0,
0, 3, 1, 0, 2, 128, 0, 3, 0, 0, 8, 128,
0, 0, 228, 128, 2, 0, 1, 0, 0, 128, 5, 0,
228, 160, 8, 0, 0, 3, 170, 160, 35, 0, 0, 2,
1, 0, 4, 128, 0, 0, 0, 0, 8, 128, 0, 0,
255, 128, 5, 0, 0, 3,
0, 0, 8, 128, 0, 0,
255, 128, 5, 0, 255, 160,
32, 0, 0, 3, 1, 0,
8, 128, 0, 0, 255, 128,
6, 0, 0, 160, 2, 0,
0, 3, 0, 0, 8, 128,
1, 0, 0, 129, 5, 0,
0, 160, 5, 0, 0, 3,
2, 0, 1, 128, 1, 0,
0, 128, 5, 0, 85, 160,
88, 0, 0, 4, 2, 0,
1, 128, 0, 0, 255, 128,
2, 0, 0, 128, 1, 0,
255, 128, 8, 0, 0, 3,
1, 0, 2, 128, 0, 0,
228, 128, 3, 0, 228, 160, 228, 128, 3, 0, 228, 160,
1, 0, 0, 2, 1, 0, 8, 0, 0, 3, 1, 0,
8, 128, 4, 0, 0, 160, 4, 128, 0, 0, 228, 128,
4, 0, 228, 160, 2, 0,
0, 3, 1, 0, 8, 128,
1, 0, 85, 128, 5, 0,
170, 160, 35, 0, 0, 2,
1, 0, 8, 128, 1, 0,
255, 128, 5, 0, 0, 3,
1, 0, 8, 128, 1, 0,
255, 128, 5, 0, 255, 160,
32, 0, 0, 3, 2, 0,
8, 128, 1, 0, 255, 128,
6, 0, 0, 160, 2, 0,
0, 3, 1, 0, 8, 128,
1, 0, 85, 129, 5, 0,
0, 160, 5, 0, 0, 3,
0, 0, 1, 128, 1, 0,
85, 128, 5, 0, 85, 160,
88, 0, 0, 4, 2, 0,
2, 128, 1, 0, 255, 128,
0, 0, 0, 128, 2, 0,
255, 128, 2, 0, 0, 3,
1, 0, 8, 128, 1, 0,
170, 128, 5, 0, 170, 160,
35, 0, 0, 2, 1, 0,
8, 128, 1, 0, 255, 128,
5, 0, 0, 3, 1, 0,
8, 128, 1, 0, 255, 128,
5, 0, 255, 160, 32, 0,
0, 3, 2, 0, 8, 128,
1, 0, 255, 128, 6, 0,
0, 160, 2, 0, 0, 3,
1, 0, 8, 128, 1, 0,
170, 129, 5, 0, 0, 160,
5, 0, 0, 3, 0, 0, 5, 0, 0, 3, 0, 0,
15, 128, 1, 0, 228, 128, 1, 128, 1, 0, 170, 128,
5, 0, 85, 160, 88, 0,
0, 4, 2, 0, 4, 128,
1, 0, 255, 128, 0, 0,
0, 128, 2, 0, 255, 128,
5, 0, 0, 3, 1, 0,
8, 128, 0, 0, 0, 160,
0, 0, 0, 160, 88, 0,
0, 4, 0, 0, 7, 128,
1, 0, 255, 129, 1, 0,
228, 128, 2, 0, 228, 128,
1, 0, 0, 2, 0, 0,
8, 128, 6, 0, 85, 160,
5, 0, 0, 3, 0, 0,
15, 128, 0, 0, 228, 128,
1, 0, 228, 176, 1, 0, 1, 0, 228, 176, 1, 0,
0, 2, 0, 8, 15, 128, 0, 2, 0, 8, 15, 128,
0, 0, 228, 128, 255, 255, 0, 0, 228, 128, 255, 255,
0, 0, 83, 72, 68, 82, 0, 0, 83, 72, 68, 82,
200, 1, 0, 0, 64, 0, 28, 3, 0, 0, 64, 0,
0, 0, 114, 0, 0, 0, 0, 0, 199, 0, 0, 0,
89, 0, 0, 4, 70, 142, 89, 0, 0, 4, 70, 142,
32, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0,
4, 0, 0, 0, 90, 0, 5, 0, 0, 0, 90, 0,
0, 3, 0, 96, 16, 0, 0, 3, 0, 96, 16, 0,
0, 0, 0, 0, 88, 24, 0, 0, 0, 0, 88, 24,
0, 4, 0, 112, 16, 0, 0, 4, 0, 112, 16, 0,
@@ -197,7 +302,7 @@ const BYTE g_main[] =
2, 0, 0, 0, 101, 0, 2, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0, 0, 3, 242, 32, 16, 0,
0, 0, 0, 0, 104, 0, 0, 0, 0, 0, 104, 0,
0, 2, 2, 0, 0, 0, 0, 2, 4, 0, 0, 0,
69, 0, 0, 9, 242, 0, 69, 0, 0, 9, 242, 0,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
70, 16, 16, 0, 1, 0, 70, 16, 16, 0, 1, 0,
@@ -210,173 +315,258 @@ const BYTE g_main[] =
0, 0, 70, 126, 16, 0, 0, 0, 70, 126, 16, 0,
1, 0, 0, 0, 0, 96, 1, 0, 0, 0, 0, 96,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
54, 0, 0, 5, 34, 0, 69, 0, 0, 9, 242, 0,
16, 0, 0, 0, 0, 0,
10, 0, 16, 0, 1, 0,
0, 0, 69, 0, 0, 9,
242, 0, 16, 0, 1, 0,
0, 0, 70, 16, 16, 0,
1, 0, 0, 0, 70, 126,
16, 0, 2, 0, 0, 0, 16, 0, 2, 0, 0, 0,
0, 96, 16, 0, 0, 0, 70, 16, 16, 0, 1, 0,
0, 0, 150, 124, 16, 0,
2, 0, 0, 0, 0, 96,
16, 0, 0, 0, 0, 0,
54, 0, 0, 5, 18, 0,
16, 0, 2, 0, 0, 0,
10, 0, 16, 0, 0, 0,
0, 0, 54, 0, 0, 5, 0, 0, 54, 0, 0, 5,
66, 0, 16, 0, 0, 0, 34, 0, 16, 0, 2, 0,
0, 0, 10, 0, 16, 0, 0, 0, 10, 0, 16, 0,
1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 8, 114, 0, 16, 0, 0, 8, 114, 0, 16, 0,
0, 0, 0, 0, 70, 2, 0, 0, 0, 0, 70, 2,
16, 0, 0, 0, 0, 0, 16, 0, 2, 0, 0, 0,
70, 130, 32, 0, 0, 0, 70, 130, 32, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
16, 0, 0, 8, 18, 0, 16, 0, 0, 8, 18, 0,
16, 0, 1, 0, 0, 0, 16, 0, 1, 0, 0, 0,
70, 2, 16, 0, 0, 0, 70, 2, 16, 0, 0, 0,
0, 0, 70, 130, 32, 0, 0, 0, 70, 130, 32, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0,
0, 0, 16, 0, 0, 8, 0, 0, 16, 0, 0, 8,
34, 0, 16, 0, 1, 0, 34, 0, 16, 0, 1, 0,
0, 0, 70, 2, 16, 0, 0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 70, 130, 0, 0, 0, 0, 70, 130,
32, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0,
2, 0, 0, 0, 16, 0, 3, 0, 0, 0, 16, 0,
0, 8, 66, 0, 16, 0, 0, 8, 66, 0, 16, 0,
1, 0, 0, 0, 70, 2, 1, 0, 0, 0, 70, 2,
16, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0,
70, 130, 32, 0, 0, 0, 70, 130, 32, 0, 0, 0,
0, 0, 3, 0, 0, 0, 0, 0, 4, 0, 0, 0,
54, 0, 0, 5, 130, 0, 57, 0, 0, 11, 18, 0,
16, 0, 0, 0, 0, 0,
2, 64, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 10, 128, 32, 0,
0, 0, 0, 0, 0, 0,
0, 0, 31, 0, 4, 3,
10, 0, 16, 0, 0, 0,
0, 0, 29, 0, 0, 10,
114, 0, 16, 0, 0, 0,
0, 0, 2, 64, 0, 0,
230, 174, 37, 61, 230, 174,
37, 61, 230, 174, 37, 61,
0, 0, 0, 0, 70, 2,
16, 0, 1, 0, 0, 0, 16, 0, 1, 0, 0, 0,
1, 64, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0,
128, 63, 56, 0, 0, 7,
242, 32, 16, 0, 0, 0,
0, 0, 70, 14, 16, 0,
1, 0, 0, 0, 70, 30,
16, 0, 2, 0, 0, 0, 16, 0, 2, 0, 0, 0,
62, 0, 0, 1, 83, 84, 70, 2, 16, 0, 1, 0,
65, 84, 116, 0, 0, 0, 0, 0, 2, 64, 0, 0,
12, 0, 0, 0, 2, 0, 145, 131, 158, 61, 145, 131,
0, 0, 0, 0, 0, 0, 158, 61, 145, 131, 158, 61,
3, 0, 0, 0, 5, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 10, 114, 0, 16, 0,
3, 0, 0, 0, 70, 2,
16, 0, 1, 0, 0, 0,
2, 64, 0, 0, 174, 71,
97, 61, 174, 71, 97, 61,
174, 71, 97, 61, 0, 0,
0, 0, 56, 0, 0, 11,
114, 0, 16, 0, 3, 0,
0, 0, 70, 2, 16, 128,
129, 0, 0, 0, 3, 0,
0, 0, 2, 64, 0, 0,
111, 167, 114, 63, 111, 167,
114, 63, 111, 167, 114, 63,
0, 0, 0, 0, 47, 0,
0, 5, 114, 0, 16, 0,
3, 0, 0, 0, 70, 2,
16, 0, 3, 0, 0, 0,
56, 0, 0, 10, 114, 0,
16, 0, 3, 0, 0, 0,
70, 2, 16, 0, 3, 0,
0, 0, 2, 64, 0, 0,
154, 153, 25, 64, 154, 153,
25, 64, 154, 153, 25, 64,
0, 0, 0, 0, 25, 0,
0, 5, 114, 0, 16, 0,
3, 0, 0, 0, 70, 2,
16, 0, 3, 0, 0, 0,
55, 0, 0, 9, 114, 0,
16, 0, 1, 0, 0, 0,
70, 2, 16, 0, 0, 0,
0, 0, 70, 2, 16, 0,
2, 0, 0, 0, 70, 2,
16, 0, 3, 0, 0, 0,
21, 0, 0, 1, 54, 0,
0, 5, 130, 0, 16, 0,
1, 0, 0, 0, 1, 64,
0, 0, 0, 0, 128, 63,
56, 0, 0, 7, 242, 32,
16, 0, 0, 0, 0, 0,
70, 14, 16, 0, 1, 0,
0, 0, 70, 30, 16, 0,
2, 0, 0, 0, 62, 0,
0, 1, 83, 84, 65, 84,
116, 0, 0, 0, 23, 0,
0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0,
0, 0, 12, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0,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0,
0, 0, 13, 0, 0, 0, 0, 0, 13, 0, 0, 0,
211, 0, 0, 0, 2, 0, 223, 0, 0, 0, 2, 0,
0, 0, 5, 0, 0, 0, 0, 0, 5, 0, 0, 0,
4, 0, 0, 0, 255, 255, 4, 0, 0, 0, 255, 255,
255, 255, 1, 0, 0, 0, 255, 255, 2, 0, 0, 0,
1, 0, 0, 0, 13, 0, 1, 0, 0, 0, 13, 0,
0, 0, 223, 0, 0, 0, 0, 0, 235, 0, 0, 0,
2, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0,
1, 0, 0, 0, 116, 104,
101, 83, 97, 109, 112, 108,
101, 114, 0, 116, 104, 101,
84, 101, 120, 116, 117, 114,
101, 89, 0, 116, 104, 101,
84, 101, 120, 116, 117, 114,
101, 85, 0, 116, 104, 101,
84, 101, 120, 116, 117, 114,
101, 86, 0, 67, 111, 110,
115, 116, 97, 110, 116, 115,
0, 171, 171, 171, 235, 0,
0, 0, 8, 0, 0, 0,
16, 1, 0, 0, 80, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 208, 1,
0, 0, 0, 0, 0, 0,
4, 0, 0, 0, 2, 0,
0, 0, 224, 1, 0, 0,
0, 0, 0, 0, 240, 1,
0, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 0,
255, 255, 255, 255, 2, 0, 4, 0, 0, 0, 0, 0,
0, 0, 224, 1, 0, 0,
0, 0, 0, 0, 255, 1,
0, 0, 8, 0, 0, 0,
4, 0, 0, 0, 0, 0,
0, 0, 224, 1, 0, 0,
0, 0, 0, 0, 14, 2,
0, 0, 12, 0, 0, 0,
4, 0, 0, 0, 0, 0,
0, 0, 224, 1, 0, 0,
0, 0, 0, 0, 21, 2,
0, 0, 16, 0, 0, 0,
16, 0, 0, 0, 2, 0,
0, 0, 32, 2, 0, 0,
0, 0, 0, 0, 48, 2,
0, 0, 32, 0, 0, 0,
16, 0, 0, 0, 2, 0,
0, 0, 32, 2, 0, 0,
0, 0, 0, 0, 55, 2,
0, 0, 48, 0, 0, 0,
16, 0, 0, 0, 2, 0,
0, 0, 32, 2, 0, 0,
0, 0, 0, 0, 62, 2,
0, 0, 64, 0, 0, 0,
16, 0, 0, 0, 2, 0,
0, 0, 32, 2, 0, 0,
0, 0, 0, 0, 115, 99,
82, 71, 66, 95, 111, 117,
116, 112, 117, 116, 0, 171,
171, 171, 0, 0, 3, 0,
1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0,
83, 68, 82, 95, 119, 104,
105, 116, 101, 108, 101, 118,
101, 108, 0, 72, 68, 82,
95, 119, 104, 105, 116, 101,
108, 101, 118, 101, 108, 0,
109, 97, 120, 67, 76, 76,
0, 89, 111, 102, 102, 115,
101, 116, 0, 171, 171, 171,
1, 0, 3, 0, 1, 0,
4, 0, 0, 0, 0, 0,
0, 0, 0, 0, 82, 99,
111, 101, 102, 102, 0, 71,
99, 111, 101, 102, 102, 0,
66, 99, 111, 101, 102, 102,
0, 77, 105, 99, 114, 111,
115, 111, 102, 116, 32, 40,
82, 41, 32, 72, 76, 83,
76, 32, 83, 104, 97, 100,
101, 114, 32, 67, 111, 109,
112, 105, 108, 101, 114, 32,
49, 48, 46, 49, 0, 171,
171, 171, 73, 83, 71, 78,
108, 0, 0, 0, 3, 0,
0, 0, 8, 0, 0, 0,
80, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
13, 0, 0, 0, 235, 0, 3, 0, 0, 0, 0, 0,
0, 0, 15, 0, 0, 0,
92, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 1, 0,
0, 0, 3, 3, 0, 0,
101, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 2, 0,
0, 0, 15, 15, 0, 0,
83, 86, 95, 80, 79, 83,
73, 84, 73, 79, 78, 0,
84, 69, 88, 67, 79, 79,
82, 68, 0, 67, 79, 76,
79, 82, 0, 171, 79, 83,
71, 78, 44, 0, 0, 0,
1, 0, 0, 0, 8, 0,
0, 0, 32, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 1, 0, 0, 0,
116, 104, 101, 83, 97, 109,
112, 108, 101, 114, 0, 116,
104, 101, 84, 101, 120, 116,
117, 114, 101, 89, 0, 116,
104, 101, 84, 101, 120, 116,
117, 114, 101, 85, 0, 116,
104, 101, 84, 101, 120, 116,
117, 114, 101, 86, 0, 67,
111, 110, 115, 116, 97, 110,
116, 115, 0, 171, 171, 171,
235, 0, 0, 0, 4, 0,
0, 0, 16, 1, 0, 0,
64, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
112, 1, 0, 0, 0, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 120, 1,
0, 0, 0, 0, 0, 0,
136, 1, 0, 0, 16, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 120, 1,
0, 0, 0, 0, 0, 0,
143, 1, 0, 0, 32, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 120, 1,
0, 0, 0, 0, 0, 0,
150, 1, 0, 0, 48, 0,
0, 0, 16, 0, 0, 0,
2, 0, 0, 0, 120, 1,
0, 0, 0, 0, 0, 0,
89, 111, 102, 102, 115, 101,
116, 0, 1, 0, 3, 0,
1, 0, 4, 0, 0, 0,
0, 0, 0, 0, 0, 0,
82, 99, 111, 101, 102, 102,
0, 71, 99, 111, 101, 102,
102, 0, 66, 99, 111, 101,
102, 102, 0, 77, 105, 99,
114, 111, 115, 111, 102, 116,
32, 40, 82, 41, 32, 72,
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 49, 48, 46, 49,
0, 171, 171, 171, 73, 83,
71, 78, 108, 0, 0, 0,
3, 0, 0, 0, 8, 0,
0, 0, 80, 0, 0, 0,
0, 0, 0, 0, 1, 0,
0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 15, 0,
0, 0, 92, 0, 0, 0, 0, 0, 83, 86, 95, 84,
0, 0, 0, 0, 0, 0, 65, 82, 71, 69, 84, 0,
0, 0, 3, 0, 0, 0, 171, 171
1, 0, 0, 0, 3, 3,
0, 0, 101, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
2, 0, 0, 0, 15, 15,
0, 0, 83, 86, 95, 80,
79, 83, 73, 84, 73, 79,
78, 0, 84, 69, 88, 67,
79, 79, 82, 68, 0, 67,
79, 76, 79, 82, 0, 171,
79, 83, 71, 78, 44, 0,
0, 0, 1, 0, 0, 0,
8, 0, 0, 0, 32, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 0, 0, 0, 0,
15, 0, 0, 0, 83, 86,
95, 84, 65, 82, 71, 69,
84, 0, 171, 171
}; };

View File

@@ -3,21 +3,7 @@ Texture2D theTextureU : register(t1);
Texture2D theTextureV : register(t2); Texture2D theTextureV : register(t2);
SamplerState theSampler : register(s0); SamplerState theSampler : register(s0);
struct PixelShaderInput #include "D3D11_PixelShader_Common.incl"
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
cbuffer Constants : register(b0)
{
float4 Yoffset;
float4 Rcoeff;
float4 Gcoeff;
float4 Bcoeff;
};
float4 main(PixelShaderInput input) : SV_TARGET float4 main(PixelShaderInput input) : SV_TARGET
{ {
@@ -28,11 +14,11 @@ float4 main(PixelShaderInput input) : SV_TARGET
yuv.y = theTextureU.Sample(theSampler, input.tex).r; yuv.y = theTextureU.Sample(theSampler, input.tex).r;
yuv.z = theTextureV.Sample(theSampler, input.tex).r; yuv.z = theTextureV.Sample(theSampler, input.tex).r;
float3 rgb;
yuv += Yoffset.xyz; yuv += Yoffset.xyz;
Output.r = dot(yuv, Rcoeff.xyz); rgb.r = dot(yuv, Rcoeff.xyz);
Output.g = dot(yuv, Gcoeff.xyz); rgb.g = dot(yuv, Gcoeff.xyz);
Output.b = dot(yuv, Bcoeff.xyz); rgb.b = dot(yuv, Bcoeff.xyz);
Output.a = 1.0f;
return Output * input.color; return GetOutputColorFromSRGB(rgb) * input.color;
} }

0
src/render/direct3d11/D3D11_VertexShader.h Executable file → Normal file
View File

View File

@@ -76,11 +76,11 @@ typedef struct
typedef struct typedef struct
{ {
float YCbCr_matrix[16];
float scRGB_output; float scRGB_output;
float SDR_whitelevel; float SDR_whitelevel;
float HDR_whitelevel; float HDR_whitelevel;
float maxCLL; float maxCLL;
float YCbCr_matrix[16];
} PixelShaderConstants; } PixelShaderConstants;
/* Per-vertex data */ /* Per-vertex data */
@@ -155,6 +155,11 @@ typedef struct
D3D_FEATURE_LEVEL featureLevel; D3D_FEATURE_LEVEL featureLevel;
SDL_bool pixelSizeChanged; SDL_bool pixelSizeChanged;
/* HDR state */
SDL_bool HDR_enabled;
int SDR_whitelevel;
int HDR_whitelevel;
/* Rasterizers */ /* Rasterizers */
ID3D11RasterizerState *mainRasterizer; ID3D11RasterizerState *mainRasterizer;
ID3D11RasterizerState *clippedRasterizer; ID3D11RasterizerState *clippedRasterizer;
@@ -465,6 +470,21 @@ static ID3D11BlendState *D3D11_CreateBlendState(SDL_Renderer *renderer, SDL_Blen
return blendState; return blendState;
} }
static void D3D11_UpdateHDRState(SDL_Renderer *renderer)
{
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
/* Using some placeholder values here... */
data->HDR_enabled = SDL_TRUE;
if (renderer->output_colorspace == SDL_COLORSPACE_SCRGB && data->HDR_enabled) {
data->SDR_whitelevel = 200.0f;
data->HDR_whitelevel = 400.0f;
} else {
data->SDR_whitelevel = 80.0f;
data->HDR_whitelevel = 80.0f;
}
}
/* Create resources that depend on the device. */ /* Create resources that depend on the device. */
static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer) static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
{ {
@@ -716,6 +736,8 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
SDL_SetProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_D3D11_DEVICE_POINTER, data->d3dDevice); SDL_SetProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_D3D11_DEVICE_POINTER, data->d3dDevice);
D3D11_UpdateHDRState(renderer);
done: done:
SAFE_RELEASE(d3dDevice); SAFE_RELEASE(d3dDevice);
SAFE_RELEASE(d3dContext); SAFE_RELEASE(d3dContext);
@@ -2177,29 +2199,25 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
rendererData->currentBlendState = blendState; rendererData->currentBlendState = blendState;
} }
if (shader_params != rendererData->currentShaderParams[shader]) { if (!rendererData->pixelShaderConstants[shader] ||
if (shader_params) { shader_params != rendererData->currentShaderParams[shader]) {
SAFE_RELEASE(rendererData->pixelShaderConstants[shader]); SAFE_RELEASE(rendererData->pixelShaderConstants[shader]);
PixelShaderConstants constants; PixelShaderConstants constants;
SDL_memcpy(constants.YCbCr_matrix, shader_params, sizeof(constants.YCbCr_matrix));
if (renderer->output_colorspace == SDL_COLORSPACE_SCRGB) { if (renderer->output_colorspace == SDL_COLORSPACE_SCRGB) {
constants.scRGB_output = 1.0f; constants.scRGB_output = 1.0f;
} else { } else {
constants.scRGB_output = 0.0f; constants.scRGB_output = 0.0f;
} }
/* Using some placeholder values here... */ constants.SDR_whitelevel = (float)rendererData->SDR_whitelevel;
const SDL_bool HDR = SDL_TRUE; constants.HDR_whitelevel = (float)rendererData->HDR_whitelevel;
if (renderer->output_colorspace == SDL_COLORSPACE_SCRGB && HDR) {
constants.SDR_whitelevel = 200.0f;
constants.HDR_whitelevel = 400.0f;
} else {
constants.SDR_whitelevel = 80.0f;
constants.HDR_whitelevel = 80.0f;
}
constants.maxCLL = 400.0f; constants.maxCLL = 400.0f;
if (shader_params) {
SDL_memcpy(constants.YCbCr_matrix, shader_params, sizeof(constants.YCbCr_matrix));
}
D3D11_BUFFER_DESC desc; D3D11_BUFFER_DESC desc;
SDL_zero(desc); SDL_zero(desc);
desc.Usage = D3D11_USAGE_DEFAULT; desc.Usage = D3D11_USAGE_DEFAULT;
@@ -2215,8 +2233,8 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device::CreateBuffer [create shader constants]"), result); WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device::CreateBuffer [create shader constants]"), result);
return -1; return -1;
} }
}
rendererData->currentShaderParams[shader] = shader_params; rendererData->currentShaderParams[shader] = shader_params;
rendererData->currentShader = SHADER_NONE;
} }
if (shader != rendererData->currentShader) { if (shader != rendererData->currentShader) {
if (!rendererData->pixelShaders[shader]) { if (!rendererData->pixelShaders[shader]) {
@@ -2371,7 +2389,13 @@ static int D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
SDL_bool convert_color = SDL_RenderingLinearSpace(renderer); SDL_bool convert_color = SDL_RenderingLinearSpace(renderer);
SDL_FColor color = cmd->data.color.color; SDL_FColor color = cmd->data.color.color;
if (convert_color) { if (convert_color) {
float light_scale = (float)rendererData->SDR_whitelevel / 80.0f;
SDL_ConvertToLinear(&color); SDL_ConvertToLinear(&color);
color.r *= light_scale;
color.g *= light_scale;
color.b *= light_scale;
} }
ID3D11DeviceContext_ClearRenderTargetView(rendererData->d3dContext, D3D11_GetCurrentRenderTargetView(renderer), &color.r); ID3D11DeviceContext_ClearRenderTargetView(rendererData->d3dContext, D3D11_GetCurrentRenderTargetView(renderer), &color.r);
break; break;