1 | /* |
2 | Simple DirectMedia Layer |
3 | Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org> |
4 | |
5 | This software is provided 'as-is', without any express or implied |
6 | warranty. In no event will the authors be held liable for any damages |
7 | arising from the use of this software. |
8 | |
9 | Permission is granted to anyone to use this software for any purpose, |
10 | including commercial applications, and to alter it and redistribute it |
11 | freely, subject to the following restrictions: |
12 | |
13 | 1. The origin of this software must not be misrepresented; you must not |
14 | claim that you wrote the original software. If you use this software |
15 | in a product, an acknowledgment in the product documentation would be |
16 | appreciated but is not required. |
17 | 2. Altered source versions must be plainly marked as such, and must not be |
18 | misrepresented as being the original software. |
19 | 3. This notice may not be removed or altered from any source distribution. |
20 | */ |
21 | #include "../../SDL_internal.h" |
22 | |
23 | #if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED |
24 | |
25 | #include "SDL_stdinc.h" |
26 | |
27 | #define COBJMACROS |
28 | #include "../../core/windows/SDL_windows.h" |
29 | #include <d3d11_1.h> |
30 | |
31 | #include "SDL_shaders_d3d11.h" |
32 | |
33 | #define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str |
34 | |
35 | |
36 | /* Direct3D 11.x shaders |
37 | |
38 | SDL's shaders are compiled into SDL itself, to simplify distribution. |
39 | |
40 | All Direct3D 11.x shaders were compiled with the following: |
41 | |
42 | fxc /E"main" /T "<TYPE>" /Fo"<OUTPUT FILE>" "<INPUT FILE>" |
43 | |
44 | Variables: |
45 | - <TYPE>: the type of shader. A table of utilized shader types is |
46 | listed below. |
47 | - <OUTPUT FILE>: where to store compiled output |
48 | - <INPUT FILE>: where to read shader source code from |
49 | |
50 | Shader types: |
51 | - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT |
52 | - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT |
53 | - ps_4_0_level_9_3: Pixel shader for Windows Phone 8 |
54 | - vs_4_0_level_9_3: Vertex shader for Windows Phone 8 |
55 | |
56 | |
57 | Shader object code was converted to a list of DWORDs via the following |
58 | *nix style command (available separately from Windows + MSVC): |
59 | |
60 | hexdump -v -e '6/4 "0x%08.8x, " "\n"' <FILE> |
61 | */ |
62 | #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP |
63 | #define D3D11_USE_SHADER_MODEL_4_0_level_9_3 |
64 | #else |
65 | #define D3D11_USE_SHADER_MODEL_4_0_level_9_1 |
66 | #endif |
67 | |
68 | /* The color-only-rendering pixel shader: |
69 | |
70 | --- D3D11_PixelShader_Colors.hlsl --- |
71 | struct PixelShaderInput |
72 | { |
73 | float4 pos : SV_POSITION; |
74 | float2 tex : TEXCOORD0; |
75 | float4 color : COLOR0; |
76 | }; |
77 | |
78 | float4 main(PixelShaderInput input) : SV_TARGET |
79 | { |
80 | return input.color; |
81 | } |
82 | */ |
83 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
84 | static const DWORD D3D11_PixelShader_Colors[] = { |
85 | 0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001, |
86 | 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, |
87 | 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, |
88 | 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, |
89 | 0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, |
90 | 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, |
91 | 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, |
92 | 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, |
93 | 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, |
94 | 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, |
95 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
96 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, |
97 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
98 | 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, |
99 | 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, |
100 | 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, |
101 | 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, |
102 | 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, |
103 | 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, |
104 | 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, |
105 | 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, |
106 | 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, |
107 | 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, |
108 | 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
109 | }; |
110 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
111 | static const DWORD D3D11_PixelShader_Colors[] = { |
112 | 0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001, |
113 | 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, |
114 | 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, |
115 | 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, |
116 | 0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, |
117 | 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, |
118 | 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, |
119 | 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, |
120 | 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, |
121 | 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, |
122 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
123 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, |
124 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
125 | 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, |
126 | 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, |
127 | 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, |
128 | 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, |
129 | 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, |
130 | 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, |
131 | 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, |
132 | 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, |
133 | 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, |
134 | 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, |
135 | 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
136 | }; |
137 | #else |
138 | #error "An appropriate 'colors' pixel shader is not defined." |
139 | #endif |
140 | |
141 | /* The texture-rendering pixel shader: |
142 | |
143 | --- D3D11_PixelShader_Textures.hlsl --- |
144 | Texture2D theTexture : register(t0); |
145 | SamplerState theSampler : register(s0); |
146 | |
147 | struct PixelShaderInput |
148 | { |
149 | float4 pos : SV_POSITION; |
150 | float2 tex : TEXCOORD0; |
151 | float4 color : COLOR0; |
152 | }; |
153 | |
154 | float4 main(PixelShaderInput input) : SV_TARGET |
155 | { |
156 | return theTexture.Sample(theSampler, input.tex) * input.color; |
157 | } |
158 | */ |
159 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
160 | static const DWORD D3D11_PixelShader_Textures[] = { |
161 | 0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001, |
162 | 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, |
163 | 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, |
164 | 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, |
165 | 0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000, |
166 | 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, |
167 | 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, |
168 | 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, |
169 | 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, |
170 | 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, |
171 | 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, |
172 | 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, |
173 | 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, |
174 | 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, |
175 | 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, |
176 | 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, |
177 | 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
178 | 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
179 | 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
180 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, |
181 | 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, |
182 | 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, |
183 | 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, |
184 | 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, |
185 | 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, |
186 | 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, |
187 | 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, |
188 | 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, |
189 | 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, |
190 | 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, |
191 | 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, |
192 | 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, |
193 | 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, |
194 | 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
195 | }; |
196 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
197 | static const DWORD D3D11_PixelShader_Textures[] = { |
198 | 0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001, |
199 | 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, |
200 | 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, |
201 | 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, |
202 | 0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000, |
203 | 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, |
204 | 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, |
205 | 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, |
206 | 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, |
207 | 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, |
208 | 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, |
209 | 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, |
210 | 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, |
211 | 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, |
212 | 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, |
213 | 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, |
214 | 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
215 | 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
216 | 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
217 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, |
218 | 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, |
219 | 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, |
220 | 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, |
221 | 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, |
222 | 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, |
223 | 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, |
224 | 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, |
225 | 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, |
226 | 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, |
227 | 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, |
228 | 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, |
229 | 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, |
230 | 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, |
231 | 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
232 | }; |
233 | #else |
234 | #error "An appropriate 'textures' pixel shader is not defined" |
235 | #endif |
236 | |
237 | /* The yuv-rendering pixel shader: |
238 | |
239 | --- D3D11_PixelShader_YUV_JPEG.hlsl --- |
240 | Texture2D theTextureY : register(t0); |
241 | Texture2D theTextureU : register(t1); |
242 | Texture2D theTextureV : register(t2); |
243 | SamplerState theSampler : register(s0); |
244 | |
245 | struct PixelShaderInput |
246 | { |
247 | float4 pos : SV_POSITION; |
248 | float2 tex : TEXCOORD0; |
249 | float4 color : COLOR0; |
250 | }; |
251 | |
252 | float4 main(PixelShaderInput input) : SV_TARGET |
253 | { |
254 | const float3 offset = {0.0, -0.501960814, -0.501960814}; |
255 | const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; |
256 | const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; |
257 | const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; |
258 | |
259 | float4 Output; |
260 | |
261 | float3 yuv; |
262 | yuv.x = theTextureY.Sample(theSampler, input.tex).r; |
263 | yuv.y = theTextureU.Sample(theSampler, input.tex).r; |
264 | yuv.z = theTextureV.Sample(theSampler, input.tex).r; |
265 | |
266 | yuv += offset; |
267 | Output.r = dot(yuv, Rcoeff); |
268 | Output.g = dot(yuv, Gcoeff); |
269 | Output.b = dot(yuv, Bcoeff); |
270 | Output.a = 1.0f; |
271 | |
272 | return Output * input.color; |
273 | } |
274 | |
275 | */ |
276 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
277 | static const DWORD D3D11_PixelShader_YUV_JPEG[] = { |
278 | 0x43425844, 0x10359e9c, 0x92c3d2c4, 0x00bf0cd5, 0x5ce8c499, 0x00000001, |
279 | 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, |
280 | 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, |
281 | 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, |
282 | 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, |
283 | 0xa00f0000, 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, |
284 | 0xa00f0001, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, |
285 | 0xa00f0002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, |
286 | 0xa00f0003, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, |
287 | 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, |
288 | 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, |
289 | 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, |
290 | 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, |
291 | 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, |
292 | 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, |
293 | 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, |
294 | 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, |
295 | 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, |
296 | 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, |
297 | 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, |
298 | 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, |
299 | 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, |
300 | 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, |
301 | 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, |
302 | 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, |
303 | 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, |
304 | 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, |
305 | 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, |
306 | 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, |
307 | 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, |
308 | 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, |
309 | 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, |
310 | 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, |
311 | 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc, |
312 | 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, |
313 | 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, |
314 | 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, |
315 | 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036, 0x00100082, |
316 | 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, |
317 | 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, |
318 | 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, |
319 | 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, |
320 | 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, |
321 | 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, |
322 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
323 | 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, |
324 | 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, |
325 | 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, |
326 | 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, |
327 | 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, |
328 | 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, |
329 | 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, |
330 | 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, |
331 | 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, |
332 | 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, |
333 | 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, |
334 | 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, |
335 | 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, |
336 | 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, |
337 | 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, |
338 | 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, |
339 | 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, |
340 | 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
341 | }; |
342 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
343 | static const DWORD D3D11_PixelShader_YUV_JPEG[] = { |
344 | 0x43425844, 0x616d6673, 0x83174178, 0x15aac25d, 0x2a340487, 0x00000001, |
345 | 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, |
346 | 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, |
347 | 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, |
348 | 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, |
349 | 0xa00f0000, 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, |
350 | 0xa00f0001, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, |
351 | 0xa00f0002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, |
352 | 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, |
353 | 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, |
354 | 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, |
355 | 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, |
356 | 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, |
357 | 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, |
358 | 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, 0x03000008, |
359 | 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, 0x80e40000, |
360 | 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, |
361 | 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, |
362 | 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, |
363 | 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, |
364 | 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, |
365 | 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, |
366 | 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, |
367 | 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, |
368 | 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, |
369 | 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, |
370 | 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, |
371 | 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, |
372 | 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, |
373 | 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, |
374 | 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, |
375 | 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, |
376 | 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, |
377 | 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, |
378 | 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, |
379 | 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, |
380 | 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, |
381 | 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, |
382 | 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, |
383 | 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, |
384 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, |
385 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, |
386 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
387 | 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, |
388 | 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, |
389 | 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, |
390 | 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, |
391 | 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, |
392 | 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, |
393 | 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, |
394 | 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, |
395 | 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, |
396 | 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, |
397 | 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, |
398 | 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, |
399 | 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, |
400 | 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, |
401 | 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, |
402 | 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, |
403 | 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, |
404 | 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, |
405 | 0x45475241, 0xabab0054 |
406 | }; |
407 | #else |
408 | #error "An appropriate 'yuv' pixel shader is not defined." |
409 | #endif |
410 | |
411 | /* The yuv-rendering pixel shader: |
412 | |
413 | --- D3D11_PixelShader_YUV_BT601.hlsl --- |
414 | Texture2D theTextureY : register(t0); |
415 | Texture2D theTextureU : register(t1); |
416 | Texture2D theTextureV : register(t2); |
417 | SamplerState theSampler : register(s0); |
418 | |
419 | struct PixelShaderInput |
420 | { |
421 | float4 pos : SV_POSITION; |
422 | float2 tex : TEXCOORD0; |
423 | float4 color : COLOR0; |
424 | }; |
425 | |
426 | float4 main(PixelShaderInput input) : SV_TARGET |
427 | { |
428 | const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; |
429 | const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; |
430 | const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; |
431 | const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; |
432 | |
433 | float4 Output; |
434 | |
435 | float3 yuv; |
436 | yuv.x = theTextureY.Sample(theSampler, input.tex).r; |
437 | yuv.y = theTextureU.Sample(theSampler, input.tex).r; |
438 | yuv.z = theTextureV.Sample(theSampler, input.tex).r; |
439 | |
440 | yuv += offset; |
441 | Output.r = dot(yuv, Rcoeff); |
442 | Output.g = dot(yuv, Gcoeff); |
443 | Output.b = dot(yuv, Bcoeff); |
444 | Output.a = 1.0f; |
445 | |
446 | return Output * input.color; |
447 | } |
448 | |
449 | */ |
450 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
451 | static const DWORD D3D11_PixelShader_YUV_BT601[] = { |
452 | 0x43425844, 0x628ec838, 0xbe9cec6a, 0xc9ee10bb, 0x63283218, 0x00000001, |
453 | 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, |
454 | 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, |
455 | 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, |
456 | 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, |
457 | 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, |
458 | 0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, |
459 | 0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, |
460 | 0xa00f0003, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, |
461 | 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, |
462 | 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, |
463 | 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, |
464 | 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, |
465 | 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, |
466 | 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, |
467 | 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, |
468 | 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, |
469 | 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, |
470 | 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, |
471 | 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, |
472 | 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, |
473 | 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, |
474 | 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, |
475 | 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, |
476 | 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, |
477 | 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, |
478 | 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, |
479 | 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, |
480 | 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, |
481 | 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, |
482 | 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, |
483 | 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, |
484 | 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, |
485 | 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba, |
486 | 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, |
487 | 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, |
488 | 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, |
489 | 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036, 0x00100082, |
490 | 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, |
491 | 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, |
492 | 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, |
493 | 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, |
494 | 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, |
495 | 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, |
496 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
497 | 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, |
498 | 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, |
499 | 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, |
500 | 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, |
501 | 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, |
502 | 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, |
503 | 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, |
504 | 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, |
505 | 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, |
506 | 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, |
507 | 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, |
508 | 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, |
509 | 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, |
510 | 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, |
511 | 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, |
512 | 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, |
513 | 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, |
514 | 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
515 | }; |
516 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
517 | static const DWORD D3D11_PixelShader_YUV_BT601[] = { |
518 | 0x43425844, 0x692b159b, 0xf58723cc, 0xf4ceac9e, 0x35eec738, 0x00000001, |
519 | 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, |
520 | 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, |
521 | 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, |
522 | 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, |
523 | 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, |
524 | 0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, |
525 | 0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, |
526 | 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, |
527 | 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, |
528 | 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, |
529 | 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, |
530 | 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, |
531 | 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, |
532 | 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008, |
533 | 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, |
534 | 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, |
535 | 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, |
536 | 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, |
537 | 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, |
538 | 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, |
539 | 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, |
540 | 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, |
541 | 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, |
542 | 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, |
543 | 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, |
544 | 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, |
545 | 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, |
546 | 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, |
547 | 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, |
548 | 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, |
549 | 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, |
550 | 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, |
551 | 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, |
552 | 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, |
553 | 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, |
554 | 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, |
555 | 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, |
556 | 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, |
557 | 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, |
558 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, |
559 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, |
560 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
561 | 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, |
562 | 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, |
563 | 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, |
564 | 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, |
565 | 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, |
566 | 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, |
567 | 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, |
568 | 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, |
569 | 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, |
570 | 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, |
571 | 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, |
572 | 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, |
573 | 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, |
574 | 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, |
575 | 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, |
576 | 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, |
577 | 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, |
578 | 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, |
579 | 0x45475241, 0xabab0054 |
580 | }; |
581 | #else |
582 | #error "An appropriate 'yuv' pixel shader is not defined." |
583 | #endif |
584 | |
585 | /* The yuv-rendering pixel shader: |
586 | |
587 | --- D3D11_PixelShader_YUV_BT709.hlsl --- |
588 | Texture2D theTextureY : register(t0); |
589 | Texture2D theTextureU : register(t1); |
590 | Texture2D theTextureV : register(t2); |
591 | SamplerState theSampler : register(s0); |
592 | |
593 | struct PixelShaderInput |
594 | { |
595 | float4 pos : SV_POSITION; |
596 | float2 tex : TEXCOORD0; |
597 | float4 color : COLOR0; |
598 | }; |
599 | |
600 | float4 main(PixelShaderInput input) : SV_TARGET |
601 | { |
602 | const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; |
603 | const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; |
604 | const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; |
605 | const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; |
606 | |
607 | float4 Output; |
608 | |
609 | float3 yuv; |
610 | yuv.x = theTextureY.Sample(theSampler, input.tex).r; |
611 | yuv.y = theTextureU.Sample(theSampler, input.tex).r; |
612 | yuv.z = theTextureV.Sample(theSampler, input.tex).r; |
613 | |
614 | yuv += offset; |
615 | Output.r = dot(yuv, Rcoeff); |
616 | Output.g = dot(yuv, Gcoeff); |
617 | Output.b = dot(yuv, Bcoeff); |
618 | Output.a = 1.0f; |
619 | |
620 | return Output * input.color; |
621 | } |
622 | |
623 | */ |
624 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
625 | static const DWORD D3D11_PixelShader_YUV_BT709[] = { |
626 | 0x43425844, 0x5045fa84, 0xc2908cce, 0x278dacc3, 0xd4276f8f, 0x00000001, |
627 | 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, |
628 | 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, |
629 | 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, |
630 | 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, |
631 | 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, |
632 | 0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, |
633 | 0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, |
634 | 0xa00f0003, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, |
635 | 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, |
636 | 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, |
637 | 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, |
638 | 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, |
639 | 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, |
640 | 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, |
641 | 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, |
642 | 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, |
643 | 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, |
644 | 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, |
645 | 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, |
646 | 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, |
647 | 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, |
648 | 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, |
649 | 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, |
650 | 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, |
651 | 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, |
652 | 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, |
653 | 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, |
654 | 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, |
655 | 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, |
656 | 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, |
657 | 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, |
658 | 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, |
659 | 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fe57732, |
660 | 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, |
661 | 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, |
662 | 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, |
663 | 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036, 0x00100082, |
664 | 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, |
665 | 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, |
666 | 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, |
667 | 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, |
668 | 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, |
669 | 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, |
670 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
671 | 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, |
672 | 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, |
673 | 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, |
674 | 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, |
675 | 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, |
676 | 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, |
677 | 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, |
678 | 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, |
679 | 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, |
680 | 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, |
681 | 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, |
682 | 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, |
683 | 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, |
684 | 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, |
685 | 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, |
686 | 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, |
687 | 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, |
688 | 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
689 | }; |
690 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
691 | static const DWORD D3D11_PixelShader_YUV_BT709[] = { |
692 | 0x43425844, 0x72d13260, 0xf6c36f65, 0x8b9b28f5, 0x5010733c, 0x00000001, |
693 | 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, |
694 | 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, |
695 | 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, |
696 | 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, |
697 | 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, |
698 | 0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, |
699 | 0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, |
700 | 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, |
701 | 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, |
702 | 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, |
703 | 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, |
704 | 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, |
705 | 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, |
706 | 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008, |
707 | 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, |
708 | 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, |
709 | 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, |
710 | 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, |
711 | 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, |
712 | 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, |
713 | 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, |
714 | 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, |
715 | 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, |
716 | 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, |
717 | 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, |
718 | 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, |
719 | 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, |
720 | 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, |
721 | 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, |
722 | 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, |
723 | 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, |
724 | 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, |
725 | 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, |
726 | 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, |
727 | 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, |
728 | 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, |
729 | 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, |
730 | 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, |
731 | 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, |
732 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, |
733 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, |
734 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
735 | 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, |
736 | 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, |
737 | 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, |
738 | 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, |
739 | 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, |
740 | 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, |
741 | 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, |
742 | 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, |
743 | 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, |
744 | 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, |
745 | 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, |
746 | 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, |
747 | 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, |
748 | 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, |
749 | 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, |
750 | 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, |
751 | 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, |
752 | 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, |
753 | 0x45475241, 0xabab0054 |
754 | }; |
755 | #else |
756 | #error "An appropriate 'yuv' pixel shader is not defined." |
757 | #endif |
758 | |
759 | /* The yuv-rendering pixel shader: |
760 | |
761 | --- D3D11_PixelShader_NV12_JPEG.hlsl --- |
762 | Texture2D theTextureY : register(t0); |
763 | Texture2D theTextureUV : register(t1); |
764 | SamplerState theSampler : register(s0); |
765 | |
766 | struct PixelShaderInput |
767 | { |
768 | float4 pos : SV_POSITION; |
769 | float2 tex : TEXCOORD0; |
770 | float4 color : COLOR0; |
771 | }; |
772 | |
773 | float4 main(PixelShaderInput input) : SV_TARGET |
774 | { |
775 | const float3 offset = {0.0, -0.501960814, -0.501960814}; |
776 | const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; |
777 | const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; |
778 | const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; |
779 | |
780 | float4 Output; |
781 | |
782 | float3 yuv; |
783 | yuv.x = theTextureY.Sample(theSampler, input.tex).r; |
784 | yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; |
785 | |
786 | yuv += offset; |
787 | Output.r = dot(yuv, Rcoeff); |
788 | Output.g = dot(yuv, Gcoeff); |
789 | Output.b = dot(yuv, Bcoeff); |
790 | Output.a = 1.0f; |
791 | |
792 | return Output * input.color; |
793 | } |
794 | |
795 | */ |
796 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
797 | static const DWORD D3D11_PixelShader_NV12_JPEG[] = { |
798 | 0x43425844, 0x8fb9c77a, 0xe9e39686, 0x62b0e0e9, 0xd2bf8183, 0x00000001, |
799 | 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, |
800 | 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, |
801 | 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
802 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, |
803 | 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, |
804 | 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, |
805 | 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003, |
806 | 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, |
807 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
808 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
809 | 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, |
810 | 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, |
811 | 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, |
812 | 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, |
813 | 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, |
814 | 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, |
815 | 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, |
816 | 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, |
817 | 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, |
818 | 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, |
819 | 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, |
820 | 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, |
821 | 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, |
822 | 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, |
823 | 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, |
824 | 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, |
825 | 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, |
826 | 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000, |
827 | 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, |
828 | 0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, |
829 | 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, |
830 | 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036, |
831 | 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, |
832 | 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, |
833 | 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, |
834 | 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, |
835 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, |
836 | 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, |
837 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
838 | 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, |
839 | 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, |
840 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, |
841 | 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, |
842 | 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, |
843 | 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, |
844 | 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, |
845 | 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, |
846 | 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, |
847 | 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, |
848 | 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, |
849 | 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, |
850 | 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, |
851 | 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, |
852 | 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, |
853 | 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, |
854 | 0x45475241, 0xabab0054 |
855 | }; |
856 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
857 | static const DWORD D3D11_PixelShader_NV12_JPEG[] = { |
858 | 0x43425844, 0xe33e5d8b, 0x1b5f6461, 0x1afee99f, 0xcc345c04, 0x00000001, |
859 | 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, |
860 | 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, |
861 | 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
862 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, |
863 | 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001, |
864 | 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002, |
865 | 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, |
866 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
867 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
868 | 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, |
869 | 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, |
870 | 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, |
871 | 0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, |
872 | 0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, |
873 | 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, |
874 | 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, |
875 | 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, |
876 | 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, |
877 | 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, |
878 | 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, |
879 | 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, |
880 | 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, |
881 | 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, |
882 | 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, |
883 | 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, |
884 | 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, |
885 | 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, |
886 | 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, |
887 | 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, |
888 | 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, |
889 | 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, |
890 | 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, |
891 | 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, |
892 | 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, |
893 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
894 | 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, |
895 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
896 | 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, |
897 | 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, |
898 | 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
899 | 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, |
900 | 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, |
901 | 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, |
902 | 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, |
903 | 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, |
904 | 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, |
905 | 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, |
906 | 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, |
907 | 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, |
908 | 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, |
909 | 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, |
910 | 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, |
911 | 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, |
912 | 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
913 | }; |
914 | #else |
915 | #error "An appropriate 'yuv' pixel shader is not defined." |
916 | #endif |
917 | |
918 | /* The yuv-rendering pixel shader: |
919 | |
920 | --- D3D11_PixelShader_NV12_BT601.hlsl --- |
921 | Texture2D theTextureY : register(t0); |
922 | Texture2D theTextureUV : register(t1); |
923 | SamplerState theSampler : register(s0); |
924 | |
925 | struct PixelShaderInput |
926 | { |
927 | float4 pos : SV_POSITION; |
928 | float2 tex : TEXCOORD0; |
929 | float4 color : COLOR0; |
930 | }; |
931 | |
932 | float4 main(PixelShaderInput input) : SV_TARGET |
933 | { |
934 | const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; |
935 | const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; |
936 | const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; |
937 | const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; |
938 | |
939 | float4 Output; |
940 | |
941 | float3 yuv; |
942 | yuv.x = theTextureY.Sample(theSampler, input.tex).r; |
943 | yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; |
944 | |
945 | yuv += offset; |
946 | Output.r = dot(yuv, Rcoeff); |
947 | Output.g = dot(yuv, Gcoeff); |
948 | Output.b = dot(yuv, Bcoeff); |
949 | Output.a = 1.0f; |
950 | |
951 | return Output * input.color; |
952 | } |
953 | |
954 | */ |
955 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
956 | static const DWORD D3D11_PixelShader_NV12_BT601[] = { |
957 | 0x43425844, 0xd1d24a0c, 0x337c447a, 0x22b55cff, 0xb5c9c74b, 0x00000001, |
958 | 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, |
959 | 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, |
960 | 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
961 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, |
962 | 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, |
963 | 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, |
964 | 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003, |
965 | 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, |
966 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
967 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
968 | 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, |
969 | 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, |
970 | 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, |
971 | 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, |
972 | 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, |
973 | 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, |
974 | 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, |
975 | 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, |
976 | 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, |
977 | 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, |
978 | 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, |
979 | 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, |
980 | 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, |
981 | 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, |
982 | 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, |
983 | 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, |
984 | 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, |
985 | 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, |
986 | 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, |
987 | 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, |
988 | 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, |
989 | 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036, |
990 | 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, |
991 | 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, |
992 | 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, |
993 | 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, |
994 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, |
995 | 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, |
996 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
997 | 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, |
998 | 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, |
999 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, |
1000 | 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, |
1001 | 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, |
1002 | 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, |
1003 | 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, |
1004 | 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, |
1005 | 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, |
1006 | 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, |
1007 | 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, |
1008 | 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, |
1009 | 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, |
1010 | 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, |
1011 | 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, |
1012 | 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, |
1013 | 0x45475241, 0xabab0054 |
1014 | }; |
1015 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
1016 | static const DWORD D3D11_PixelShader_NV12_BT601[] = { |
1017 | 0x43425844, 0x84b8b692, 0x589b9edd, 0x51ef2f0b, 0xf7247962, 0x00000001, |
1018 | 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, |
1019 | 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, |
1020 | 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
1021 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, |
1022 | 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, |
1023 | 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, 0xa00f0002, |
1024 | 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, 0x80000000, |
1025 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
1026 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
1027 | 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, |
1028 | 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, |
1029 | 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, |
1030 | 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, |
1031 | 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, |
1032 | 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, |
1033 | 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, |
1034 | 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, |
1035 | 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, |
1036 | 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, |
1037 | 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, |
1038 | 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, |
1039 | 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, |
1040 | 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, |
1041 | 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, |
1042 | 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, |
1043 | 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, |
1044 | 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, |
1045 | 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, |
1046 | 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, |
1047 | 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, |
1048 | 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, |
1049 | 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, |
1050 | 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, |
1051 | 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, |
1052 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1053 | 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, |
1054 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1055 | 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, |
1056 | 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, |
1057 | 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1058 | 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, |
1059 | 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, |
1060 | 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, |
1061 | 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, |
1062 | 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, |
1063 | 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, |
1064 | 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, |
1065 | 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, |
1066 | 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, |
1067 | 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, |
1068 | 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, |
1069 | 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, |
1070 | 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, |
1071 | 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
1072 | }; |
1073 | #else |
1074 | #error "An appropriate 'yuv' pixel shader is not defined." |
1075 | #endif |
1076 | |
1077 | /* The yuv-rendering pixel shader: |
1078 | |
1079 | --- D3D11_PixelShader_NV12_BT709.hlsl --- |
1080 | Texture2D theTextureY : register(t0); |
1081 | Texture2D theTextureUV : register(t1); |
1082 | SamplerState theSampler : register(s0); |
1083 | |
1084 | struct PixelShaderInput |
1085 | { |
1086 | float4 pos : SV_POSITION; |
1087 | float2 tex : TEXCOORD0; |
1088 | float4 color : COLOR0; |
1089 | }; |
1090 | |
1091 | float4 main(PixelShaderInput input) : SV_TARGET |
1092 | { |
1093 | const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; |
1094 | const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; |
1095 | const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; |
1096 | const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; |
1097 | |
1098 | float4 Output; |
1099 | |
1100 | float3 yuv; |
1101 | yuv.x = theTextureY.Sample(theSampler, input.tex).r; |
1102 | yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; |
1103 | |
1104 | yuv += offset; |
1105 | Output.r = dot(yuv, Rcoeff); |
1106 | Output.g = dot(yuv, Gcoeff); |
1107 | Output.b = dot(yuv, Bcoeff); |
1108 | Output.a = 1.0f; |
1109 | |
1110 | return Output * input.color; |
1111 | } |
1112 | |
1113 | */ |
1114 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
1115 | static const DWORD D3D11_PixelShader_NV12_BT709[] = { |
1116 | 0x43425844, 0x40d1b8d5, 0xaf4b78b5, 0x907fd0b5, 0xa2d23686, 0x00000001, |
1117 | 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, |
1118 | 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, |
1119 | 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
1120 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, |
1121 | 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, |
1122 | 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, |
1123 | 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003, |
1124 | 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, |
1125 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
1126 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
1127 | 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, |
1128 | 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, |
1129 | 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, |
1130 | 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, |
1131 | 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, |
1132 | 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, |
1133 | 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, |
1134 | 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, |
1135 | 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, |
1136 | 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, |
1137 | 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, |
1138 | 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, |
1139 | 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, |
1140 | 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, |
1141 | 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, |
1142 | 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, |
1143 | 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, |
1144 | 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, |
1145 | 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, |
1146 | 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, |
1147 | 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, |
1148 | 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036, |
1149 | 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, |
1150 | 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, |
1151 | 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, |
1152 | 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, |
1153 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, |
1154 | 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, |
1155 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1156 | 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, |
1157 | 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, |
1158 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, |
1159 | 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, |
1160 | 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, |
1161 | 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, |
1162 | 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, |
1163 | 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, |
1164 | 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, |
1165 | 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, |
1166 | 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, |
1167 | 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, |
1168 | 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, |
1169 | 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, |
1170 | 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, |
1171 | 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, |
1172 | 0x45475241, 0xabab0054 |
1173 | }; |
1174 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
1175 | static const DWORD D3D11_PixelShader_NV12_BT709[] = { |
1176 | 0x43425844, 0xa3bba187, 0x71b6afa9, 0x15998682, 0x2d545cae, 0x00000001, |
1177 | 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, |
1178 | 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, |
1179 | 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
1180 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, |
1181 | 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, |
1182 | 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, 0xa00f0002, |
1183 | 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, 0x80000000, |
1184 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
1185 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
1186 | 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, |
1187 | 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, |
1188 | 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, |
1189 | 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, |
1190 | 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, |
1191 | 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, |
1192 | 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, |
1193 | 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, |
1194 | 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, |
1195 | 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, |
1196 | 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, |
1197 | 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, |
1198 | 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, |
1199 | 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, |
1200 | 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, |
1201 | 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, |
1202 | 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, |
1203 | 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, |
1204 | 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, |
1205 | 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, |
1206 | 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, |
1207 | 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, |
1208 | 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, |
1209 | 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, |
1210 | 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, |
1211 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1212 | 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, |
1213 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1214 | 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, |
1215 | 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, |
1216 | 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1217 | 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, |
1218 | 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, |
1219 | 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, |
1220 | 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, |
1221 | 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, |
1222 | 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, |
1223 | 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, |
1224 | 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, |
1225 | 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, |
1226 | 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, |
1227 | 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, |
1228 | 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, |
1229 | 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, |
1230 | 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
1231 | }; |
1232 | #else |
1233 | #error "An appropriate 'yuv' pixel shader is not defined." |
1234 | #endif |
1235 | |
1236 | /* The yuv-rendering pixel shader: |
1237 | |
1238 | --- D3D11_PixelShader_NV21_JPEG.hlsl --- |
1239 | Texture2D theTextureY : register(t0); |
1240 | Texture2D theTextureUV : register(t1); |
1241 | SamplerState theSampler : register(s0); |
1242 | |
1243 | struct PixelShaderInput |
1244 | { |
1245 | float4 pos : SV_POSITION; |
1246 | float2 tex : TEXCOORD0; |
1247 | float4 color : COLOR0; |
1248 | }; |
1249 | |
1250 | float4 main(PixelShaderInput input) : SV_TARGET |
1251 | { |
1252 | const float3 offset = {0.0, -0.501960814, -0.501960814}; |
1253 | const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; |
1254 | const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; |
1255 | const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; |
1256 | |
1257 | float4 Output; |
1258 | |
1259 | float3 yuv; |
1260 | yuv.x = theTextureY.Sample(theSampler, input.tex).r; |
1261 | yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; |
1262 | |
1263 | yuv += offset; |
1264 | Output.r = dot(yuv, Rcoeff); |
1265 | Output.g = dot(yuv, Gcoeff); |
1266 | Output.b = dot(yuv, Bcoeff); |
1267 | Output.a = 1.0f; |
1268 | |
1269 | return Output * input.color; |
1270 | } |
1271 | |
1272 | */ |
1273 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
1274 | static const DWORD D3D11_PixelShader_NV21_JPEG[] = { |
1275 | 0x43425844, 0x9c41f579, 0xfd1019d8, 0x7c27e3ae, 0x52e3a5ff, 0x00000001, |
1276 | 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, |
1277 | 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, |
1278 | 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
1279 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, |
1280 | 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, |
1281 | 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, |
1282 | 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003, |
1283 | 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, |
1284 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
1285 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
1286 | 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, |
1287 | 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, |
1288 | 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, |
1289 | 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, |
1290 | 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, |
1291 | 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, |
1292 | 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, |
1293 | 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, |
1294 | 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, |
1295 | 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, |
1296 | 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, |
1297 | 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, |
1298 | 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, |
1299 | 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, |
1300 | 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, |
1301 | 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, |
1302 | 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, |
1303 | 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, |
1304 | 0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, |
1305 | 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, |
1306 | 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, |
1307 | 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, |
1308 | 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, |
1309 | 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, |
1310 | 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, |
1311 | 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, |
1312 | 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1313 | 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1314 | 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1315 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, |
1316 | 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, |
1317 | 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, |
1318 | 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, |
1319 | 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, |
1320 | 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, |
1321 | 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, |
1322 | 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, |
1323 | 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, |
1324 | 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, |
1325 | 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, |
1326 | 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, |
1327 | 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, |
1328 | 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, |
1329 | 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, |
1330 | 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, |
1331 | 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
1332 | }; |
1333 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
1334 | static const DWORD D3D11_PixelShader_NV21_JPEG[] = { |
1335 | 0x43425844, 0x5705ccc9, 0xeb57571d, 0x8ce556e0, 0x2adef743, 0x00000001, |
1336 | 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, |
1337 | 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, |
1338 | 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
1339 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, |
1340 | 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001, |
1341 | 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002, |
1342 | 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, |
1343 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
1344 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
1345 | 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, |
1346 | 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, |
1347 | 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, |
1348 | 0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, |
1349 | 0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, |
1350 | 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, |
1351 | 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, |
1352 | 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, |
1353 | 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, |
1354 | 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, |
1355 | 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, |
1356 | 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, |
1357 | 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, |
1358 | 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, |
1359 | 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, |
1360 | 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, |
1361 | 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, |
1362 | 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, |
1363 | 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, |
1364 | 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, |
1365 | 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, |
1366 | 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, |
1367 | 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, |
1368 | 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, |
1369 | 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, |
1370 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1371 | 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, |
1372 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1373 | 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, |
1374 | 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, |
1375 | 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1376 | 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, |
1377 | 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, |
1378 | 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, |
1379 | 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, |
1380 | 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, |
1381 | 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, |
1382 | 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, |
1383 | 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, |
1384 | 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, |
1385 | 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, |
1386 | 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, |
1387 | 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, |
1388 | 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, |
1389 | 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
1390 | }; |
1391 | #else |
1392 | #error "An appropriate 'yuv' pixel shader is not defined." |
1393 | #endif |
1394 | |
1395 | /* The yuv-rendering pixel shader: |
1396 | |
1397 | --- D3D11_PixelShader_NV21_BT601.hlsl --- |
1398 | Texture2D theTextureY : register(t0); |
1399 | Texture2D theTextureUV : register(t1); |
1400 | SamplerState theSampler : register(s0); |
1401 | |
1402 | struct PixelShaderInput |
1403 | { |
1404 | float4 pos : SV_POSITION; |
1405 | float2 tex : TEXCOORD0; |
1406 | float4 color : COLOR0; |
1407 | }; |
1408 | |
1409 | float4 main(PixelShaderInput input) : SV_TARGET |
1410 | { |
1411 | const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; |
1412 | const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; |
1413 | const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; |
1414 | const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; |
1415 | |
1416 | float4 Output; |
1417 | |
1418 | float3 yuv; |
1419 | yuv.x = theTextureY.Sample(theSampler, input.tex).r; |
1420 | yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; |
1421 | |
1422 | yuv += offset; |
1423 | Output.r = dot(yuv, Rcoeff); |
1424 | Output.g = dot(yuv, Gcoeff); |
1425 | Output.b = dot(yuv, Bcoeff); |
1426 | Output.a = 1.0f; |
1427 | |
1428 | return Output * input.color; |
1429 | } |
1430 | |
1431 | */ |
1432 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
1433 | static const DWORD D3D11_PixelShader_NV21_BT601[] = { |
1434 | 0x43425844, 0x7fc6cfdc, 0xba87a4ff, 0xa72685a6, 0xa051b38c, 0x00000001, |
1435 | 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, |
1436 | 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, |
1437 | 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
1438 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, |
1439 | 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, |
1440 | 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, |
1441 | 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003, |
1442 | 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, |
1443 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
1444 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
1445 | 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, |
1446 | 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, |
1447 | 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, |
1448 | 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, |
1449 | 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, |
1450 | 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, |
1451 | 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, |
1452 | 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, |
1453 | 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, |
1454 | 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, |
1455 | 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, |
1456 | 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, |
1457 | 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, |
1458 | 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, |
1459 | 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, |
1460 | 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, |
1461 | 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, |
1462 | 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, |
1463 | 0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, |
1464 | 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, |
1465 | 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, |
1466 | 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, |
1467 | 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, |
1468 | 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, |
1469 | 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, |
1470 | 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, |
1471 | 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1472 | 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1473 | 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1474 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, |
1475 | 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, |
1476 | 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, |
1477 | 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, |
1478 | 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, |
1479 | 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, |
1480 | 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, |
1481 | 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, |
1482 | 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, |
1483 | 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, |
1484 | 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, |
1485 | 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, |
1486 | 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, |
1487 | 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, |
1488 | 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, |
1489 | 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, |
1490 | 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
1491 | }; |
1492 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
1493 | static const DWORD D3D11_PixelShader_NV21_BT601[] = { |
1494 | 0x43425844, 0x1e92bca4, 0xfeb04e20, 0x3f4226b1, 0xc89c58ad, 0x00000001, |
1495 | 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, |
1496 | 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, |
1497 | 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
1498 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, |
1499 | 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, |
1500 | 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, 0xa00f0002, |
1501 | 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, 0x80000000, |
1502 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
1503 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
1504 | 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, |
1505 | 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, |
1506 | 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, |
1507 | 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, |
1508 | 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, |
1509 | 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, |
1510 | 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, |
1511 | 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, |
1512 | 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, |
1513 | 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, |
1514 | 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, |
1515 | 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, |
1516 | 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, |
1517 | 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, |
1518 | 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, |
1519 | 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, |
1520 | 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, |
1521 | 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, |
1522 | 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, |
1523 | 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, |
1524 | 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, |
1525 | 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, |
1526 | 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, |
1527 | 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, |
1528 | 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, |
1529 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1530 | 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, |
1531 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1532 | 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, |
1533 | 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, |
1534 | 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1535 | 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, |
1536 | 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, |
1537 | 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, |
1538 | 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, |
1539 | 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, |
1540 | 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, |
1541 | 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, |
1542 | 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, |
1543 | 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, |
1544 | 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, |
1545 | 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, |
1546 | 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, |
1547 | 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, |
1548 | 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
1549 | }; |
1550 | #else |
1551 | #error "An appropriate 'yuv' pixel shader is not defined." |
1552 | #endif |
1553 | |
1554 | /* The yuv-rendering pixel shader: |
1555 | |
1556 | --- D3D11_PixelShader_NV21_BT709.hlsl --- |
1557 | Texture2D theTextureY : register(t0); |
1558 | Texture2D theTextureUV : register(t1); |
1559 | SamplerState theSampler : register(s0); |
1560 | |
1561 | struct PixelShaderInput |
1562 | { |
1563 | float4 pos : SV_POSITION; |
1564 | float2 tex : TEXCOORD0; |
1565 | float4 color : COLOR0; |
1566 | }; |
1567 | |
1568 | float4 main(PixelShaderInput input) : SV_TARGET |
1569 | { |
1570 | const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; |
1571 | const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; |
1572 | const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; |
1573 | const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; |
1574 | |
1575 | float4 Output; |
1576 | |
1577 | float3 yuv; |
1578 | yuv.x = theTextureY.Sample(theSampler, input.tex).r; |
1579 | yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; |
1580 | |
1581 | yuv += offset; |
1582 | Output.r = dot(yuv, Rcoeff); |
1583 | Output.g = dot(yuv, Gcoeff); |
1584 | Output.b = dot(yuv, Bcoeff); |
1585 | Output.a = 1.0f; |
1586 | |
1587 | return Output * input.color; |
1588 | } |
1589 | |
1590 | */ |
1591 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
1592 | static const DWORD D3D11_PixelShader_NV21_BT709[] = { |
1593 | 0x43425844, 0x754ba6c4, 0xe321a747, 0x23680787, 0x6bb1bdcc, 0x00000001, |
1594 | 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, |
1595 | 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, |
1596 | 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
1597 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, |
1598 | 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, |
1599 | 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, |
1600 | 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003, |
1601 | 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, |
1602 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
1603 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
1604 | 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, |
1605 | 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, |
1606 | 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, |
1607 | 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, |
1608 | 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, |
1609 | 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, |
1610 | 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, |
1611 | 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, |
1612 | 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, |
1613 | 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, |
1614 | 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, |
1615 | 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, |
1616 | 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, |
1617 | 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, |
1618 | 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, |
1619 | 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, |
1620 | 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, |
1621 | 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, |
1622 | 0x00000000, 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, |
1623 | 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, |
1624 | 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, |
1625 | 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, |
1626 | 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, |
1627 | 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, |
1628 | 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, |
1629 | 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, |
1630 | 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1631 | 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1632 | 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1633 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, |
1634 | 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, |
1635 | 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, |
1636 | 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, |
1637 | 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, |
1638 | 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, |
1639 | 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, |
1640 | 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, |
1641 | 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, |
1642 | 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, |
1643 | 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, |
1644 | 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, |
1645 | 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, |
1646 | 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, |
1647 | 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, |
1648 | 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, |
1649 | 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
1650 | }; |
1651 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
1652 | static const DWORD D3D11_PixelShader_NV21_BT709[] = { |
1653 | 0x43425844, 0xb6219b20, 0xb71bbcf7, 0xf361cc45, 0xc4d5f5be, 0x00000001, |
1654 | 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, |
1655 | 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, |
1656 | 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, |
1657 | 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, |
1658 | 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, |
1659 | 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, 0xa00f0002, |
1660 | 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, 0x80000000, |
1661 | 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, |
1662 | 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, |
1663 | 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, |
1664 | 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, |
1665 | 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, |
1666 | 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, |
1667 | 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, |
1668 | 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, |
1669 | 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, |
1670 | 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, |
1671 | 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, |
1672 | 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, |
1673 | 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, |
1674 | 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, |
1675 | 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, |
1676 | 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, |
1677 | 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, |
1678 | 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, |
1679 | 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, |
1680 | 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, |
1681 | 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, |
1682 | 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, |
1683 | 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, |
1684 | 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, |
1685 | 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, |
1686 | 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, |
1687 | 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, |
1688 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1689 | 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, |
1690 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1691 | 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, |
1692 | 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, |
1693 | 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1694 | 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, |
1695 | 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, |
1696 | 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, |
1697 | 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, |
1698 | 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, |
1699 | 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, |
1700 | 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, |
1701 | 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, |
1702 | 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, |
1703 | 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, |
1704 | 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, |
1705 | 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, |
1706 | 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, |
1707 | 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 |
1708 | }; |
1709 | #else |
1710 | #error "An appropriate 'yuv' pixel shader is not defined." |
1711 | #endif |
1712 | |
1713 | /* The sole vertex shader: |
1714 | |
1715 | --- D3D11_VertexShader.hlsl --- |
1716 | #pragma pack_matrix( row_major ) |
1717 | |
1718 | cbuffer VertexShaderConstants : register(b0) |
1719 | { |
1720 | matrix model; |
1721 | matrix projectionAndView; |
1722 | }; |
1723 | |
1724 | struct VertexShaderInput |
1725 | { |
1726 | float3 pos : POSITION; |
1727 | float2 tex : TEXCOORD0; |
1728 | float4 color : COLOR0; |
1729 | }; |
1730 | |
1731 | struct VertexShaderOutput |
1732 | { |
1733 | float4 pos : SV_POSITION; |
1734 | float2 tex : TEXCOORD0; |
1735 | float4 color : COLOR0; |
1736 | }; |
1737 | |
1738 | VertexShaderOutput main(VertexShaderInput input) |
1739 | { |
1740 | VertexShaderOutput output; |
1741 | float4 pos = float4(input.pos, 1.0f); |
1742 | |
1743 | // Transform the vertex position into projected space. |
1744 | pos = mul(pos, model); |
1745 | pos = mul(pos, projectionAndView); |
1746 | output.pos = pos; |
1747 | |
1748 | // Pass through texture coordinates and color values without transformation |
1749 | output.tex = input.tex; |
1750 | output.color = input.color; |
1751 | |
1752 | return output; |
1753 | } |
1754 | */ |
1755 | #if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) |
1756 | static const DWORD D3D11_VertexShader[] = { |
1757 | 0x43425844, 0x62dfae5f, 0x3e8bd8df, 0x9ec97127, 0x5044eefb, 0x00000001, |
1758 | 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, |
1759 | 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, |
1760 | 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, |
1761 | 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0200, |
1762 | 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, |
1763 | 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, |
1764 | 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, |
1765 | 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, |
1766 | 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, |
1767 | 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, |
1768 | 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, |
1769 | 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, |
1770 | 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, |
1771 | 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, |
1772 | 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, |
1773 | 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, |
1774 | 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, |
1775 | 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, |
1776 | 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, |
1777 | 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, |
1778 | 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, |
1779 | 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, |
1780 | 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, |
1781 | 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, |
1782 | 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, |
1783 | 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, |
1784 | 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, |
1785 | 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, |
1786 | 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, |
1787 | 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, |
1788 | 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, |
1789 | 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, |
1790 | 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, |
1791 | 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, |
1792 | 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, |
1793 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1794 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, |
1795 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1796 | 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, |
1797 | 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, |
1798 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, |
1799 | 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, |
1800 | 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, |
1801 | 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, |
1802 | 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, |
1803 | 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, |
1804 | 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, |
1805 | 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, |
1806 | 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, |
1807 | 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, |
1808 | 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, |
1809 | 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, |
1810 | 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, |
1811 | 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, |
1812 | 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, |
1813 | 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, |
1814 | 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, |
1815 | 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, |
1816 | 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f |
1817 | }; |
1818 | #elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) |
1819 | static const DWORD D3D11_VertexShader[] = { |
1820 | 0x43425844, 0x01a24e41, 0x696af551, 0x4b2a87d1, 0x82ea03f6, 0x00000001, |
1821 | 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, |
1822 | 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, |
1823 | 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, |
1824 | 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0201, |
1825 | 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, |
1826 | 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, |
1827 | 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, |
1828 | 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, |
1829 | 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, |
1830 | 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, |
1831 | 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, |
1832 | 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, |
1833 | 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, |
1834 | 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, |
1835 | 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, |
1836 | 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, |
1837 | 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, |
1838 | 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, |
1839 | 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, |
1840 | 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, |
1841 | 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, |
1842 | 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, |
1843 | 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, |
1844 | 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, |
1845 | 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, |
1846 | 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, |
1847 | 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, |
1848 | 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, |
1849 | 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, |
1850 | 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, |
1851 | 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, |
1852 | 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, |
1853 | 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, |
1854 | 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, |
1855 | 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, |
1856 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1857 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, |
1858 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1859 | 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, |
1860 | 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, |
1861 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, |
1862 | 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, |
1863 | 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, |
1864 | 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, |
1865 | 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, |
1866 | 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, |
1867 | 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, |
1868 | 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, |
1869 | 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, |
1870 | 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, |
1871 | 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, |
1872 | 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, |
1873 | 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, |
1874 | 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, |
1875 | 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, |
1876 | 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, |
1877 | 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, |
1878 | 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, |
1879 | 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f |
1880 | }; |
1881 | #else |
1882 | #error "An appropriate vertex shader is not defined." |
1883 | #endif |
1884 | |
1885 | static struct |
1886 | { |
1887 | const void *shader_data; |
1888 | SIZE_T shader_size; |
1889 | } D3D11_shaders[] = { |
1890 | { D3D11_PixelShader_Colors, sizeof(D3D11_PixelShader_Colors) }, |
1891 | { D3D11_PixelShader_Textures, sizeof(D3D11_PixelShader_Textures) }, |
1892 | { D3D11_PixelShader_YUV_JPEG, sizeof(D3D11_PixelShader_YUV_JPEG) }, |
1893 | { D3D11_PixelShader_YUV_BT601, sizeof(D3D11_PixelShader_YUV_BT601) }, |
1894 | { D3D11_PixelShader_YUV_BT709, sizeof(D3D11_PixelShader_YUV_BT709) }, |
1895 | { D3D11_PixelShader_NV12_JPEG, sizeof(D3D11_PixelShader_NV12_JPEG) }, |
1896 | { D3D11_PixelShader_NV12_BT601, sizeof(D3D11_PixelShader_NV12_BT601) }, |
1897 | { D3D11_PixelShader_NV12_BT709, sizeof(D3D11_PixelShader_NV12_BT709) }, |
1898 | { D3D11_PixelShader_NV21_JPEG, sizeof(D3D11_PixelShader_NV21_JPEG) }, |
1899 | { D3D11_PixelShader_NV21_BT601, sizeof(D3D11_PixelShader_NV21_BT601) }, |
1900 | { D3D11_PixelShader_NV21_BT709, sizeof(D3D11_PixelShader_NV21_BT709) }, |
1901 | }; |
1902 | |
1903 | int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout) |
1904 | { |
1905 | /* Declare how the input layout for SDL's vertex shader will be setup: */ |
1906 | const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = |
1907 | { |
1908 | { "POSITION" , 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, |
1909 | { "TEXCOORD" , 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, |
1910 | { "COLOR" , 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, |
1911 | }; |
1912 | HRESULT result; |
1913 | |
1914 | /* Load in SDL's one and only vertex shader: */ |
1915 | result = ID3D11Device_CreateVertexShader(d3dDevice, |
1916 | D3D11_VertexShader, |
1917 | sizeof(D3D11_VertexShader), |
1918 | NULL, |
1919 | vertexShader |
1920 | ); |
1921 | if (FAILED(result)) { |
1922 | return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateVertexShader" ), result); |
1923 | } |
1924 | |
1925 | /* Create an input layout for SDL's vertex shader: */ |
1926 | result = ID3D11Device_CreateInputLayout(d3dDevice, |
1927 | vertexDesc, |
1928 | ARRAYSIZE(vertexDesc), |
1929 | D3D11_VertexShader, |
1930 | sizeof(D3D11_VertexShader), |
1931 | inputLayout |
1932 | ); |
1933 | if (FAILED(result)) { |
1934 | return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateInputLayout" ), result); |
1935 | } |
1936 | return 0; |
1937 | } |
1938 | |
1939 | int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D11PixelShader **pixelShader) |
1940 | { |
1941 | HRESULT result; |
1942 | |
1943 | result = ID3D11Device_CreatePixelShader(d3dDevice, |
1944 | D3D11_shaders[shader].shader_data, |
1945 | D3D11_shaders[shader].shader_size, |
1946 | NULL, |
1947 | pixelShader |
1948 | ); |
1949 | if (FAILED(result)) { |
1950 | return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader" ), result); |
1951 | } |
1952 | return 0; |
1953 | } |
1954 | |
1955 | #endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ |
1956 | |
1957 | /* vi: set ts=4 sw=4 expandtab: */ |
1958 | |