Added support for SDL_COLORSPACE_BT709_FULL to the hardware renderers

This commit is contained in:
Sam Lantinga
2024-02-04 00:13:11 -08:00
parent ec322bee1c
commit dab77fe29b
55 changed files with 8405 additions and 9470 deletions

View File

@@ -0,0 +1,134 @@
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float
// TEXCOORD 0 xy 1 NONE float
// COLOR 0 xyzw 2 NONE float xyzw
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET 0 xyzw 0 TARGET float xyzw
//
//
// Level9 shader bytecode:
//
ps_2_0
dcl t1
mov oC0, t1
// approximately 1 instruction slot used
ps_4_0
dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw
mov o0.xyzw, v2.xyzw
ret
// Approximately 2 instruction slots used
#endif
const BYTE g_main[] =
{
68, 88, 66, 67, 226, 124,
10, 63, 141, 181, 49, 167,
218, 135, 248, 147, 77, 222,
95, 123, 1, 0, 0, 0,
52, 2, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0,
132, 0, 0, 0, 196, 0,
0, 0, 64, 1, 0, 0,
140, 1, 0, 0, 0, 2,
0, 0, 65, 111, 110, 57,
68, 0, 0, 0, 68, 0,
0, 0, 0, 2, 255, 255,
32, 0, 0, 0, 36, 0,
0, 0, 0, 0, 36, 0,
0, 0, 36, 0, 0, 0,
36, 0, 0, 0, 36, 0,
0, 0, 36, 0, 0, 2,
255, 255, 31, 0, 0, 2,
0, 0, 0, 128, 1, 0,
15, 176, 1, 0, 0, 2,
0, 8, 15, 128, 1, 0,
228, 176, 255, 255, 0, 0,
83, 72, 68, 82, 56, 0,
0, 0, 64, 0, 0, 0,
14, 0, 0, 0, 98, 16,
0, 3, 242, 16, 16, 0,
2, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
0, 0, 0, 0, 54, 0,
0, 5, 242, 32, 16, 0,
0, 0, 0, 0, 70, 30,
16, 0, 2, 0, 0, 0,
62, 0, 0, 1, 83, 84,
65, 84, 116, 0, 0, 0,
2, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
2, 0, 0, 0, 0, 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, 0, 0, 0, 0,
0, 0, 0, 0, 0, 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, 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, 28, 0,
0, 0, 0, 4, 255, 255,
0, 1, 0, 0, 28, 0,
0, 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,
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, 0, 0,
15, 0, 0, 0, 92, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 1, 0, 0, 0,
3, 0, 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

@@ -0,0 +1,11 @@
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
float4 main(PixelShaderInput input) : SV_TARGET
{
return input.color;
}

View File

@@ -0,0 +1,347 @@
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
// Buffer Definitions:
//
// cbuffer Constants
// {
//
// float4 Yoffset; // Offset: 0 Size: 16
// float4 Rcoeff; // Offset: 16 Size: 16
// float4 Gcoeff; // Offset: 32 Size: 16
// float4 Bcoeff; // Offset: 48 Size: 16
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim HLSL Bind Count
// ------------------------------ ---------- ------- ----------- -------------- ------
// theSampler sampler NA NA s0 1
// theTextureY texture float4 2d t0 1
// theTextureUV texture float4 2d t1 1
// Constants cbuffer NA NA cb0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float
// TEXCOORD 0 xy 1 NONE float xy
// COLOR 0 xyzw 2 NONE float xyzw
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// 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 4 ( FLT, FLT, FLT, FLT)
//
//
// Sampler/Resource to DX9 shader sampler mappings:
//
// Target Sampler Source Sampler Source Resource
// -------------- --------------- ----------------
// s0 s0 t0
// s1 s0 t1
//
//
// Level9 shader bytecode:
//
ps_2_0
def c4, 1, 0, 0, 0
dcl t0.xy
dcl t1
dcl_2d s0
dcl_2d s1
texld r0, t0, s0
texld r1, t0, s1
mov r0.yz, r1.zxyw
add r0.xyz, r0, c0
dp3 r1.x, r0, c1
dp3 r1.y, r0, c2
dp3 r1.z, r0, c3
mov r1.w, c4.x
mul r0, r1, t1
mov oC0, r0
// approximately 10 instruction slots used (2 texture, 8 arithmetic)
ps_4_0
dcl_constantbuffer CB0[4], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw
dcl_temps 2
sample r0.xyzw, v1.xyxx, t0.xyzw, s0
sample r1.xyzw, v1.xyxx, t1.xyzw, s0
mov r0.yz, r1.xxyx
add r0.xyz, r0.xyzx, cb0[0].xyzx
dp3 r1.x, r0.xyzx, cb0[1].xyzx
dp3 r1.y, r0.xyzx, cb0[2].xyzx
dp3 r1.z, r0.xyzx, cb0[3].xyzx
mov r1.w, l(1.000000)
mul o0.xyzw, r1.xyzw, v2.xyzw
ret
// Approximately 10 instruction slots used
#endif
const BYTE g_main[] =
{
68, 88, 66, 67, 141, 213,
118, 74, 78, 95, 162, 4,
201, 30, 199, 78, 91, 203,
113, 9, 1, 0, 0, 0,
172, 5, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0,
92, 1, 0, 0, 228, 2,
0, 0, 96, 3, 0, 0,
4, 5, 0, 0, 120, 5,
0, 0, 65, 111, 110, 57,
28, 1, 0, 0, 28, 1,
0, 0, 0, 2, 255, 255,
228, 0, 0, 0, 56, 0,
0, 0, 1, 0, 44, 0,
0, 0, 56, 0, 0, 0,
56, 0, 2, 0, 36, 0,
0, 0, 56, 0, 0, 0,
0, 0, 1, 0, 1, 0,
0, 0, 0, 0, 4, 0,
0, 0, 0, 0, 0, 0,
0, 2, 255, 255, 81, 0,
0, 5, 4, 0, 15, 160,
0, 0, 128, 63, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 31, 0,
0, 2, 0, 0, 0, 128,
0, 0, 3, 176, 31, 0,
0, 2, 0, 0, 0, 128,
1, 0, 15, 176, 31, 0,
0, 2, 0, 0, 0, 144,
0, 8, 15, 160, 31, 0,
0, 2, 0, 0, 0, 144,
1, 8, 15, 160, 66, 0,
0, 3, 0, 0, 15, 128,
0, 0, 228, 176, 0, 8,
228, 160, 66, 0, 0, 3,
1, 0, 15, 128, 0, 0,
228, 176, 1, 8, 228, 160,
1, 0, 0, 2, 0, 0,
6, 128, 1, 0, 210, 128,
2, 0, 0, 3, 0, 0,
7, 128, 0, 0, 228, 128,
0, 0, 228, 160, 8, 0,
0, 3, 1, 0, 1, 128,
0, 0, 228, 128, 1, 0,
228, 160, 8, 0, 0, 3,
1, 0, 2, 128, 0, 0,
228, 128, 2, 0, 228, 160,
8, 0, 0, 3, 1, 0,
4, 128, 0, 0, 228, 128,
3, 0, 228, 160, 1, 0,
0, 2, 1, 0, 8, 128,
4, 0, 0, 160, 5, 0,
0, 3, 0, 0, 15, 128,
1, 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, 128, 1,
0, 0, 64, 0, 0, 0,
96, 0, 0, 0, 89, 0,
0, 4, 70, 142, 32, 0,
0, 0, 0, 0, 4, 0,
0, 0, 90, 0, 0, 3,
0, 96, 16, 0, 0, 0,
0, 0, 88, 24, 0, 4,
0, 112, 16, 0, 0, 0,
0, 0, 85, 85, 0, 0,
88, 24, 0, 4, 0, 112,
16, 0, 1, 0, 0, 0,
85, 85, 0, 0, 98, 16,
0, 3, 50, 16, 16, 0,
1, 0, 0, 0, 98, 16,
0, 3, 242, 16, 16, 0,
2, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
0, 0, 0, 0, 104, 0,
0, 2, 2, 0, 0, 0,
69, 0, 0, 9, 242, 0,
16, 0, 0, 0, 0, 0,
70, 16, 16, 0, 1, 0,
0, 0, 70, 126, 16, 0,
0, 0, 0, 0, 0, 96,
16, 0, 0, 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,
1, 0, 0, 0, 0, 96,
16, 0, 0, 0, 0, 0,
54, 0, 0, 5, 98, 0,
16, 0, 0, 0, 0, 0,
6, 1, 16, 0, 1, 0,
0, 0, 0, 0, 0, 8,
114, 0, 16, 0, 0, 0,
0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 70, 130,
32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 16, 0,
0, 8, 18, 0, 16, 0,
1, 0, 0, 0, 70, 2,
16, 0, 0, 0, 0, 0,
70, 130, 32, 0, 0, 0,
0, 0, 1, 0, 0, 0,
16, 0, 0, 8, 34, 0,
16, 0, 1, 0, 0, 0,
70, 2, 16, 0, 0, 0,
0, 0, 70, 130, 32, 0,
0, 0, 0, 0, 2, 0,
0, 0, 16, 0, 0, 8,
66, 0, 16, 0, 1, 0,
0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 70, 130,
32, 0, 0, 0, 0, 0,
3, 0, 0, 0, 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, 10, 0,
0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 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,
2, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 2, 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,
82, 68, 69, 70, 156, 1,
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, 113, 1, 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, 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,
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,
86, 0, 67, 111, 110, 115,
116, 97, 110, 116, 115, 0,
171, 171, 192, 0, 0, 0,
4, 0, 0, 0, 228, 0,
0, 0, 64, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 68, 1, 0, 0,
0, 0, 0, 0, 16, 0,
0, 0, 2, 0, 0, 0,
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, 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, 0, 0,
15, 0, 0, 0, 92, 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, 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

@@ -0,0 +1,36 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
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 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
yuv += Yoffset.xyz;
Output.r = dot(yuv, Rcoeff.xyz);
Output.g = dot(yuv, Gcoeff.xyz);
Output.b = dot(yuv, Bcoeff.xyz);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,350 @@
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
// Buffer Definitions:
//
// cbuffer Constants
// {
//
// float4 Yoffset; // Offset: 0 Size: 16
// float4 Rcoeff; // Offset: 16 Size: 16
// float4 Gcoeff; // Offset: 32 Size: 16
// float4 Bcoeff; // Offset: 48 Size: 16
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim HLSL Bind Count
// ------------------------------ ---------- ------- ----------- -------------- ------
// theSampler sampler NA NA s0 1
// theTextureY texture float4 2d t0 1
// theTextureUV texture float4 2d t1 1
// Constants cbuffer NA NA cb0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float
// TEXCOORD 0 xy 1 NONE float xy
// COLOR 0 xyzw 2 NONE float xyzw
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// 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 4 ( FLT, FLT, FLT, FLT)
//
//
// Sampler/Resource to DX9 shader sampler mappings:
//
// Target Sampler Source Sampler Source Resource
// -------------- --------------- ----------------
// s0 s0 t0
// s1 s0 t1
//
//
// Level9 shader bytecode:
//
ps_2_0
def c4, 1, 0, 0, 0
dcl t0.xy
dcl t1
dcl_2d s0
dcl_2d s1
texld r0, t0, s0
texld r1, t0, s1
mov r0.y, r1.y
mov r0.z, r1.x
add r0.xyz, r0, c0
dp3 r1.x, r0, c1
dp3 r1.y, r0, c2
dp3 r1.z, r0, c3
mov r1.w, c4.x
mul r0, r1, t1
mov oC0, r0
// approximately 11 instruction slots used (2 texture, 9 arithmetic)
ps_4_0
dcl_constantbuffer CB0[4], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw
dcl_temps 2
sample r0.xyzw, v1.xyxx, t0.xyzw, s0
sample r1.xyzw, v1.xyxx, t1.xyzw, s0
mov r0.yz, r1.yyxy
add r0.xyz, r0.xyzx, cb0[0].xyzx
dp3 r1.x, r0.xyzx, cb0[1].xyzx
dp3 r1.y, r0.xyzx, cb0[2].xyzx
dp3 r1.z, r0.xyzx, cb0[3].xyzx
mov r1.w, l(1.000000)
mul o0.xyzw, r1.xyzw, v2.xyzw
ret
// Approximately 10 instruction slots used
#endif
const BYTE g_main[] =
{
68, 88, 66, 67, 142, 144,
79, 192, 175, 21, 0, 8,
7, 119, 219, 202, 53, 69,
174, 234, 1, 0, 0, 0,
184, 5, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0,
104, 1, 0, 0, 240, 2,
0, 0, 108, 3, 0, 0,
16, 5, 0, 0, 132, 5,
0, 0, 65, 111, 110, 57,
40, 1, 0, 0, 40, 1,
0, 0, 0, 2, 255, 255,
240, 0, 0, 0, 56, 0,
0, 0, 1, 0, 44, 0,
0, 0, 56, 0, 0, 0,
56, 0, 2, 0, 36, 0,
0, 0, 56, 0, 0, 0,
0, 0, 1, 0, 1, 0,
0, 0, 0, 0, 4, 0,
0, 0, 0, 0, 0, 0,
0, 2, 255, 255, 81, 0,
0, 5, 4, 0, 15, 160,
0, 0, 128, 63, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 31, 0,
0, 2, 0, 0, 0, 128,
0, 0, 3, 176, 31, 0,
0, 2, 0, 0, 0, 128,
1, 0, 15, 176, 31, 0,
0, 2, 0, 0, 0, 144,
0, 8, 15, 160, 31, 0,
0, 2, 0, 0, 0, 144,
1, 8, 15, 160, 66, 0,
0, 3, 0, 0, 15, 128,
0, 0, 228, 176, 0, 8,
228, 160, 66, 0, 0, 3,
1, 0, 15, 128, 0, 0,
228, 176, 1, 8, 228, 160,
1, 0, 0, 2, 0, 0,
2, 128, 1, 0, 85, 128,
1, 0, 0, 2, 0, 0,
4, 128, 1, 0, 0, 128,
2, 0, 0, 3, 0, 0,
7, 128, 0, 0, 228, 128,
0, 0, 228, 160, 8, 0,
0, 3, 1, 0, 1, 128,
0, 0, 228, 128, 1, 0,
228, 160, 8, 0, 0, 3,
1, 0, 2, 128, 0, 0,
228, 128, 2, 0, 228, 160,
8, 0, 0, 3, 1, 0,
4, 128, 0, 0, 228, 128,
3, 0, 228, 160, 1, 0,
0, 2, 1, 0, 8, 128,
4, 0, 0, 160, 5, 0,
0, 3, 0, 0, 15, 128,
1, 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, 128, 1,
0, 0, 64, 0, 0, 0,
96, 0, 0, 0, 89, 0,
0, 4, 70, 142, 32, 0,
0, 0, 0, 0, 4, 0,
0, 0, 90, 0, 0, 3,
0, 96, 16, 0, 0, 0,
0, 0, 88, 24, 0, 4,
0, 112, 16, 0, 0, 0,
0, 0, 85, 85, 0, 0,
88, 24, 0, 4, 0, 112,
16, 0, 1, 0, 0, 0,
85, 85, 0, 0, 98, 16,
0, 3, 50, 16, 16, 0,
1, 0, 0, 0, 98, 16,
0, 3, 242, 16, 16, 0,
2, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
0, 0, 0, 0, 104, 0,
0, 2, 2, 0, 0, 0,
69, 0, 0, 9, 242, 0,
16, 0, 0, 0, 0, 0,
70, 16, 16, 0, 1, 0,
0, 0, 70, 126, 16, 0,
0, 0, 0, 0, 0, 96,
16, 0, 0, 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,
1, 0, 0, 0, 0, 96,
16, 0, 0, 0, 0, 0,
54, 0, 0, 5, 98, 0,
16, 0, 0, 0, 0, 0,
86, 4, 16, 0, 1, 0,
0, 0, 0, 0, 0, 8,
114, 0, 16, 0, 0, 0,
0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 70, 130,
32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 16, 0,
0, 8, 18, 0, 16, 0,
1, 0, 0, 0, 70, 2,
16, 0, 0, 0, 0, 0,
70, 130, 32, 0, 0, 0,
0, 0, 1, 0, 0, 0,
16, 0, 0, 8, 34, 0,
16, 0, 1, 0, 0, 0,
70, 2, 16, 0, 0, 0,
0, 0, 70, 130, 32, 0,
0, 0, 0, 0, 2, 0,
0, 0, 16, 0, 0, 8,
66, 0, 16, 0, 1, 0,
0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 70, 130,
32, 0, 0, 0, 0, 0,
3, 0, 0, 0, 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, 10, 0,
0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 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,
2, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 2, 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,
82, 68, 69, 70, 156, 1,
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, 113, 1, 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, 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,
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,
86, 0, 67, 111, 110, 115,
116, 97, 110, 116, 115, 0,
171, 171, 192, 0, 0, 0,
4, 0, 0, 0, 228, 0,
0, 0, 64, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 68, 1, 0, 0,
0, 0, 0, 0, 16, 0,
0, 0, 2, 0, 0, 0,
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, 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, 0, 0,
15, 0, 0, 0, 92, 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, 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

@@ -0,0 +1,36 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
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 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
yuv += Yoffset.xyz;
Output.r = dot(yuv, Rcoeff.xyz);
Output.g = dot(yuv, Gcoeff.xyz);
Output.b = dot(yuv, Bcoeff.xyz);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,198 @@
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
// Resource Bindings:
//
// Name Type Format Dim HLSL Bind Count
// ------------------------------ ---------- ------- ----------- -------------- ------
// theSampler sampler NA NA s0 1
// theTexture texture float4 2d t0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float
// TEXCOORD 0 xy 1 NONE float xy
// COLOR 0 xyzw 2 NONE float xyzw
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET 0 xyzw 0 TARGET float xyzw
//
//
// Sampler/Resource to DX9 shader sampler mappings:
//
// Target Sampler Source Sampler Source Resource
// -------------- --------------- ----------------
// s0 s0 t0
//
//
// Level9 shader bytecode:
//
ps_2_0
dcl t0.xy
dcl t1
dcl_2d s0
texld r0, t0, s0
mul r0, r0, t1
mov oC0, r0
// approximately 3 instruction slots used (1 texture, 2 arithmetic)
ps_4_0
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw
dcl_temps 1
sample r0.xyzw, v1.xyxx, t0.xyzw, s0
mul o0.xyzw, r0.xyzw, v2.xyzw
ret
// Approximately 3 instruction slots used
#endif
const BYTE g_main[] =
{
68, 88, 66, 67, 192, 209,
41, 173, 243, 223, 145, 48,
186, 133, 149, 213, 4, 163,
174, 97, 1, 0, 0, 0,
36, 3, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0,
192, 0, 0, 0, 92, 1,
0, 0, 216, 1, 0, 0,
124, 2, 0, 0, 240, 2,
0, 0, 65, 111, 110, 57,
128, 0, 0, 0, 128, 0,
0, 0, 0, 2, 255, 255,
88, 0, 0, 0, 40, 0,
0, 0, 0, 0, 40, 0,
0, 0, 40, 0, 0, 0,
40, 0, 1, 0, 36, 0,
0, 0, 40, 0, 0, 0,
0, 0, 0, 2, 255, 255,
31, 0, 0, 2, 0, 0,
0, 128, 0, 0, 3, 176,
31, 0, 0, 2, 0, 0,
0, 128, 1, 0, 15, 176,
31, 0, 0, 2, 0, 0,
0, 144, 0, 8, 15, 160,
66, 0, 0, 3, 0, 0,
15, 128, 0, 0, 228, 176,
0, 8, 228, 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, 148, 0,
0, 0, 64, 0, 0, 0,
37, 0, 0, 0, 90, 0,
0, 3, 0, 96, 16, 0,
0, 0, 0, 0, 88, 24,
0, 4, 0, 112, 16, 0,
0, 0, 0, 0, 85, 85,
0, 0, 98, 16, 0, 3,
50, 16, 16, 0, 1, 0,
0, 0, 98, 16, 0, 3,
242, 16, 16, 0, 2, 0,
0, 0, 101, 0, 0, 3,
242, 32, 16, 0, 0, 0,
0, 0, 104, 0, 0, 2,
1, 0, 0, 0, 69, 0,
0, 9, 242, 0, 16, 0,
0, 0, 0, 0, 70, 16,
16, 0, 1, 0, 0, 0,
70, 126, 16, 0, 0, 0,
0, 0, 0, 96, 16, 0,
0, 0, 0, 0, 56, 0,
0, 7, 242, 32, 16, 0,
0, 0, 0, 0, 70, 14,
16, 0, 0, 0, 0, 0,
70, 30, 16, 0, 2, 0,
0, 0, 62, 0, 0, 1,
83, 84, 65, 84, 116, 0,
0, 0, 3, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
1, 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, 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,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 82, 68,
69, 70, 156, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 2, 0, 0, 0,
28, 0, 0, 0, 0, 4,
255, 255, 0, 1, 0, 0,
114, 0, 0, 0, 92, 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,
103, 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, 116, 104, 101, 83,
97, 109, 112, 108, 101, 114,
0, 116, 104, 101, 84, 101,
120, 116, 117, 114, 101, 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,
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, 0, 0,
15, 0, 0, 0, 92, 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, 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

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

View File

@@ -0,0 +1,382 @@
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
// Buffer Definitions:
//
// cbuffer Constants
// {
//
// float4 Yoffset; // Offset: 0 Size: 16
// float4 Rcoeff; // Offset: 16 Size: 16
// float4 Gcoeff; // Offset: 32 Size: 16
// float4 Bcoeff; // Offset: 48 Size: 16
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim HLSL Bind Count
// ------------------------------ ---------- ------- ----------- -------------- ------
// theSampler sampler NA NA s0 1
// theTextureY texture float4 2d t0 1
// theTextureU texture float4 2d t1 1
// theTextureV texture float4 2d t2 1
// Constants cbuffer NA NA cb0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float
// TEXCOORD 0 xy 1 NONE float xy
// COLOR 0 xyzw 2 NONE float xyzw
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// 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 4 ( FLT, FLT, FLT, FLT)
//
//
// Sampler/Resource to DX9 shader sampler mappings:
//
// Target Sampler Source Sampler Source Resource
// -------------- --------------- ----------------
// s0 s0 t0
// s1 s0 t1
// s2 s0 t2
//
//
// Level9 shader bytecode:
//
ps_2_0
def c4, 1, 0, 0, 0
dcl t0.xy
dcl t1
dcl_2d s0
dcl_2d s1
dcl_2d s2
texld r0, t0, s0
texld r1, t0, s1
texld r2, t0, s2
mov r0.y, r1.x
mov r0.z, r2.x
add r0.xyz, r0, c0
dp3 r1.x, r0, c1
dp3 r1.y, r0, c2
dp3 r1.z, r0, c3
mov r1.w, c4.x
mul r0, r1, t1
mov oC0, r0
// approximately 12 instruction slots used (3 texture, 9 arithmetic)
ps_4_0
dcl_constantbuffer CB0[4], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyzw
dcl_output o0.xyzw
dcl_temps 2
sample r0.xyzw, v1.xyxx, t0.xyzw, s0
sample r1.xyzw, v1.xyxx, t1.xyzw, s0
mov r0.y, r1.x
sample r1.xyzw, v1.xyxx, t2.xyzw, s0
mov r0.z, r1.x
add r0.xyz, r0.xyzx, cb0[0].xyzx
dp3 r1.x, r0.xyzx, cb0[1].xyzx
dp3 r1.y, r0.xyzx, cb0[2].xyzx
dp3 r1.z, r0.xyzx, cb0[3].xyzx
mov r1.w, l(1.000000)
mul o0.xyzw, r1.xyzw, v2.xyzw
ret
// Approximately 12 instruction slots used
#endif
const BYTE g_main[] =
{
68, 88, 66, 67, 17, 27,
202, 87, 93, 193, 186, 139,
251, 175, 168, 151, 229, 182,
100, 211, 1, 0, 0, 0,
76, 6, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0,
136, 1, 0, 0, 88, 3,
0, 0, 212, 3, 0, 0,
164, 5, 0, 0, 24, 6,
0, 0, 65, 111, 110, 57,
72, 1, 0, 0, 72, 1,
0, 0, 0, 2, 255, 255,
12, 1, 0, 0, 60, 0,
0, 0, 1, 0, 48, 0,
0, 0, 60, 0, 0, 0,
60, 0, 3, 0, 36, 0,
0, 0, 60, 0, 0, 0,
0, 0, 1, 0, 1, 0,
2, 0, 2, 0, 0, 0,
0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 0, 2,
255, 255, 81, 0, 0, 5,
4, 0, 15, 160, 0, 0,
128, 63, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 31, 0, 0, 2,
0, 0, 0, 128, 0, 0,
3, 176, 31, 0, 0, 2,
0, 0, 0, 128, 1, 0,
15, 176, 31, 0, 0, 2,
0, 0, 0, 144, 0, 8,
15, 160, 31, 0, 0, 2,
0, 0, 0, 144, 1, 8,
15, 160, 31, 0, 0, 2,
0, 0, 0, 144, 2, 8,
15, 160, 66, 0, 0, 3,
0, 0, 15, 128, 0, 0,
228, 176, 0, 8, 228, 160,
66, 0, 0, 3, 1, 0,
15, 128, 0, 0, 228, 176,
1, 8, 228, 160, 66, 0,
0, 3, 2, 0, 15, 128,
0, 0, 228, 176, 2, 8,
228, 160, 1, 0, 0, 2,
0, 0, 2, 128, 1, 0,
0, 128, 1, 0, 0, 2,
0, 0, 4, 128, 2, 0,
0, 128, 2, 0, 0, 3,
0, 0, 7, 128, 0, 0,
228, 128, 0, 0, 228, 160,
8, 0, 0, 3, 1, 0,
1, 128, 0, 0, 228, 128,
1, 0, 228, 160, 8, 0,
0, 3, 1, 0, 2, 128,
0, 0, 228, 128, 2, 0,
228, 160, 8, 0, 0, 3,
1, 0, 4, 128, 0, 0,
228, 128, 3, 0, 228, 160,
1, 0, 0, 2, 1, 0,
8, 128, 4, 0, 0, 160,
5, 0, 0, 3, 0, 0,
15, 128, 1, 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,
200, 1, 0, 0, 64, 0,
0, 0, 114, 0, 0, 0,
89, 0, 0, 4, 70, 142,
32, 0, 0, 0, 0, 0,
4, 0, 0, 0, 90, 0,
0, 3, 0, 96, 16, 0,
0, 0, 0, 0, 88, 24,
0, 4, 0, 112, 16, 0,
0, 0, 0, 0, 85, 85,
0, 0, 88, 24, 0, 4,
0, 112, 16, 0, 1, 0,
0, 0, 85, 85, 0, 0,
88, 24, 0, 4, 0, 112,
16, 0, 2, 0, 0, 0,
85, 85, 0, 0, 98, 16,
0, 3, 50, 16, 16, 0,
1, 0, 0, 0, 98, 16,
0, 3, 242, 16, 16, 0,
2, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
0, 0, 0, 0, 104, 0,
0, 2, 2, 0, 0, 0,
69, 0, 0, 9, 242, 0,
16, 0, 0, 0, 0, 0,
70, 16, 16, 0, 1, 0,
0, 0, 70, 126, 16, 0,
0, 0, 0, 0, 0, 96,
16, 0, 0, 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,
1, 0, 0, 0, 0, 96,
16, 0, 0, 0, 0, 0,
54, 0, 0, 5, 34, 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,
0, 96, 16, 0, 0, 0,
0, 0, 54, 0, 0, 5,
66, 0, 16, 0, 0, 0,
0, 0, 10, 0, 16, 0,
1, 0, 0, 0, 0, 0,
0, 8, 114, 0, 16, 0,
0, 0, 0, 0, 70, 2,
16, 0, 0, 0, 0, 0,
70, 130, 32, 0, 0, 0,
0, 0, 0, 0, 0, 0,
16, 0, 0, 8, 18, 0,
16, 0, 1, 0, 0, 0,
70, 2, 16, 0, 0, 0,
0, 0, 70, 130, 32, 0,
0, 0, 0, 0, 1, 0,
0, 0, 16, 0, 0, 8,
34, 0, 16, 0, 1, 0,
0, 0, 70, 2, 16, 0,
0, 0, 0, 0, 70, 130,
32, 0, 0, 0, 0, 0,
2, 0, 0, 0, 16, 0,
0, 8, 66, 0, 16, 0,
1, 0, 0, 0, 70, 2,
16, 0, 0, 0, 0, 0,
70, 130, 32, 0, 0, 0,
0, 0, 3, 0, 0, 0,
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,
12, 0, 0, 0, 2, 0,
0, 0, 0, 0, 0, 0,
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, 3, 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, 82, 68, 69, 70,
200, 1, 0, 0, 1, 0,
0, 0, 248, 0, 0, 0,
5, 0, 0, 0, 28, 0,
0, 0, 0, 4, 255, 255,
0, 1, 0, 0, 157, 1,
0, 0, 188, 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, 199, 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,
211, 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, 223, 0, 0, 0,
2, 0, 0, 0, 5, 0,
0, 0, 4, 0, 0, 0,
255, 255, 255, 255, 2, 0,
0, 0, 1, 0, 0, 0,
13, 0, 0, 0, 235, 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,
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, 0, 0, 15, 0,
0, 0, 92, 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, 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

@@ -0,0 +1,38 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureU : register(t1);
Texture2D theTextureV : register(t2);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
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 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
yuv += Yoffset.xyz;
Output.r = dot(yuv, Rcoeff.xyz);
Output.g = dot(yuv, Gcoeff.xyz);
Output.b = dot(yuv, Bcoeff.xyz);
Output.a = 1.0f;
return Output * input.color;
}

View File

@@ -0,0 +1,339 @@
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
// Buffer Definitions:
//
// cbuffer VertexShaderConstants
// {
//
// row_major float4x4 model; // Offset: 0 Size: 64
// row_major float4x4 projectionAndView;// Offset: 64 Size: 64
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim HLSL Bind Count
// ------------------------------ ---------- ------- ----------- -------------- ------
// VertexShaderConstants cbuffer NA NA cb0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION 0 xyz 0 NONE float xyz
// TEXCOORD 0 xy 1 NONE float xy
// COLOR 0 xyzw 2 NONE float xyzw
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float xyzw
// TEXCOORD 0 xy 1 NONE float xy
// COLOR 0 xyzw 2 NONE float xyzw
//
//
// Constant buffer to DX9 shader constant mappings:
//
// Target Reg Buffer Start Reg # of Regs Data Conversion
// ---------- ------- --------- --------- ----------------------
// c1 cb0 0 8 ( FLT, FLT, FLT, FLT)
//
//
// Runtime generated constant mappings:
//
// Target Reg Constant Description
// ---------- --------------------------------------------------
// c0 Vertex Shader position offset
//
//
// Level9 shader bytecode:
//
vs_2_0
dcl_texcoord v0
dcl_texcoord1 v1
dcl_texcoord2 v2
mul r0, v0.y, c2
mad r0, v0.x, c1, r0
mad r0, v0.z, c3, r0
add r0, r0, c4
mul r1, r0.y, c6
mad r1, r0.x, c5, r1
mad r1, r0.z, c7, r1
mad r0, r0.w, c8, r1
mad oPos.xy, r0.w, c0, r0
mov oPos.zw, r0
mov oT0.xy, v1
mov oT1, v2
// approximately 12 instruction slots used
vs_4_0
dcl_constantbuffer CB0[8], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xy
dcl_input v2.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o2.xyzw
dcl_temps 2
mul r0.xyzw, v0.yyyy, cb0[1].xyzw
mad r0.xyzw, v0.xxxx, cb0[0].xyzw, r0.xyzw
mad r0.xyzw, v0.zzzz, cb0[2].xyzw, r0.xyzw
add r0.xyzw, r0.xyzw, cb0[3].xyzw
mul r1.xyzw, r0.yyyy, cb0[5].xyzw
mad r1.xyzw, r0.xxxx, cb0[4].xyzw, r1.xyzw
mad r1.xyzw, r0.zzzz, cb0[6].xyzw, r1.xyzw
mad o0.xyzw, r0.wwww, cb0[7].xyzw, r1.xyzw
mov o1.xy, v1.xyxx
mov o2.xyzw, v2.xyzw
ret
// Approximately 11 instruction slots used
#endif
const BYTE g_main[] =
{
68, 88, 66, 67, 152, 172,
81, 45, 198, 200, 12, 38,
143, 4, 178, 228, 158, 175,
169, 64, 1, 0, 0, 0,
140, 5, 0, 0, 6, 0,
0, 0, 56, 0, 0, 0,
108, 1, 0, 0, 52, 3,
0, 0, 176, 3, 0, 0,
168, 4, 0, 0, 24, 5,
0, 0, 65, 111, 110, 57,
44, 1, 0, 0, 44, 1,
0, 0, 0, 2, 254, 255,
248, 0, 0, 0, 52, 0,
0, 0, 1, 0, 36, 0,
0, 0, 48, 0, 0, 0,
48, 0, 0, 0, 36, 0,
1, 0, 48, 0, 0, 0,
0, 0, 8, 0, 1, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 2, 254, 255,
31, 0, 0, 2, 5, 0,
0, 128, 0, 0, 15, 144,
31, 0, 0, 2, 5, 0,
1, 128, 1, 0, 15, 144,
31, 0, 0, 2, 5, 0,
2, 128, 2, 0, 15, 144,
5, 0, 0, 3, 0, 0,
15, 128, 0, 0, 85, 144,
2, 0, 228, 160, 4, 0,
0, 4, 0, 0, 15, 128,
0, 0, 0, 144, 1, 0,
228, 160, 0, 0, 228, 128,
4, 0, 0, 4, 0, 0,
15, 128, 0, 0, 170, 144,
3, 0, 228, 160, 0, 0,
228, 128, 2, 0, 0, 3,
0, 0, 15, 128, 0, 0,
228, 128, 4, 0, 228, 160,
5, 0, 0, 3, 1, 0,
15, 128, 0, 0, 85, 128,
6, 0, 228, 160, 4, 0,
0, 4, 1, 0, 15, 128,
0, 0, 0, 128, 5, 0,
228, 160, 1, 0, 228, 128,
4, 0, 0, 4, 1, 0,
15, 128, 0, 0, 170, 128,
7, 0, 228, 160, 1, 0,
228, 128, 4, 0, 0, 4,
0, 0, 15, 128, 0, 0,
255, 128, 8, 0, 228, 160,
1, 0, 228, 128, 4, 0,
0, 4, 0, 0, 3, 192,
0, 0, 255, 128, 0, 0,
228, 160, 0, 0, 228, 128,
1, 0, 0, 2, 0, 0,
12, 192, 0, 0, 228, 128,
1, 0, 0, 2, 0, 0,
3, 224, 1, 0, 228, 144,
1, 0, 0, 2, 1, 0,
15, 224, 2, 0, 228, 144,
255, 255, 0, 0, 83, 72,
68, 82, 192, 1, 0, 0,
64, 0, 1, 0, 112, 0,
0, 0, 89, 0, 0, 4,
70, 142, 32, 0, 0, 0,
0, 0, 8, 0, 0, 0,
95, 0, 0, 3, 114, 16,
16, 0, 0, 0, 0, 0,
95, 0, 0, 3, 50, 16,
16, 0, 1, 0, 0, 0,
95, 0, 0, 3, 242, 16,
16, 0, 2, 0, 0, 0,
103, 0, 0, 4, 242, 32,
16, 0, 0, 0, 0, 0,
1, 0, 0, 0, 101, 0,
0, 3, 50, 32, 16, 0,
1, 0, 0, 0, 101, 0,
0, 3, 242, 32, 16, 0,
2, 0, 0, 0, 104, 0,
0, 2, 2, 0, 0, 0,
56, 0, 0, 8, 242, 0,
16, 0, 0, 0, 0, 0,
86, 21, 16, 0, 0, 0,
0, 0, 70, 142, 32, 0,
0, 0, 0, 0, 1, 0,
0, 0, 50, 0, 0, 10,
242, 0, 16, 0, 0, 0,
0, 0, 6, 16, 16, 0,
0, 0, 0, 0, 70, 142,
32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 70, 14,
16, 0, 0, 0, 0, 0,
50, 0, 0, 10, 242, 0,
16, 0, 0, 0, 0, 0,
166, 26, 16, 0, 0, 0,
0, 0, 70, 142, 32, 0,
0, 0, 0, 0, 2, 0,
0, 0, 70, 14, 16, 0,
0, 0, 0, 0, 0, 0,
0, 8, 242, 0, 16, 0,
0, 0, 0, 0, 70, 14,
16, 0, 0, 0, 0, 0,
70, 142, 32, 0, 0, 0,
0, 0, 3, 0, 0, 0,
56, 0, 0, 8, 242, 0,
16, 0, 1, 0, 0, 0,
86, 5, 16, 0, 0, 0,
0, 0, 70, 142, 32, 0,
0, 0, 0, 0, 5, 0,
0, 0, 50, 0, 0, 10,
242, 0, 16, 0, 1, 0,
0, 0, 6, 0, 16, 0,
0, 0, 0, 0, 70, 142,
32, 0, 0, 0, 0, 0,
4, 0, 0, 0, 70, 14,
16, 0, 1, 0, 0, 0,
50, 0, 0, 10, 242, 0,
16, 0, 1, 0, 0, 0,
166, 10, 16, 0, 0, 0,
0, 0, 70, 142, 32, 0,
0, 0, 0, 0, 6, 0,
0, 0, 70, 14, 16, 0,
1, 0, 0, 0, 50, 0,
0, 10, 242, 32, 16, 0,
0, 0, 0, 0, 246, 15,
16, 0, 0, 0, 0, 0,
70, 142, 32, 0, 0, 0,
0, 0, 7, 0, 0, 0,
70, 14, 16, 0, 1, 0,
0, 0, 54, 0, 0, 5,
50, 32, 16, 0, 1, 0,
0, 0, 70, 16, 16, 0,
1, 0, 0, 0, 54, 0,
0, 5, 242, 32, 16, 0,
2, 0, 0, 0, 70, 30,
16, 0, 2, 0, 0, 0,
62, 0, 0, 1, 83, 84,
65, 84, 116, 0, 0, 0,
11, 0, 0, 0, 2, 0,
0, 0, 0, 0, 0, 0,
6, 0, 0, 0, 8, 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, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 2, 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, 82, 68, 69, 70,
240, 0, 0, 0, 1, 0,
0, 0, 84, 0, 0, 0,
1, 0, 0, 0, 28, 0,
0, 0, 0, 4, 254, 255,
0, 1, 0, 0, 198, 0,
0, 0, 60, 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, 86, 101,
114, 116, 101, 120, 83, 104,
97, 100, 101, 114, 67, 111,
110, 115, 116, 97, 110, 116,
115, 0, 171, 171, 60, 0,
0, 0, 2, 0, 0, 0,
108, 0, 0, 0, 128, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 156, 0,
0, 0, 0, 0, 0, 0,
64, 0, 0, 0, 2, 0,
0, 0, 164, 0, 0, 0,
0, 0, 0, 0, 180, 0,
0, 0, 64, 0, 0, 0,
64, 0, 0, 0, 2, 0,
0, 0, 164, 0, 0, 0,
0, 0, 0, 0, 109, 111,
100, 101, 108, 0, 171, 171,
2, 0, 3, 0, 4, 0,
4, 0, 0, 0, 0, 0,
0, 0, 0, 0, 112, 114,
111, 106, 101, 99, 116, 105,
111, 110, 65, 110, 100, 86,
105, 101, 119, 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, 73, 83,
71, 78, 104, 0, 0, 0,
3, 0, 0, 0, 8, 0,
0, 0, 80, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 7, 7,
0, 0, 89, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
1, 0, 0, 0, 3, 3,
0, 0, 98, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 3, 0, 0, 0,
2, 0, 0, 0, 15, 15,
0, 0, 80, 79, 83, 73,
84, 73, 79, 78, 0, 84,
69, 88, 67, 79, 79, 82,
68, 0, 67, 79, 76, 79,
82, 0, 79, 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,
0, 0, 15, 0, 0, 0,
92, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 1, 0,
0, 0, 3, 12, 0, 0,
101, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 2, 0,
0, 0, 15, 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
};

View File

@@ -0,0 +1,38 @@
#pragma pack_matrix( row_major )
cbuffer VertexShaderConstants : register(b0)
{
matrix model;
matrix projectionAndView;
};
struct VertexShaderInput
{
float3 pos : POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
struct VertexShaderOutput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
VertexShaderOutput main(VertexShaderInput input)
{
VertexShaderOutput output;
float4 pos = float4(input.pos, 1.0f);
// Transform the vertex position into projected space.
pos = mul(pos, model);
pos = mul(pos, projectionAndView);
output.pos = pos;
// Pass through texture coordinates and color values without transformation
output.tex = input.tex;
output.color = input.color;
return output;
}

View File

@@ -85,6 +85,7 @@ typedef struct
/* Per-texture data */
typedef struct
{
int w, h;
ID3D11Texture2D *mainTexture;
ID3D11ShaderResourceView *mainTextureResourceView;
ID3D11RenderTargetView *mainTextureRenderTargetView;
@@ -92,6 +93,8 @@ typedef struct
int lockedTexturePositionX;
int lockedTexturePositionY;
D3D11_FILTER scaleMode;
D3D11_Shader shader;
const float *shader_params;
#if SDL_HAVE_YUV
/* YV12 texture support */
SDL_bool yuv;
@@ -135,6 +138,7 @@ typedef struct
size_t vertexBufferSizes[8];
ID3D11VertexShader *vertexShader;
ID3D11PixelShader *pixelShaders[NUM_SHADERS];
ID3D11Buffer *pixelShaderConstants[NUM_SHADERS];
int blendModesCount;
D3D11_BlendMode *blendModes;
ID3D11SamplerState *nearestPixelSampler;
@@ -155,7 +159,8 @@ typedef struct
ID3D11RenderTargetView *currentRenderTargetView;
ID3D11RasterizerState *currentRasterizerState;
ID3D11BlendState *currentBlendState;
ID3D11PixelShader *currentShader;
D3D11_Shader currentShader;
const float *currentShaderParams[NUM_SHADERS];
ID3D11ShaderResourceView *currentShaderResource;
ID3D11SamplerState *currentSampler;
SDL_bool cliprectDirty;
@@ -299,6 +304,9 @@ static void D3D11_ReleaseAll(SDL_Renderer *renderer)
for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) {
SAFE_RELEASE(data->pixelShaders[i]);
}
for (i = 0; i < SDL_arraysize(data->pixelShaderConstants); ++i) {
SAFE_RELEASE(data->pixelShaderConstants[i]);
}
SAFE_RELEASE(data->vertexShader);
for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) {
SAFE_RELEASE(data->vertexBuffers[i]);
@@ -322,7 +330,8 @@ static void D3D11_ReleaseAll(SDL_Renderer *renderer)
data->currentRenderTargetView = NULL;
data->currentRasterizerState = NULL;
data->currentBlendState = NULL;
data->currentShader = NULL;
data->currentShader = SHADER_NONE;
SDL_zero(data->currentShaderParams);
data->currentShaderResource = NULL;
data->currentSampler = NULL;
@@ -452,7 +461,6 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
IDXGIDevice1 *dxgiDevice = NULL;
HRESULT result = S_OK;
UINT creationFlags;
int i;
/* This array defines the set of DirectX hardware feature levels this app will support.
* Note the ordering should be preserved.
@@ -609,12 +617,6 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
goto done;
}
for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) {
if (D3D11_CreatePixelShader(data->d3dDevice, (D3D11_Shader)i, &data->pixelShaders[i]) < 0) {
goto done;
}
}
/* Setup space to hold vertex shader constants: */
SDL_zero(constantBufferDesc);
constantBufferDesc.ByteWidth = sizeof(VertexShaderConstants);
@@ -1181,6 +1183,16 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
textureDesc.SampleDesc.Quality = 0;
textureDesc.MiscFlags = 0;
/* NV12 textures must have even width and height */
if (texture->format == SDL_PIXELFORMAT_NV12 ||
texture->format == SDL_PIXELFORMAT_NV21) {
textureDesc.Width = (textureDesc.Width + 1) & ~1;
textureDesc.Height = (textureDesc.Height + 1) & ~1;
}
textureData->w = (int)textureDesc.Width;
textureData->h = (int)textureDesc.Height;
textureData->shader = SHADER_RGB;
if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
textureDesc.Usage = D3D11_USAGE_DYNAMIC;
textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
@@ -1204,7 +1216,6 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
NULL,
&textureData->mainTexture);
if (FAILED(result)) {
D3D11_DestroyTexture(renderer, texture);
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
}
}
@@ -1226,7 +1237,6 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
NULL,
&textureData->mainTextureU);
if (FAILED(result)) {
D3D11_DestroyTexture(renderer, texture);
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
}
}
@@ -1241,15 +1251,26 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
NULL,
&textureData->mainTextureV);
if (FAILED(result)) {
D3D11_DestroyTexture(renderer, texture);
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
}
}
SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER, textureData->mainTextureV);
textureData->shader = SHADER_YUV;
textureData->shader_params = SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace);
if (!textureData->shader_params) {
return SDL_SetError("Unsupported YUV colorspace");
}
}
if (texture->format == SDL_PIXELFORMAT_NV12 ||
texture->format == SDL_PIXELFORMAT_NV21) {
textureData->nv12 = SDL_TRUE;
textureData->shader = (texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12 : SHADER_NV21);
textureData->shader_params = SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace);
if (!textureData->shader_params) {
return SDL_SetError("Unsupported YUV colorspace");
}
}
#endif /* SDL_HAVE_YUV */
SDL_zero(resourceViewDesc);
@@ -1262,7 +1283,6 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
&resourceViewDesc,
&textureData->mainTextureResourceView);
if (FAILED(result)) {
D3D11_DestroyTexture(renderer, texture);
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
}
#if SDL_HAVE_YUV
@@ -1272,7 +1292,6 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
&resourceViewDesc,
&textureData->mainTextureResourceViewU);
if (FAILED(result)) {
D3D11_DestroyTexture(renderer, texture);
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
}
result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
@@ -1280,7 +1299,6 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
&resourceViewDesc,
&textureData->mainTextureResourceViewV);
if (FAILED(result)) {
D3D11_DestroyTexture(renderer, texture);
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
}
}
@@ -1295,7 +1313,6 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
&nvResourceViewDesc,
&textureData->mainTextureResourceViewNV);
if (FAILED(result)) {
D3D11_DestroyTexture(renderer, texture);
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
}
}
@@ -1313,7 +1330,6 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
&renderTargetViewDesc,
&textureData->mainTextureRenderTargetView);
if (FAILED(result)) {
D3D11_DestroyTexture(renderer, texture);
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result);
}
}
@@ -1365,6 +1381,10 @@ static int D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Tex
stagingTextureDesc.MiscFlags = 0;
stagingTextureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
stagingTextureDesc.Usage = D3D11_USAGE_STAGING;
if (stagingTextureDesc.Format == DXGI_FORMAT_NV12) {
stagingTextureDesc.Width = (stagingTextureDesc.Width + 1) & ~1;
stagingTextureDesc.Height = (stagingTextureDesc.Height + 1) & ~1;
}
result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
&stagingTextureDesc,
NULL,
@@ -1385,13 +1405,8 @@ static int D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Tex
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11DeviceContext1::Map [map staging texture]"), result);
}
if (stagingTextureDesc.Format == DXGI_FORMAT_NV12) {
/* Copy the UV plane as well */
h += (h + 1) / 2;
}
src = (const Uint8 *)pixels;
dst = textureMemory.pData;
dst = (Uint8 *)textureMemory.pData;
length = w * bpp;
if (length == (UINT)pitch && length == textureMemory.RowPitch) {
SDL_memcpy(dst, src, (size_t)length * h);
@@ -1409,6 +1424,19 @@ static int D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Tex
}
}
if (stagingTextureDesc.Format == DXGI_FORMAT_NV12) {
/* Copy the UV plane as well */
h = (h + 1) / 2;
length = (length + 1) & ~1;
pitch = (pitch + 1) & ~1;
dst = (Uint8 *)textureMemory.pData + stagingTextureDesc.Height * textureMemory.RowPitch;
for (row = 0; row < h; ++row) {
SDL_memcpy(dst, src, length);
src += pitch;
dst += textureMemory.RowPitch;
}
}
/* Commit the pixel buffer's changes back to the staging texture: */
ID3D11DeviceContext_Unmap(rendererData->d3dContext,
(ID3D11Resource *)stagingTexture,
@@ -1797,6 +1825,9 @@ static int D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
int count = indices ? num_indices : num_vertices;
VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first);
SDL_bool convert_color = SDL_RenderingLinearSpace(renderer);
D3D11_TextureData *textureData = texture ? (D3D11_TextureData *)texture->driverdata : NULL;
float u_scale = textureData ? (float)texture->w / textureData->w : 0.0f;
float v_scale = textureData ? (float)texture->h / textureData->h : 0.0f;
if (!verts) {
return -1;
@@ -1829,8 +1860,8 @@ static int D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
if (texture) {
float *uv_ = (float *)((char *)uv + j * uv_stride);
verts->tex.x = uv_[0];
verts->tex.y = uv_[1];
verts->tex.x = uv_[0] * u_scale;
verts->tex.y = uv_[1] * v_scale;
} else {
verts->tex.x = 0.0f;
verts->tex.y = 0.0f;
@@ -2012,7 +2043,8 @@ static ID3D11RenderTargetView *D3D11_GetCurrentRenderTargetView(SDL_Renderer *re
}
}
static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, ID3D11PixelShader *shader,
static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd,
D3D11_Shader shader, const float *shader_params,
const int numShaderResources, ID3D11ShaderResourceView **shaderResources,
ID3D11SamplerState *sampler, const Float4X4 *matrix)
@@ -2098,8 +2130,40 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
rendererData->currentBlendState = blendState;
}
if (shader_params != rendererData->currentShaderParams[shader]) {
if (shader_params) {
const UINT shader_params_length = 4 * 4 * sizeof(float); /* The YUV shader takes 4 float4 parameters */
SAFE_RELEASE(rendererData->pixelShaderConstants[shader]);
D3D11_BUFFER_DESC desc;
SDL_zero(desc);
desc.Usage = D3D11_USAGE_DEFAULT;
desc.ByteWidth = shader_params_length;
desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
D3D11_SUBRESOURCE_DATA data;
SDL_zero(data);
data.pSysMem = shader_params;
HRESULT result = ID3D11Device_CreateBuffer(rendererData->d3dDevice, &desc, &data, &rendererData->pixelShaderConstants[shader]);
if (FAILED(result)) {
WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device::CreateBuffer [create shader constants]"), result);
return -1;
}
}
rendererData->currentShaderParams[shader] = shader_params;
}
if (shader != rendererData->currentShader) {
ID3D11DeviceContext_PSSetShader(rendererData->d3dContext, shader, NULL, 0);
if (!rendererData->pixelShaders[shader]) {
if (D3D11_CreatePixelShader(rendererData->d3dDevice, shader, &rendererData->pixelShaders[shader]) < 0) {
return -1;
}
}
ID3D11DeviceContext_PSSetShader(rendererData->d3dContext, rendererData->pixelShaders[shader], NULL, 0);
if (rendererData->pixelShaderConstants[shader]) {
ID3D11DeviceContext_PSSetConstantBuffers(rendererData->d3dContext, 0, 1, &rendererData->pixelShaderConstants[shader]);
}
rendererData->currentShader = shader;
}
if (shaderResource != rendererData->currentShaderResource) {
@@ -2149,25 +2213,8 @@ static int D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
textureData->mainTextureResourceViewU,
textureData->mainTextureResourceViewV
};
D3D11_Shader shader;
if (SDL_ISCOLORSPACE_YUV_BT601(texture->colorspace)) {
if (SDL_ISCOLORSPACE_LIMITED_RANGE(texture->colorspace)) {
shader = SHADER_YUV_BT601;
} else {
shader = SHADER_YUV_JPEG;
}
} else if (SDL_ISCOLORSPACE_YUV_BT709(texture->colorspace)) {
if (SDL_ISCOLORSPACE_LIMITED_RANGE(texture->colorspace)) {
shader = SHADER_YUV_BT709;
} else {
return SDL_SetError("Unsupported YUV conversion mode");
}
} else {
return SDL_SetError("Unsupported YUV conversion mode");
}
return D3D11_SetDrawState(renderer, cmd, rendererData->pixelShaders[shader],
return D3D11_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params,
SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
} else if (textureData->nv12) {
@@ -2175,29 +2222,12 @@ static int D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
textureData->mainTextureResourceView,
textureData->mainTextureResourceViewNV,
};
D3D11_Shader shader;
if (SDL_ISCOLORSPACE_YUV_BT601(texture->colorspace)) {
if (SDL_ISCOLORSPACE_LIMITED_RANGE(texture->colorspace)) {
shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT601 : SHADER_NV21_BT601;
} else {
shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_JPEG : SHADER_NV21_JPEG;
}
} else if (SDL_ISCOLORSPACE_YUV_BT709(texture->colorspace)) {
if (SDL_ISCOLORSPACE_LIMITED_RANGE(texture->colorspace)) {
shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT709 : SHADER_NV21_BT709;
} else {
return SDL_SetError("Unsupported YUV conversion mode");
}
} else {
return SDL_SetError("Unsupported YUV conversion mode");
}
return D3D11_SetDrawState(renderer, cmd, rendererData->pixelShaders[shader],
return D3D11_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params,
SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
}
#endif /* SDL_HAVE_YUV */
return D3D11_SetDrawState(renderer, cmd, rendererData->pixelShaders[SHADER_RGB],
return D3D11_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params,
1, &textureData->mainTextureResourceView, textureSampler, matrix);
}
@@ -2214,7 +2244,8 @@ static void D3D11_InvalidateCachedState(SDL_Renderer *renderer)
data->currentRenderTargetView = NULL;
data->currentRasterizerState = NULL;
data->currentBlendState = NULL;
data->currentShader = NULL;
data->currentShader = NUM_SHADERS;
SDL_zero(data->currentShaderParams);
data->currentShaderResource = NULL;
data->currentSampler = NULL;
data->cliprectDirty = SDL_TRUE;
@@ -2287,7 +2318,7 @@ static int D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
const size_t count = cmd->data.draw.count;
const size_t first = cmd->data.draw.first;
const size_t start = first / sizeof(VertexPositionColor);
D3D11_SetDrawState(renderer, cmd, rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL, NULL);
D3D11_SetDrawState(renderer, cmd, SHADER_SOLID, NULL, 0, NULL, NULL, NULL);
D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, start, count);
break;
}
@@ -2298,7 +2329,7 @@ static int D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
const size_t first = cmd->data.draw.first;
const size_t start = first / sizeof(VertexPositionColor);
const VertexPositionColor *verts = (VertexPositionColor *)(((Uint8 *)vertices) + first);
D3D11_SetDrawState(renderer, cmd, rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL, NULL);
D3D11_SetDrawState(renderer, cmd, SHADER_SOLID, NULL, 0, NULL, NULL, NULL);
D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP, start, count);
if (verts[0].pos.x != verts[count - 1].pos.x || verts[0].pos.y != verts[count - 1].pos.y) {
D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, start + (count - 1), 1);
@@ -2325,7 +2356,7 @@ static int D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
if (texture) {
D3D11_SetCopyState(renderer, cmd, NULL);
} else {
D3D11_SetDrawState(renderer, cmd, rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL, NULL);
D3D11_SetDrawState(renderer, cmd, SHADER_SOLID, NULL, 0, NULL, NULL, NULL);
}
D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, start, count);

File diff suppressed because it is too large Load Diff

View File

@@ -24,18 +24,13 @@
typedef enum
{
SHADER_NONE,
SHADER_SOLID,
SHADER_RGB,
#if SDL_HAVE_YUV
SHADER_YUV_JPEG,
SHADER_YUV_BT601,
SHADER_YUV_BT709,
SHADER_NV12_JPEG,
SHADER_NV12_BT601,
SHADER_NV12_BT709,
SHADER_NV21_JPEG,
SHADER_NV21_BT601,
SHADER_NV21_BT709,
SHADER_YUV,
SHADER_NV12,
SHADER_NV21,
#endif
NUM_SHADERS
} D3D11_Shader;

View File

@@ -0,0 +1,6 @@
fxc /T ps_4_0_level_9_1 /Fh D3D11_PixelShader_Colors.h D3D11_PixelShader_Colors.hlsl
fxc /T ps_4_0_level_9_1 /Fh D3D11_PixelShader_Textures.h D3D11_PixelShader_Textures.hlsl
fxc /T ps_4_0_level_9_1 /Fh D3D11_PixelShader_YUV.h D3D11_PixelShader_YUV.hlsl
fxc /T ps_4_0_level_9_1 /Fh D3D11_PixelShader_NV12.h D3D11_PixelShader_NV12.hlsl
fxc /T ps_4_0_level_9_1 /Fh D3D11_PixelShader_NV21.h D3D11_PixelShader_NV21.hlsl
fxc /T vs_4_0_level_9_1 /Fh D3D11_VertexShader.h D3D11_VertexShader.hlsl