Use Apple RGB color profile

This commit is contained in:
elasota
2020-06-07 20:42:49 -04:00
parent b55a508686
commit 5b95fd8c6b
5 changed files with 65 additions and 72 deletions

View File

@@ -1,8 +1,8 @@
static unsigned char gs_shaderData[] = {
68, 88, 66, 67, 123, 171, 231, 206, 83, 178, 250, 149, 189, 168, 129,
29, 12, 186, 195, 194, 1, 0, 0, 0, 24, 9, 0, 0, 5, 0,
68, 88, 66, 67, 22, 132, 178, 62, 124, 31, 180, 122, 2, 1, 47,
236, 0, 128, 56, 7, 1, 0, 0, 0, 240, 7, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0, 172, 2, 0, 0, 4, 3, 0, 0, 56,
3, 0, 0, 156, 8, 0, 0, 82, 68, 69, 70, 112, 2, 0, 0,
3, 0, 0, 116, 7, 0, 0, 82, 68, 69, 70, 112, 2, 0, 0,
1, 0, 0, 0, 180, 0, 0, 0, 3, 0, 0, 0, 28, 0, 0,
0, 0, 4, 255, 255, 0, 137, 0, 0, 72, 2, 0, 0, 124, 0,
0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 255,
@@ -54,13 +54,13 @@ static unsigned char gs_shaderData[] = {
1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
72, 68, 82, 92, 5, 0, 0, 64, 0, 0, 0, 87, 1, 0, 0,
72, 68, 82, 52, 4, 0, 0, 64, 0, 0, 0, 13, 1, 0, 0,
89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 3, 0, 0,
0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68,
0, 0, 88, 16, 0, 4, 0, 112, 16, 0, 1, 0, 0, 0, 85,
85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0,
101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0,
2, 4, 0, 0, 0, 65, 0, 0, 5, 50, 0, 16, 0, 0, 0,
2, 3, 0, 0, 0, 65, 0, 0, 5, 50, 0, 16, 0, 0, 0,
0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 27, 0, 0, 5, 50,
0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0,
54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0,
@@ -93,68 +93,48 @@ static unsigned char gs_shaderData[] = {
0, 0, 0, 55, 0, 0, 12, 242, 0, 16, 0, 0, 0, 0, 0,
6, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0, 0,
0, 2, 64, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0,
128, 63, 0, 0, 128, 63, 57, 0, 0, 8, 18, 0, 16, 0, 1,
0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0,
1, 64, 0, 0, 0, 0, 0, 0, 31, 0, 4, 3, 10, 0, 16,
0, 1, 0, 0, 0, 29, 0, 0, 10, 114, 0, 16, 0, 1, 0,
0, 0, 2, 64, 0, 0, 28, 46, 77, 59, 28, 46, 77, 59, 28,
46, 77, 59, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0,
56, 0, 0, 10, 114, 0, 16, 0, 2, 0, 0, 0, 70, 2, 16,
0, 0, 0, 0, 0, 2, 64, 0, 0, 82, 184, 78, 65, 82, 184,
78, 65, 82, 184, 78, 65, 0, 0, 0, 0, 47, 0, 0, 5, 114,
0, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0,
56, 0, 0, 10, 114, 0, 16, 0, 3, 0, 0, 0, 70, 2, 16,
0, 3, 0, 0, 0, 2, 64, 0, 0, 85, 85, 213, 62, 85, 85,
213, 62, 85, 85, 213, 62, 0, 0, 0, 0, 25, 0, 0, 5, 114,
0, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, 3, 0, 0, 0,
50, 0, 0, 15, 114, 0, 16, 0, 3, 0, 0, 0, 70, 2, 16,
0, 3, 0, 0, 0, 2, 64, 0, 0, 61, 10, 135, 63, 61, 10,
135, 63, 61, 10, 135, 63, 0, 0, 0, 0, 2, 64, 0, 0, 174,
71, 97, 189, 174, 71, 97, 189, 174, 71, 97, 189, 0, 0, 0, 0,
55, 0, 0, 9, 114, 0, 16, 0, 1, 0, 0, 0, 70, 2, 16,
0, 1, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 70, 2,
16, 0, 3, 0, 0, 0, 16, 0, 0, 10, 130, 0, 16, 0, 1,
0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0,
154, 153, 153, 62, 154, 153, 25, 63, 205, 204, 204, 61, 0, 0, 0,
0, 0, 0, 0, 9, 18, 0, 16, 0, 2, 0, 0, 0, 10, 128,
32, 128, 65, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
64, 0, 0, 0, 0, 128, 63, 56, 0, 0, 8, 130, 0, 16, 0,
1, 0, 0, 0, 58, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32,
0, 0, 0, 0, 0, 2, 0, 0, 0, 50, 0, 0, 9, 114, 0,
16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 6,
0, 16, 0, 2, 0, 0, 0, 246, 15, 16, 0, 1, 0, 0, 0,
29, 0, 0, 10, 114, 0, 16, 0, 2, 0, 0, 0, 2, 64, 0,
0, 230, 174, 37, 61, 230, 174, 37, 61, 230, 174, 37, 61, 0, 0,
0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 56, 0, 0, 10, 114,
0, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0,
2, 64, 0, 0, 145, 131, 158, 61, 145, 131, 158, 61, 145, 131, 158,
61, 0, 0, 0, 0, 0, 0, 0, 10, 114, 0, 16, 0, 1, 0,
0, 0, 70, 2, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0, 174,
71, 97, 61, 174, 71, 97, 61, 174, 71, 97, 61, 0, 0, 0, 0,
56, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0, 70, 2, 16,
0, 1, 0, 0, 0, 2, 64, 0, 0, 110, 167, 114, 63, 110, 167,
114, 63, 110, 167, 114, 63, 0, 0, 0, 0, 47, 0, 0, 5, 114,
0, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0,
56, 0, 0, 10, 114, 0, 16, 0, 1, 0, 0, 0, 70, 2, 16,
0, 1, 0, 0, 0, 2, 64, 0, 0, 154, 153, 25, 64, 154, 153,
25, 64, 154, 153, 25, 64, 0, 0, 0, 0, 25, 0, 0, 5, 114,
0, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 1, 0, 0, 0,
55, 0, 0, 9, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
0, 2, 0, 0, 0, 70, 2, 16, 0, 3, 0, 0, 0, 70, 2,
16, 0, 1, 0, 0, 0, 21, 0, 0, 1, 29, 0, 0, 7, 18,
0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0,
58, 0, 16, 0, 0, 0, 0, 0, 13, 0, 4, 3, 10, 0, 16,
0, 1, 0, 0, 0, 54, 0, 0, 5, 242, 32, 16, 0, 0, 0,
0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83,
84, 65, 84, 116, 0, 0, 0, 42, 0, 0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 22, 0, 0, 0, 4, 0, 0,
0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
128, 63, 0, 0, 128, 63, 29, 0, 0, 7, 18, 0, 16, 0, 1,
0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
0, 0, 0, 0, 13, 0, 4, 3, 10, 0, 16, 0, 1, 0, 0,
0, 57, 0, 0, 8, 18, 0, 16, 0, 1, 0, 0, 0, 10, 128,
32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0, 0,
0, 0, 0, 16, 0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 154, 153, 153,
62, 154, 153, 25, 63, 205, 204, 204, 61, 0, 0, 0, 0, 0, 0,
0, 9, 66, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 128, 65,
0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 64, 0, 0,
0, 0, 128, 63, 56, 0, 0, 8, 34, 0, 16, 0, 1, 0, 0,
0, 26, 0, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0,
0, 0, 2, 0, 0, 0, 50, 0, 0, 9, 226, 0, 16, 0, 1,
0, 0, 0, 6, 9, 16, 0, 0, 0, 0, 0, 166, 10, 16, 0,
1, 0, 0, 0, 86, 5, 16, 0, 1, 0, 0, 0, 55, 32, 0,
9, 114, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0,
0, 0, 150, 7, 16, 0, 1, 0, 0, 0, 70, 2, 16, 0, 0,
0, 0, 0, 47, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16,
0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64,
0, 0, 102, 102, 230, 63, 102, 102, 230, 63, 102, 102, 230, 63, 0,
0, 0, 0, 25, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0,
70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16,
0, 1, 0, 0, 0, 86, 5, 16, 0, 0, 0, 0, 0, 2, 64,
0, 0, 150, 246, 160, 189, 43, 199, 117, 63, 40, 177, 243, 60, 0,
0, 0, 0, 50, 0, 0, 12, 114, 0, 16, 0, 1, 0, 0, 0,
6, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 87, 203, 136,
63, 86, 131, 197, 60, 225, 104, 227, 58, 0, 0, 0, 0, 70, 2,
16, 0, 1, 0, 0, 0, 50, 0, 0, 12, 114, 32, 16, 0, 0,
0, 0, 0, 166, 10, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
5, 9, 34, 60, 158, 151, 129, 60, 194, 240, 119, 63, 0, 0, 0,
0, 70, 2, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 32,
16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62,
0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 32, 0, 0, 0,
3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0,
0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0,
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0,
0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
namespace GpBinarizedShaders

View File

@@ -544,7 +544,7 @@ bool GpDisplayDriverD3D11::InitResources(uint32_t virtualWidth, uint32_t virtual
}
}
DXGI_FORMAT paletteTextureFormat = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
DXGI_FORMAT paletteTextureFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
// Palette texture
{

View File

@@ -93,7 +93,7 @@ GpDisplayDriverSurfaceD3D11 *GpDisplayDriverSurfaceD3D11::Create(ID3D11Device *d
dxgiFormat = DXGI_FORMAT_R16_UINT;
break;
case GpPixelFormats::kRGB32:
dxgiFormat = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
dxgiFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
break;
case GpPixelFormats::kRGB24: // RGB24 is not supported as a surface format (PL must convert it)
default:

View File

@@ -29,5 +29,7 @@ SDrawQuadPixelOutput PSMain(SDrawQuadPixelInput input)
if (result.color.a <= 0.0)
discard;
result.color.rgb = AppleRGBToSRGBLinear(result.color.rgb);
return result;
}

View File

@@ -47,13 +47,24 @@ float4 ApplyFlicker(int2 coordinate, int startThreshold, int endThreshold, float
float4 ApplyDesaturation(float desaturation, float4 color)
{
// This is intentionally done in gamma space
if (desaturation == 0.0)
return color;
float3 srgbColor = LinearToSRGB(color.rgb);
float grayLevel = dot(srgbColor, float3(3.0, 6.0, 1.0) / 10.0);
float grayLevel = dot(color.rgb, float3(3.0, 6.0, 1.0) / 10.0);
srgbColor = srgbColor * (1.0 - desaturation) + float3(grayLevel, grayLevel, grayLevel) * desaturation;
return float4(SRGBToLinear(srgbColor), color.a);
color.rgb = color.rgb * (1.0 - desaturation) + float3(grayLevel, grayLevel, grayLevel) * desaturation;
return color;
}
float3 AppleRGBToSRGBLinear(float3 color)
{
color = pow(saturate(color), 1.8);
float3 result;
result = color.r * float3(1.06870538834699, 0.024110476735, 0.00173499822713);
result += color.g * float3(-0.07859532843279, 0.96007030899244, 0.02974755969275);
result += color.b * float3(0.00988984558395, 0.01581936633364, 0.96851741859153);
return result;
}