mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-09-22 19:25:19 +08:00
Added the Chrome HDR tonemap operator
Also added support for the SDL_PIXELFORMAT_XBGR2101010 pixel format to the D3D12, D3D11, and Metal renderers.
This commit is contained in:
@@ -212,9 +212,9 @@ extern DECLSPEC void SDLCALL SDL_DestroySurface(SDL_Surface *surface);
|
||||
* for YUV surfaces.
|
||||
* - `SDL_PROP_SURFACE_MAXCLL_NUMBER`: MaxCLL (Maximum Content Light Level) indicates the maximum light level of any single pixel (in cd/m2 or nits) of the content. MaxCLL is usually measured off the final delivered content after mastering. If one uses the full light level of the HDR mastering display and adds a hard clip at its maximum value, MaxCLL would be equal to the peak luminance of the mastering monitor. This defaults to 400 for HDR10 surfaces.
|
||||
* - `SDL_PROP_SURFACE_MAXFALL_NUMBER`: MaxFALL (Maximum Frame Average Light Level) indicates the maximum value of the frame average light level (in cd/m2 or nits) of the content. MaxFALL is calculated by averaging the decoded luminance values of all the pixels within a frame. MaxFALL is usually much lower than MaxCLL.
|
||||
* - `SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating point surfaces, this defines the value of 100% diffuse white, with higher values being displayed in the High Dynamic Range headroom. This defaults to 100 for surfaces using the PQ colorspace and 1.0 for other surfaces.
|
||||
* - `SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating point surfaces, this defines the value of 100% diffuse white, with higher values being displayed in the High Dynamic Range headroom. This defaults to 100 for HDR10 surfaces and 1.0 for other surfaces.
|
||||
* - `SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT`: for HDR10 and floating point surfaces, this defines the maximum dynamic range used by the content, in terms of the SDR white point. This defaults to SDL_PROP_SURFACE_MAXCLL_NUMBER / SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT, or 4.0, for HDR10 surfaces.
|
||||
* - `SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING`: the tone mapping operator used when converting between different SDR/HDR ranges. Currently this supports the form "*=N", where N is a floating point scale factor applied in linear space.
|
||||
* - `SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING`: the tone mapping operator used when compressing from a surface with high dynamic range to another with lower dynamic range. Currently this supports "chrome", which uses the same tone mapping that Chrome uses for HDR content, the form "*=N", where N is a floating point scale factor applied in linear space, and "none", which disables tone mapping. This defaults to "chrome".
|
||||
*
|
||||
* \param surface the SDL_Surface structure to query
|
||||
* \returns a valid property ID on success or 0 on failure; call
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
|
||||
#include "D3D11_PixelShader_Common.incl"
|
||||
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
return AdvancedPixelShader(input);
|
||||
}
|
||||
@@ -9,13 +9,17 @@
|
||||
// {
|
||||
//
|
||||
// float scRGB_output; // Offset: 0 Size: 4 [unused]
|
||||
// float color_scale; // Offset: 4 Size: 4
|
||||
// float unused1; // Offset: 8 Size: 4 [unused]
|
||||
// float unused2; // Offset: 12 Size: 4 [unused]
|
||||
// float4 Yoffset; // Offset: 16 Size: 16 [unused]
|
||||
// float4 Rcoeff; // Offset: 32 Size: 16 [unused]
|
||||
// float4 Gcoeff; // Offset: 48 Size: 16 [unused]
|
||||
// float4 Bcoeff; // Offset: 64 Size: 16 [unused]
|
||||
// float texture_type; // Offset: 4 Size: 4 [unused]
|
||||
// float input_type; // Offset: 8 Size: 4 [unused]
|
||||
// float color_scale; // Offset: 12 Size: 4
|
||||
// float tonemap_method; // Offset: 16 Size: 4 [unused]
|
||||
// float tonemap_factor1; // Offset: 20 Size: 4 [unused]
|
||||
// float tonemap_factor2; // Offset: 24 Size: 4 [unused]
|
||||
// float sdr_white_point; // Offset: 28 Size: 4 [unused]
|
||||
// float4 Yoffset; // Offset: 32 Size: 16 [unused]
|
||||
// float4 Rcoeff; // Offset: 48 Size: 16 [unused]
|
||||
// float4 Gcoeff; // Offset: 64 Size: 16 [unused]
|
||||
// float4 Bcoeff; // Offset: 80 Size: 16 [unused]
|
||||
//
|
||||
// }
|
||||
//
|
||||
@@ -55,7 +59,7 @@
|
||||
//
|
||||
ps_2_0
|
||||
dcl t1
|
||||
mul r0.xyz, t1, c0.y
|
||||
mul r0.xyz, t1, c0.w
|
||||
mov r0.w, t1.w
|
||||
mov oC0, r0
|
||||
|
||||
@@ -65,7 +69,7 @@ dcl_constantbuffer CB0[1], immediateIndexed
|
||||
dcl_input_ps linear v2.xyzw
|
||||
dcl_output o0.xyzw
|
||||
dcl_temps 1
|
||||
mov r0.x, cb0[0].y
|
||||
mov r0.x, cb0[0].w
|
||||
mov r0.w, l(1.000000)
|
||||
mul o0.xyzw, r0.xxxw, v2.xyzw
|
||||
ret
|
||||
@@ -74,15 +78,15 @@ ret
|
||||
|
||||
const BYTE g_main[] =
|
||||
{
|
||||
68, 88, 66, 67, 76, 154,
|
||||
233, 103, 201, 50, 167, 173,
|
||||
112, 159, 134, 20, 133, 254,
|
||||
166, 35, 1, 0, 0, 0,
|
||||
24, 4, 0, 0, 6, 0,
|
||||
68, 88, 66, 67, 78, 223,
|
||||
23, 23, 93, 184, 255, 26,
|
||||
153, 0, 220, 179, 25, 194,
|
||||
30, 249, 1, 0, 0, 0,
|
||||
192, 4, 0, 0, 6, 0,
|
||||
0, 0, 56, 0, 0, 0,
|
||||
172, 0, 0, 0, 56, 1,
|
||||
0, 0, 180, 1, 0, 0,
|
||||
112, 3, 0, 0, 228, 3,
|
||||
24, 4, 0, 0, 140, 4,
|
||||
0, 0, 65, 111, 110, 57,
|
||||
108, 0, 0, 0, 108, 0,
|
||||
0, 0, 0, 2, 255, 255,
|
||||
@@ -97,7 +101,7 @@ const BYTE g_main[] =
|
||||
0, 0, 0, 128, 1, 0,
|
||||
15, 176, 5, 0, 0, 3,
|
||||
0, 0, 7, 128, 1, 0,
|
||||
228, 176, 0, 0, 85, 160,
|
||||
228, 176, 0, 0, 255, 160,
|
||||
1, 0, 0, 2, 0, 0,
|
||||
8, 128, 1, 0, 255, 176,
|
||||
1, 0, 0, 2, 0, 8,
|
||||
@@ -115,7 +119,7 @@ const BYTE g_main[] =
|
||||
104, 0, 0, 2, 1, 0,
|
||||
0, 0, 54, 0, 0, 6,
|
||||
18, 0, 16, 0, 0, 0,
|
||||
0, 0, 26, 128, 32, 0,
|
||||
0, 0, 58, 128, 32, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 54, 0, 0, 5,
|
||||
130, 0, 16, 0, 0, 0,
|
||||
@@ -147,12 +151,12 @@ const BYTE g_main[] =
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 82, 68,
|
||||
69, 70, 180, 1, 0, 0,
|
||||
69, 70, 92, 2, 0, 0,
|
||||
1, 0, 0, 0, 72, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
28, 0, 0, 0, 0, 4,
|
||||
255, 255, 0, 1, 0, 0,
|
||||
137, 1, 0, 0, 60, 0,
|
||||
49, 2, 0, 0, 60, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
@@ -160,54 +164,82 @@ const BYTE g_main[] =
|
||||
0, 0, 1, 0, 0, 0,
|
||||
67, 111, 110, 115, 116, 97,
|
||||
110, 116, 115, 0, 171, 171,
|
||||
60, 0, 0, 0, 8, 0,
|
||||
60, 0, 0, 0, 12, 0,
|
||||
0, 0, 96, 0, 0, 0,
|
||||
80, 0, 0, 0, 0, 0,
|
||||
96, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
32, 1, 0, 0, 0, 0,
|
||||
128, 1, 0, 0, 0, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
0, 0, 0, 0, 48, 1,
|
||||
0, 0, 0, 0, 144, 1,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
64, 1, 0, 0, 4, 0,
|
||||
160, 1, 0, 0, 4, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
2, 0, 0, 0, 48, 1,
|
||||
0, 0, 0, 0, 144, 1,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
76, 1, 0, 0, 8, 0,
|
||||
173, 1, 0, 0, 8, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
0, 0, 0, 0, 48, 1,
|
||||
0, 0, 0, 0, 144, 1,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
84, 1, 0, 0, 12, 0,
|
||||
184, 1, 0, 0, 12, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
0, 0, 0, 0, 48, 1,
|
||||
2, 0, 0, 0, 144, 1,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
92, 1, 0, 0, 16, 0,
|
||||
0, 0, 16, 0, 0, 0,
|
||||
0, 0, 0, 0, 100, 1,
|
||||
196, 1, 0, 0, 16, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
0, 0, 0, 0, 144, 1,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
116, 1, 0, 0, 32, 0,
|
||||
0, 0, 16, 0, 0, 0,
|
||||
0, 0, 0, 0, 100, 1,
|
||||
211, 1, 0, 0, 20, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
0, 0, 0, 0, 144, 1,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
123, 1, 0, 0, 48, 0,
|
||||
0, 0, 16, 0, 0, 0,
|
||||
0, 0, 0, 0, 100, 1,
|
||||
227, 1, 0, 0, 24, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
0, 0, 0, 0, 144, 1,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
130, 1, 0, 0, 64, 0,
|
||||
243, 1, 0, 0, 28, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
0, 0, 0, 0, 144, 1,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 2, 0, 0, 32, 0,
|
||||
0, 0, 16, 0, 0, 0,
|
||||
0, 0, 0, 0, 100, 1,
|
||||
0, 0, 0, 0, 12, 2,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
28, 2, 0, 0, 48, 0,
|
||||
0, 0, 16, 0, 0, 0,
|
||||
0, 0, 0, 0, 12, 2,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
35, 2, 0, 0, 64, 0,
|
||||
0, 0, 16, 0, 0, 0,
|
||||
0, 0, 0, 0, 12, 2,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
42, 2, 0, 0, 80, 0,
|
||||
0, 0, 16, 0, 0, 0,
|
||||
0, 0, 0, 0, 12, 2,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
115, 99, 82, 71, 66, 95,
|
||||
111, 117, 116, 112, 117, 116,
|
||||
0, 171, 171, 171, 0, 0,
|
||||
3, 0, 1, 0, 1, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 99, 111, 108, 111,
|
||||
0, 0, 116, 101, 120, 116,
|
||||
117, 114, 101, 95, 116, 121,
|
||||
112, 101, 0, 105, 110, 112,
|
||||
117, 116, 95, 116, 121, 112,
|
||||
101, 0, 99, 111, 108, 111,
|
||||
114, 95, 115, 99, 97, 108,
|
||||
101, 0, 117, 110, 117, 115,
|
||||
101, 100, 49, 0, 117, 110,
|
||||
117, 115, 101, 100, 50, 0,
|
||||
89, 111, 102, 102, 115, 101,
|
||||
116, 0, 1, 0, 3, 0,
|
||||
101, 0, 116, 111, 110, 101,
|
||||
109, 97, 112, 95, 109, 101,
|
||||
116, 104, 111, 100, 0, 116,
|
||||
111, 110, 101, 109, 97, 112,
|
||||
95, 102, 97, 99, 116, 111,
|
||||
114, 49, 0, 116, 111, 110,
|
||||
101, 109, 97, 112, 95, 102,
|
||||
97, 99, 116, 111, 114, 50,
|
||||
0, 115, 100, 114, 95, 119,
|
||||
104, 105, 116, 101, 95, 112,
|
||||
111, 105, 110, 116, 0, 89,
|
||||
111, 102, 102, 115, 101, 116,
|
||||
0, 171, 1, 0, 3, 0,
|
||||
1, 0, 4, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
82, 99, 111, 101, 102, 102,
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
|
||||
Texture2D texture0 : register(t0);
|
||||
Texture2D texture1 : register(t1);
|
||||
Texture2D texture2 : register(t2);
|
||||
SamplerState sampler0 : register(s0);
|
||||
|
||||
struct PixelShaderInput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
@@ -5,12 +11,33 @@ struct PixelShaderInput
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
|
||||
// These should mirror the definitions in SDL_render_d3d12.c
|
||||
static const float TONEMAP_NONE = 0;
|
||||
static const float TONEMAP_LINEAR = 1;
|
||||
static const float TONEMAP_CHROME = 2;
|
||||
|
||||
static const float TEXTURETYPE_NONE = 0;
|
||||
static const float TEXTURETYPE_RGB = 1;
|
||||
static const float TEXTURETYPE_NV12 = 2;
|
||||
static const float TEXTURETYPE_NV21 = 3;
|
||||
static const float TEXTURETYPE_YUV = 4;
|
||||
|
||||
static const float INPUTTYPE_UNSPECIFIED = 0;
|
||||
static const float INPUTTYPE_SRGB = 1;
|
||||
static const float INPUTTYPE_SCRGB = 2;
|
||||
static const float INPUTTYPE_HDR10 = 3;
|
||||
|
||||
cbuffer Constants : register(b0)
|
||||
{
|
||||
float scRGB_output;
|
||||
float texture_type;
|
||||
float input_type;
|
||||
float color_scale;
|
||||
float unused1;
|
||||
float unused2;
|
||||
|
||||
float tonemap_method;
|
||||
float tonemap_factor1;
|
||||
float tonemap_factor2;
|
||||
float sdr_white_point;
|
||||
|
||||
float4 Yoffset;
|
||||
float4 Rcoeff;
|
||||
@@ -18,15 +45,17 @@ cbuffer Constants : register(b0)
|
||||
float4 Bcoeff;
|
||||
};
|
||||
|
||||
float3 scRGBtoNits(float3 v)
|
||||
{
|
||||
return v * 80.0;
|
||||
}
|
||||
static const float3x3 mat709to2020 = {
|
||||
{ 0.627404, 0.329283, 0.043313 },
|
||||
{ 0.069097, 0.919541, 0.011362 },
|
||||
{ 0.016391, 0.088013, 0.895595 }
|
||||
};
|
||||
|
||||
float3 scRGBfromNits(float3 v)
|
||||
{
|
||||
return v / 80.0;
|
||||
}
|
||||
static const float3x3 mat2020to709 = {
|
||||
{ 1.660496, -0.587656, -0.072840 },
|
||||
{ -0.124547, 1.132895, -0.008348 },
|
||||
{ -0.018154, -0.100597, 1.118751 }
|
||||
};
|
||||
|
||||
float sRGBtoLinear(float v)
|
||||
{
|
||||
@@ -48,6 +77,92 @@ float sRGBfromLinear(float v)
|
||||
return v;
|
||||
}
|
||||
|
||||
float3 PQtoLinear(float3 v)
|
||||
{
|
||||
const float c1 = 0.8359375;
|
||||
const float c2 = 18.8515625;
|
||||
const float c3 = 18.6875;
|
||||
const float oo_m1 = 1.0 / 0.1593017578125;
|
||||
const float oo_m2 = 1.0 / 78.84375;
|
||||
|
||||
float3 num = max(pow(abs(v), oo_m2) - c1, 0.0);
|
||||
float3 den = c2 - c3 * pow(abs(v), oo_m2);
|
||||
return (10000.0 * pow(abs(num / den), oo_m1) / sdr_white_point);
|
||||
}
|
||||
|
||||
float3 ApplyTonemap(float3 v)
|
||||
{
|
||||
if (tonemap_method == TONEMAP_LINEAR) {
|
||||
v *= tonemap_factor1;
|
||||
} else if (tonemap_method == TONEMAP_CHROME) {
|
||||
if (input_type == INPUTTYPE_SCRGB) {
|
||||
// Convert to BT.2020 colorspace for tone mapping
|
||||
v = mul(mat709to2020, v);
|
||||
}
|
||||
|
||||
float vmax = max(v.r, max(v.g, v.b));
|
||||
if (vmax > 0.0) {
|
||||
float scale = (1.0 + tonemap_factor1 * vmax) / (1.0 + tonemap_factor2 * vmax);
|
||||
v *= scale;
|
||||
}
|
||||
|
||||
if (input_type == INPUTTYPE_SCRGB) {
|
||||
// Convert to BT.709 colorspace after tone mapping
|
||||
v = mul(mat2020to709, v);
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
float4 GetInputColor(PixelShaderInput input)
|
||||
{
|
||||
float4 rgba;
|
||||
|
||||
if (texture_type == TEXTURETYPE_NONE) {
|
||||
rgba = 1.0;
|
||||
} else if (texture_type == TEXTURETYPE_RGB) {
|
||||
rgba = texture0.Sample(sampler0, input.tex);
|
||||
} else if (texture_type == TEXTURETYPE_NV12) {
|
||||
float3 yuv;
|
||||
yuv.x = texture0.Sample(sampler0, input.tex).r;
|
||||
yuv.yz = texture1.Sample(sampler0, input.tex).rg;
|
||||
|
||||
yuv += Yoffset.xyz;
|
||||
rgba.r = dot(yuv, Rcoeff.xyz);
|
||||
rgba.g = dot(yuv, Gcoeff.xyz);
|
||||
rgba.b = dot(yuv, Bcoeff.xyz);
|
||||
rgba.a = 1.0;
|
||||
} else if (texture_type == TEXTURETYPE_NV21) {
|
||||
float3 yuv;
|
||||
yuv.x = texture0.Sample(sampler0, input.tex).r;
|
||||
yuv.yz = texture1.Sample(sampler0, input.tex).gr;
|
||||
|
||||
yuv += Yoffset.xyz;
|
||||
rgba.r = dot(yuv, Rcoeff.xyz);
|
||||
rgba.g = dot(yuv, Gcoeff.xyz);
|
||||
rgba.b = dot(yuv, Bcoeff.xyz);
|
||||
rgba.a = 1.0;
|
||||
} else if (texture_type == TEXTURETYPE_YUV) {
|
||||
float3 yuv;
|
||||
yuv.x = texture0.Sample(sampler0, input.tex).r;
|
||||
yuv.y = texture1.Sample(sampler0, input.tex).r;
|
||||
yuv.z = texture2.Sample(sampler0, input.tex).r;
|
||||
|
||||
yuv += Yoffset.xyz;
|
||||
rgba.r = dot(yuv, Rcoeff.xyz);
|
||||
rgba.g = dot(yuv, Gcoeff.xyz);
|
||||
rgba.b = dot(yuv, Bcoeff.xyz);
|
||||
rgba.a = 1.0;
|
||||
} else {
|
||||
// Error!
|
||||
rgba.r = 1.0;
|
||||
rgba.g = 0.0;
|
||||
rgba.b = 0.0;
|
||||
rgba.a = 1.0;
|
||||
}
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 GetOutputColor(float4 rgba)
|
||||
{
|
||||
float4 output;
|
||||
@@ -58,9 +173,9 @@ float4 GetOutputColor(float4 rgba)
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 GetOutputColorFromSRGB(float3 rgb)
|
||||
float3 GetOutputColorFromSRGB(float3 rgb)
|
||||
{
|
||||
float4 output;
|
||||
float3 output;
|
||||
|
||||
if (scRGB_output) {
|
||||
rgb.r = sRGBtoLinear(rgb.r);
|
||||
@@ -69,17 +184,15 @@ float4 GetOutputColorFromSRGB(float3 rgb)
|
||||
}
|
||||
|
||||
output.rgb = rgb * color_scale;
|
||||
output.a = 1.0;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 GetOutputColorFromSCRGB(float3 rgb)
|
||||
float3 GetOutputColorFromLinear(float3 rgb)
|
||||
{
|
||||
float4 output;
|
||||
float3 output;
|
||||
|
||||
output.rgb = rgb * color_scale;
|
||||
output.a = 1.0;
|
||||
|
||||
if (!scRGB_output) {
|
||||
output.r = sRGBfromLinear(output.r);
|
||||
@@ -90,3 +203,33 @@ float4 GetOutputColorFromSCRGB(float3 rgb)
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 AdvancedPixelShader(PixelShaderInput input)
|
||||
{
|
||||
float4 rgba = GetInputColor(input);
|
||||
float4 output;
|
||||
|
||||
if (input_type == INPUTTYPE_HDR10) {
|
||||
rgba.rgb = PQtoLinear(rgba.rgb);
|
||||
}
|
||||
|
||||
if (tonemap_method != TONEMAP_NONE) {
|
||||
rgba.rgb = ApplyTonemap(rgba.rgb);
|
||||
}
|
||||
|
||||
if (input_type == INPUTTYPE_SRGB) {
|
||||
output.rgb = GetOutputColorFromSRGB(rgba.rgb);
|
||||
output.a = rgba.a;
|
||||
} else if (input_type == INPUTTYPE_SCRGB) {
|
||||
output.rgb = GetOutputColorFromLinear(rgba.rgb);
|
||||
output.a = rgba.a;
|
||||
} else if (input_type == INPUTTYPE_HDR10) {
|
||||
rgba.rgb = mul(mat2020to709, rgba.rgb);
|
||||
output.rgb = GetOutputColorFromLinear(rgba.rgb);
|
||||
output.a = rgba.a;
|
||||
} else {
|
||||
output = GetOutputColor(rgba);
|
||||
}
|
||||
|
||||
return output * input.color;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,45 +0,0 @@
|
||||
Texture2D theTextureY : register(t0);
|
||||
Texture2D theTextureUV : register(t1);
|
||||
SamplerState theSampler : register(s0);
|
||||
|
||||
#include "D3D11_PixelShader_Common.incl"
|
||||
|
||||
float3 PQtoNits(float3 v)
|
||||
{
|
||||
const float c1 = 0.8359375;
|
||||
const float c2 = 18.8515625;
|
||||
const float c3 = 18.6875;
|
||||
const float oo_m1 = 1.0 / 0.1593017578125;
|
||||
const float oo_m2 = 1.0 / 78.84375;
|
||||
|
||||
float3 num = max(pow(abs(v), oo_m2) - c1, 0.0);
|
||||
float3 den = c2 - c3 * pow(abs(v), oo_m2);
|
||||
return 10000.0 * pow(abs(num / den), oo_m1);
|
||||
}
|
||||
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
const float3x3 mat2020to709 = {
|
||||
1.660496, -0.587656, -0.072840,
|
||||
-0.124547, 1.132895, -0.008348,
|
||||
-0.018154, -0.100597, 1.118751
|
||||
};
|
||||
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
|
||||
|
||||
float3 rgb;
|
||||
yuv += Yoffset.xyz;
|
||||
rgb.r = dot(yuv, Rcoeff.xyz);
|
||||
rgb.g = dot(yuv, Gcoeff.xyz);
|
||||
rgb.b = dot(yuv, Bcoeff.xyz);
|
||||
|
||||
rgb = PQtoNits(rgb);
|
||||
|
||||
rgb = mul(mat2020to709, rgb);
|
||||
|
||||
rgb = scRGBfromNits(rgb);
|
||||
|
||||
return GetOutputColorFromSCRGB(rgb) * input.color;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,20 +0,0 @@
|
||||
Texture2D theTextureY : register(t0);
|
||||
Texture2D theTextureUV : register(t1);
|
||||
SamplerState theSampler : register(s0);
|
||||
|
||||
#include "D3D11_PixelShader_Common.incl"
|
||||
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
|
||||
|
||||
float3 rgb;
|
||||
yuv += Yoffset.xyz;
|
||||
rgb.r = dot(yuv, Rcoeff.xyz);
|
||||
rgb.g = dot(yuv, Gcoeff.xyz);
|
||||
rgb.b = dot(yuv, Bcoeff.xyz);
|
||||
|
||||
return GetOutputColorFromSRGB(rgb) * input.color;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,20 +0,0 @@
|
||||
Texture2D theTextureY : register(t0);
|
||||
Texture2D theTextureUV : register(t1);
|
||||
SamplerState theSampler : register(s0);
|
||||
|
||||
#include "D3D11_PixelShader_Common.incl"
|
||||
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
|
||||
|
||||
float3 rgb;
|
||||
yuv += Yoffset.xyz;
|
||||
rgb.r = dot(yuv, Rcoeff.xyz);
|
||||
rgb.g = dot(yuv, Gcoeff.xyz);
|
||||
rgb.b = dot(yuv, Bcoeff.xyz);
|
||||
|
||||
return GetOutputColorFromSRGB(rgb) * input.color;
|
||||
}
|
||||
@@ -9,13 +9,17 @@
|
||||
// {
|
||||
//
|
||||
// float scRGB_output; // Offset: 0 Size: 4 [unused]
|
||||
// float color_scale; // Offset: 4 Size: 4
|
||||
// float unused1; // Offset: 8 Size: 4 [unused]
|
||||
// float unused2; // Offset: 12 Size: 4 [unused]
|
||||
// float4 Yoffset; // Offset: 16 Size: 16 [unused]
|
||||
// float4 Rcoeff; // Offset: 32 Size: 16 [unused]
|
||||
// float4 Gcoeff; // Offset: 48 Size: 16 [unused]
|
||||
// float4 Bcoeff; // Offset: 64 Size: 16 [unused]
|
||||
// float texture_type; // Offset: 4 Size: 4 [unused]
|
||||
// float input_type; // Offset: 8 Size: 4 [unused]
|
||||
// float color_scale; // Offset: 12 Size: 4
|
||||
// float tonemap_method; // Offset: 16 Size: 4 [unused]
|
||||
// float tonemap_factor1; // Offset: 20 Size: 4 [unused]
|
||||
// float tonemap_factor2; // Offset: 24 Size: 4 [unused]
|
||||
// float sdr_white_point; // Offset: 28 Size: 4 [unused]
|
||||
// float4 Yoffset; // Offset: 32 Size: 16 [unused]
|
||||
// float4 Rcoeff; // Offset: 48 Size: 16 [unused]
|
||||
// float4 Gcoeff; // Offset: 64 Size: 16 [unused]
|
||||
// float4 Bcoeff; // Offset: 80 Size: 16 [unused]
|
||||
//
|
||||
// }
|
||||
//
|
||||
@@ -67,7 +71,7 @@
|
||||
dcl t1
|
||||
dcl_2d s0
|
||||
texld r0, t0, s0
|
||||
mul r0.xyz, r0, c0.y
|
||||
mul r0.xyz, r0, c0.w
|
||||
mul r0, r0, t1
|
||||
mov oC0, r0
|
||||
|
||||
@@ -81,7 +85,7 @@ dcl_input_ps linear v2.xyzw
|
||||
dcl_output o0.xyzw
|
||||
dcl_temps 1
|
||||
sample r0.xyzw, v1.xyxx, t0.xyzw, s0
|
||||
mul r0.xyz, r0.xyzx, cb0[0].yyyy
|
||||
mul r0.xyz, r0.xyzx, cb0[0].wwww
|
||||
mul o0.xyzw, r0.xyzw, v2.xyzw
|
||||
ret
|
||||
// Approximately 4 instruction slots used
|
||||
@@ -89,15 +93,15 @@ ret
|
||||
|
||||
const BYTE g_main[] =
|
||||
{
|
||||
68, 88, 66, 67, 159, 171,
|
||||
49, 134, 139, 171, 105, 34,
|
||||
166, 1, 101, 132, 110, 4,
|
||||
121, 76, 1, 0, 0, 0,
|
||||
220, 4, 0, 0, 6, 0,
|
||||
68, 88, 66, 67, 8, 152,
|
||||
224, 210, 182, 254, 37, 89,
|
||||
68, 213, 13, 174, 95, 42,
|
||||
2, 11, 1, 0, 0, 0,
|
||||
132, 5, 0, 0, 6, 0,
|
||||
0, 0, 56, 0, 0, 0,
|
||||
220, 0, 0, 0, 168, 1,
|
||||
0, 0, 36, 2, 0, 0,
|
||||
52, 4, 0, 0, 168, 4,
|
||||
220, 4, 0, 0, 80, 5,
|
||||
0, 0, 65, 111, 110, 57,
|
||||
156, 0, 0, 0, 156, 0,
|
||||
0, 0, 0, 2, 255, 255,
|
||||
@@ -120,7 +124,7 @@ const BYTE g_main[] =
|
||||
0, 8, 228, 160, 5, 0,
|
||||
0, 3, 0, 0, 7, 128,
|
||||
0, 0, 228, 128, 0, 0,
|
||||
85, 160, 5, 0, 0, 3,
|
||||
255, 160, 5, 0, 0, 3,
|
||||
0, 0, 15, 128, 0, 0,
|
||||
228, 128, 1, 0, 228, 176,
|
||||
1, 0, 0, 2, 0, 8,
|
||||
@@ -152,7 +156,7 @@ const BYTE g_main[] =
|
||||
56, 0, 0, 8, 114, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
70, 2, 16, 0, 0, 0,
|
||||
0, 0, 86, 133, 32, 0,
|
||||
0, 0, 246, 143, 32, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 56, 0, 0, 7,
|
||||
242, 32, 16, 0, 0, 0,
|
||||
@@ -181,11 +185,11 @@ const BYTE g_main[] =
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 82, 68, 69, 70,
|
||||
8, 2, 0, 0, 1, 0,
|
||||
176, 2, 0, 0, 1, 0,
|
||||
0, 0, 156, 0, 0, 0,
|
||||
3, 0, 0, 0, 28, 0,
|
||||
0, 0, 0, 4, 255, 255,
|
||||
0, 1, 0, 0, 221, 1,
|
||||
0, 1, 0, 0, 133, 2,
|
||||
0, 0, 124, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
@@ -208,53 +212,81 @@ const BYTE g_main[] =
|
||||
120, 116, 117, 114, 101, 0,
|
||||
67, 111, 110, 115, 116, 97,
|
||||
110, 116, 115, 0, 146, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
180, 0, 0, 0, 80, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 116, 1,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
4, 0, 0, 0, 0, 0,
|
||||
0, 0, 132, 1, 0, 0,
|
||||
0, 0, 0, 0, 148, 1,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
4, 0, 0, 0, 2, 0,
|
||||
0, 0, 132, 1, 0, 0,
|
||||
0, 0, 0, 0, 160, 1,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
4, 0, 0, 0, 0, 0,
|
||||
0, 0, 132, 1, 0, 0,
|
||||
0, 0, 0, 0, 168, 1,
|
||||
0, 0, 12, 0, 0, 0,
|
||||
180, 0, 0, 0, 96, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 212, 1,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
4, 0, 0, 0, 0, 0,
|
||||
0, 0, 132, 1, 0, 0,
|
||||
0, 0, 0, 0, 176, 1,
|
||||
0, 0, 228, 1, 0, 0,
|
||||
0, 0, 0, 0, 244, 1,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
4, 0, 0, 0, 0, 0,
|
||||
0, 0, 228, 1, 0, 0,
|
||||
0, 0, 0, 0, 1, 2,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
4, 0, 0, 0, 0, 0,
|
||||
0, 0, 228, 1, 0, 0,
|
||||
0, 0, 0, 0, 12, 2,
|
||||
0, 0, 12, 0, 0, 0,
|
||||
4, 0, 0, 0, 2, 0,
|
||||
0, 0, 228, 1, 0, 0,
|
||||
0, 0, 0, 0, 24, 2,
|
||||
0, 0, 16, 0, 0, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
0, 0, 184, 1, 0, 0,
|
||||
0, 0, 0, 0, 200, 1,
|
||||
4, 0, 0, 0, 0, 0,
|
||||
0, 0, 228, 1, 0, 0,
|
||||
0, 0, 0, 0, 39, 2,
|
||||
0, 0, 20, 0, 0, 0,
|
||||
4, 0, 0, 0, 0, 0,
|
||||
0, 0, 228, 1, 0, 0,
|
||||
0, 0, 0, 0, 55, 2,
|
||||
0, 0, 24, 0, 0, 0,
|
||||
4, 0, 0, 0, 0, 0,
|
||||
0, 0, 228, 1, 0, 0,
|
||||
0, 0, 0, 0, 71, 2,
|
||||
0, 0, 28, 0, 0, 0,
|
||||
4, 0, 0, 0, 0, 0,
|
||||
0, 0, 228, 1, 0, 0,
|
||||
0, 0, 0, 0, 87, 2,
|
||||
0, 0, 32, 0, 0, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
0, 0, 184, 1, 0, 0,
|
||||
0, 0, 0, 0, 207, 1,
|
||||
0, 0, 96, 2, 0, 0,
|
||||
0, 0, 0, 0, 112, 2,
|
||||
0, 0, 48, 0, 0, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
0, 0, 184, 1, 0, 0,
|
||||
0, 0, 0, 0, 214, 1,
|
||||
0, 0, 96, 2, 0, 0,
|
||||
0, 0, 0, 0, 119, 2,
|
||||
0, 0, 64, 0, 0, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
0, 0, 184, 1, 0, 0,
|
||||
0, 0, 96, 2, 0, 0,
|
||||
0, 0, 0, 0, 126, 2,
|
||||
0, 0, 80, 0, 0, 0,
|
||||
16, 0, 0, 0, 0, 0,
|
||||
0, 0, 96, 2, 0, 0,
|
||||
0, 0, 0, 0, 115, 99,
|
||||
82, 71, 66, 95, 111, 117,
|
||||
116, 112, 117, 116, 0, 171,
|
||||
171, 171, 0, 0, 3, 0,
|
||||
1, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
116, 101, 120, 116, 117, 114,
|
||||
101, 95, 116, 121, 112, 101,
|
||||
0, 105, 110, 112, 117, 116,
|
||||
95, 116, 121, 112, 101, 0,
|
||||
99, 111, 108, 111, 114, 95,
|
||||
115, 99, 97, 108, 101, 0,
|
||||
117, 110, 117, 115, 101, 100,
|
||||
49, 0, 117, 110, 117, 115,
|
||||
101, 100, 50, 0, 89, 111,
|
||||
102, 102, 115, 101, 116, 0,
|
||||
116, 111, 110, 101, 109, 97,
|
||||
112, 95, 109, 101, 116, 104,
|
||||
111, 100, 0, 116, 111, 110,
|
||||
101, 109, 97, 112, 95, 102,
|
||||
97, 99, 116, 111, 114, 49,
|
||||
0, 116, 111, 110, 101, 109,
|
||||
97, 112, 95, 102, 97, 99,
|
||||
116, 111, 114, 50, 0, 115,
|
||||
100, 114, 95, 119, 104, 105,
|
||||
116, 101, 95, 112, 111, 105,
|
||||
110, 116, 0, 89, 111, 102,
|
||||
102, 115, 101, 116, 0, 171,
|
||||
1, 0, 3, 0, 1, 0,
|
||||
4, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 82, 99,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,22 +0,0 @@
|
||||
Texture2D theTextureY : register(t0);
|
||||
Texture2D theTextureU : register(t1);
|
||||
Texture2D theTextureV : register(t2);
|
||||
SamplerState theSampler : register(s0);
|
||||
|
||||
#include "D3D11_PixelShader_Common.incl"
|
||||
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
|
||||
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
|
||||
|
||||
float3 rgb;
|
||||
yuv += Yoffset.xyz;
|
||||
rgb.r = dot(yuv, Rcoeff.xyz);
|
||||
rgb.g = dot(yuv, Gcoeff.xyz);
|
||||
rgb.b = dot(yuv, Bcoeff.xyz);
|
||||
|
||||
return GetOutputColorFromSRGB(rgb) * input.color;
|
||||
}
|
||||
@@ -75,21 +75,41 @@ typedef struct
|
||||
Float4X4 projectionAndView;
|
||||
} VertexShaderConstants;
|
||||
|
||||
/* These should mirror the definitions in D3D11_PixelShader_Common.incl */
|
||||
//static const float TONEMAP_NONE = 0;
|
||||
//static const float TONEMAP_LINEAR = 1;
|
||||
static const float TONEMAP_CHROME = 2;
|
||||
|
||||
//static const float TEXTURETYPE_NONE = 0;
|
||||
static const float TEXTURETYPE_RGB = 1;
|
||||
static const float TEXTURETYPE_NV12 = 2;
|
||||
static const float TEXTURETYPE_NV21 = 3;
|
||||
static const float TEXTURETYPE_YUV = 4;
|
||||
|
||||
static const float INPUTTYPE_UNSPECIFIED = 0;
|
||||
static const float INPUTTYPE_SRGB = 1;
|
||||
static const float INPUTTYPE_SCRGB = 2;
|
||||
static const float INPUTTYPE_HDR10 = 3;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float scRGB_output;
|
||||
float texture_type;
|
||||
float input_type;
|
||||
float color_scale;
|
||||
float unused1;
|
||||
float unused2;
|
||||
|
||||
float tonemap_method;
|
||||
float tonemap_factor1;
|
||||
float tonemap_factor2;
|
||||
float sdr_white_point;
|
||||
|
||||
float YCbCr_matrix[16];
|
||||
} PixelShaderConstants;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ID3D11Buffer *constants;
|
||||
SDL_bool scRGB_output;
|
||||
float color_scale;
|
||||
const float *shader_params;
|
||||
PixelShaderConstants shader_constants;
|
||||
} PixelShaderState;
|
||||
|
||||
/* Per-vertex data */
|
||||
@@ -112,7 +132,7 @@ typedef struct
|
||||
int lockedTexturePositionY;
|
||||
D3D11_FILTER scaleMode;
|
||||
D3D11_Shader shader;
|
||||
const float *shader_params;
|
||||
const float *YCbCr_matrix;
|
||||
#if SDL_HAVE_YUV
|
||||
/* YV12 texture support */
|
||||
SDL_bool yuv;
|
||||
@@ -245,6 +265,8 @@ static DXGI_FORMAT SDLPixelFormatToDXGITextureFormat(Uint32 format, Uint32 color
|
||||
switch (format) {
|
||||
case SDL_PIXELFORMAT_RGBA64_FLOAT:
|
||||
return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||
case SDL_PIXELFORMAT_XBGR2101010:
|
||||
return DXGI_FORMAT_R10G10B10A2_UNORM;
|
||||
case SDL_PIXELFORMAT_ARGB8888:
|
||||
if (colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
|
||||
@@ -263,8 +285,6 @@ static DXGI_FORMAT SDLPixelFormatToDXGITextureFormat(Uint32 format, Uint32 color
|
||||
return DXGI_FORMAT_NV12;
|
||||
case SDL_PIXELFORMAT_P010:
|
||||
return DXGI_FORMAT_P010;
|
||||
case SDL_PIXELFORMAT_P016:
|
||||
return DXGI_FORMAT_P016;
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
@@ -275,6 +295,8 @@ static DXGI_FORMAT SDLPixelFormatToDXGIMainResourceViewFormat(Uint32 format, Uin
|
||||
switch (format) {
|
||||
case SDL_PIXELFORMAT_RGBA64_FLOAT:
|
||||
return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||
case SDL_PIXELFORMAT_XBGR2101010:
|
||||
return DXGI_FORMAT_R10G10B10A2_UNORM;
|
||||
case SDL_PIXELFORMAT_ARGB8888:
|
||||
if (colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
|
||||
@@ -291,7 +313,6 @@ static DXGI_FORMAT SDLPixelFormatToDXGIMainResourceViewFormat(Uint32 format, Uin
|
||||
case SDL_PIXELFORMAT_NV21: /* For the Y texture */
|
||||
return DXGI_FORMAT_R8_UNORM;
|
||||
case SDL_PIXELFORMAT_P010: /* For the Y texture */
|
||||
case SDL_PIXELFORMAT_P016: /* For the Y texture */
|
||||
return DXGI_FORMAT_R16_UNORM;
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
@@ -1267,14 +1288,17 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
/* NV12 textures must have even width and height */
|
||||
if (texture->format == SDL_PIXELFORMAT_NV12 ||
|
||||
texture->format == SDL_PIXELFORMAT_NV21 ||
|
||||
texture->format == SDL_PIXELFORMAT_P010 ||
|
||||
texture->format == SDL_PIXELFORMAT_P016) {
|
||||
texture->format == SDL_PIXELFORMAT_P010) {
|
||||
textureDesc.Width = (textureDesc.Width + 1) & ~1;
|
||||
textureDesc.Height = (textureDesc.Height + 1) & ~1;
|
||||
}
|
||||
textureData->w = (int)textureDesc.Width;
|
||||
textureData->h = (int)textureDesc.Height;
|
||||
textureData->shader = SHADER_RGB;
|
||||
if (SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_SRGB) {
|
||||
textureData->shader = SHADER_RGB;
|
||||
} else {
|
||||
textureData->shader = SHADER_ADVANCED;
|
||||
}
|
||||
|
||||
if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
|
||||
textureDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
@@ -1339,53 +1363,28 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
}
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER, textureData->mainTextureV);
|
||||
|
||||
textureData->shader = SHADER_YUV;
|
||||
textureData->shader_params = SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, 8);
|
||||
if (!textureData->shader_params) {
|
||||
textureData->YCbCr_matrix = SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, 8);
|
||||
if (!textureData->YCbCr_matrix) {
|
||||
return SDL_SetError("Unsupported YUV colorspace");
|
||||
}
|
||||
}
|
||||
if (texture->format == SDL_PIXELFORMAT_NV12 ||
|
||||
texture->format == SDL_PIXELFORMAT_NV21 ||
|
||||
texture->format == SDL_PIXELFORMAT_P010 ||
|
||||
texture->format == SDL_PIXELFORMAT_P016) {
|
||||
texture->format == SDL_PIXELFORMAT_P010) {
|
||||
int bits_per_pixel;
|
||||
|
||||
textureData->nv12 = SDL_TRUE;
|
||||
|
||||
switch (texture->format) {
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
textureData->shader = SHADER_NV12;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
textureData->shader = SHADER_NV21;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_P010:
|
||||
case SDL_PIXELFORMAT_P016:
|
||||
if(SDL_COLORSPACEPRIMARIES(texture->colorspace) == SDL_COLOR_PRIMARIES_BT2020 &&
|
||||
SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
||||
textureData->shader = SHADER_HDR10;
|
||||
} else {
|
||||
return SDL_SetError("Unsupported YUV colorspace");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* This should never happen because of the check above */
|
||||
return SDL_SetError("Unsupported YUV colorspace");
|
||||
}
|
||||
switch (texture->format) {
|
||||
case SDL_PIXELFORMAT_P010:
|
||||
bits_per_pixel = 10;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_P016:
|
||||
bits_per_pixel = 16;
|
||||
break;
|
||||
default:
|
||||
bits_per_pixel = 8;
|
||||
break;
|
||||
}
|
||||
textureData->shader_params = SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, bits_per_pixel);
|
||||
if (!textureData->shader_params) {
|
||||
textureData->YCbCr_matrix = SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, bits_per_pixel);
|
||||
if (!textureData->YCbCr_matrix) {
|
||||
return SDL_SetError("Unsupported YUV colorspace");
|
||||
}
|
||||
}
|
||||
@@ -1425,7 +1424,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
|
||||
if (texture->format == SDL_PIXELFORMAT_NV12 || texture->format == SDL_PIXELFORMAT_NV21) {
|
||||
nvResourceViewDesc.Format = DXGI_FORMAT_R8G8_UNORM;
|
||||
} else if (texture->format == SDL_PIXELFORMAT_P010 || texture->format == SDL_PIXELFORMAT_P016) {
|
||||
} else if (texture->format == SDL_PIXELFORMAT_P010) {
|
||||
nvResourceViewDesc.Format = DXGI_FORMAT_R16G16_UNORM;
|
||||
}
|
||||
|
||||
@@ -1503,8 +1502,7 @@ static int D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Tex
|
||||
stagingTextureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
stagingTextureDesc.Usage = D3D11_USAGE_STAGING;
|
||||
if (stagingTextureDesc.Format == DXGI_FORMAT_NV12 ||
|
||||
stagingTextureDesc.Format == DXGI_FORMAT_P010 ||
|
||||
stagingTextureDesc.Format == DXGI_FORMAT_P016) {
|
||||
stagingTextureDesc.Format == DXGI_FORMAT_P010) {
|
||||
stagingTextureDesc.Width = (stagingTextureDesc.Width + 1) & ~1;
|
||||
stagingTextureDesc.Height = (stagingTextureDesc.Height + 1) & ~1;
|
||||
}
|
||||
@@ -1548,8 +1546,7 @@ static int D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Tex
|
||||
}
|
||||
|
||||
if (stagingTextureDesc.Format == DXGI_FORMAT_NV12 ||
|
||||
stagingTextureDesc.Format == DXGI_FORMAT_P010 ||
|
||||
stagingTextureDesc.Format == DXGI_FORMAT_P016) {
|
||||
stagingTextureDesc.Format == DXGI_FORMAT_P010) {
|
||||
/* Copy the UV plane as well */
|
||||
h = (h + 1) / 2;
|
||||
length = (length + 1) & ~1;
|
||||
@@ -2170,8 +2167,71 @@ static ID3D11RenderTargetView *D3D11_GetCurrentRenderTargetView(SDL_Renderer *re
|
||||
}
|
||||
}
|
||||
|
||||
static void D3D11_SetupShaderConstants(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const SDL_Texture *texture, PixelShaderConstants *constants)
|
||||
{
|
||||
float output_headroom;
|
||||
|
||||
SDL_zerop(constants);
|
||||
|
||||
constants->scRGB_output = (float)SDL_RenderingLinearSpace(renderer);
|
||||
constants->color_scale = cmd->data.draw.color_scale;
|
||||
|
||||
if (texture) {
|
||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
||||
|
||||
switch (texture->format) {
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
constants->texture_type = TEXTURETYPE_YUV;
|
||||
constants->input_type = INPUTTYPE_SRGB;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
constants->texture_type = TEXTURETYPE_NV12;
|
||||
constants->input_type = INPUTTYPE_SRGB;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
constants->texture_type = TEXTURETYPE_NV21;
|
||||
constants->input_type = INPUTTYPE_SRGB;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_P010:
|
||||
constants->texture_type = TEXTURETYPE_NV12;
|
||||
constants->input_type = INPUTTYPE_HDR10;
|
||||
break;
|
||||
default:
|
||||
constants->texture_type = TEXTURETYPE_RGB;
|
||||
if (texture->colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
constants->input_type = INPUTTYPE_SCRGB;
|
||||
} else if (SDL_COLORSPACEPRIMARIES(texture->colorspace) == SDL_COLOR_PRIMARIES_BT2020 &&
|
||||
SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
||||
constants->input_type = INPUTTYPE_HDR10;
|
||||
} else {
|
||||
constants->input_type = INPUTTYPE_UNSPECIFIED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
constants->sdr_white_point = texture->SDR_white_point;
|
||||
|
||||
if (renderer->target) {
|
||||
output_headroom = renderer->target->HDR_headroom;
|
||||
} else {
|
||||
output_headroom = renderer->HDR_headroom;
|
||||
}
|
||||
|
||||
if (texture->HDR_headroom > output_headroom) {
|
||||
constants->tonemap_method = TONEMAP_CHROME;
|
||||
constants->tonemap_factor1 = (output_headroom / (texture->HDR_headroom * texture->HDR_headroom));
|
||||
constants->tonemap_factor2 = (1.0f / output_headroom);
|
||||
}
|
||||
|
||||
if (textureData->YCbCr_matrix) {
|
||||
SDL_memcpy(constants->YCbCr_matrix, textureData->YCbCr_matrix, sizeof(constants->YCbCr_matrix));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd,
|
||||
D3D11_Shader shader, const float *shader_params,
|
||||
D3D11_Shader shader, const PixelShaderConstants *shader_constants,
|
||||
const int numShaderResources, ID3D11ShaderResourceView **shaderResources,
|
||||
ID3D11SamplerState *sampler, const Float4X4 *matrix)
|
||||
|
||||
@@ -2184,9 +2244,8 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
const SDL_BlendMode blendMode = cmd->data.draw.blend;
|
||||
ID3D11BlendState *blendState = NULL;
|
||||
SDL_bool updateSubresource = SDL_FALSE;
|
||||
SDL_bool scRGB_output = SDL_RenderingLinearSpace(renderer);
|
||||
float color_scale = cmd->data.draw.color_scale;
|
||||
PixelShaderState *shader_state = &rendererData->currentShaderState[shader];
|
||||
PixelShaderConstants solid_constants;
|
||||
|
||||
if (numShaderResources > 0) {
|
||||
shaderResource = shaderResources[0];
|
||||
@@ -2260,37 +2319,31 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
rendererData->currentBlendState = blendState;
|
||||
}
|
||||
|
||||
if (!shader_state->constants ||
|
||||
scRGB_output != shader_state->scRGB_output ||
|
||||
color_scale != shader_state->color_scale ||
|
||||
shader_params != shader_state->shader_params) {
|
||||
SAFE_RELEASE(shader_state->constants);
|
||||
if (!shader_constants) {
|
||||
D3D11_SetupShaderConstants(renderer, cmd, NULL, &solid_constants);
|
||||
shader_constants = &solid_constants;
|
||||
}
|
||||
|
||||
PixelShaderConstants constants;
|
||||
constants.scRGB_output = (float)scRGB_output;
|
||||
constants.color_scale = color_scale;
|
||||
if (shader_params) {
|
||||
SDL_memcpy(constants.YCbCr_matrix, shader_params, sizeof(constants.YCbCr_matrix));
|
||||
}
|
||||
if (!shader_state->constants ||
|
||||
SDL_memcmp(shader_constants, &shader_state->shader_constants, sizeof(*shader_constants)) != 0) {
|
||||
SAFE_RELEASE(shader_state->constants);
|
||||
|
||||
D3D11_BUFFER_DESC desc;
|
||||
SDL_zero(desc);
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = sizeof(constants);
|
||||
desc.ByteWidth = sizeof(*shader_constants);
|
||||
desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
|
||||
|
||||
D3D11_SUBRESOURCE_DATA data;
|
||||
SDL_zero(data);
|
||||
data.pSysMem = &constants;
|
||||
data.pSysMem = shader_constants;
|
||||
|
||||
HRESULT result = ID3D11Device_CreateBuffer(rendererData->d3dDevice, &desc, &data, &shader_state->constants);
|
||||
if (FAILED(result)) {
|
||||
WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device::CreateBuffer [create shader constants]"), result);
|
||||
return -1;
|
||||
}
|
||||
shader_state->scRGB_output = scRGB_output;
|
||||
shader_state->color_scale = color_scale;
|
||||
shader_state->shader_params = shader_params;
|
||||
SDL_memcpy(&shader_state->shader_constants, shader_constants, sizeof(*shader_constants));
|
||||
|
||||
/* Force the shader parameters to be re-set */
|
||||
rendererData->currentShader = SHADER_NONE;
|
||||
@@ -2302,8 +2355,8 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
}
|
||||
}
|
||||
ID3D11DeviceContext_PSSetShader(rendererData->d3dContext, rendererData->pixelShaders[shader], NULL, 0);
|
||||
if (rendererData->currentShaderState[shader].constants) {
|
||||
ID3D11DeviceContext_PSSetConstantBuffers(rendererData->d3dContext, 0, 1, &rendererData->currentShaderState[shader].constants);
|
||||
if (shader_state->constants) {
|
||||
ID3D11DeviceContext_PSSetConstantBuffers(rendererData->d3dContext, 0, 1, &shader_state->constants);
|
||||
}
|
||||
rendererData->currentShader = shader;
|
||||
}
|
||||
@@ -2336,6 +2389,9 @@ static int D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
||||
ID3D11SamplerState *textureSampler;
|
||||
PixelShaderConstants constants;
|
||||
|
||||
D3D11_SetupShaderConstants(renderer, cmd, texture, &constants);
|
||||
|
||||
switch (textureData->scaleMode) {
|
||||
case D3D11_FILTER_MIN_MAG_MIP_POINT:
|
||||
@@ -2355,7 +2411,7 @@ static int D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
shaderResources[1] = textureData->mainTextureResourceViewU;
|
||||
shaderResources[2] = textureData->mainTextureResourceViewV;
|
||||
|
||||
return D3D11_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params,
|
||||
return D3D11_SetDrawState(renderer, cmd, textureData->shader, &constants,
|
||||
SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
|
||||
|
||||
} else if (textureData->nv12) {
|
||||
@@ -2364,11 +2420,11 @@ static int D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
shaderResources[0] = textureData->mainTextureResourceView;
|
||||
shaderResources[1] = textureData->mainTextureResourceViewNV;
|
||||
|
||||
return D3D11_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params,
|
||||
return D3D11_SetDrawState(renderer, cmd, textureData->shader, &constants,
|
||||
SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
|
||||
}
|
||||
#endif /* SDL_HAVE_YUV */
|
||||
return D3D11_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params,
|
||||
return D3D11_SetDrawState(renderer, cmd, textureData->shader, &constants,
|
||||
1, &textureData->mainTextureResourceView, textureSampler, matrix);
|
||||
}
|
||||
|
||||
@@ -2791,13 +2847,13 @@ SDL_RenderDriver D3D11_RenderDriver = {
|
||||
{ /* texture_formats */
|
||||
SDL_PIXELFORMAT_ARGB8888,
|
||||
SDL_PIXELFORMAT_XRGB8888,
|
||||
SDL_PIXELFORMAT_XBGR2101010,
|
||||
SDL_PIXELFORMAT_RGBA64_FLOAT,
|
||||
SDL_PIXELFORMAT_YV12,
|
||||
SDL_PIXELFORMAT_IYUV,
|
||||
SDL_PIXELFORMAT_NV12,
|
||||
SDL_PIXELFORMAT_NV21,
|
||||
SDL_PIXELFORMAT_P010,
|
||||
SDL_PIXELFORMAT_P016 },
|
||||
SDL_PIXELFORMAT_P010 },
|
||||
0, /* max_texture_width: will be filled in later */
|
||||
0 /* max_texture_height: will be filled in later */
|
||||
}
|
||||
|
||||
@@ -44,20 +44,8 @@
|
||||
#include "D3D11_PixelShader_Textures.h"
|
||||
#undef g_main
|
||||
|
||||
#define g_main D3D11_PixelShader_YUV
|
||||
#include "D3D11_PixelShader_YUV.h"
|
||||
#undef g_main
|
||||
|
||||
#define g_main D3D11_PixelShader_NV12
|
||||
#include "D3D11_PixelShader_NV12.h"
|
||||
#undef g_main
|
||||
|
||||
#define g_main D3D11_PixelShader_NV21
|
||||
#include "D3D11_PixelShader_NV21.h"
|
||||
#undef g_main
|
||||
|
||||
#define g_main D3D11_PixelShader_HDR10
|
||||
#include "D3D11_PixelShader_HDR10.h"
|
||||
#define g_main D3D11_PixelShader_Advanced
|
||||
#include "D3D11_PixelShader_Advanced.h"
|
||||
#undef g_main
|
||||
|
||||
#define g_main D3D11_VertexShader
|
||||
@@ -73,12 +61,7 @@ static struct
|
||||
{ NULL, 0 },
|
||||
{ D3D11_PixelShader_Colors, sizeof(D3D11_PixelShader_Colors) },
|
||||
{ D3D11_PixelShader_Textures, sizeof(D3D11_PixelShader_Textures) },
|
||||
#if SDL_HAVE_YUV
|
||||
{ D3D11_PixelShader_YUV, sizeof(D3D11_PixelShader_YUV) },
|
||||
{ D3D11_PixelShader_NV12, sizeof(D3D11_PixelShader_NV12) },
|
||||
{ D3D11_PixelShader_NV21, sizeof(D3D11_PixelShader_NV21) },
|
||||
{ D3D11_PixelShader_HDR10, sizeof(D3D11_PixelShader_HDR10) },
|
||||
#endif
|
||||
{ D3D11_PixelShader_Advanced, sizeof(D3D11_PixelShader_Advanced) },
|
||||
};
|
||||
SDL_COMPILE_TIME_ASSERT(D3D11_shaders, SDL_arraysize(D3D11_shaders) == NUM_SHADERS);
|
||||
|
||||
|
||||
@@ -27,12 +27,7 @@ typedef enum
|
||||
SHADER_NONE,
|
||||
SHADER_SOLID,
|
||||
SHADER_RGB,
|
||||
#if SDL_HAVE_YUV
|
||||
SHADER_YUV,
|
||||
SHADER_NV12,
|
||||
SHADER_NV21,
|
||||
SHADER_HDR10,
|
||||
#endif
|
||||
SHADER_ADVANCED,
|
||||
NUM_SHADERS
|
||||
} D3D11_Shader;
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
fxc /T ps_4_0_level_9_1 /Fh D3D11_PixelShader_Colors.h D3D11_PixelShader_Colors.hlsl
|
||||
fxc /T ps_4_0_level_9_1 /Fh D3D11_PixelShader_Textures.h D3D11_PixelShader_Textures.hlsl
|
||||
fxc /T ps_4_0_level_9_1 /Fh D3D11_PixelShader_YUV.h D3D11_PixelShader_YUV.hlsl
|
||||
fxc /T ps_4_0_level_9_1 /Fh D3D11_PixelShader_NV12.h D3D11_PixelShader_NV12.hlsl
|
||||
fxc /T ps_4_0_level_9_1 /Fh D3D11_PixelShader_NV21.h D3D11_PixelShader_NV21.hlsl
|
||||
fxc /T ps_5_0 /Fh D3D11_PixelShader_HDR10.h D3D11_PixelShader_HDR10.hlsl
|
||||
fxc /T ps_5_0 /Fh D3D11_PixelShader_Advanced.h D3D11_PixelShader_Advanced.hlsl
|
||||
fxc /T vs_4_0_level_9_1 /Fh D3D11_VertexShader.h D3D11_VertexShader.hlsl
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+5
-17
@@ -1,31 +1,19 @@
|
||||
Texture2D theTextureY : register(t0);
|
||||
Texture2D theTextureUV : register(t1);
|
||||
SamplerState theSampler : register(s0);
|
||||
|
||||
#include "D3D12_PixelShader_Common.incl"
|
||||
|
||||
#define NVRS \
|
||||
#define ADVANCEDRS \
|
||||
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
|
||||
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_HULL_SHADER_ROOT_ACCESS )," \
|
||||
"RootConstants(num32BitConstants=20, b1),"\
|
||||
"RootConstants(num32BitConstants=24, b1),"\
|
||||
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
|
||||
|
||||
[RootSignature(NVRS)]
|
||||
[RootSignature(ADVANCEDRS)]
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
|
||||
|
||||
float3 rgb;
|
||||
yuv += Yoffset.xyz;
|
||||
rgb.r = dot(yuv, Rcoeff.xyz);
|
||||
rgb.g = dot(yuv, Gcoeff.xyz);
|
||||
rgb.b = dot(yuv, Bcoeff.xyz);
|
||||
|
||||
return GetOutputColorFromSRGB(rgb) * input.color;
|
||||
return AdvancedPixelShader(input);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
"DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
|
||||
"DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
|
||||
"DENY_HULL_SHADER_ROOT_ACCESS )," \
|
||||
"RootConstants(num32BitConstants=20, b1)"
|
||||
"RootConstants(num32BitConstants=24, b1)"
|
||||
|
||||
[RootSignature(ColorRS)]
|
||||
float4 main(PixelShaderInput input) : SV_TARGET0
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
|
||||
Texture2D texture0 : register(t0);
|
||||
Texture2D texture1 : register(t1);
|
||||
Texture2D texture2 : register(t2);
|
||||
SamplerState sampler0 : register(s0);
|
||||
|
||||
struct PixelShaderInput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
@@ -5,12 +11,33 @@ struct PixelShaderInput
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
|
||||
// These should mirror the definitions in SDL_render_d3d12.c
|
||||
static const float TONEMAP_NONE = 0;
|
||||
static const float TONEMAP_LINEAR = 1;
|
||||
static const float TONEMAP_CHROME = 2;
|
||||
|
||||
static const float TEXTURETYPE_NONE = 0;
|
||||
static const float TEXTURETYPE_RGB = 1;
|
||||
static const float TEXTURETYPE_NV12 = 2;
|
||||
static const float TEXTURETYPE_NV21 = 3;
|
||||
static const float TEXTURETYPE_YUV = 4;
|
||||
|
||||
static const float INPUTTYPE_UNSPECIFIED = 0;
|
||||
static const float INPUTTYPE_SRGB = 1;
|
||||
static const float INPUTTYPE_SCRGB = 2;
|
||||
static const float INPUTTYPE_HDR10 = 3;
|
||||
|
||||
cbuffer Constants : register(b1)
|
||||
{
|
||||
float scRGB_output;
|
||||
float texture_type;
|
||||
float input_type;
|
||||
float color_scale;
|
||||
float unused1;
|
||||
float unused2;
|
||||
|
||||
float tonemap_method;
|
||||
float tonemap_factor1;
|
||||
float tonemap_factor2;
|
||||
float sdr_white_point;
|
||||
|
||||
float4 Yoffset;
|
||||
float4 Rcoeff;
|
||||
@@ -18,15 +45,17 @@ cbuffer Constants : register(b1)
|
||||
float4 Bcoeff;
|
||||
};
|
||||
|
||||
float3 scRGBtoNits(float3 v)
|
||||
{
|
||||
return v * 80.0;
|
||||
}
|
||||
static const float3x3 mat709to2020 = {
|
||||
{ 0.627404, 0.329283, 0.043313 },
|
||||
{ 0.069097, 0.919541, 0.011362 },
|
||||
{ 0.016391, 0.088013, 0.895595 }
|
||||
};
|
||||
|
||||
float3 scRGBfromNits(float3 v)
|
||||
{
|
||||
return v / 80.0;
|
||||
}
|
||||
static const float3x3 mat2020to709 = {
|
||||
{ 1.660496, -0.587656, -0.072840 },
|
||||
{ -0.124547, 1.132895, -0.008348 },
|
||||
{ -0.018154, -0.100597, 1.118751 }
|
||||
};
|
||||
|
||||
float sRGBtoLinear(float v)
|
||||
{
|
||||
@@ -48,6 +77,92 @@ float sRGBfromLinear(float v)
|
||||
return v;
|
||||
}
|
||||
|
||||
float3 PQtoLinear(float3 v)
|
||||
{
|
||||
const float c1 = 0.8359375;
|
||||
const float c2 = 18.8515625;
|
||||
const float c3 = 18.6875;
|
||||
const float oo_m1 = 1.0 / 0.1593017578125;
|
||||
const float oo_m2 = 1.0 / 78.84375;
|
||||
|
||||
float3 num = max(pow(abs(v), oo_m2) - c1, 0.0);
|
||||
float3 den = c2 - c3 * pow(abs(v), oo_m2);
|
||||
return (10000.0 * pow(abs(num / den), oo_m1) / sdr_white_point);
|
||||
}
|
||||
|
||||
float3 ApplyTonemap(float3 v)
|
||||
{
|
||||
if (tonemap_method == TONEMAP_LINEAR) {
|
||||
v *= tonemap_factor1;
|
||||
} else if (tonemap_method == TONEMAP_CHROME) {
|
||||
if (input_type == INPUTTYPE_SCRGB) {
|
||||
// Convert to BT.2020 colorspace for tone mapping
|
||||
v = mul(mat709to2020, v);
|
||||
}
|
||||
|
||||
float vmax = max(v.r, max(v.g, v.b));
|
||||
if (vmax > 0.0) {
|
||||
float scale = (1.0 + tonemap_factor1 * vmax) / (1.0 + tonemap_factor2 * vmax);
|
||||
v *= scale;
|
||||
}
|
||||
|
||||
if (input_type == INPUTTYPE_SCRGB) {
|
||||
// Convert to BT.709 colorspace after tone mapping
|
||||
v = mul(mat2020to709, v);
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
float4 GetInputColor(PixelShaderInput input)
|
||||
{
|
||||
float4 rgba;
|
||||
|
||||
if (texture_type == TEXTURETYPE_NONE) {
|
||||
rgba = 1.0;
|
||||
} else if (texture_type == TEXTURETYPE_RGB) {
|
||||
rgba = texture0.Sample(sampler0, input.tex);
|
||||
} else if (texture_type == TEXTURETYPE_NV12) {
|
||||
float3 yuv;
|
||||
yuv.x = texture0.Sample(sampler0, input.tex).r;
|
||||
yuv.yz = texture1.Sample(sampler0, input.tex).rg;
|
||||
|
||||
yuv += Yoffset.xyz;
|
||||
rgba.r = dot(yuv, Rcoeff.xyz);
|
||||
rgba.g = dot(yuv, Gcoeff.xyz);
|
||||
rgba.b = dot(yuv, Bcoeff.xyz);
|
||||
rgba.a = 1.0;
|
||||
} else if (texture_type == TEXTURETYPE_NV21) {
|
||||
float3 yuv;
|
||||
yuv.x = texture0.Sample(sampler0, input.tex).r;
|
||||
yuv.yz = texture1.Sample(sampler0, input.tex).gr;
|
||||
|
||||
yuv += Yoffset.xyz;
|
||||
rgba.r = dot(yuv, Rcoeff.xyz);
|
||||
rgba.g = dot(yuv, Gcoeff.xyz);
|
||||
rgba.b = dot(yuv, Bcoeff.xyz);
|
||||
rgba.a = 1.0;
|
||||
} else if (texture_type == TEXTURETYPE_YUV) {
|
||||
float3 yuv;
|
||||
yuv.x = texture0.Sample(sampler0, input.tex).r;
|
||||
yuv.y = texture1.Sample(sampler0, input.tex).r;
|
||||
yuv.z = texture2.Sample(sampler0, input.tex).r;
|
||||
|
||||
yuv += Yoffset.xyz;
|
||||
rgba.r = dot(yuv, Rcoeff.xyz);
|
||||
rgba.g = dot(yuv, Gcoeff.xyz);
|
||||
rgba.b = dot(yuv, Bcoeff.xyz);
|
||||
rgba.a = 1.0;
|
||||
} else {
|
||||
// Error!
|
||||
rgba.r = 1.0;
|
||||
rgba.g = 0.0;
|
||||
rgba.b = 0.0;
|
||||
rgba.a = 1.0;
|
||||
}
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 GetOutputColor(float4 rgba)
|
||||
{
|
||||
float4 output;
|
||||
@@ -58,9 +173,9 @@ float4 GetOutputColor(float4 rgba)
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 GetOutputColorFromSRGB(float3 rgb)
|
||||
float3 GetOutputColorFromSRGB(float3 rgb)
|
||||
{
|
||||
float4 output;
|
||||
float3 output;
|
||||
|
||||
if (scRGB_output) {
|
||||
rgb.r = sRGBtoLinear(rgb.r);
|
||||
@@ -69,17 +184,15 @@ float4 GetOutputColorFromSRGB(float3 rgb)
|
||||
}
|
||||
|
||||
output.rgb = rgb * color_scale;
|
||||
output.a = 1.0;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 GetOutputColorFromSCRGB(float3 rgb)
|
||||
float3 GetOutputColorFromLinear(float3 rgb)
|
||||
{
|
||||
float4 output;
|
||||
float3 output;
|
||||
|
||||
output.rgb = rgb * color_scale;
|
||||
output.a = 1.0;
|
||||
|
||||
if (!scRGB_output) {
|
||||
output.r = sRGBfromLinear(output.r);
|
||||
@@ -90,3 +203,33 @@ float4 GetOutputColorFromSCRGB(float3 rgb)
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 AdvancedPixelShader(PixelShaderInput input)
|
||||
{
|
||||
float4 rgba = GetInputColor(input);
|
||||
float4 output;
|
||||
|
||||
if (input_type == INPUTTYPE_HDR10) {
|
||||
rgba.rgb = PQtoLinear(rgba.rgb);
|
||||
}
|
||||
|
||||
if (tonemap_method != TONEMAP_NONE) {
|
||||
rgba.rgb = ApplyTonemap(rgba.rgb);
|
||||
}
|
||||
|
||||
if (input_type == INPUTTYPE_SRGB) {
|
||||
output.rgb = GetOutputColorFromSRGB(rgba.rgb);
|
||||
output.a = rgba.a;
|
||||
} else if (input_type == INPUTTYPE_SCRGB) {
|
||||
output.rgb = GetOutputColorFromLinear(rgba.rgb);
|
||||
output.a = rgba.a;
|
||||
} else if (input_type == INPUTTYPE_HDR10) {
|
||||
rgba.rgb = mul(mat2020to709, rgba.rgb);
|
||||
output.rgb = GetOutputColorFromLinear(rgba.rgb);
|
||||
output.a = rgba.a;
|
||||
} else {
|
||||
output = GetOutputColor(rgba);
|
||||
}
|
||||
|
||||
return output * input.color;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,56 +0,0 @@
|
||||
Texture2D theTextureY : register(t0);
|
||||
Texture2D theTextureUV : register(t1);
|
||||
SamplerState theSampler : register(s0);
|
||||
|
||||
#include "D3D12_PixelShader_Common.incl"
|
||||
|
||||
#define NVRS \
|
||||
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
|
||||
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_HULL_SHADER_ROOT_ACCESS )," \
|
||||
"RootConstants(num32BitConstants=20, b1),"\
|
||||
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
|
||||
|
||||
float3 PQtoNits(float3 v)
|
||||
{
|
||||
const float c1 = 0.8359375;
|
||||
const float c2 = 18.8515625;
|
||||
const float c3 = 18.6875;
|
||||
const float oo_m1 = 1.0 / 0.1593017578125;
|
||||
const float oo_m2 = 1.0 / 78.84375;
|
||||
|
||||
float3 num = max(pow(abs(v), oo_m2) - c1, 0.0);
|
||||
float3 den = c2 - c3 * pow(abs(v), oo_m2);
|
||||
return 10000.0 * pow(abs(num / den), oo_m1);
|
||||
}
|
||||
|
||||
[RootSignature(NVRS)]
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
const float3x3 mat2020to709 = {
|
||||
1.660496, -0.587656, -0.072840,
|
||||
-0.124547, 1.132895, -0.008348,
|
||||
-0.018154, -0.100597, 1.118751
|
||||
};
|
||||
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
|
||||
|
||||
float3 rgb;
|
||||
yuv += Yoffset.xyz;
|
||||
rgb.r = dot(yuv, Rcoeff.xyz);
|
||||
rgb.g = dot(yuv, Gcoeff.xyz);
|
||||
rgb.b = dot(yuv, Bcoeff.xyz);
|
||||
|
||||
rgb = PQtoNits(rgb);
|
||||
|
||||
rgb = mul(mat2020to709, rgb);
|
||||
|
||||
rgb = scRGBfromNits(rgb);
|
||||
|
||||
return GetOutputColorFromSCRGB(rgb) * input.color;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,31 +0,0 @@
|
||||
Texture2D theTextureY : register(t0);
|
||||
Texture2D theTextureUV : register(t1);
|
||||
SamplerState theSampler : register(s0);
|
||||
|
||||
#include "D3D12_PixelShader_Common.incl"
|
||||
|
||||
#define NVRS \
|
||||
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
|
||||
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_HULL_SHADER_ROOT_ACCESS )," \
|
||||
"RootConstants(num32BitConstants=20, b1),"\
|
||||
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
|
||||
|
||||
[RootSignature(NVRS)]
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
|
||||
|
||||
float3 rgb;
|
||||
yuv += Yoffset.xyz;
|
||||
rgb.r = dot(yuv, Rcoeff.xyz);
|
||||
rgb.g = dot(yuv, Gcoeff.xyz);
|
||||
rgb.b = dot(yuv, Bcoeff.xyz);
|
||||
|
||||
return GetOutputColorFromSRGB(rgb) * input.color;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,3 @@
|
||||
Texture2D theTexture : register(t0);
|
||||
SamplerState theSampler : register(s0);
|
||||
|
||||
#include "D3D12_PixelShader_Common.incl"
|
||||
|
||||
@@ -8,12 +6,12 @@ SamplerState theSampler : register(s0);
|
||||
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_HULL_SHADER_ROOT_ACCESS )," \
|
||||
"RootConstants(num32BitConstants=20, b1),"\
|
||||
"RootConstants(num32BitConstants=24, b1),"\
|
||||
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
|
||||
|
||||
[RootSignature(TextureRS)]
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
return GetOutputColor(theTexture.Sample(theSampler, input.tex)) * input.color;
|
||||
return GetOutputColor(texture0.Sample(sampler0, input.tex)) * input.color;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
Texture2D theTextureY : register(t0);
|
||||
Texture2D theTextureU : register(t1);
|
||||
Texture2D theTextureV : register(t2);
|
||||
SamplerState theSampler : register(s0);
|
||||
|
||||
#include "D3D12_PixelShader_Common.incl"
|
||||
|
||||
#define YUVRS \
|
||||
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
|
||||
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_HULL_SHADER_ROOT_ACCESS )," \
|
||||
"RootConstants(num32BitConstants=20, b1),"\
|
||||
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
|
||||
|
||||
[RootSignature(YUVRS)]
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
|
||||
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
|
||||
|
||||
float3 rgb;
|
||||
yuv += Yoffset.xyz;
|
||||
rgb.r = dot(yuv, Rcoeff.xyz);
|
||||
rgb.g = dot(yuv, Gcoeff.xyz);
|
||||
rgb.b = dot(yuv, Bcoeff.xyz);
|
||||
|
||||
return GetOutputColorFromSRGB(rgb) * input.color;
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
Disassembly failed
|
||||
#endif
|
||||
|
||||
const unsigned char g_YUVRS[] = {
|
||||
const unsigned char g_AdvancedRS[] = {
|
||||
0x44, 0x58, 0x42, 0x43, 0xc2, 0xcd, 0x2f, 0xaf, 0x3b, 0x72, 0x07, 0x2a,
|
||||
0xa9, 0x73, 0x1b, 0xab, 0x8e, 0x46, 0xf7, 0x46, 0x01, 0x00, 0x00, 0x00,
|
||||
0x24, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
|
||||
@@ -1,27 +0,0 @@
|
||||
#if 0
|
||||
Disassembly failed
|
||||
#endif
|
||||
|
||||
const unsigned char g_NVRS[] = {
|
||||
0x44, 0x58, 0x42, 0x43, 0xfd, 0x56, 0xee, 0x54, 0x9c, 0x1e, 0xc4, 0x3b,
|
||||
0xc6, 0x37, 0x26, 0x3f, 0x01, 0x62, 0x06, 0x1c, 0x01, 0x00, 0x00, 0x00,
|
||||
0xf8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
|
||||
0x52, 0x54, 0x53, 0x30, 0xcc, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x05, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xcc, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x05, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x05, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x05, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||
0x01, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
|
||||
};
|
||||
@@ -38,7 +38,7 @@ struct VertexShaderOutput
|
||||
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
|
||||
|
||||
#define YUVRS \
|
||||
#define AdvancedRS \
|
||||
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
|
||||
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
|
||||
@@ -50,17 +50,6 @@ struct VertexShaderOutput
|
||||
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
|
||||
|
||||
#define NVRS \
|
||||
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
|
||||
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
|
||||
" DENY_HULL_SHADER_ROOT_ACCESS )," \
|
||||
"RootConstants(num32BitConstants=32, b0),"\
|
||||
"RootConstants(num32BitConstants=20, b1),"\
|
||||
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
|
||||
|
||||
[RootSignature(ColorRS)]
|
||||
VertexShaderOutput mainColor(VertexShaderInput input)
|
||||
{
|
||||
@@ -85,14 +74,8 @@ VertexShaderOutput mainTexture(VertexShaderInput input)
|
||||
return mainColor(input);
|
||||
}
|
||||
|
||||
[RootSignature(YUVRS)]
|
||||
VertexShaderOutput mainYUV(VertexShaderInput input)
|
||||
{
|
||||
return mainColor(input);
|
||||
}
|
||||
|
||||
[RootSignature(NVRS)]
|
||||
VertexShaderOutput mainNV(VertexShaderInput input)
|
||||
[RootSignature(AdvancedRS)]
|
||||
VertexShaderOutput mainAdvanced(VertexShaderInput input)
|
||||
{
|
||||
return mainColor(input);
|
||||
}
|
||||
|
||||
+218
-216
@@ -17,7 +17,7 @@
|
||||
; TEXCOORD 0 xy 1 NONE float xy
|
||||
; COLOR 0 xyzw 2 NONE float xyzw
|
||||
;
|
||||
; shader hash: a80c812db8f3c804d5484e45d632860b
|
||||
; shader hash: c170d994513745a8e268b8d54da903ed
|
||||
;
|
||||
; Pipeline Runtime Information:
|
||||
;
|
||||
@@ -87,7 +87,7 @@ target triple = "dxil-ms-dx"
|
||||
%dx.types.CBufRet.f32 = type { float, float, float, float }
|
||||
%hostlayout.VertexShaderConstants = type { [4 x <4 x float>], [4 x <4 x float>] }
|
||||
|
||||
define void @mainYUV() {
|
||||
define void @mainAdvanced() {
|
||||
%1 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 2, i32 0, i32 0, i1 false) ; CreateHandle(resourceClass,rangeId,index,nonUniformIndex)
|
||||
%2 = call float @dx.op.loadInput.f32(i32 4, i32 2, i32 0, i8 0, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis)
|
||||
%3 = call float @dx.op.loadInput.f32(i32 4, i32 2, i32 0, i8 1, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis)
|
||||
@@ -218,7 +218,7 @@ attributes #2 = { nounwind readonly }
|
||||
!5 = !{!6}
|
||||
!6 = !{i32 0, %hostlayout.VertexShaderConstants* undef, !"", i32 0, i32 0, i32 1, i32 128, null}
|
||||
!7 = !{[14 x i32] [i32 12, i32 12, i32 15, i32 15, i32 15, i32 0, i32 16, i32 32, i32 0, i32 0, i32 256, i32 512, i32 1024, i32 2048]}
|
||||
!8 = !{void ()* @mainYUV, !"mainYUV", !9, !4, null}
|
||||
!8 = !{void ()* @mainAdvanced, !"mainAdvanced", !9, !4, null}
|
||||
!9 = !{!10, !18, null}
|
||||
!10 = !{!11, !14, !16}
|
||||
!11 = !{i32 0, !"POSITION", i8 9, i8 0, !12, i8 0, i32 1, i8 3, i32 0, i8 0, !13}
|
||||
@@ -235,13 +235,13 @@ attributes #2 = { nounwind readonly }
|
||||
|
||||
#endif
|
||||
|
||||
const unsigned char g_mainYUV[] = {
|
||||
0x44, 0x58, 0x42, 0x43, 0xbb, 0xef, 0x2b, 0x63, 0x10, 0x5a, 0xb4, 0x09,
|
||||
0xc0, 0x20, 0xa8, 0xff, 0x4d, 0xb1, 0xab, 0xe7, 0x01, 0x00, 0x00, 0x00,
|
||||
0x4f, 0x13, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
const unsigned char g_mainAdvanced[] = {
|
||||
0x44, 0x58, 0x42, 0x43, 0x2a, 0x90, 0x76, 0x57, 0x08, 0xab, 0xff, 0xa1,
|
||||
0x21, 0xd0, 0xb4, 0x0c, 0x31, 0xf8, 0x05, 0x5d, 0x01, 0x00, 0x00, 0x00,
|
||||
0x63, 0x13, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
0x50, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x63, 0x01, 0x00, 0x00,
|
||||
0x87, 0x02, 0x00, 0x00, 0x87, 0x03, 0x00, 0x00, 0x33, 0x0a, 0x00, 0x00,
|
||||
0x4f, 0x0a, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00,
|
||||
0x87, 0x02, 0x00, 0x00, 0x87, 0x03, 0x00, 0x00, 0x3f, 0x0a, 0x00, 0x00,
|
||||
0x5b, 0x0a, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31,
|
||||
0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -311,10 +311,10 @@ const unsigned char g_mainYUV[] = {
|
||||
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xe0,
|
||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
|
||||
0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0xa4, 0x06, 0x00, 0x00, 0x60,
|
||||
0x00, 0x01, 0x00, 0xa9, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00,
|
||||
0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x8c, 0x06, 0x00, 0x00, 0x42,
|
||||
0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x0b,
|
||||
0xff, 0xff, 0xff, 0x53, 0x54, 0x41, 0x54, 0xb0, 0x06, 0x00, 0x00, 0x60,
|
||||
0x00, 0x01, 0x00, 0xac, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00,
|
||||
0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x98, 0x06, 0x00, 0x00, 0x42,
|
||||
0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xa3, 0x01, 0x00, 0x00, 0x0b,
|
||||
0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07,
|
||||
0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92,
|
||||
0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80,
|
||||
@@ -366,7 +366,7 @@ const unsigned char g_mainYUV[] = {
|
||||
0xca, 0xa0, 0x08, 0x0a, 0x81, 0x62, 0x0d, 0xd0, 0x9d, 0x01, 0x20, 0x3c,
|
||||
0x03, 0x40, 0x79, 0x2c, 0x87, 0x61, 0x9e, 0xe7, 0x01, 0x20, 0x30, 0x00,
|
||||
0x00, 0x10, 0x01, 0x21, 0x10, 0x0c, 0x40, 0x50, 0x00, 0x00, 0x00, 0x79,
|
||||
0x18, 0x00, 0x00, 0x9e, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46,
|
||||
0x18, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46,
|
||||
0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b,
|
||||
0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1,
|
||||
0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa,
|
||||
@@ -385,81 +385,82 @@ const unsigned char g_mainYUV[] = {
|
||||
0x81, 0x78, 0x36, 0x28, 0x88, 0x26, 0x51, 0xd5, 0x66, 0x5d, 0x17, 0xb6,
|
||||
0x61, 0x60, 0x32, 0x6e, 0xc3, 0x40, 0x40, 0xdd, 0x04, 0x41, 0x00, 0x36,
|
||||
0x00, 0x1b, 0x06, 0x02, 0x0c, 0xc0, 0x60, 0x43, 0x10, 0x06, 0x1b, 0x86,
|
||||
0xe1, 0x13, 0x83, 0x09, 0x42, 0xc6, 0x6d, 0x08, 0xc8, 0x80, 0x47, 0x5b,
|
||||
0x58, 0x9a, 0x5b, 0x56, 0x95, 0x15, 0x11, 0xa8, 0xa7, 0xa9, 0x24, 0xaa,
|
||||
0xa4, 0x27, 0xa7, 0x09, 0x42, 0x41, 0x4d, 0x10, 0x8a, 0x6a, 0x43, 0x40,
|
||||
0x4c, 0x10, 0x0a, 0x6b, 0x83, 0x50, 0x59, 0x1b, 0x16, 0xe2, 0x0c, 0xd0,
|
||||
0x20, 0x0d, 0xd4, 0x20, 0x0d, 0x86, 0x35, 0x20, 0xd2, 0x80, 0x0d, 0x88,
|
||||
0x50, 0x15, 0x61, 0x0d, 0x3d, 0x3d, 0x49, 0x11, 0x4d, 0x10, 0x8a, 0x6b,
|
||||
0x83, 0x50, 0x55, 0x1b, 0x96, 0xc1, 0x0d, 0xd0, 0x20, 0x0d, 0xd4, 0x20,
|
||||
0x0d, 0x86, 0x37, 0x18, 0xd2, 0x00, 0x0e, 0x58, 0x0c, 0x3d, 0x31, 0x3d,
|
||||
0x49, 0x4d, 0x10, 0x0a, 0x6c, 0x82, 0x40, 0x40, 0x1b, 0x84, 0x8a, 0x0e,
|
||||
0x36, 0x2c, 0x92, 0x1c, 0xa0, 0x41, 0x1a, 0xa8, 0x41, 0x1a, 0x0c, 0x73,
|
||||
0x20, 0xa5, 0x41, 0x1d, 0x6c, 0x18, 0xda, 0x20, 0x0e, 0xec, 0x80, 0xcb,
|
||||
0x94, 0xd5, 0x17, 0xd4, 0xdb, 0x5c, 0x1a, 0x5d, 0xda, 0x9b, 0xdb, 0x86,
|
||||
0x85, 0xc0, 0x03, 0x34, 0x58, 0x03, 0x35, 0x98, 0x83, 0x61, 0x0e, 0x88,
|
||||
0x34, 0xa8, 0x83, 0x0d, 0xcb, 0xe0, 0x06, 0x68, 0x90, 0x06, 0x6a, 0xf0,
|
||||
0x06, 0xc3, 0x1b, 0x0c, 0x69, 0x00, 0x07, 0x1b, 0x16, 0x49, 0x0e, 0xd0,
|
||||
0x20, 0x0d, 0xd4, 0xe0, 0x0d, 0x86, 0x39, 0x90, 0xd2, 0xa0, 0x0e, 0x36,
|
||||
0x0c, 0x79, 0xa0, 0x07, 0x7b, 0xb0, 0x61, 0xb8, 0x03, 0x3e, 0x00, 0x36,
|
||||
0x14, 0x9f, 0x19, 0xf4, 0xc1, 0x03, 0xd0, 0x30, 0x63, 0x7b, 0x0b, 0xa3,
|
||||
0x9b, 0x9b, 0x20, 0x10, 0x11, 0x8b, 0x34, 0xb7, 0x39, 0xba, 0xb9, 0x09,
|
||||
0x02, 0x21, 0xd1, 0x98, 0x4b, 0x3b, 0xfb, 0x62, 0x23, 0xa3, 0x31, 0x97,
|
||||
0x76, 0xf6, 0x35, 0x47, 0x37, 0x41, 0x20, 0xa6, 0x0d, 0xc8, 0x1f, 0x80,
|
||||
0x42, 0x28, 0x88, 0xc2, 0x28, 0x5c, 0xa4, 0x50, 0x0a, 0x55, 0xd8, 0xd8,
|
||||
0xec, 0xda, 0x5c, 0xd2, 0xc8, 0xca, 0xdc, 0xe8, 0xa6, 0x04, 0x41, 0x15,
|
||||
0x32, 0x3c, 0x17, 0xbb, 0x32, 0xb9, 0xb9, 0xb4, 0x37, 0xb7, 0x29, 0x01,
|
||||
0xd1, 0x84, 0x0c, 0xcf, 0xc5, 0x2e, 0x8c, 0xcd, 0xae, 0x4c, 0x6e, 0x4a,
|
||||
0x50, 0xd4, 0x21, 0xc3, 0x73, 0x99, 0x43, 0x0b, 0x23, 0x2b, 0x93, 0x6b,
|
||||
0x7a, 0x23, 0x2b, 0x63, 0x9b, 0x12, 0x20, 0x65, 0xc8, 0xf0, 0x5c, 0xe4,
|
||||
0xca, 0xe6, 0xde, 0xea, 0xe4, 0xc6, 0xca, 0xe6, 0xa6, 0x04, 0x4e, 0x25,
|
||||
0x32, 0x3c, 0x17, 0xba, 0x3c, 0xb8, 0xb2, 0x20, 0x37, 0xb7, 0x37, 0xba,
|
||||
0x30, 0xba, 0xb4, 0x37, 0xb7, 0xb9, 0x29, 0x42, 0x27, 0x06, 0x75, 0xc8,
|
||||
0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92, 0xc8, 0xa6, 0xe8, 0xc2, 0xe8,
|
||||
0xca, 0xa6, 0x04, 0x64, 0x50, 0x87, 0x0c, 0xcf, 0xa5, 0xcc, 0x8d, 0x4e,
|
||||
0x2e, 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e, 0x6e, 0x4a, 0xd0, 0x07, 0x5d,
|
||||
0xc8, 0xf0, 0x5c, 0xc6, 0xde, 0xea, 0xdc, 0xe8, 0xca, 0xe4, 0xe6, 0xa6,
|
||||
0x04, 0xa5, 0x00, 0x79, 0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33,
|
||||
0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43,
|
||||
0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98,
|
||||
0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33,
|
||||
0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05,
|
||||
0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43,
|
||||
0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08,
|
||||
0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78,
|
||||
0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1,
|
||||
0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33,
|
||||
0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e,
|
||||
0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03,
|
||||
0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60,
|
||||
0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80,
|
||||
0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8,
|
||||
0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18,
|
||||
0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee,
|
||||
0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c,
|
||||
0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c,
|
||||
0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43,
|
||||
0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3,
|
||||
0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83,
|
||||
0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xc8, 0x21,
|
||||
0x07, 0x7c, 0x70, 0x03, 0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7b, 0x08,
|
||||
0x07, 0x79, 0x60, 0x87, 0x70, 0xc8, 0x87, 0x77, 0xa8, 0x07, 0x7a, 0x00,
|
||||
0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x36,
|
||||
0xb0, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x50, 0x45, 0x41, 0x44, 0xa5,
|
||||
0x03, 0x0c, 0x25, 0x61, 0x00, 0x02, 0xe6, 0x17, 0xb7, 0x6d, 0x05, 0xd2,
|
||||
0x70, 0xf9, 0xce, 0xe3, 0x0b, 0x11, 0x01, 0x4c, 0x44, 0x08, 0x34, 0xc3,
|
||||
0x42, 0x58, 0xc0, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62,
|
||||
0xf3, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, 0x3b, 0x8f,
|
||||
0x2f, 0x4d, 0x4e, 0x44, 0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, 0xdc, 0xb6,
|
||||
0x11, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, 0x11, 0xd1, 0x84, 0x00, 0x11,
|
||||
0xe6, 0x17, 0xb7, 0x6d, 0x00, 0x07, 0x03, 0x20, 0x8d, 0xec, 0xbe, 0x00,
|
||||
0xe1, 0x13, 0x83, 0x09, 0x42, 0xc6, 0x6d, 0x08, 0xc8, 0x80, 0x4c, 0x5b,
|
||||
0x58, 0x9a, 0x5b, 0x10, 0x99, 0x5d, 0x98, 0xdb, 0x58, 0x19, 0x19, 0x11,
|
||||
0xa8, 0xa7, 0xa9, 0x24, 0xaa, 0xa4, 0x27, 0xa7, 0x09, 0x42, 0x41, 0x4d,
|
||||
0x10, 0x8a, 0x6a, 0x43, 0x40, 0x4c, 0x10, 0x0a, 0x6b, 0x83, 0x50, 0x59,
|
||||
0x1b, 0x16, 0xe2, 0x0c, 0xd0, 0x20, 0x0d, 0xd4, 0x20, 0x0d, 0x86, 0x35,
|
||||
0x20, 0xd2, 0x80, 0x0d, 0x88, 0x50, 0x15, 0x61, 0x0d, 0x3d, 0x3d, 0x49,
|
||||
0x11, 0x4d, 0x10, 0x8a, 0x6b, 0x83, 0x50, 0x55, 0x1b, 0x96, 0xc1, 0x0d,
|
||||
0xd0, 0x20, 0x0d, 0xd4, 0x20, 0x0d, 0x86, 0x37, 0x18, 0xd2, 0x00, 0x0e,
|
||||
0x58, 0x0c, 0x3d, 0x31, 0x3d, 0x49, 0x4d, 0x10, 0x0a, 0x6c, 0x82, 0x40,
|
||||
0x40, 0x1b, 0x84, 0x8a, 0x0e, 0x36, 0x2c, 0x92, 0x1c, 0xa0, 0x41, 0x1a,
|
||||
0xa8, 0x41, 0x1a, 0x0c, 0x73, 0x20, 0xa5, 0x41, 0x1d, 0x6c, 0x18, 0xda,
|
||||
0x20, 0x0e, 0xec, 0x80, 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xdb, 0x5c, 0x1a,
|
||||
0x5d, 0xda, 0x9b, 0xdb, 0x86, 0x85, 0xc0, 0x03, 0x34, 0x58, 0x03, 0x35,
|
||||
0x98, 0x83, 0x61, 0x0e, 0x88, 0x34, 0xa8, 0x83, 0x0d, 0xcb, 0xe0, 0x06,
|
||||
0x68, 0x90, 0x06, 0x6a, 0xf0, 0x06, 0xc3, 0x1b, 0x0c, 0x69, 0x00, 0x07,
|
||||
0x1b, 0x16, 0x49, 0x0e, 0xd0, 0x20, 0x0d, 0xd4, 0xe0, 0x0d, 0x86, 0x39,
|
||||
0x90, 0xd2, 0xa0, 0x0e, 0x36, 0x0c, 0x79, 0xa0, 0x07, 0x7b, 0xb0, 0x61,
|
||||
0xb8, 0x03, 0x3e, 0x00, 0x36, 0x14, 0x9f, 0x19, 0xf4, 0xc1, 0x03, 0xd0,
|
||||
0x30, 0x63, 0x7b, 0x0b, 0xa3, 0x9b, 0x9b, 0x20, 0x10, 0x11, 0x8b, 0x34,
|
||||
0xb7, 0x39, 0xba, 0xb9, 0x09, 0x02, 0x21, 0xd1, 0x98, 0x4b, 0x3b, 0xfb,
|
||||
0x62, 0x23, 0xa3, 0x31, 0x97, 0x76, 0xf6, 0x35, 0x47, 0x37, 0x41, 0x20,
|
||||
0xa6, 0x0d, 0xc8, 0x1f, 0x80, 0x42, 0x28, 0x88, 0xc2, 0x28, 0x5c, 0xa4,
|
||||
0x50, 0x0a, 0x55, 0xd8, 0xd8, 0xec, 0xda, 0x5c, 0xd2, 0xc8, 0xca, 0xdc,
|
||||
0xe8, 0xa6, 0x04, 0x41, 0x15, 0x32, 0x3c, 0x17, 0xbb, 0x32, 0xb9, 0xb9,
|
||||
0xb4, 0x37, 0xb7, 0x29, 0x01, 0xd1, 0x84, 0x0c, 0xcf, 0xc5, 0x2e, 0x8c,
|
||||
0xcd, 0xae, 0x4c, 0x6e, 0x4a, 0x50, 0xd4, 0x21, 0xc3, 0x73, 0x99, 0x43,
|
||||
0x0b, 0x23, 0x2b, 0x93, 0x6b, 0x7a, 0x23, 0x2b, 0x63, 0x9b, 0x12, 0x20,
|
||||
0x65, 0xc8, 0xf0, 0x5c, 0xe4, 0xca, 0xe6, 0xde, 0xea, 0xe4, 0xc6, 0xca,
|
||||
0xe6, 0xa6, 0x04, 0x4e, 0x25, 0x32, 0x3c, 0x17, 0xba, 0x3c, 0xb8, 0xb2,
|
||||
0x20, 0x37, 0xb7, 0x37, 0xba, 0x30, 0xba, 0xb4, 0x37, 0xb7, 0xb9, 0x29,
|
||||
0x42, 0x27, 0x06, 0x75, 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92,
|
||||
0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, 0xa6, 0x04, 0x64, 0x50, 0x87, 0x0c,
|
||||
0xcf, 0xa5, 0xcc, 0x8d, 0x4e, 0x2e, 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e,
|
||||
0x6e, 0x4a, 0xd0, 0x07, 0x5d, 0xc8, 0xf0, 0x5c, 0xc6, 0xde, 0xea, 0xdc,
|
||||
0xe8, 0xca, 0xe4, 0xe6, 0xa6, 0x04, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x79,
|
||||
0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4,
|
||||
0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c,
|
||||
0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00,
|
||||
0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2,
|
||||
0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38,
|
||||
0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d,
|
||||
0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87,
|
||||
0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87,
|
||||
0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30,
|
||||
0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde,
|
||||
0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b,
|
||||
0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c,
|
||||
0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07,
|
||||
0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87,
|
||||
0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87,
|
||||
0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87,
|
||||
0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0,
|
||||
0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc,
|
||||
0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4,
|
||||
0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39,
|
||||
0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38,
|
||||
0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b,
|
||||
0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xc8, 0x21, 0x07, 0x7c, 0x70, 0x03,
|
||||
0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7b, 0x08, 0x07, 0x79, 0x60, 0x87,
|
||||
0x70, 0xc8, 0x87, 0x77, 0xa8, 0x07, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x71,
|
||||
0x20, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x36, 0xb0, 0x0d, 0x97, 0xef,
|
||||
0x3c, 0xbe, 0x10, 0x50, 0x45, 0x41, 0x44, 0xa5, 0x03, 0x0c, 0x25, 0x61,
|
||||
0x00, 0x02, 0xe6, 0x17, 0xb7, 0x6d, 0x05, 0xd2, 0x70, 0xf9, 0xce, 0xe3,
|
||||
0x0b, 0x11, 0x01, 0x4c, 0x44, 0x08, 0x34, 0xc3, 0x42, 0x58, 0xc0, 0x34,
|
||||
0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62, 0xf3, 0x50, 0x93, 0x5f,
|
||||
0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x4d, 0x4e, 0x44,
|
||||
0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x11, 0x48, 0xc3, 0xe5,
|
||||
0x3b, 0x8f, 0x3f, 0x11, 0xd1, 0x84, 0x00, 0x11, 0xe6, 0x17, 0xb7, 0x6d,
|
||||
0x00, 0x0c, 0x03, 0x20, 0x8d, 0x36, 0x54, 0x40, 0x23, 0x10, 0x03, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x0c, 0x81, 0x2d, 0xb8,
|
||||
0xf3, 0xc8, 0x04, 0xd5, 0x48, 0x4e, 0x45, 0xd6, 0x32, 0x86, 0x0b, 0x44,
|
||||
0x58, 0x49, 0x4c, 0xf8, 0x08, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x3e,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x70, 0xd9, 0x94, 0x51,
|
||||
0x37, 0x45, 0xa8, 0xe2, 0x68, 0xb8, 0xd5, 0x4d, 0xa9, 0x03, 0xed, 0x44,
|
||||
0x58, 0x49, 0x4c, 0x00, 0x09, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x40,
|
||||
0x02, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10,
|
||||
0x00, 0x00, 0x00, 0xe0, 0x08, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21,
|
||||
0x0c, 0x00, 0x00, 0x35, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0xe8, 0x08, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21,
|
||||
0x0c, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41,
|
||||
0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25,
|
||||
0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42,
|
||||
@@ -509,7 +510,7 @@ const unsigned char g_mainYUV[] = {
|
||||
0xe5, 0x50, 0x04, 0xe5, 0x41, 0xa5, 0x24, 0x46, 0x00, 0xca, 0xa0, 0x08,
|
||||
0x0a, 0x81, 0xf0, 0x0c, 0x00, 0xe5, 0xb1, 0x1c, 0x86, 0x79, 0x9e, 0x07,
|
||||
0x80, 0xc0, 0x00, 0x00, 0x40, 0x04, 0x84, 0x40, 0x30, 0x00, 0x41, 0x01,
|
||||
0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x1a,
|
||||
0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x1a,
|
||||
0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73,
|
||||
0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71,
|
||||
0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a,
|
||||
@@ -519,133 +520,134 @@ const unsigned char g_mainYUV[] = {
|
||||
0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, 0x08, 0xd8, 0x44, 0x60, 0x82, 0x40,
|
||||
0x24, 0x1b, 0x10, 0x42, 0x59, 0x08, 0x62, 0x60, 0x80, 0x0d, 0x41, 0xb3,
|
||||
0x81, 0x00, 0x00, 0x07, 0x98, 0x20, 0x64, 0xd4, 0x86, 0x00, 0x9a, 0x20,
|
||||
0x08, 0x00, 0x8f, 0xb6, 0xb0, 0x34, 0xb7, 0xac, 0x2a, 0x2b, 0x22, 0x50,
|
||||
0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x13, 0x84, 0xc2, 0x99, 0x20,
|
||||
0x14, 0xcf, 0x86, 0x80, 0x98, 0x20, 0x14, 0xd0, 0x04, 0x81, 0x50, 0x26,
|
||||
0x08, 0xc4, 0xb2, 0x41, 0xc8, 0xb4, 0x0d, 0x0b, 0x41, 0x55, 0xd6, 0x65,
|
||||
0x0d, 0x18, 0x61, 0x6d, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4,
|
||||
0x88, 0x26, 0x08, 0x45, 0xb4, 0x41, 0xc8, 0xb2, 0x0d, 0xcb, 0xd0, 0x55,
|
||||
0xd6, 0x65, 0x0d, 0xde, 0x60, 0x7d, 0x13, 0x04, 0x82, 0x61, 0x31, 0xf4,
|
||||
0xc4, 0xf4, 0x24, 0x35, 0x41, 0x28, 0xa4, 0x09, 0x02, 0xd1, 0x6c, 0x10,
|
||||
0x32, 0x32, 0xd8, 0xb0, 0x84, 0x81, 0x18, 0x54, 0xd6, 0x65, 0x0d, 0x63,
|
||||
0x10, 0x06, 0x56, 0x19, 0x6c, 0x18, 0x38, 0x30, 0x30, 0x03, 0x2e, 0x53,
|
||||
0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1b, 0x16,
|
||||
0x02, 0x0d, 0x2a, 0xec, 0x1a, 0x83, 0x61, 0x0c, 0x08, 0xab, 0x0c, 0x36,
|
||||
0x2c, 0x43, 0x57, 0x59, 0x97, 0x37, 0x78, 0x83, 0xf5, 0x6d, 0x58, 0xc2,
|
||||
0x40, 0x0c, 0x2a, 0xeb, 0xf2, 0x86, 0x31, 0x08, 0x03, 0xab, 0x0c, 0x36,
|
||||
0x0c, 0x69, 0xa0, 0x06, 0x6b, 0xb0, 0x61, 0x38, 0x03, 0x36, 0x00, 0x36,
|
||||
0x14, 0xd2, 0xd4, 0x06, 0x0f, 0x50, 0x85, 0x8d, 0xcd, 0xae, 0xcd, 0x25,
|
||||
0x8d, 0xac, 0xcc, 0x8d, 0x6e, 0x4a, 0x10, 0x54, 0x21, 0xc3, 0x73, 0xb1,
|
||||
0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, 0x12, 0x10, 0x4d, 0xc8, 0xf0,
|
||||
0x5c, 0xec, 0xc2, 0xd8, 0xec, 0xca, 0xe4, 0xa6, 0x04, 0x46, 0x1d, 0x32,
|
||||
0x3c, 0x97, 0x39, 0xb4, 0x30, 0xb2, 0x32, 0xb9, 0xa6, 0x37, 0xb2, 0x32,
|
||||
0xb6, 0x29, 0x01, 0x52, 0x86, 0x0c, 0xcf, 0x45, 0xae, 0x6c, 0xee, 0xad,
|
||||
0x4e, 0x6e, 0xac, 0x6c, 0x6e, 0x4a, 0xe0, 0xd4, 0x21, 0xc3, 0x73, 0xb1,
|
||||
0x4b, 0x2b, 0xbb, 0x4b, 0x22, 0x9b, 0xa2, 0x0b, 0xa3, 0x2b, 0x9b, 0x12,
|
||||
0x40, 0x75, 0xc8, 0xf0, 0x5c, 0xca, 0xdc, 0xe8, 0xe4, 0xf2, 0xa0, 0xde,
|
||||
0xd2, 0xdc, 0xe8, 0xe6, 0xa6, 0x04, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x79,
|
||||
0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4,
|
||||
0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c,
|
||||
0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00,
|
||||
0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2,
|
||||
0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38,
|
||||
0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d,
|
||||
0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87,
|
||||
0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87,
|
||||
0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30,
|
||||
0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde,
|
||||
0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b,
|
||||
0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c,
|
||||
0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07,
|
||||
0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87,
|
||||
0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87,
|
||||
0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87,
|
||||
0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0,
|
||||
0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc,
|
||||
0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4,
|
||||
0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39,
|
||||
0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38,
|
||||
0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b,
|
||||
0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xc8, 0x21, 0x07, 0x7c, 0x70, 0x03,
|
||||
0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7b, 0x08, 0x07, 0x79, 0x60, 0x87,
|
||||
0x70, 0xc8, 0x87, 0x77, 0xa8, 0x07, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x71,
|
||||
0x20, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x36, 0xb0, 0x0d, 0x97, 0xef,
|
||||
0x3c, 0xbe, 0x10, 0x50, 0x45, 0x41, 0x44, 0xa5, 0x03, 0x0c, 0x25, 0x61,
|
||||
0x00, 0x02, 0xe6, 0x17, 0xb7, 0x6d, 0x05, 0xd2, 0x70, 0xf9, 0xce, 0xe3,
|
||||
0x0b, 0x11, 0x01, 0x4c, 0x44, 0x08, 0x34, 0xc3, 0x42, 0x58, 0xc0, 0x34,
|
||||
0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62, 0xf3, 0x50, 0x93, 0x5f,
|
||||
0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x4d, 0x4e, 0x44,
|
||||
0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x11, 0x48, 0xc3, 0xe5,
|
||||
0x3b, 0x8f, 0x3f, 0x11, 0xd1, 0x84, 0x00, 0x11, 0xe6, 0x17, 0xb7, 0x6d,
|
||||
0x00, 0x07, 0x03, 0x20, 0x8d, 0xec, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x61,
|
||||
0x20, 0x00, 0x00, 0xcf, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10,
|
||||
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x44, 0x8a, 0xab, 0x14, 0x0a,
|
||||
0x61, 0x06, 0xa0, 0xec, 0x4a, 0x8e, 0x4a, 0x09, 0x50, 0x1c, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x61, 0x03,
|
||||
0x63, 0x59, 0xc1, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x18, 0xdd, 0x21,
|
||||
0x5d, 0x8f, 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x86, 0x87, 0x4c,
|
||||
0x18, 0x71, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0xf1, 0x25, 0x54,
|
||||
0xf6, 0x20, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x80, 0x81, 0x52,
|
||||
0x69, 0x51, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46, 0x18, 0x2c,
|
||||
0xdc, 0x36, 0x29, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x88, 0x01,
|
||||
0xd3, 0x71, 0xc8, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xc6, 0x18,
|
||||
0x34, 0x5d, 0x57, 0x31, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x90,
|
||||
0x81, 0xe3, 0x79, 0x4a, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46,
|
||||
0x19, 0x3c, 0xdf, 0x57, 0x39, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0xd0,
|
||||
0x90, 0x81, 0xa3, 0x80, 0xc1, 0x68, 0x42, 0x00, 0x8c, 0x26, 0x08, 0xc1,
|
||||
0x68, 0xc2, 0x20, 0x8c, 0x26, 0x10, 0xc3, 0x88, 0xc1, 0x01, 0x80, 0x20,
|
||||
0x18, 0x34, 0x69, 0x30, 0x3d, 0x66, 0x30, 0x9a, 0x10, 0x00, 0xa3, 0x09,
|
||||
0x08, 0x00, 0x99, 0xb6, 0xb0, 0x34, 0xb7, 0x20, 0x32, 0xbb, 0x30, 0xb7,
|
||||
0xb1, 0x32, 0x32, 0x22, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e,
|
||||
0x13, 0x84, 0xc2, 0x99, 0x20, 0x14, 0xcf, 0x86, 0x80, 0x98, 0x20, 0x14,
|
||||
0xd0, 0x04, 0x81, 0x50, 0x26, 0x08, 0xc4, 0xb2, 0x41, 0xc8, 0xb4, 0x0d,
|
||||
0x0b, 0x41, 0x55, 0xd6, 0x65, 0x0d, 0x18, 0x61, 0x6d, 0x44, 0xa8, 0x8a,
|
||||
0xb0, 0x86, 0x9e, 0x9e, 0xa4, 0x88, 0x26, 0x08, 0x45, 0xb4, 0x41, 0xc8,
|
||||
0xb2, 0x0d, 0xcb, 0xd0, 0x55, 0xd6, 0x65, 0x0d, 0xde, 0x60, 0x7d, 0x13,
|
||||
0x04, 0x82, 0x61, 0x31, 0xf4, 0xc4, 0xf4, 0x24, 0x35, 0x41, 0x28, 0xa4,
|
||||
0x09, 0x02, 0xd1, 0x6c, 0x10, 0x32, 0x32, 0xd8, 0xb0, 0x84, 0x81, 0x18,
|
||||
0x54, 0xd6, 0x65, 0x0d, 0x63, 0x10, 0x06, 0x56, 0x19, 0x6c, 0x18, 0x38,
|
||||
0x30, 0x30, 0x03, 0x2e, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x1b, 0x16, 0x02, 0x0d, 0x2a, 0xec, 0x1a, 0x83, 0x61,
|
||||
0x0c, 0x08, 0xab, 0x0c, 0x36, 0x2c, 0x43, 0x57, 0x59, 0x97, 0x37, 0x78,
|
||||
0x83, 0xf5, 0x6d, 0x58, 0xc2, 0x40, 0x0c, 0x2a, 0xeb, 0xf2, 0x86, 0x31,
|
||||
0x08, 0x03, 0xab, 0x0c, 0x36, 0x0c, 0x69, 0xa0, 0x06, 0x6b, 0xb0, 0x61,
|
||||
0x38, 0x03, 0x36, 0x00, 0x36, 0x14, 0xd2, 0xd4, 0x06, 0x0f, 0x50, 0x85,
|
||||
0x8d, 0xcd, 0xae, 0xcd, 0x25, 0x8d, 0xac, 0xcc, 0x8d, 0x6e, 0x4a, 0x10,
|
||||
0x54, 0x21, 0xc3, 0x73, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x9b,
|
||||
0x12, 0x10, 0x4d, 0xc8, 0xf0, 0x5c, 0xec, 0xc2, 0xd8, 0xec, 0xca, 0xe4,
|
||||
0xa6, 0x04, 0x46, 0x1d, 0x32, 0x3c, 0x97, 0x39, 0xb4, 0x30, 0xb2, 0x32,
|
||||
0xb9, 0xa6, 0x37, 0xb2, 0x32, 0xb6, 0x29, 0x01, 0x52, 0x86, 0x0c, 0xcf,
|
||||
0x45, 0xae, 0x6c, 0xee, 0xad, 0x4e, 0x6e, 0xac, 0x6c, 0x6e, 0x4a, 0xe0,
|
||||
0xd4, 0x21, 0xc3, 0x73, 0xb1, 0x4b, 0x2b, 0xbb, 0x4b, 0x22, 0x9b, 0xa2,
|
||||
0x0b, 0xa3, 0x2b, 0x9b, 0x12, 0x40, 0x75, 0xc8, 0xf0, 0x5c, 0xca, 0xdc,
|
||||
0xe8, 0xe4, 0xf2, 0xa0, 0xde, 0xd2, 0xdc, 0xe8, 0xe6, 0xa6, 0x04, 0x6d,
|
||||
0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x33,
|
||||
0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43,
|
||||
0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98,
|
||||
0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33,
|
||||
0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05,
|
||||
0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43,
|
||||
0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08,
|
||||
0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78,
|
||||
0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1,
|
||||
0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33,
|
||||
0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e,
|
||||
0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03,
|
||||
0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60,
|
||||
0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80,
|
||||
0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8,
|
||||
0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18,
|
||||
0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee,
|
||||
0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c,
|
||||
0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c,
|
||||
0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43,
|
||||
0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3,
|
||||
0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83,
|
||||
0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xc8, 0x21,
|
||||
0x07, 0x7c, 0x70, 0x03, 0x72, 0x10, 0x87, 0x73, 0x70, 0x03, 0x7b, 0x08,
|
||||
0x07, 0x79, 0x60, 0x87, 0x70, 0xc8, 0x87, 0x77, 0xa8, 0x07, 0x7a, 0x00,
|
||||
0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x36,
|
||||
0xb0, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x50, 0x45, 0x41, 0x44, 0xa5,
|
||||
0x03, 0x0c, 0x25, 0x61, 0x00, 0x02, 0xe6, 0x17, 0xb7, 0x6d, 0x05, 0xd2,
|
||||
0x70, 0xf9, 0xce, 0xe3, 0x0b, 0x11, 0x01, 0x4c, 0x44, 0x08, 0x34, 0xc3,
|
||||
0x42, 0x58, 0xc0, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62,
|
||||
0xf3, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, 0x3b, 0x8f,
|
||||
0x2f, 0x4d, 0x4e, 0x44, 0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, 0xdc, 0xb6,
|
||||
0x11, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, 0x3f, 0x11, 0xd1, 0x84, 0x00, 0x11,
|
||||
0xe6, 0x17, 0xb7, 0x6d, 0x00, 0x0c, 0x03, 0x20, 0x8d, 0x36, 0x54, 0x40,
|
||||
0x23, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0xcf,
|
||||
0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x05,
|
||||
0x00, 0x00, 0x00, 0x44, 0x8a, 0xab, 0x14, 0x0a, 0x61, 0x06, 0xa0, 0xec,
|
||||
0x4a, 0x8e, 0x4a, 0x09, 0x50, 0x1c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x23,
|
||||
0x06, 0x09, 0x00, 0x82, 0x60, 0x20, 0x61, 0x03, 0x63, 0x59, 0xc1, 0x88,
|
||||
0x41, 0x02, 0x80, 0x20, 0x18, 0x18, 0xdd, 0x21, 0x5d, 0x8f, 0x31, 0x62,
|
||||
0x90, 0x00, 0x20, 0x08, 0x06, 0x86, 0x87, 0x4c, 0x18, 0x71, 0x8c, 0x18,
|
||||
0x24, 0x00, 0x08, 0x82, 0x81, 0xf1, 0x25, 0x54, 0xf6, 0x20, 0x23, 0x06,
|
||||
0x09, 0x00, 0x82, 0x60, 0x60, 0x80, 0x81, 0x52, 0x69, 0x51, 0x32, 0x62,
|
||||
0x90, 0x00, 0x20, 0x08, 0x06, 0x46, 0x18, 0x2c, 0xdc, 0x36, 0x29, 0x23,
|
||||
0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x88, 0x01, 0xd3, 0x71, 0xc8, 0x32,
|
||||
0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xc6, 0x18, 0x34, 0x5d, 0x57, 0x31,
|
||||
0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x90, 0x81, 0xe3, 0x79, 0x4a,
|
||||
0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x46, 0x19, 0x3c, 0xdf, 0x57,
|
||||
0x39, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0xd0, 0x90, 0x81, 0xa3, 0x80,
|
||||
0xc1, 0x68, 0x42, 0x00, 0x8c, 0x26, 0x08, 0xc1, 0x68, 0xc2, 0x20, 0x8c,
|
||||
0x26, 0x10, 0xc3, 0x88, 0xc1, 0x01, 0x80, 0x20, 0x18, 0x34, 0x69, 0x30,
|
||||
0x3d, 0x66, 0x30, 0x9a, 0x10, 0x00, 0xa3, 0x09, 0x42, 0x30, 0x9a, 0x30,
|
||||
0x08, 0xa3, 0x09, 0xc4, 0x30, 0x62, 0x70, 0x00, 0x20, 0x08, 0x06, 0x8d,
|
||||
0x1b, 0x60, 0x54, 0x19, 0x8c, 0x26, 0x04, 0xc0, 0x68, 0x82, 0x10, 0x8c,
|
||||
0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0x8c, 0x18, 0x1c, 0x00, 0x08, 0x82,
|
||||
0x41, 0x33, 0x07, 0x5d, 0xc6, 0x06, 0xa3, 0x09, 0x01, 0x30, 0x9a, 0x20,
|
||||
0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, 0x36, 0x5d, 0xf2, 0x19,
|
||||
0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x07, 0x0f, 0xce, 0xe0, 0x7a, 0x82,
|
||||
0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0xf2, 0x00, 0x0d, 0xae, 0x25,
|
||||
0xb0, 0xe0, 0x80, 0x8e, 0x59, 0x9b, 0x7c, 0x46, 0x0c, 0x10, 0x00, 0x04,
|
||||
0xc1, 0xe0, 0xe1, 0x83, 0x35, 0xd8, 0xa4, 0x60, 0xc4, 0x00, 0x01, 0x40,
|
||||
0x10, 0x0c, 0x9e, 0x3e, 0x60, 0x83, 0xcd, 0x09, 0x2c, 0x50, 0xa0, 0x63,
|
||||
0xd9, 0x27, 0x9f, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0x40, 0xe1,
|
||||
0x0d, 0xbe, 0x2a, 0x18, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x27, 0x14,
|
||||
0xe0, 0xe0, 0x8b, 0x02, 0x0b, 0x1a, 0xe8, 0x18, 0x37, 0x06, 0xf2, 0x19,
|
||||
0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x14, 0xe6, 0x60, 0x0c, 0xb0,
|
||||
0x60, 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x52, 0xa0, 0x83, 0x31,
|
||||
0xa0, 0x02, 0x0b, 0x20, 0xe8, 0x8c, 0x18, 0x1c, 0x00, 0x08, 0x82, 0x41,
|
||||
0x83, 0x0a, 0x72, 0xe0, 0x06, 0x74, 0x30, 0x9a, 0x10, 0x00, 0xa3, 0x09,
|
||||
0x42, 0x30, 0x9a, 0x30, 0x08, 0xa3, 0x09, 0xc4, 0x30, 0x62, 0x70, 0x00,
|
||||
0x20, 0x08, 0x06, 0x8d, 0x1b, 0x60, 0x54, 0x19, 0x8c, 0x26, 0x04, 0xc0,
|
||||
0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0x8c, 0x18,
|
||||
0x1c, 0x00, 0x08, 0x82, 0x41, 0x33, 0x07, 0x5d, 0xc6, 0x06, 0xa3, 0x09,
|
||||
0x01, 0x30, 0x9a, 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c,
|
||||
0x36, 0x5d, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x07, 0x0f,
|
||||
0xce, 0xe0, 0x7a, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0xf2,
|
||||
0x00, 0x0d, 0xae, 0x25, 0xb0, 0xe0, 0x80, 0x8e, 0x59, 0x9b, 0x7c, 0x46,
|
||||
0x0c, 0x10, 0x00, 0x04, 0xc1, 0xe0, 0xe1, 0x83, 0x35, 0xd8, 0xa4, 0x60,
|
||||
0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x3e, 0x60, 0x83, 0xcd, 0x09,
|
||||
0x2c, 0x50, 0xa0, 0x63, 0xd9, 0x27, 0x9f, 0x11, 0x03, 0x04, 0x00, 0x41,
|
||||
0x30, 0x78, 0x40, 0xe1, 0x0d, 0xbe, 0x2a, 0x18, 0x31, 0x40, 0x00, 0x10,
|
||||
0x04, 0x83, 0x27, 0x14, 0xe0, 0xe0, 0x8b, 0x02, 0x0b, 0x1a, 0xe8, 0x18,
|
||||
0x37, 0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x14,
|
||||
0xe6, 0x60, 0x0c, 0xb0, 0x60, 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e,
|
||||
0x52, 0xa0, 0x83, 0x31, 0xa0, 0x02, 0x0b, 0x20, 0xe8, 0x8c, 0x18, 0x1c,
|
||||
0x00, 0x08, 0x82, 0x41, 0x83, 0x0a, 0x72, 0xe0, 0x06, 0x74, 0x30, 0x9a,
|
||||
0x10, 0x00, 0xa3, 0x09, 0x42, 0x30, 0x9a, 0x30, 0x08, 0xa3, 0x09, 0xc4,
|
||||
0x30, 0x62, 0x70, 0x00, 0x20, 0x08, 0x06, 0x4d, 0x2b, 0xdc, 0xc1, 0x1c,
|
||||
0xe8, 0xc1, 0x68, 0x42, 0x00, 0x8c, 0x26, 0x08, 0xc1, 0x68, 0xc2, 0x20,
|
||||
0x8c, 0x26, 0x10, 0xc3, 0x88, 0xc1, 0x01, 0x80, 0x20, 0x18, 0x34, 0xb2,
|
||||
0xc0, 0x07, 0x78, 0xd0, 0x0a, 0xa3, 0x09, 0x01, 0x30, 0x9a, 0x20, 0x04,
|
||||
0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, 0x23, 0x06, 0x07, 0x00, 0x82,
|
||||
0x60, 0xd0, 0xdc, 0x42, 0x28, 0xf4, 0xc1, 0x2b, 0x8c, 0x26, 0x04, 0xc0,
|
||||
0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0xd8, 0x14,
|
||||
0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x17, 0x56,
|
||||
0xc1, 0x7b, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0x7a, 0x81,
|
||||
0x15, 0xb6, 0x25, 0x18, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0xc7, 0x17,
|
||||
0x5a, 0x01, 0x3b, 0x02, 0xb3, 0xca, 0x40, 0x3e, 0x23, 0x06, 0x08, 0x00,
|
||||
0x82, 0x60, 0xf0, 0x80, 0xc3, 0x2b, 0x88, 0x81, 0x14, 0x8c, 0x18, 0x20,
|
||||
0x00, 0x08, 0x82, 0xc1, 0x13, 0x0e, 0xb0, 0xf0, 0x39, 0xc1, 0x88, 0x01,
|
||||
0x02, 0x80, 0x20, 0x18, 0x3c, 0xe2, 0x10, 0x0b, 0x9c, 0x12, 0x58, 0x96,
|
||||
0x06, 0xf2, 0x19, 0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x1c, 0x66,
|
||||
0xc1, 0x0c, 0xaa, 0x60, 0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x72,
|
||||
0xa0, 0x85, 0x31, 0x88, 0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78,
|
||||
0xcc, 0xa1, 0x16, 0xc0, 0xa0, 0x09, 0x8c, 0x6b, 0x03, 0xf9, 0x8c, 0x18,
|
||||
0x20, 0x00, 0x08, 0x82, 0xc1, 0x83, 0x0e, 0xb7, 0xa0, 0x06, 0x58, 0x30,
|
||||
0x62, 0x80, 0x00, 0x20, 0x08, 0x06, 0x4f, 0x3a, 0xe0, 0xc2, 0x19, 0x50,
|
||||
0xc1, 0x88, 0x01, 0x02, 0x80, 0x20, 0x18, 0x3c, 0xea, 0x90, 0x0b, 0x64,
|
||||
0x00, 0x05, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e,
|
||||
0xa0, 0x03, 0x3a, 0x80, 0x43, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06,
|
||||
0x48, 0x3b, 0xe4, 0x02, 0x3a, 0xa0, 0x03, 0x2d, 0x24, 0x23, 0x06, 0x09,
|
||||
0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0xa0, 0x03, 0x3a, 0xf8, 0x42,
|
||||
0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0x02, 0x3a,
|
||||
0xa0, 0xc3, 0x2f, 0x04, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xb4,
|
||||
0x43, 0x2e, 0xa4, 0x03, 0x3a, 0x80, 0x43, 0x2b, 0x8c, 0x18, 0x24, 0x00,
|
||||
0x08, 0x82, 0x01, 0xd2, 0x0e, 0xb9, 0x90, 0x0e, 0xe8, 0x40, 0x0b, 0xac,
|
||||
0x30, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0xc2, 0x38,
|
||||
0xa0, 0x03, 0x38, 0xc4, 0xc2, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20,
|
||||
0xed, 0x90, 0x0b, 0xe3, 0x80, 0x0e, 0xb4, 0x00, 0x0b, 0x23, 0x06, 0x09,
|
||||
0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0x8c, 0x03, 0x3a, 0xf8, 0xc2,
|
||||
0x2b, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xd2, 0x0e, 0xb9, 0x30,
|
||||
0x0e, 0xe8, 0xf0, 0x0b, 0xae, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
0x20, 0x08, 0x06, 0x4d, 0x2b, 0xdc, 0xc1, 0x1c, 0xe8, 0xc1, 0x68, 0x42,
|
||||
0x00, 0x8c, 0x26, 0x08, 0xc1, 0x68, 0xc2, 0x20, 0x8c, 0x26, 0x10, 0xc3,
|
||||
0x88, 0xc1, 0x01, 0x80, 0x20, 0x18, 0x34, 0xb2, 0xc0, 0x07, 0x78, 0xd0,
|
||||
0x0a, 0xa3, 0x09, 0x01, 0x30, 0x9a, 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30,
|
||||
0x9a, 0x40, 0x0c, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0xd0, 0xdc, 0x42,
|
||||
0x28, 0xf4, 0xc1, 0x2b, 0x8c, 0x26, 0x04, 0xc0, 0x68, 0x82, 0x10, 0x8c,
|
||||
0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0xd8, 0x14, 0x06, 0xf2, 0x19, 0x31,
|
||||
0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x17, 0x56, 0xc1, 0x7b, 0x82, 0x11,
|
||||
0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0x7a, 0x81, 0x15, 0xb6, 0x25, 0x18,
|
||||
0x31, 0x40, 0x00, 0x10, 0x04, 0x83, 0xc7, 0x17, 0x5a, 0x01, 0x3b, 0x02,
|
||||
0xb3, 0xca, 0x40, 0x3e, 0x23, 0x06, 0x08, 0x00, 0x82, 0x60, 0xf0, 0x80,
|
||||
0xc3, 0x2b, 0x88, 0x81, 0x14, 0x8c, 0x18, 0x20, 0x00, 0x08, 0x82, 0xc1,
|
||||
0x13, 0x0e, 0xb0, 0xf0, 0x39, 0xc1, 0x88, 0x01, 0x02, 0x80, 0x20, 0x18,
|
||||
0x3c, 0xe2, 0x10, 0x0b, 0x9c, 0x12, 0x58, 0x96, 0x06, 0xf2, 0x19, 0x31,
|
||||
0x40, 0x00, 0x10, 0x04, 0x83, 0x87, 0x1c, 0x66, 0xc1, 0x0c, 0xaa, 0x60,
|
||||
0xc4, 0x00, 0x01, 0x40, 0x10, 0x0c, 0x9e, 0x72, 0xa0, 0x85, 0x31, 0x88,
|
||||
0x82, 0x11, 0x03, 0x04, 0x00, 0x41, 0x30, 0x78, 0xcc, 0xa1, 0x16, 0xc0,
|
||||
0xa0, 0x09, 0x8c, 0x6b, 0x03, 0xf9, 0x8c, 0x18, 0x20, 0x00, 0x08, 0x82,
|
||||
0xc1, 0x83, 0x0e, 0xb7, 0xa0, 0x06, 0x58, 0x30, 0x62, 0x80, 0x00, 0x20,
|
||||
0x08, 0x06, 0x4f, 0x3a, 0xe0, 0xc2, 0x19, 0x50, 0xc1, 0x88, 0x01, 0x02,
|
||||
0x80, 0x20, 0x18, 0x3c, 0xea, 0x90, 0x0b, 0x64, 0x00, 0x05, 0x23, 0x06,
|
||||
0x09, 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0xa0, 0x03, 0x3a, 0x80,
|
||||
0x43, 0x33, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0x02,
|
||||
0x3a, 0xa0, 0x03, 0x2d, 0x24, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80,
|
||||
0xb4, 0x43, 0x2e, 0xa0, 0x03, 0x3a, 0xf8, 0x42, 0x31, 0x62, 0x90, 0x00,
|
||||
0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0x02, 0x3a, 0xa0, 0xc3, 0x2f, 0x04,
|
||||
0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xb4, 0x43, 0x2e, 0xa4, 0x03,
|
||||
0x3a, 0x80, 0x43, 0x2b, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xd2,
|
||||
0x0e, 0xb9, 0x90, 0x0e, 0xe8, 0x40, 0x0b, 0xac, 0x30, 0x62, 0x90, 0x00,
|
||||
0x20, 0x08, 0x06, 0x48, 0x3b, 0xe4, 0xc2, 0x38, 0xa0, 0x03, 0x38, 0xc4,
|
||||
0xc2, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0xed, 0x90, 0x0b, 0xe3,
|
||||
0x80, 0x0e, 0xb4, 0x00, 0x0b, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80,
|
||||
0xb4, 0x43, 0x2e, 0x8c, 0x03, 0x3a, 0xf8, 0xc2, 0x2b, 0x8c, 0x18, 0x24,
|
||||
0x00, 0x08, 0x82, 0x01, 0xd2, 0x0e, 0xb9, 0x30, 0x0e, 0xe8, 0xf0, 0x0b,
|
||||
0xae, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -88,12 +88,34 @@ typedef struct
|
||||
Float4X4 projectionAndView;
|
||||
} VertexShaderConstants;
|
||||
|
||||
/* These should mirror the definitions in D3D12_PixelShader_Common.incl */
|
||||
//static const float TONEMAP_NONE = 0;
|
||||
//static const float TONEMAP_LINEAR = 1;
|
||||
static const float TONEMAP_CHROME = 2;
|
||||
|
||||
//static const float TEXTURETYPE_NONE = 0;
|
||||
static const float TEXTURETYPE_RGB = 1;
|
||||
static const float TEXTURETYPE_NV12 = 2;
|
||||
static const float TEXTURETYPE_NV21 = 3;
|
||||
static const float TEXTURETYPE_YUV = 4;
|
||||
|
||||
static const float INPUTTYPE_UNSPECIFIED = 0;
|
||||
static const float INPUTTYPE_SRGB = 1;
|
||||
static const float INPUTTYPE_SCRGB = 2;
|
||||
static const float INPUTTYPE_HDR10 = 3;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float scRGB_output;
|
||||
float texture_type;
|
||||
float input_type;
|
||||
float color_scale;
|
||||
float unused1;
|
||||
float unused2;
|
||||
|
||||
float tonemap_method;
|
||||
float tonemap_factor1;
|
||||
float tonemap_factor2;
|
||||
float sdr_white_point;
|
||||
|
||||
float YCbCr_matrix[16];
|
||||
} PixelShaderConstants;
|
||||
|
||||
@@ -119,7 +141,7 @@ typedef struct
|
||||
D3D12_RESOURCE_STATES stagingResourceState;
|
||||
D3D12_FILTER scaleMode;
|
||||
D3D12_Shader shader;
|
||||
const float *shader_params;
|
||||
const float *YCbCr_matrix;
|
||||
#if SDL_HAVE_YUV
|
||||
/* YV12 texture support */
|
||||
SDL_bool yuv;
|
||||
@@ -147,9 +169,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
D3D12_Shader shader;
|
||||
SDL_bool scRGB_output;
|
||||
float color_scale;
|
||||
const float *shader_params;
|
||||
PixelShaderConstants shader_constants;
|
||||
SDL_BlendMode blendMode;
|
||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE topology;
|
||||
DXGI_FORMAT rtvFormat;
|
||||
@@ -309,6 +329,8 @@ static DXGI_FORMAT SDLPixelFormatToDXGITextureFormat(Uint32 format, Uint32 color
|
||||
switch (format) {
|
||||
case SDL_PIXELFORMAT_RGBA64_FLOAT:
|
||||
return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||
case SDL_PIXELFORMAT_XBGR2101010:
|
||||
return DXGI_FORMAT_R10G10B10A2_UNORM;
|
||||
case SDL_PIXELFORMAT_ARGB8888:
|
||||
if (colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
|
||||
@@ -327,8 +349,6 @@ static DXGI_FORMAT SDLPixelFormatToDXGITextureFormat(Uint32 format, Uint32 color
|
||||
return DXGI_FORMAT_NV12;
|
||||
case SDL_PIXELFORMAT_P010:
|
||||
return DXGI_FORMAT_P010;
|
||||
case SDL_PIXELFORMAT_P016:
|
||||
return DXGI_FORMAT_P016;
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
@@ -339,6 +359,8 @@ static DXGI_FORMAT SDLPixelFormatToDXGIMainResourceViewFormat(Uint32 format, Uin
|
||||
switch (format) {
|
||||
case SDL_PIXELFORMAT_RGBA64_FLOAT:
|
||||
return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||
case SDL_PIXELFORMAT_XBGR2101010:
|
||||
return DXGI_FORMAT_R10G10B10A2_UNORM;
|
||||
case SDL_PIXELFORMAT_ARGB8888:
|
||||
if (colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
|
||||
@@ -355,7 +377,6 @@ static DXGI_FORMAT SDLPixelFormatToDXGIMainResourceViewFormat(Uint32 format, Uin
|
||||
case SDL_PIXELFORMAT_NV21: /* For the Y texture */
|
||||
return DXGI_FORMAT_R8_UNORM;
|
||||
case SDL_PIXELFORMAT_P010: /* For the Y texture */
|
||||
case SDL_PIXELFORMAT_P016: /* For the Y texture */
|
||||
return DXGI_FORMAT_R16_UNORM;
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
@@ -1575,14 +1596,17 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
/* NV12 textures must have even width and height */
|
||||
if (texture->format == SDL_PIXELFORMAT_NV12 ||
|
||||
texture->format == SDL_PIXELFORMAT_NV21 ||
|
||||
texture->format == SDL_PIXELFORMAT_P010 ||
|
||||
texture->format == SDL_PIXELFORMAT_P016) {
|
||||
texture->format == SDL_PIXELFORMAT_P010) {
|
||||
textureDesc.Width = (textureDesc.Width + 1) & ~1;
|
||||
textureDesc.Height = (textureDesc.Height + 1) & ~1;
|
||||
}
|
||||
textureData->w = (int)textureDesc.Width;
|
||||
textureData->h = (int)textureDesc.Height;
|
||||
textureData->shader = SHADER_RGB;
|
||||
if (SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_SRGB) {
|
||||
textureData->shader = SHADER_RGB;
|
||||
} else {
|
||||
textureData->shader = SHADER_ADVANCED;
|
||||
}
|
||||
|
||||
if (texture->access == SDL_TEXTUREACCESS_TARGET) {
|
||||
textureDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
|
||||
@@ -1657,54 +1681,29 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
textureData->mainResourceStateV = D3D12_RESOURCE_STATE_COPY_DEST;
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER, textureData->mainTextureV);
|
||||
|
||||
textureData->shader = SHADER_YUV;
|
||||
textureData->shader_params = SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, 8);
|
||||
if (!textureData->shader_params) {
|
||||
textureData->YCbCr_matrix = SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, 8);
|
||||
if (!textureData->YCbCr_matrix) {
|
||||
return SDL_SetError("Unsupported YUV colorspace");
|
||||
}
|
||||
}
|
||||
|
||||
if (texture->format == SDL_PIXELFORMAT_NV12 ||
|
||||
texture->format == SDL_PIXELFORMAT_NV21 ||
|
||||
texture->format == SDL_PIXELFORMAT_P010 ||
|
||||
texture->format == SDL_PIXELFORMAT_P016) {
|
||||
texture->format == SDL_PIXELFORMAT_P010) {
|
||||
int bits_per_pixel;
|
||||
|
||||
textureData->nv12 = SDL_TRUE;
|
||||
|
||||
switch (texture->format) {
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
textureData->shader = SHADER_NV12;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
textureData->shader = SHADER_NV21;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_P010:
|
||||
case SDL_PIXELFORMAT_P016:
|
||||
if(SDL_COLORSPACEPRIMARIES(texture->colorspace) == SDL_COLOR_PRIMARIES_BT2020 &&
|
||||
SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
||||
textureData->shader = SHADER_HDR10;
|
||||
} else {
|
||||
return SDL_SetError("Unsupported YUV colorspace");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* This should never happen because of the check above */
|
||||
return SDL_SetError("Unsupported YUV colorspace");
|
||||
}
|
||||
switch (texture->format) {
|
||||
case SDL_PIXELFORMAT_P010:
|
||||
bits_per_pixel = 10;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_P016:
|
||||
bits_per_pixel = 16;
|
||||
break;
|
||||
default:
|
||||
bits_per_pixel = 8;
|
||||
break;
|
||||
}
|
||||
textureData->shader_params = SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, bits_per_pixel);
|
||||
if (!textureData->shader_params) {
|
||||
textureData->YCbCr_matrix = SDL_GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, bits_per_pixel);
|
||||
if (!textureData->YCbCr_matrix) {
|
||||
return SDL_SetError("Unsupported YUV colorspace");
|
||||
}
|
||||
}
|
||||
@@ -1747,7 +1746,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
|
||||
if (texture->format == SDL_PIXELFORMAT_NV12 || texture->format == SDL_PIXELFORMAT_NV21) {
|
||||
nvResourceViewDesc.Format = DXGI_FORMAT_R8G8_UNORM;
|
||||
} else if (texture->format == SDL_PIXELFORMAT_P010 || texture->format == SDL_PIXELFORMAT_P016) {
|
||||
} else if (texture->format == SDL_PIXELFORMAT_P010) {
|
||||
nvResourceViewDesc.Format = DXGI_FORMAT_R16G16_UNORM;
|
||||
}
|
||||
nvResourceViewDesc.Texture2D.PlaneSlice = 1;
|
||||
@@ -1837,8 +1836,7 @@ static int D3D12_UpdateTextureInternal(D3D12_RenderData *rendererData, ID3D12Res
|
||||
textureDesc.Width = w;
|
||||
textureDesc.Height = h;
|
||||
if (textureDesc.Format == DXGI_FORMAT_NV12 ||
|
||||
textureDesc.Format == DXGI_FORMAT_P010 ||
|
||||
textureDesc.Format == DXGI_FORMAT_P016) {
|
||||
textureDesc.Format == DXGI_FORMAT_P010) {
|
||||
textureDesc.Width = (textureDesc.Width + 1) & ~1;
|
||||
textureDesc.Height = (textureDesc.Height + 1) & ~1;
|
||||
}
|
||||
@@ -2519,7 +2517,70 @@ static int D3D12_UpdateViewport(SDL_Renderer *renderer)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, D3D12_Shader shader, const float *shader_params,
|
||||
static void D3D12_SetupShaderConstants(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const SDL_Texture *texture, PixelShaderConstants *constants)
|
||||
{
|
||||
float output_headroom;
|
||||
|
||||
SDL_zerop(constants);
|
||||
|
||||
constants->scRGB_output = (float)SDL_RenderingLinearSpace(renderer);
|
||||
constants->color_scale = cmd->data.draw.color_scale;
|
||||
|
||||
if (texture) {
|
||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
||||
|
||||
switch (texture->format) {
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
constants->texture_type = TEXTURETYPE_YUV;
|
||||
constants->input_type = INPUTTYPE_SRGB;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
constants->texture_type = TEXTURETYPE_NV12;
|
||||
constants->input_type = INPUTTYPE_SRGB;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
constants->texture_type = TEXTURETYPE_NV21;
|
||||
constants->input_type = INPUTTYPE_SRGB;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_P010:
|
||||
constants->texture_type = TEXTURETYPE_NV12;
|
||||
constants->input_type = INPUTTYPE_HDR10;
|
||||
break;
|
||||
default:
|
||||
constants->texture_type = TEXTURETYPE_RGB;
|
||||
if (texture->colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
constants->input_type = INPUTTYPE_SCRGB;
|
||||
} else if (SDL_COLORSPACEPRIMARIES(texture->colorspace) == SDL_COLOR_PRIMARIES_BT2020 &&
|
||||
SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
||||
constants->input_type = INPUTTYPE_HDR10;
|
||||
} else {
|
||||
constants->input_type = INPUTTYPE_UNSPECIFIED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
constants->sdr_white_point = texture->SDR_white_point;
|
||||
|
||||
if (renderer->target) {
|
||||
output_headroom = renderer->target->HDR_headroom;
|
||||
} else {
|
||||
output_headroom = renderer->HDR_headroom;
|
||||
}
|
||||
|
||||
if (texture->HDR_headroom > output_headroom) {
|
||||
constants->tonemap_method = TONEMAP_CHROME;
|
||||
constants->tonemap_factor1 = (output_headroom / (texture->HDR_headroom * texture->HDR_headroom));
|
||||
constants->tonemap_factor2 = (1.0f / output_headroom);
|
||||
}
|
||||
|
||||
if (textureData->YCbCr_matrix) {
|
||||
SDL_memcpy(constants->YCbCr_matrix, textureData->YCbCr_matrix, sizeof(constants->YCbCr_matrix));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, D3D12_Shader shader, const PixelShaderConstants *shader_constants,
|
||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE topology,
|
||||
const int numShaderResources, D3D12_CPU_DESCRIPTOR_HANDLE *shaderResources,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE *sampler, const Float4X4 *matrix)
|
||||
@@ -2533,19 +2594,19 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
int i;
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE firstShaderResource;
|
||||
DXGI_FORMAT rtvFormat = rendererData->renderTargetFormat;
|
||||
SDL_bool scRGB_output = SDL_RenderingLinearSpace(renderer);
|
||||
float color_scale = cmd->data.draw.color_scale;
|
||||
D3D12_PipelineState *currentPipelineState = rendererData->currentPipelineState;;
|
||||
PixelShaderConstants solid_constants;
|
||||
|
||||
if (rendererData->textureRenderTarget) {
|
||||
rtvFormat = rendererData->textureRenderTarget->mainTextureFormat;
|
||||
}
|
||||
|
||||
/* See if we need to change the pipeline state */
|
||||
if (!rendererData->currentPipelineState ||
|
||||
rendererData->currentPipelineState->shader != shader ||
|
||||
rendererData->currentPipelineState->blendMode != blendMode ||
|
||||
rendererData->currentPipelineState->topology != topology ||
|
||||
rendererData->currentPipelineState->rtvFormat != rtvFormat) {
|
||||
if (!currentPipelineState ||
|
||||
currentPipelineState->shader != shader ||
|
||||
currentPipelineState->blendMode != blendMode ||
|
||||
currentPipelineState->topology != topology ||
|
||||
currentPipelineState->rtvFormat != rtvFormat) {
|
||||
|
||||
/* Find the matching pipeline.
|
||||
NOTE: Although it may seem inefficient to linearly search through ~450 pipelines
|
||||
@@ -2553,35 +2614,36 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
It's unlikely that using a hash table would affect performance a measurable amount unless
|
||||
it's a degenerate case that's changing the pipeline state dozens of times per frame.
|
||||
*/
|
||||
rendererData->currentPipelineState = NULL;
|
||||
currentPipelineState = NULL;
|
||||
for (i = 0; i < rendererData->pipelineStateCount; ++i) {
|
||||
D3D12_PipelineState *candidatePiplineState = &rendererData->pipelineStates[i];
|
||||
if (candidatePiplineState->shader == shader &&
|
||||
candidatePiplineState->blendMode == blendMode &&
|
||||
candidatePiplineState->topology == topology &&
|
||||
candidatePiplineState->rtvFormat == rtvFormat) {
|
||||
rendererData->currentPipelineState = candidatePiplineState;
|
||||
currentPipelineState = candidatePiplineState;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we didn't find a match, create a new one -- it must mean the blend mode is non-standard */
|
||||
if (!rendererData->currentPipelineState) {
|
||||
rendererData->currentPipelineState = D3D12_CreatePipelineState(renderer, shader, blendMode, topology, rtvFormat);
|
||||
if (!currentPipelineState) {
|
||||
currentPipelineState = D3D12_CreatePipelineState(renderer, shader, blendMode, topology, rtvFormat);
|
||||
}
|
||||
|
||||
if (!rendererData->currentPipelineState) {
|
||||
if (!currentPipelineState) {
|
||||
/* The error has been set inside D3D12_CreatePipelineState() */
|
||||
return -1;
|
||||
}
|
||||
|
||||
D3D_CALL(rendererData->commandList, SetPipelineState, rendererData->currentPipelineState->pipelineState);
|
||||
D3D_CALL(rendererData->commandList, SetPipelineState, currentPipelineState->pipelineState);
|
||||
D3D_CALL(rendererData->commandList, SetGraphicsRootSignature,
|
||||
rendererData->rootSignatures[D3D12_GetRootSignatureType(rendererData->currentPipelineState->shader)]);
|
||||
rendererData->rootSignatures[D3D12_GetRootSignatureType(currentPipelineState->shader)]);
|
||||
/* When we change these we will need to re-upload the constant buffer and reset any descriptors */
|
||||
updateSubresource = SDL_TRUE;
|
||||
rendererData->currentSampler.ptr = 0;
|
||||
rendererData->currentShaderResource.ptr = 0;
|
||||
rendererData->currentPipelineState = currentPipelineState;
|
||||
}
|
||||
|
||||
if (renderTargetView.ptr != rendererData->currentRenderTargetView.ptr) {
|
||||
@@ -2628,16 +2690,9 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
case SHADER_RGB:
|
||||
tableIndex = 3;
|
||||
break;
|
||||
#if SDL_HAVE_YUV
|
||||
case SHADER_YUV:
|
||||
case SHADER_ADVANCED:
|
||||
tableIndex = 5;
|
||||
break;
|
||||
case SHADER_NV12:
|
||||
case SHADER_NV21:
|
||||
case SHADER_HDR10:
|
||||
tableIndex = 4;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return SDL_SetError("[direct3d12] Trying to set a sampler for a shader which doesn't have one");
|
||||
break;
|
||||
@@ -2656,28 +2711,20 @@ static int D3D12_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
0);
|
||||
}
|
||||
|
||||
if (!shader_constants) {
|
||||
D3D12_SetupShaderConstants(renderer, cmd, NULL, &solid_constants);
|
||||
shader_constants = &solid_constants;
|
||||
}
|
||||
|
||||
if (updateSubresource == SDL_TRUE ||
|
||||
scRGB_output != rendererData->currentPipelineState->scRGB_output ||
|
||||
color_scale != rendererData->currentPipelineState->color_scale ||
|
||||
(shader_params && shader_params != rendererData->currentPipelineState->shader_params)) {
|
||||
PixelShaderConstants constants;
|
||||
|
||||
constants.scRGB_output = (float)scRGB_output;
|
||||
constants.color_scale = color_scale;
|
||||
|
||||
if (shader_params) {
|
||||
SDL_memcpy(constants.YCbCr_matrix, shader_params, sizeof(constants.YCbCr_matrix));
|
||||
}
|
||||
|
||||
SDL_memcmp(shader_constants, ¤tPipelineState->shader_constants, sizeof(*shader_constants)) != 0) {
|
||||
D3D_CALL(rendererData->commandList, SetGraphicsRoot32BitConstants,
|
||||
1,
|
||||
20,
|
||||
&constants,
|
||||
sizeof(*shader_constants) / sizeof(float),
|
||||
shader_constants,
|
||||
0);
|
||||
|
||||
rendererData->currentPipelineState->scRGB_output = scRGB_output;
|
||||
rendererData->currentPipelineState->color_scale = color_scale;
|
||||
rendererData->currentPipelineState->shader_params = shader_params;
|
||||
SDL_memcpy(¤tPipelineState->shader_constants, shader_constants, sizeof(*shader_constants));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -2689,6 +2736,9 @@ static int D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE *textureSampler;
|
||||
PixelShaderConstants constants;
|
||||
|
||||
D3D12_SetupShaderConstants(renderer, cmd, texture, &constants);
|
||||
|
||||
switch (textureData->scaleMode) {
|
||||
case D3D12_FILTER_MIN_MAG_MIP_POINT:
|
||||
@@ -2716,7 +2766,7 @@ static int D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
D3D12_TransitionResource(rendererData, textureData->mainTextureV, textureData->mainResourceStateV, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
|
||||
textureData->mainResourceStateV = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
|
||||
|
||||
return D3D12_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
|
||||
return D3D12_SetDrawState(renderer, cmd, textureData->shader, &constants, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
|
||||
} else if (textureData->nv12) {
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE shaderResources[2];
|
||||
|
||||
@@ -2727,12 +2777,12 @@ static int D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
D3D12_TransitionResource(rendererData, textureData->mainTexture, textureData->mainResourceState, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
|
||||
textureData->mainResourceState = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
|
||||
|
||||
return D3D12_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
|
||||
return D3D12_SetDrawState(renderer, cmd, textureData->shader, &constants, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
|
||||
}
|
||||
#endif /* SDL_HAVE_YUV */
|
||||
D3D12_TransitionResource(rendererData, textureData->mainTexture, textureData->mainResourceState, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
|
||||
textureData->mainResourceState = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
|
||||
return D3D12_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, 1, &textureData->mainTextureResourceView, textureSampler, matrix);
|
||||
return D3D12_SetDrawState(renderer, cmd, textureData->shader, &constants, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, 1, &textureData->mainTextureResourceView, textureSampler, matrix);
|
||||
}
|
||||
|
||||
static void D3D12_DrawPrimitives(SDL_Renderer *renderer, D3D12_PRIMITIVE_TOPOLOGY primitiveTopology, const size_t vertexStart, const size_t vertexCount)
|
||||
@@ -3228,13 +3278,13 @@ SDL_RenderDriver D3D12_RenderDriver = {
|
||||
{ /* texture_formats */
|
||||
SDL_PIXELFORMAT_ARGB8888,
|
||||
SDL_PIXELFORMAT_XRGB8888,
|
||||
SDL_PIXELFORMAT_XBGR2101010,
|
||||
SDL_PIXELFORMAT_RGBA64_FLOAT,
|
||||
SDL_PIXELFORMAT_YV12,
|
||||
SDL_PIXELFORMAT_IYUV,
|
||||
SDL_PIXELFORMAT_NV12,
|
||||
SDL_PIXELFORMAT_NV21,
|
||||
SDL_PIXELFORMAT_P010,
|
||||
SDL_PIXELFORMAT_P016 },
|
||||
SDL_PIXELFORMAT_P010 },
|
||||
16384, /* max_texture_width */
|
||||
16384 /* max_texture_height */
|
||||
}
|
||||
|
||||
@@ -39,20 +39,8 @@
|
||||
#include "D3D12_PixelShader_Textures.h"
|
||||
#undef g_main
|
||||
|
||||
#define g_main D3D12_PixelShader_YUV
|
||||
#include "D3D12_PixelShader_YUV.h"
|
||||
#undef g_main
|
||||
|
||||
#define g_main D3D12_PixelShader_NV12
|
||||
#include "D3D12_PixelShader_NV12.h"
|
||||
#undef g_main
|
||||
|
||||
#define g_main D3D12_PixelShader_NV21
|
||||
#include "D3D12_PixelShader_NV21.h"
|
||||
#undef g_main
|
||||
|
||||
#define g_main D3D12_PixelShader_HDR10
|
||||
#include "D3D12_PixelShader_HDR10.h"
|
||||
#define g_main D3D12_PixelShader_Advanced
|
||||
#include "D3D12_PixelShader_Advanced.h"
|
||||
#undef g_main
|
||||
|
||||
|
||||
@@ -64,13 +52,9 @@
|
||||
#include "D3D12_VertexShader_Texture.h"
|
||||
#undef g_mainTexture
|
||||
|
||||
#define g_mainYUV D3D12_VertexShader_YUV
|
||||
#include "D3D12_VertexShader_YUV.h"
|
||||
#undef g_mainYUV
|
||||
|
||||
#define g_mainNV D3D12_VertexShader_NV
|
||||
#include "D3D12_VertexShader_NV.h"
|
||||
#undef g_mainNV
|
||||
#define g_mainAdvanced D3D12_VertexShader_Advanced
|
||||
#include "D3D12_VertexShader_Advanced.h"
|
||||
#undef g_mainAdvanced
|
||||
|
||||
|
||||
#define g_ColorRS D3D12_RootSig_Color
|
||||
@@ -81,13 +65,9 @@
|
||||
#include "D3D12_RootSig_Texture.h"
|
||||
#undef g_TextureRS
|
||||
|
||||
#define g_YUVRS D3D12_RootSig_YUV
|
||||
#include "D3D12_RootSig_YUV.h"
|
||||
#undef g_YUVRS
|
||||
|
||||
#define g_NVRS D3D12_RootSig_NV
|
||||
#include "D3D12_RootSig_NV.h"
|
||||
#undef g_NVRS
|
||||
#define g_AdvancedRS D3D12_RootSig_Advanced
|
||||
#include "D3D12_RootSig_Advanced.h"
|
||||
#undef g_AdvancedRS
|
||||
|
||||
|
||||
static struct
|
||||
@@ -104,20 +84,9 @@ static struct
|
||||
{ D3D12_PixelShader_Textures, sizeof(D3D12_PixelShader_Textures),
|
||||
D3D12_VertexShader_Textures, sizeof(D3D12_VertexShader_Textures),
|
||||
ROOTSIG_TEXTURE },
|
||||
#if SDL_HAVE_YUV
|
||||
{ D3D12_PixelShader_YUV, sizeof(D3D12_PixelShader_YUV),
|
||||
D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV),
|
||||
ROOTSIG_YUV },
|
||||
{ D3D12_PixelShader_NV12, sizeof(D3D12_PixelShader_NV12),
|
||||
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
|
||||
ROOTSIG_NV },
|
||||
{ D3D12_PixelShader_NV21, sizeof(D3D12_PixelShader_NV21),
|
||||
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
|
||||
ROOTSIG_NV },
|
||||
{ D3D12_PixelShader_HDR10, sizeof(D3D12_PixelShader_HDR10),
|
||||
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
|
||||
ROOTSIG_NV },
|
||||
#endif
|
||||
{ D3D12_PixelShader_Advanced, sizeof(D3D12_PixelShader_Advanced),
|
||||
D3D12_VertexShader_Advanced, sizeof(D3D12_VertexShader_Advanced),
|
||||
ROOTSIG_ADVANCED },
|
||||
};
|
||||
|
||||
static struct
|
||||
@@ -127,10 +96,7 @@ static struct
|
||||
} D3D12_rootsigs[NUM_ROOTSIGS] = {
|
||||
{ D3D12_RootSig_Color, sizeof(D3D12_RootSig_Color) },
|
||||
{ D3D12_RootSig_Texture, sizeof(D3D12_RootSig_Texture) },
|
||||
#if SDL_HAVE_YUV
|
||||
{ D3D12_RootSig_YUV, sizeof(D3D12_RootSig_YUV) },
|
||||
{ D3D12_RootSig_NV, sizeof(D3D12_RootSig_NV) },
|
||||
#endif
|
||||
{ D3D12_RootSig_Advanced, sizeof(D3D12_RootSig_Advanced) },
|
||||
};
|
||||
|
||||
void D3D12_GetVertexShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode)
|
||||
|
||||
@@ -31,12 +31,7 @@ typedef enum
|
||||
{
|
||||
SHADER_SOLID,
|
||||
SHADER_RGB,
|
||||
#if SDL_HAVE_YUV
|
||||
SHADER_YUV,
|
||||
SHADER_NV12,
|
||||
SHADER_NV21,
|
||||
SHADER_HDR10,
|
||||
#endif
|
||||
SHADER_ADVANCED,
|
||||
NUM_SHADERS
|
||||
} D3D12_Shader;
|
||||
|
||||
@@ -44,10 +39,7 @@ typedef enum
|
||||
{
|
||||
ROOTSIG_COLOR,
|
||||
ROOTSIG_TEXTURE,
|
||||
#if SDL_HAVE_YUV
|
||||
ROOTSIG_YUV,
|
||||
ROOTSIG_NV,
|
||||
#endif
|
||||
ROOTSIG_ADVANCED,
|
||||
NUM_ROOTSIGS
|
||||
} D3D12_RootSignature;
|
||||
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
dxc -E main -T ps_6_0 -Fh D3D12_PixelShader_Colors.h D3D12_PixelShader_Colors.hlsl
|
||||
dxc -E main -T ps_6_0 -Fh D3D12_PixelShader_Textures.h D3D12_PixelShader_Textures.hlsl
|
||||
dxc -E main -T ps_6_0 -Fh D3D12_PixelShader_YUV.h D3D12_PixelShader_YUV.hlsl
|
||||
dxc -E main -T ps_6_0 -Fh D3D12_PixelShader_NV12.h D3D12_PixelShader_NV12.hlsl
|
||||
dxc -E main -T ps_6_0 -Fh D3D12_PixelShader_NV21.h D3D12_PixelShader_NV21.hlsl
|
||||
dxc -E main -T ps_6_0 -Fh D3D12_PixelShader_HDR10.h D3D12_PixelShader_HDR10.hlsl
|
||||
dxc -E main -T ps_6_0 -Fh D3D12_PixelShader_Advanced.h D3D12_PixelShader_Advanced.hlsl
|
||||
|
||||
dxc -E mainColor -T vs_6_0 -Fh D3D12_VertexShader_Color.h D3D12_VertexShader.hlsl
|
||||
dxc -E mainTexture -T vs_6_0 -Fh D3D12_VertexShader_Texture.h D3D12_VertexShader.hlsl
|
||||
dxc -E mainYUV -T vs_6_0 -Fh D3D12_VertexShader_YUV.h D3D12_VertexShader.hlsl
|
||||
dxc -E mainNV -T vs_6_0 -Fh D3D12_VertexShader_NV.h D3D12_VertexShader.hlsl
|
||||
dxc -E mainAdvanced -T vs_6_0 -Fh D3D12_VertexShader_Advanced.h D3D12_VertexShader.hlsl
|
||||
|
||||
dxc -E ColorRS -T rootsig_1_1 -rootsig-define ColorRS -Fh D3D12_RootSig_Color.h D3D12_VertexShader.hlsl
|
||||
dxc -E TextureRS -T rootsig_1_1 -rootsig-define TextureRS -Fh D3D12_RootSig_Texture.h D3D12_VertexShader.hlsl
|
||||
dxc -E YUVRS -T rootsig_1_1 -rootsig-define YUVRS -Fh D3D12_RootSig_YUV.h D3D12_VertexShader.hlsl
|
||||
dxc -E NVRS -T rootsig_1_1 -rootsig-define NVRS -Fh D3D12_RootSig_NV.h D3D12_VertexShader.hlsl
|
||||
dxc -E AdvancedRS -T rootsig_1_1 -rootsig-define AdvancedRS -Fh D3D12_RootSig_Advanced.h D3D12_VertexShader.hlsl
|
||||
|
||||
@@ -91,9 +91,7 @@ typedef enum SDL_MetalFragmentFunction
|
||||
SDL_METAL_FRAGMENT_SOLID = 0,
|
||||
SDL_METAL_FRAGMENT_COPY,
|
||||
SDL_METAL_FRAGMENT_YUV,
|
||||
SDL_METAL_FRAGMENT_NV12,
|
||||
SDL_METAL_FRAGMENT_NV21,
|
||||
SDL_METAL_FRAGMENT_HDR10,
|
||||
SDL_METAL_FRAGMENT_ADVANCED,
|
||||
SDL_METAL_FRAGMENT_COUNT,
|
||||
} SDL_MetalFragmentFunction;
|
||||
|
||||
@@ -247,12 +245,8 @@ static NSString *GetFragmentFunctionName(SDL_MetalFragmentFunction function)
|
||||
return @"SDL_Copy_fragment";
|
||||
case SDL_METAL_FRAGMENT_YUV:
|
||||
return @"SDL_YUV_fragment";
|
||||
case SDL_METAL_FRAGMENT_NV12:
|
||||
return @"SDL_NV12_fragment";
|
||||
case SDL_METAL_FRAGMENT_NV21:
|
||||
return @"SDL_NV21_fragment";
|
||||
case SDL_METAL_FRAGMENT_HDR10:
|
||||
return @"SDL_HDR10_fragment";
|
||||
case SDL_METAL_FRAGMENT_ADVANCED:
|
||||
return @"SDL_Advanced_fragment";
|
||||
default:
|
||||
return nil;
|
||||
}
|
||||
@@ -390,9 +384,7 @@ void MakeShaderPipelines(METAL_RenderData *data, METAL_ShaderPipelines *pipeline
|
||||
MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_SOLID], "SDL primitives pipeline", rtformat, SDL_METAL_VERTEX_SOLID, SDL_METAL_FRAGMENT_SOLID);
|
||||
MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_COPY], "SDL copy pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_COPY);
|
||||
MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_YUV], "SDL YUV pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_YUV);
|
||||
MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_NV12], "SDL NV12 pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_NV12);
|
||||
MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_NV21], "SDL NV21 pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_NV21);
|
||||
MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_HDR10], "SDL HDR10 pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_HDR10);
|
||||
MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_ADVANCED], "SDL advanced pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_ADVANCED);
|
||||
}
|
||||
|
||||
static METAL_ShaderPipelines *ChooseShaderPipelines(METAL_RenderData *data, MTLPixelFormat rtformat)
|
||||
@@ -637,7 +629,8 @@ static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
MTLPixelFormat pixfmt;
|
||||
MTLTextureDescriptor *mtltexdesc;
|
||||
id<MTLTexture> mtltexture, mtltextureUv;
|
||||
BOOL yuv, nv12;
|
||||
BOOL yuv = FALSE;
|
||||
BOOL nv12 = FALSE;
|
||||
METAL_TextureData *texturedata;
|
||||
CVPixelBufferRef pixelbuffer = nil;
|
||||
IOSurfaceRef surface = nil;
|
||||
@@ -665,6 +658,9 @@ static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
pixfmt = MTLPixelFormatBGRA8Unorm;
|
||||
}
|
||||
break;
|
||||
case SDL_PIXELFORMAT_XBGR2101010:
|
||||
pixfmt = MTLPixelFormatRGB10A2Unorm;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
@@ -745,30 +741,17 @@ static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
|
||||
} else {
|
||||
texturedata.mtlsampler = data.mtlsamplerlinear;
|
||||
}
|
||||
if (SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_SRGB) {
|
||||
texturedata.fragmentFunction = SDL_METAL_FRAGMENT_COPY;
|
||||
} else if (yuv) {
|
||||
texturedata.fragmentFunction = SDL_METAL_FRAGMENT_YUV;
|
||||
} else {
|
||||
texturedata.fragmentFunction = SDL_METAL_FRAGMENT_ADVANCED;
|
||||
}
|
||||
texturedata.mtltexture = mtltexture;
|
||||
texturedata.mtltextureUv = mtltextureUv;
|
||||
#if SDL_HAVE_YUV
|
||||
texturedata.yuv = yuv;
|
||||
texturedata.nv12 = nv12;
|
||||
|
||||
if (yuv) {
|
||||
texturedata.fragmentFunction = SDL_METAL_FRAGMENT_YUV;
|
||||
} else if (texture->format == SDL_PIXELFORMAT_NV12) {
|
||||
texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV12;
|
||||
} else if (texture->format == SDL_PIXELFORMAT_NV21) {
|
||||
texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV21;
|
||||
} else if (texture->format == SDL_PIXELFORMAT_P010) {
|
||||
if(SDL_COLORSPACEPRIMARIES(texture->colorspace) == SDL_COLOR_PRIMARIES_BT2020 &&
|
||||
SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
||||
texturedata.fragmentFunction = SDL_METAL_FRAGMENT_HDR10;
|
||||
} else {
|
||||
return SDL_SetError("Unsupported YUV colorspace");
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
texturedata.fragmentFunction = SDL_METAL_FRAGMENT_COPY;
|
||||
}
|
||||
#if SDL_HAVE_YUV
|
||||
if (yuv || nv12) {
|
||||
size_t offset = GetYCbCRtoRGBConversionMatrix(texture->colorspace, texture->w, texture->h, 8);
|
||||
@@ -1167,20 +1150,6 @@ static int METAL_QueueNoOp(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||
return 0; /* nothing to do in this backend. */
|
||||
}
|
||||
|
||||
static int METAL_QueueSetColorScale(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
||||
{
|
||||
const size_t vertlen = (2 * sizeof(float));
|
||||
float *verts = (float *)SDL_AllocateRenderVertices(renderer, vertlen, DEVICE_ALIGN(8), &cmd->data.color.first);
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*verts++ = (float)SDL_RenderingLinearSpace(renderer);
|
||||
*verts++ = cmd->data.color.color_scale;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int METAL_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
|
||||
{
|
||||
SDL_FColor color = cmd->data.draw.color;
|
||||
@@ -1320,6 +1289,35 @@ static int METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* These should mirror the definitions in SDL_shaders_metal.metal */
|
||||
//static const float TONEMAP_NONE = 0;
|
||||
//static const float TONEMAP_LINEAR = 1;
|
||||
static const float TONEMAP_CHROME = 2;
|
||||
|
||||
//static const float TEXTURETYPE_NONE = 0;
|
||||
static const float TEXTURETYPE_RGB = 1;
|
||||
static const float TEXTURETYPE_NV12 = 2;
|
||||
static const float TEXTURETYPE_NV21 = 3;
|
||||
static const float TEXTURETYPE_YUV = 4;
|
||||
|
||||
static const float INPUTTYPE_UNSPECIFIED = 0;
|
||||
static const float INPUTTYPE_SRGB = 1;
|
||||
static const float INPUTTYPE_SCRGB = 2;
|
||||
static const float INPUTTYPE_HDR10 = 3;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float scRGB_output;
|
||||
float texture_type;
|
||||
float input_type;
|
||||
float color_scale;
|
||||
|
||||
float tonemap_method;
|
||||
float tonemap_factor1;
|
||||
float tonemap_factor2;
|
||||
float sdr_white_point;
|
||||
} PixelShaderConstants;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
__unsafe_unretained id<MTLRenderPipelineState> pipeline;
|
||||
@@ -1332,17 +1330,74 @@ typedef struct
|
||||
SDL_bool viewport_dirty;
|
||||
SDL_Rect viewport;
|
||||
size_t projection_offset;
|
||||
SDL_bool color_scale_dirty;
|
||||
size_t color_scale_offset;
|
||||
SDL_bool shader_constants_dirty;
|
||||
PixelShaderConstants shader_constants;
|
||||
} METAL_DrawStateCache;
|
||||
|
||||
static SDL_bool SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const SDL_MetalFragmentFunction shader,
|
||||
const size_t constants_offset, id<MTLBuffer> mtlbufvertex, METAL_DrawStateCache *statecache)
|
||||
static void SetupShaderConstants(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const SDL_Texture *texture, PixelShaderConstants *constants)
|
||||
{
|
||||
float output_headroom;
|
||||
|
||||
SDL_zerop(constants);
|
||||
|
||||
constants->scRGB_output = (float)SDL_RenderingLinearSpace(renderer);
|
||||
constants->color_scale = cmd->data.draw.color_scale;
|
||||
|
||||
if (texture) {
|
||||
switch (texture->format) {
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
constants->texture_type = TEXTURETYPE_YUV;
|
||||
constants->input_type = INPUTTYPE_SRGB;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
constants->texture_type = TEXTURETYPE_NV12;
|
||||
constants->input_type = INPUTTYPE_SRGB;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
constants->texture_type = TEXTURETYPE_NV21;
|
||||
constants->input_type = INPUTTYPE_SRGB;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_P010:
|
||||
constants->texture_type = TEXTURETYPE_NV12;
|
||||
constants->input_type = INPUTTYPE_HDR10;
|
||||
break;
|
||||
default:
|
||||
constants->texture_type = TEXTURETYPE_RGB;
|
||||
if (texture->colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
constants->input_type = INPUTTYPE_SCRGB;
|
||||
} else if (SDL_COLORSPACEPRIMARIES(texture->colorspace) == SDL_COLOR_PRIMARIES_BT2020 &&
|
||||
SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
||||
constants->input_type = INPUTTYPE_HDR10;
|
||||
} else {
|
||||
constants->input_type = INPUTTYPE_UNSPECIFIED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
constants->sdr_white_point = texture->SDR_white_point;
|
||||
|
||||
if (renderer->target) {
|
||||
output_headroom = renderer->target->HDR_headroom;
|
||||
} else {
|
||||
output_headroom = renderer->HDR_headroom;
|
||||
}
|
||||
|
||||
if (texture->HDR_headroom > output_headroom) {
|
||||
constants->tonemap_method = TONEMAP_CHROME;
|
||||
constants->tonemap_factor1 = (output_headroom / (texture->HDR_headroom * texture->HDR_headroom));
|
||||
constants->tonemap_factor2 = (1.0f / output_headroom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_bool SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const SDL_MetalFragmentFunction shader, PixelShaderConstants *shader_constants, const size_t constants_offset, id<MTLBuffer> mtlbufvertex, METAL_DrawStateCache *statecache)
|
||||
{
|
||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
||||
const SDL_BlendMode blend = cmd->data.draw.blend;
|
||||
size_t first = cmd->data.draw.first;
|
||||
id<MTLRenderPipelineState> newpipeline;
|
||||
PixelShaderConstants solid_constants;
|
||||
|
||||
if (!METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad, NULL, statecache->vertex_buffer)) {
|
||||
return SDL_FALSE;
|
||||
@@ -1394,17 +1449,28 @@ static SDL_bool SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cm
|
||||
statecache->cliprect_dirty = SDL_FALSE;
|
||||
}
|
||||
|
||||
if (statecache->color_scale_dirty) {
|
||||
[data.mtlcmdencoder setFragmentBufferOffset:statecache->color_scale_offset atIndex:0];
|
||||
statecache->color_scale_dirty = SDL_FALSE;
|
||||
}
|
||||
|
||||
newpipeline = ChoosePipelineState(data, data.activepipelines, shader, blend);
|
||||
if (newpipeline != statecache->pipeline) {
|
||||
[data.mtlcmdencoder setRenderPipelineState:newpipeline];
|
||||
statecache->pipeline = newpipeline;
|
||||
}
|
||||
|
||||
if (!shader_constants) {
|
||||
SetupShaderConstants(renderer, cmd, NULL, &solid_constants);
|
||||
shader_constants = &solid_constants;
|
||||
}
|
||||
|
||||
if (statecache->shader_constants_dirty ||
|
||||
SDL_memcmp(shader_constants, &statecache->shader_constants, sizeof(*shader_constants)) != 0) {
|
||||
id<MTLBuffer> mtlbufconstants = [data.mtldevice newBufferWithLength:sizeof(*shader_constants) options:MTLResourceStorageModeShared];
|
||||
mtlbufconstants.label = @"SDL shader constants data";
|
||||
SDL_memcpy([mtlbufconstants contents], shader_constants, sizeof(*shader_constants));
|
||||
[data.mtlcmdencoder setFragmentBuffer:mtlbufconstants offset:0 atIndex:0];
|
||||
|
||||
SDL_memcpy(&statecache->shader_constants, shader_constants, sizeof(*shader_constants));
|
||||
statecache->shader_constants_dirty = SDL_FALSE;
|
||||
}
|
||||
|
||||
if (constants_offset != statecache->constants_offset) {
|
||||
if (constants_offset != CONSTANTS_OFFSET_INVALID) {
|
||||
[data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:constants_offset atIndex:3];
|
||||
@@ -1422,8 +1488,11 @@ static SDL_bool SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cm
|
||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
||||
SDL_Texture *texture = cmd->data.draw.texture;
|
||||
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
|
||||
PixelShaderConstants constants;
|
||||
|
||||
if (!SetDrawState(renderer, cmd, texturedata.fragmentFunction, constants_offset, mtlbufvertex, statecache)) {
|
||||
SetupShaderConstants(renderer, cmd, texture, &constants);
|
||||
|
||||
if (!SetDrawState(renderer, cmd, texturedata.fragmentFunction, &constants, constants_offset, mtlbufvertex, statecache)) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
@@ -1465,11 +1534,10 @@ static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
statecache.vertex_buffer = nil;
|
||||
statecache.constants_offset = CONSTANTS_OFFSET_INVALID;
|
||||
statecache.texture = NULL;
|
||||
statecache.color_scale_dirty = SDL_TRUE;
|
||||
statecache.shader_constants_dirty = SDL_TRUE;
|
||||
statecache.cliprect_dirty = SDL_TRUE;
|
||||
statecache.viewport_dirty = SDL_TRUE;
|
||||
statecache.projection_offset = 0;
|
||||
statecache.color_scale_offset = 0;
|
||||
|
||||
// !!! FIXME: have a ring of pre-made MTLBuffers we cycle through? How expensive is creation?
|
||||
if (vertsize > 0) {
|
||||
@@ -1478,8 +1546,7 @@ static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
* data from the GPU than to read managed/private data, but we avoid the
|
||||
* cost of copying the data and the code's simpler. Apple's best
|
||||
* practices guide recommends this approach for streamed vertex data.
|
||||
* TODO: this buffer is also used for constants. Is performance still
|
||||
* good for those, or should we have a managed buffer for them? */
|
||||
*/
|
||||
mtlbufvertex = [data.mtldevice newBufferWithLength:vertsize options:MTLResourceStorageModeShared];
|
||||
mtlbufvertex.label = @"SDL vertex data";
|
||||
SDL_memcpy([mtlbufvertex contents], vertices, vertsize);
|
||||
@@ -1519,8 +1586,6 @@ static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
|
||||
case SDL_RENDERCMD_SETCOLORSCALE:
|
||||
{
|
||||
statecache.color_scale_offset = cmd->data.color.first;
|
||||
statecache.color_scale_dirty = SDL_TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1542,7 +1607,7 @@ static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
statecache.pipeline = nil;
|
||||
statecache.constants_offset = CONSTANTS_OFFSET_INVALID;
|
||||
statecache.texture = NULL;
|
||||
statecache.color_scale_dirty = SDL_TRUE;
|
||||
statecache.shader_constants_dirty = SDL_TRUE;
|
||||
statecache.cliprect_dirty = SDL_TRUE;
|
||||
statecache.viewport_dirty = SDL_TRUE;
|
||||
|
||||
@@ -1569,7 +1634,7 @@ static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
{
|
||||
const size_t count = cmd->data.draw.count;
|
||||
const MTLPrimitiveType primtype = (cmd->command == SDL_RENDERCMD_DRAW_POINTS) ? MTLPrimitiveTypePoint : MTLPrimitiveTypeLineStrip;
|
||||
if (SetDrawState(renderer, cmd, SDL_METAL_FRAGMENT_SOLID, CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM, mtlbufvertex, &statecache)) {
|
||||
if (SetDrawState(renderer, cmd, SDL_METAL_FRAGMENT_SOLID, NULL, CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM, mtlbufvertex, &statecache)) {
|
||||
[data.mtlcmdencoder drawPrimitives:primtype vertexStart:0 vertexCount:count];
|
||||
}
|
||||
break;
|
||||
@@ -1594,7 +1659,7 @@ static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
[data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:count];
|
||||
}
|
||||
} else {
|
||||
if (SetDrawState(renderer, cmd, SDL_METAL_FRAGMENT_SOLID, CONSTANTS_OFFSET_IDENTITY, mtlbufvertex, &statecache)) {
|
||||
if (SetDrawState(renderer, cmd, SDL_METAL_FRAGMENT_SOLID, NULL, CONSTANTS_OFFSET_IDENTITY, mtlbufvertex, &statecache)) {
|
||||
[data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:count];
|
||||
}
|
||||
}
|
||||
@@ -1658,6 +1723,9 @@ static SDL_Surface *METAL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec
|
||||
case MTLPixelFormatRGBA8Unorm_sRGB:
|
||||
format = SDL_PIXELFORMAT_ABGR8888;
|
||||
break;
|
||||
case MTLPixelFormatRGB10A2Unorm:
|
||||
format = SDL_PIXELFORMAT_XBGR2101010;
|
||||
break;
|
||||
case MTLPixelFormatRGBA16Float:
|
||||
format = SDL_PIXELFORMAT_RGBA64_FLOAT;
|
||||
break;
|
||||
@@ -2080,7 +2148,7 @@ static SDL_Renderer *METAL_CreateRenderer(SDL_Window *window, SDL_PropertiesID c
|
||||
renderer->SetRenderTarget = METAL_SetRenderTarget;
|
||||
renderer->QueueSetViewport = METAL_QueueSetViewport;
|
||||
renderer->QueueSetDrawColor = METAL_QueueNoOp;
|
||||
renderer->QueueSetColorScale = METAL_QueueSetColorScale;
|
||||
renderer->QueueSetColorScale = METAL_QueueNoOp;
|
||||
renderer->QueueDrawPoints = METAL_QueueDrawPoints;
|
||||
renderer->QueueDrawLines = METAL_QueueDrawLines;
|
||||
renderer->QueueGeometry = METAL_QueueGeometry;
|
||||
@@ -2158,6 +2226,7 @@ SDL_RenderDriver METAL_RenderDriver = {
|
||||
9,
|
||||
{ SDL_PIXELFORMAT_ARGB8888,
|
||||
SDL_PIXELFORMAT_ABGR8888,
|
||||
SDL_PIXELFORMAT_XBGR2101010,
|
||||
SDL_PIXELFORMAT_RGBA64_FLOAT,
|
||||
SDL_PIXELFORMAT_RGBA128_FLOAT,
|
||||
SDL_PIXELFORMAT_YV12,
|
||||
|
||||
@@ -4,15 +4,40 @@
|
||||
|
||||
using namespace metal;
|
||||
|
||||
float3 scRGBtoNits(float3 v)
|
||||
{
|
||||
return v * 80.0;
|
||||
}
|
||||
// These should mirror the definitions in SDL_render_metal.m
|
||||
#define TONEMAP_NONE 0
|
||||
#define TONEMAP_LINEAR 1
|
||||
#define TONEMAP_CHROME 2
|
||||
|
||||
float3 scRGBfromNits(float3 v)
|
||||
#define TEXTURETYPE_NONE 0
|
||||
#define TEXTURETYPE_RGB 1
|
||||
#define TEXTURETYPE_NV12 2
|
||||
#define TEXTURETYPE_NV21 3
|
||||
#define TEXTURETYPE_YUV 4
|
||||
|
||||
#define INPUTTYPE_UNSPECIFIED 0
|
||||
#define INPUTTYPE_SRGB 1
|
||||
#define INPUTTYPE_SCRGB 2
|
||||
#define INPUTTYPE_HDR10 3
|
||||
|
||||
struct ShaderConstants
|
||||
{
|
||||
return v / 80.0;
|
||||
}
|
||||
float scRGB_output;
|
||||
float texture_type;
|
||||
float input_type;
|
||||
float color_scale;
|
||||
|
||||
float tonemap_method;
|
||||
float tonemap_factor1;
|
||||
float tonemap_factor2;
|
||||
float sdr_white_point;
|
||||
};
|
||||
|
||||
struct YUVDecode
|
||||
{
|
||||
float3 offset;
|
||||
float3x3 matrix;
|
||||
};
|
||||
|
||||
float sRGBtoLinear(float v)
|
||||
{
|
||||
@@ -34,7 +59,7 @@ float sRGBfromLinear(float v)
|
||||
return v;
|
||||
}
|
||||
|
||||
float3 PQtoNits(float3 v)
|
||||
float3 PQtoLinear(float3 v, float sdr_white_point)
|
||||
{
|
||||
const float c1 = 0.8359375;
|
||||
const float c2 = 18.8515625;
|
||||
@@ -44,7 +69,74 @@ float3 PQtoNits(float3 v)
|
||||
|
||||
float3 num = max(pow(abs(v), oo_m2) - c1, 0.0);
|
||||
float3 den = c2 - c3 * pow(abs(v), oo_m2);
|
||||
return 10000.0 * pow(abs(num / den), oo_m1);
|
||||
return (10000.0 * pow(abs(num / den), oo_m1) / sdr_white_point);
|
||||
}
|
||||
|
||||
float3 ApplyTonemap(float3 v, float input_type, float tonemap_method, float tonemap_factor1, float tonemap_factor2)
|
||||
{
|
||||
const float3x3 mat709to2020 = {
|
||||
{ 0.627404, 0.329283, 0.043313 },
|
||||
{ 0.069097, 0.919541, 0.011362 },
|
||||
{ 0.016391, 0.088013, 0.895595 }
|
||||
};
|
||||
const float3x3 mat2020to709 = {
|
||||
{ 1.660496, -0.587656, -0.072840 },
|
||||
{ -0.124547, 1.132895, -0.008348 },
|
||||
{ -0.018154, -0.100597, 1.118751 }
|
||||
};
|
||||
|
||||
if (tonemap_method == TONEMAP_LINEAR) {
|
||||
v *= tonemap_factor1;
|
||||
} else if (tonemap_method == TONEMAP_CHROME) {
|
||||
if (input_type == INPUTTYPE_SCRGB) {
|
||||
// Convert to BT.2020 colorspace for tone mapping
|
||||
v = v * mat709to2020;
|
||||
}
|
||||
|
||||
float vmax = max(v.r, max(v.g, v.b));
|
||||
if (vmax > 0.0) {
|
||||
float scale = (1.0 + tonemap_factor1 * vmax) / (1.0 + tonemap_factor2 * vmax);
|
||||
v *= scale;
|
||||
}
|
||||
|
||||
if (input_type == INPUTTYPE_SCRGB) {
|
||||
// Convert to BT.709 colorspace after tone mapping
|
||||
v = v * mat2020to709;
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
float4 GetInputColor(float2 texcoord, float texture_type, constant YUVDecode &decode, texture2d<float> tex0, texture2d<float> tex1, sampler s)
|
||||
{
|
||||
float4 rgba;
|
||||
|
||||
if (texture_type == TEXTURETYPE_NONE) {
|
||||
rgba = 1.0;
|
||||
} else if (texture_type == TEXTURETYPE_RGB) {
|
||||
rgba = tex0.sample(s, texcoord);
|
||||
} else if (texture_type == TEXTURETYPE_NV12) {
|
||||
float3 yuv;
|
||||
yuv.x = tex0.sample(s, texcoord).r;
|
||||
yuv.yz = tex1.sample(s, texcoord).rg;
|
||||
|
||||
rgba.rgb = (yuv + decode.offset) * decode.matrix;
|
||||
rgba.a = 1.0;
|
||||
} else if (texture_type == TEXTURETYPE_NV21) {
|
||||
float3 yuv;
|
||||
yuv.x = tex0.sample(s, texcoord).r;
|
||||
yuv.yz = tex1.sample(s, texcoord).gr;
|
||||
|
||||
rgba.rgb = (yuv + decode.offset) * decode.matrix;
|
||||
rgba.a = 1.0;
|
||||
} else {
|
||||
// Error!
|
||||
rgba.r = 1.0;
|
||||
rgba.g = 0.0;
|
||||
rgba.b = 0.0;
|
||||
rgba.a = 1.0;
|
||||
}
|
||||
return rgba;
|
||||
}
|
||||
|
||||
float4 GetOutputColor(float4 rgba, float color_scale)
|
||||
@@ -57,9 +149,9 @@ float4 GetOutputColor(float4 rgba, float color_scale)
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 GetOutputColorFromSRGB(float3 rgb, float scRGB_output, float color_scale)
|
||||
float3 GetOutputColorFromSRGB(float3 rgb, float scRGB_output, float color_scale)
|
||||
{
|
||||
float4 output;
|
||||
float3 output;
|
||||
|
||||
if (scRGB_output) {
|
||||
rgb.r = sRGBtoLinear(rgb.r);
|
||||
@@ -67,35 +159,27 @@ float4 GetOutputColorFromSRGB(float3 rgb, float scRGB_output, float color_scale)
|
||||
rgb.b = sRGBtoLinear(rgb.b);
|
||||
}
|
||||
|
||||
output.rgb = rgb * color_scale;
|
||||
output.a = 1.0;
|
||||
output = rgb * color_scale;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 GetOutputColorFromSCRGB(float3 rgb, float scRGB_output, float color_scale)
|
||||
float3 GetOutputColorFromLinear(float3 rgb, float scRGB_output, float color_scale)
|
||||
{
|
||||
float4 output;
|
||||
float3 output;
|
||||
|
||||
output.rgb = rgb * color_scale;
|
||||
output.a = 1.0;
|
||||
output = rgb * color_scale;
|
||||
|
||||
if (!scRGB_output) {
|
||||
output.r = sRGBfromLinear(output.r);
|
||||
output.g = sRGBfromLinear(output.g);
|
||||
output.b = sRGBfromLinear(output.b);
|
||||
output.rgb = clamp(output.rgb, 0.0, 1.0);
|
||||
output = clamp(output.rgb, 0.0, 1.0);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
struct ShaderConstants
|
||||
{
|
||||
float scRGB_output;
|
||||
float color_scale;
|
||||
};
|
||||
|
||||
struct SolidVertexInput
|
||||
{
|
||||
float2 position [[attribute(0)]];
|
||||
@@ -159,11 +243,45 @@ fragment float4 SDL_Copy_fragment(CopyVertexOutput vert [[stage_in]],
|
||||
return GetOutputColor(tex.sample(s, vert.texcoord), c.color_scale) * vert.color;
|
||||
}
|
||||
|
||||
struct YUVDecode
|
||||
fragment float4 SDL_Advanced_fragment(CopyVertexOutput vert [[stage_in]],
|
||||
constant ShaderConstants &c [[buffer(0)]],
|
||||
constant YUVDecode &decode [[buffer(1)]],
|
||||
texture2d<float> tex0 [[texture(0)]],
|
||||
texture2d<float> tex1 [[texture(1)]],
|
||||
sampler s [[sampler(0)]])
|
||||
{
|
||||
float3 offset;
|
||||
float3x3 matrix;
|
||||
};
|
||||
const float3x3 mat2020to709 = {
|
||||
{ 1.660496, -0.587656, -0.072840 },
|
||||
{ -0.124547, 1.132895, -0.008348 },
|
||||
{ -0.018154, -0.100597, 1.118751 }
|
||||
};
|
||||
float4 rgba = GetInputColor(vert.texcoord, c.texture_type, decode, tex0, tex1, s);
|
||||
float4 output;
|
||||
|
||||
if (c.input_type == INPUTTYPE_HDR10) {
|
||||
rgba.rgb = PQtoLinear(rgba.rgb, c.sdr_white_point);
|
||||
}
|
||||
|
||||
if (c.tonemap_method != TONEMAP_NONE) {
|
||||
rgba.rgb = ApplyTonemap(rgba.rgb, c.input_type, c.tonemap_method, c.tonemap_factor1, c.tonemap_factor2);
|
||||
}
|
||||
|
||||
if (c.input_type == INPUTTYPE_SRGB) {
|
||||
output.rgb = GetOutputColorFromSRGB(rgba.rgb, c.scRGB_output, c.color_scale);
|
||||
output.a = rgba.a;
|
||||
} else if (c.input_type == INPUTTYPE_SCRGB) {
|
||||
output.rgb = GetOutputColorFromLinear(rgba.rgb, c.scRGB_output, c.color_scale);
|
||||
output.a = rgba.a;
|
||||
} else if (c.input_type == INPUTTYPE_HDR10) {
|
||||
rgba.rgb = rgba.rgb * mat2020to709;
|
||||
output.rgb = GetOutputColorFromLinear(rgba.rgb, c.scRGB_output, c.color_scale);
|
||||
output.a = rgba.a;
|
||||
} else {
|
||||
output = GetOutputColor(rgba, c.color_scale);
|
||||
}
|
||||
|
||||
return output * vert.color;
|
||||
}
|
||||
|
||||
fragment float4 SDL_YUV_fragment(CopyVertexOutput vert [[stage_in]],
|
||||
constant ShaderConstants &c [[buffer(0)]],
|
||||
@@ -180,69 +298,9 @@ fragment float4 SDL_YUV_fragment(CopyVertexOutput vert [[stage_in]],
|
||||
float3 rgb;
|
||||
rgb = (yuv + decode.offset) * decode.matrix;
|
||||
|
||||
return GetOutputColorFromSRGB(rgb, c.scRGB_output, c.color_scale) * vert.color;
|
||||
float4 output;
|
||||
output.rgb = GetOutputColorFromSRGB(rgb, c.scRGB_output, c.color_scale);
|
||||
output.a = 1.0;
|
||||
|
||||
return output * vert.color;
|
||||
}
|
||||
|
||||
fragment float4 SDL_NV12_fragment(CopyVertexOutput vert [[stage_in]],
|
||||
constant ShaderConstants &c [[buffer(0)]],
|
||||
constant YUVDecode &decode [[buffer(1)]],
|
||||
texture2d<float> texY [[texture(0)]],
|
||||
texture2d<float> texUV [[texture(1)]],
|
||||
sampler s [[sampler(0)]])
|
||||
{
|
||||
float3 yuv;
|
||||
yuv.x = texY.sample(s, vert.texcoord).r;
|
||||
yuv.yz = texUV.sample(s, vert.texcoord).rg;
|
||||
|
||||
float3 rgb;
|
||||
rgb = (yuv + decode.offset) * decode.matrix;
|
||||
|
||||
return GetOutputColorFromSRGB(rgb, c.scRGB_output, c.color_scale) * vert.color;
|
||||
}
|
||||
|
||||
fragment float4 SDL_NV21_fragment(CopyVertexOutput vert [[stage_in]],
|
||||
constant ShaderConstants &c [[buffer(0)]],
|
||||
constant YUVDecode &decode [[buffer(1)]],
|
||||
texture2d<float> texY [[texture(0)]],
|
||||
texture2d<float> texUV [[texture(1)]],
|
||||
sampler s [[sampler(0)]])
|
||||
{
|
||||
float3 yuv;
|
||||
yuv.x = texY.sample(s, vert.texcoord).r;
|
||||
yuv.yz = texUV.sample(s, vert.texcoord).gr;
|
||||
|
||||
float3 rgb;
|
||||
rgb = (yuv + decode.offset) * decode.matrix;
|
||||
|
||||
return GetOutputColorFromSRGB(rgb, c.scRGB_output, c.color_scale) * vert.color;
|
||||
}
|
||||
|
||||
fragment float4 SDL_HDR10_fragment(CopyVertexOutput vert [[stage_in]],
|
||||
constant ShaderConstants &c [[buffer(0)]],
|
||||
constant YUVDecode &decode [[buffer(1)]],
|
||||
texture2d<float> texY [[texture(0)]],
|
||||
texture2d<float> texUV [[texture(1)]],
|
||||
sampler s [[sampler(0)]])
|
||||
{
|
||||
const float3x3 mat2020to709 = {
|
||||
{ 1.660496, -0.587656, -0.072840 },
|
||||
{ -0.124547, 1.132895, -0.008348 },
|
||||
{ -0.018154, -0.100597, 1.118751 }
|
||||
};
|
||||
|
||||
float3 yuv;
|
||||
yuv.x = texY.sample(s, vert.texcoord).r;
|
||||
yuv.yz = texUV.sample(s, vert.texcoord).rg;
|
||||
|
||||
float3 rgb;
|
||||
rgb = (yuv + decode.offset) * decode.matrix;
|
||||
|
||||
rgb = PQtoNits(rgb);
|
||||
|
||||
rgb = rgb * mat2020to709;
|
||||
|
||||
rgb = scRGBfromNits(rgb);
|
||||
|
||||
return GetOutputColorFromSCRGB(rgb, c.scRGB_output, c.color_scale) * vert.color;
|
||||
}
|
||||
|
||||
|
||||
+2033
-2576
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1981
-2506
File diff suppressed because it is too large
Load Diff
+2033
-2576
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+84
-44
@@ -670,7 +670,7 @@ typedef enum
|
||||
{
|
||||
SDL_TONEMAP_NONE,
|
||||
SDL_TONEMAP_LINEAR,
|
||||
SDL_TONEMAP_PIECEWISE_HDR,
|
||||
SDL_TONEMAP_CHROME
|
||||
} SDL_TonemapOperator;
|
||||
|
||||
typedef struct
|
||||
@@ -682,41 +682,53 @@ typedef struct
|
||||
float scale;
|
||||
} linear;
|
||||
|
||||
struct
|
||||
{
|
||||
float scale;
|
||||
} piecewise_HDR;
|
||||
struct {
|
||||
float a;
|
||||
float b;
|
||||
const float *color_primaries_matrix;
|
||||
} chrome;
|
||||
|
||||
} data;
|
||||
|
||||
} SDL_TonemapContext;
|
||||
|
||||
static void TonemapLinear(float *r, float *g, float *b, float scale)
|
||||
{
|
||||
*r *= scale;
|
||||
*g *= scale;
|
||||
*b *= scale;
|
||||
}
|
||||
|
||||
static void TonemapChrome(float *r, float *g, float *b, float tonemap_a, float tonemap_b)
|
||||
{
|
||||
float v1 = *r;
|
||||
float v2 = *g;
|
||||
float v3 = *b;
|
||||
float vmax = SDL_max(v1, SDL_max(v2, v3));
|
||||
|
||||
if (vmax > 0.0f) {
|
||||
float scale = (1.0f + tonemap_a * vmax) / (1.0f + tonemap_b * vmax);
|
||||
TonemapLinear(r, g, b, scale);
|
||||
}
|
||||
}
|
||||
|
||||
static void ApplyTonemap(SDL_TonemapContext *ctx, float *r, float *g, float *b)
|
||||
{
|
||||
switch (ctx->op) {
|
||||
case SDL_TONEMAP_LINEAR:
|
||||
*r *= ctx->data.linear.scale;
|
||||
*g *= ctx->data.linear.scale;
|
||||
*b *= ctx->data.linear.scale;
|
||||
TonemapLinear(r, g, b, ctx->data.linear.scale);
|
||||
break;
|
||||
case SDL_TONEMAP_PIECEWISE_HDR:
|
||||
*r = (*r <= 1.0f) ? *r : (1.0f + (*r - 1.0f) * ctx->data.piecewise_HDR.scale);
|
||||
*g = (*g <= 1.0f) ? *g : (1.0f + (*g - 1.0f) * ctx->data.piecewise_HDR.scale);
|
||||
*b = (*r <= 1.0f) ? *b : (1.0f + (*b - 1.0f) * ctx->data.piecewise_HDR.scale);
|
||||
case SDL_TONEMAP_CHROME:
|
||||
if (ctx->data.chrome.color_primaries_matrix) {
|
||||
SDL_ConvertColorPrimaries(r, g, b, ctx->data.chrome.color_primaries_matrix);
|
||||
}
|
||||
TonemapChrome(r, g, b, ctx->data.chrome.a, ctx->data.chrome.b);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_bool IsHDRColorspace(SDL_Colorspace colorspace)
|
||||
{
|
||||
if (colorspace == SDL_COLORSPACE_SRGB_LINEAR ||
|
||||
SDL_COLORSPACETRANSFER(colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
/* The SECOND TRUE BLITTER
|
||||
* This one is even slower than the first, but also handles large pixel formats and colorspace conversion
|
||||
*/
|
||||
@@ -740,35 +752,63 @@ void SDL_Blit_Slow_Float(SDL_BlitInfo *info)
|
||||
SlowBlitPixelAccess dst_access;
|
||||
SDL_Colorspace src_colorspace;
|
||||
SDL_Colorspace dst_colorspace;
|
||||
SDL_ColorPrimaries src_primaries;
|
||||
SDL_ColorPrimaries dst_primaries;
|
||||
const float *color_primaries_matrix = NULL;
|
||||
float SDR_white_point_src = 1.0f;
|
||||
float SDR_white_point_dst = 1.0f;
|
||||
float src_white_point;
|
||||
float dst_white_point;
|
||||
float dst_headroom;
|
||||
float src_headroom;
|
||||
SDL_TonemapContext tonemap;
|
||||
|
||||
if (SDL_GetSurfaceColorspace(info->src_surface, &src_colorspace) < 0 ||
|
||||
SDL_GetSurfaceColorspace(info->dst_surface, &dst_colorspace) < 0) {
|
||||
return;
|
||||
}
|
||||
src_primaries = SDL_COLORSPACEPRIMARIES(src_colorspace);
|
||||
dst_primaries = SDL_COLORSPACEPRIMARIES(dst_colorspace);
|
||||
|
||||
tonemap.op = SDL_TONEMAP_NONE;
|
||||
if (src_colorspace != dst_colorspace) {
|
||||
SDL_ColorPrimaries src_primaries = SDL_COLORSPACEPRIMARIES(src_colorspace);
|
||||
SDL_ColorPrimaries dst_primaries = SDL_COLORSPACEPRIMARIES(dst_colorspace);
|
||||
color_primaries_matrix = SDL_GetColorPrimariesConversionMatrix(src_primaries, dst_primaries);
|
||||
src_white_point = SDL_GetSurfaceSDRWhitePoint(info->src_surface, src_colorspace);
|
||||
dst_white_point = SDL_GetSurfaceSDRWhitePoint(info->dst_surface, dst_colorspace);
|
||||
src_headroom = SDL_GetSurfaceHDRHeadroom(info->src_surface, src_colorspace);
|
||||
dst_headroom = SDL_GetSurfaceHDRHeadroom(info->dst_surface, dst_colorspace);
|
||||
if (dst_headroom == 0.0f) {
|
||||
/* The destination will have the same headroom as the source */
|
||||
dst_headroom = src_headroom;
|
||||
SDL_SetFloatProperty(SDL_GetSurfaceProperties(info->dst_surface), SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT, dst_headroom);
|
||||
}
|
||||
|
||||
if (IsHDRColorspace(src_colorspace) != IsHDRColorspace(dst_colorspace)) {
|
||||
const char *tonemap_operator = SDL_GetStringProperty(SDL_GetSurfaceProperties(info->src_surface), SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING, NULL);
|
||||
if (tonemap_operator) {
|
||||
if (SDL_strncmp(tonemap_operator, "*=", 2) == 0) {
|
||||
tonemap.op = SDL_TONEMAP_LINEAR;
|
||||
tonemap.data.linear.scale = SDL_atof(tonemap_operator + 2);
|
||||
}
|
||||
SDL_zero(tonemap);
|
||||
|
||||
if (src_headroom > dst_headroom) {
|
||||
const char *tonemap_operator = SDL_GetStringProperty(SDL_GetSurfaceProperties(info->src_surface), SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING, NULL);
|
||||
if (tonemap_operator) {
|
||||
if (SDL_strncmp(tonemap_operator, "*=", 2) == 0) {
|
||||
tonemap.op = SDL_TONEMAP_LINEAR;
|
||||
tonemap.data.linear.scale = SDL_atof(tonemap_operator + 2);
|
||||
} else if (SDL_strcasecmp(tonemap_operator, "chrome") == 0) {
|
||||
tonemap.op = SDL_TONEMAP_CHROME;
|
||||
} else if (SDL_strcasecmp(tonemap_operator, "none") == 0) {
|
||||
tonemap.op = SDL_TONEMAP_NONE;
|
||||
}
|
||||
} else {
|
||||
tonemap.op = SDL_TONEMAP_CHROME;
|
||||
}
|
||||
if (tonemap.op == SDL_TONEMAP_CHROME) {
|
||||
tonemap.data.chrome.a = (dst_headroom / (src_headroom * src_headroom));
|
||||
tonemap.data.chrome.b = (1.0f / dst_headroom);
|
||||
|
||||
/* We'll convert to BT.2020 primaries for the tonemap operation */
|
||||
tonemap.data.chrome.color_primaries_matrix = SDL_GetColorPrimariesConversionMatrix(src_primaries, SDL_COLOR_PRIMARIES_BT2020);
|
||||
if (tonemap.data.chrome.color_primaries_matrix) {
|
||||
src_primaries = SDL_COLOR_PRIMARIES_BT2020;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDR_white_point_src = SDL_GetSurfaceSDRWhitePoint(info->src_surface, src_colorspace);
|
||||
SDR_white_point_dst = SDL_GetSurfaceSDRWhitePoint(info->dst_surface, dst_colorspace);
|
||||
if (src_primaries != dst_primaries) {
|
||||
color_primaries_matrix = SDL_GetColorPrimariesConversionMatrix(src_primaries, dst_primaries);
|
||||
}
|
||||
|
||||
src_access = GetPixelAccessMethod(src_fmt);
|
||||
dst_access = GetPixelAccessMethod(dst_fmt);
|
||||
@@ -787,21 +827,21 @@ void SDL_Blit_Slow_Float(SDL_BlitInfo *info)
|
||||
srcx = posx >> 16;
|
||||
src = (info->src + (srcy * info->src_pitch) + (srcx * srcbpp));
|
||||
|
||||
ReadFloatPixel(src, src_access, src_fmt, src_colorspace, SDR_white_point_src, &srcR, &srcG, &srcB, &srcA);
|
||||
|
||||
if (color_primaries_matrix) {
|
||||
SDL_ConvertColorPrimaries(&srcR, &srcG, &srcB, color_primaries_matrix);
|
||||
}
|
||||
ReadFloatPixel(src, src_access, src_fmt, src_colorspace, src_white_point, &srcR, &srcG, &srcB, &srcA);
|
||||
|
||||
if (tonemap.op) {
|
||||
ApplyTonemap(&tonemap, &srcR, &srcG, &srcB);
|
||||
}
|
||||
|
||||
if (color_primaries_matrix) {
|
||||
SDL_ConvertColorPrimaries(&srcR, &srcG, &srcB, color_primaries_matrix);
|
||||
}
|
||||
|
||||
if (flags & SDL_COPY_COLORKEY) {
|
||||
/* colorkey isn't supported */
|
||||
}
|
||||
if ((flags & (SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_MUL))) {
|
||||
ReadFloatPixel(dst, dst_access, dst_fmt, dst_colorspace, SDR_white_point_dst, &dstR, &dstG, &dstB, &dstA);
|
||||
ReadFloatPixel(dst, dst_access, dst_fmt, dst_colorspace, dst_white_point, &dstR, &dstG, &dstB, &dstA);
|
||||
} else {
|
||||
/* don't care */
|
||||
dstR = dstG = dstB = dstA = 0.0f;
|
||||
@@ -853,7 +893,7 @@ void SDL_Blit_Slow_Float(SDL_BlitInfo *info)
|
||||
break;
|
||||
}
|
||||
|
||||
WriteFloatPixel(dst, dst_access, dst_fmt, dst_colorspace, SDR_white_point_dst, dstR, dstG, dstB, dstA);
|
||||
WriteFloatPixel(dst, dst_access, dst_fmt, dst_colorspace, dst_white_point, dstR, dstG, dstB, dstA);
|
||||
|
||||
posx += incx;
|
||||
dst += dstbpp;
|
||||
|
||||
@@ -340,9 +340,9 @@ float SDL_GetSurfaceHDRHeadroom(SDL_Surface *surface, SDL_Colorspace colorspace)
|
||||
} else {
|
||||
props = 0;
|
||||
}
|
||||
if (transfer == SDL_TRANSFER_CHARACTERISTICS_PQ &&
|
||||
SDL_HasProperty(props, SDL_PROP_SURFACE_MAXCLL_NUMBER)) {
|
||||
default_value = (float)SDL_GetNumberProperty(props, SDL_PROP_SURFACE_MAXCLL_NUMBER, 0) / SDL_GetSurfaceSDRWhitePoint(surface, colorspace);
|
||||
if (transfer == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
||||
const int DEFAULT_PQ_MAXCLL = 400; /* The official definition is 10000, but PQ game content is often mastered for 400 nits */
|
||||
default_value = (float)SDL_GetNumberProperty(props, SDL_PROP_SURFACE_MAXCLL_NUMBER, DEFAULT_PQ_MAXCLL) / SDL_GetSurfaceSDRWhitePoint(surface, colorspace);
|
||||
}
|
||||
return SDL_GetFloatProperty(props, SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT, default_value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user