TextureCache: Use same color coefficients for EFB2Tex as EFB2RAM
This commit is contained in:
parent
d6cdf49769
commit
accce4294a
|
@ -104,7 +104,7 @@ const char color_matrix_program_code[] = {"sampler samp0 : register(s0);\n"
|
||||||
"in float4 pos : SV_Position,\n"
|
"in float4 pos : SV_Position,\n"
|
||||||
"in float3 uv0 : TEXCOORD0){\n"
|
"in float3 uv0 : TEXCOORD0){\n"
|
||||||
"float4 texcol = Tex0.Sample(samp0,uv0);\n"
|
"float4 texcol = Tex0.Sample(samp0,uv0);\n"
|
||||||
"texcol = round(texcol * cColMatrix[5])*cColMatrix[6];\n"
|
"texcol = floor(texcol * cColMatrix[5])*cColMatrix[6];\n"
|
||||||
"ocol0 = "
|
"ocol0 = "
|
||||||
"float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix["
|
"float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix["
|
||||||
"1]),dot(texcol,cColMatrix[2]),dot(texcol,cColMatrix[3]))"
|
"1]),dot(texcol,cColMatrix[2]),dot(texcol,cColMatrix[3]))"
|
||||||
|
@ -126,7 +126,7 @@ const char color_matrix_program_code_msaa[] = {
|
||||||
"for(int i = 0; i < SAMPLES; ++i)\n"
|
"for(int i = 0; i < SAMPLES; ++i)\n"
|
||||||
" texcol += Tex0.Load(int3(uv0.x*(width), uv0.y*(height), uv0.z), i);\n"
|
" texcol += Tex0.Load(int3(uv0.x*(width), uv0.y*(height), uv0.z), i);\n"
|
||||||
"texcol /= SAMPLES;\n"
|
"texcol /= SAMPLES;\n"
|
||||||
"texcol = round(texcol * cColMatrix[5])*cColMatrix[6];\n"
|
"texcol = floor(texcol * cColMatrix[5])*cColMatrix[6];\n"
|
||||||
"ocol0 = "
|
"ocol0 = "
|
||||||
"float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot("
|
"float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot("
|
||||||
"texcol,cColMatrix[3])) + cColMatrix[4];\n"
|
"texcol,cColMatrix[3])) + cColMatrix[4];\n"
|
||||||
|
|
|
@ -131,7 +131,7 @@ static constexpr const char s_color_matrix_program_hlsl[] = {
|
||||||
"in float4 pos : SV_Position,\n"
|
"in float4 pos : SV_Position,\n"
|
||||||
"in float3 uv0 : TEXCOORD0){\n"
|
"in float3 uv0 : TEXCOORD0){\n"
|
||||||
"float4 texcol = Tex0.Sample(samp0,uv0);\n"
|
"float4 texcol = Tex0.Sample(samp0,uv0);\n"
|
||||||
"texcol = round(texcol * cColMatrix[5])*cColMatrix[6];\n"
|
"texcol = floor(texcol * cColMatrix[5])*cColMatrix[6];\n"
|
||||||
"ocol0 = "
|
"ocol0 = "
|
||||||
"float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot("
|
"float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot("
|
||||||
"texcol,cColMatrix[3])) + cColMatrix[4];\n"
|
"texcol,cColMatrix[3])) + cColMatrix[4];\n"
|
||||||
|
@ -152,7 +152,7 @@ static constexpr const char s_color_matrix_program_msaa_hlsl[] = {
|
||||||
"for(int i = 0; i < SAMPLES; ++i)\n"
|
"for(int i = 0; i < SAMPLES; ++i)\n"
|
||||||
" texcol += Tex0.Load(int3(uv0.x*(width), uv0.y*(height), uv0.z), i);\n"
|
" texcol += Tex0.Load(int3(uv0.x*(width), uv0.y*(height), uv0.z), i);\n"
|
||||||
"texcol /= SAMPLES;\n"
|
"texcol /= SAMPLES;\n"
|
||||||
"texcol = round(texcol * cColMatrix[5])*cColMatrix[6];\n"
|
"texcol = floor(texcol * cColMatrix[5])*cColMatrix[6];\n"
|
||||||
"ocol0 = "
|
"ocol0 = "
|
||||||
"float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot("
|
"float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot("
|
||||||
"texcol,cColMatrix[3])) + cColMatrix[4];\n"
|
"texcol,cColMatrix[3])) + cColMatrix[4];\n"
|
||||||
|
|
|
@ -333,7 +333,7 @@ bool TextureCache::CompileShaders()
|
||||||
"\n"
|
"\n"
|
||||||
"void main(){\n"
|
"void main(){\n"
|
||||||
" vec4 texcol = texture(samp9, f_uv0);\n"
|
" vec4 texcol = texture(samp9, f_uv0);\n"
|
||||||
" texcol = round(texcol * colmat[5]) * colmat[6];\n"
|
" texcol = floor(texcol * colmat[5]) * colmat[6];\n"
|
||||||
" ocol0 = texcol * mat4(colmat[0], colmat[1], colmat[2], colmat[3]) + colmat[4];\n"
|
" ocol0 = texcol * mat4(colmat[0], colmat[1], colmat[2], colmat[3]) + colmat[4];\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
|
|
|
@ -602,7 +602,7 @@ bool TextureCache::CompileShaders()
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float4 texcol = texture(samp0, uv0);
|
float4 texcol = texture(samp0, uv0);
|
||||||
texcol = round(texcol * C.colmat[5]) * C.colmat[6];
|
texcol = floor(texcol * C.colmat[5]) * C.colmat[6];
|
||||||
ocol0 = texcol * mat4(C.colmat[0], C.colmat[1], C.colmat[2], C.colmat[3]) + C.colmat[4];
|
ocol0 = texcol * mat4(C.colmat[0], C.colmat[1], C.colmat[2], C.colmat[3]) + C.colmat[4];
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
|
||||||
fConstAdd[3] = 16.0f / 255.0f;
|
fConstAdd[3] = 16.0f / 255.0f;
|
||||||
if (dstFormat == 0)
|
if (dstFormat == 0)
|
||||||
{
|
{
|
||||||
ColorMask[0] = ColorMask[1] = ColorMask[2] = 15.0f;
|
ColorMask[0] = ColorMask[1] = ColorMask[2] = 255.0f / 16.0f;
|
||||||
ColorMask[4] = ColorMask[5] = ColorMask[6] = 1.0f / 15.0f;
|
ColorMask[4] = ColorMask[5] = ColorMask[6] = 1.0f / 15.0f;
|
||||||
cbufid = 9;
|
cbufid = 9;
|
||||||
}
|
}
|
||||||
|
@ -1053,7 +1053,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
|
||||||
colmat[15] = 1;
|
colmat[15] = 1;
|
||||||
if (dstFormat == 2)
|
if (dstFormat == 2)
|
||||||
{
|
{
|
||||||
ColorMask[0] = ColorMask[1] = ColorMask[2] = ColorMask[3] = 15.0f;
|
ColorMask[0] = ColorMask[1] = ColorMask[2] = ColorMask[3] = 255.0f / 16.0f;
|
||||||
ColorMask[4] = ColorMask[5] = ColorMask[6] = ColorMask[7] = 1.0f / 15.0f;
|
ColorMask[4] = ColorMask[5] = ColorMask[6] = ColorMask[7] = 1.0f / 15.0f;
|
||||||
cbufid = 11;
|
cbufid = 11;
|
||||||
}
|
}
|
||||||
|
@ -1077,7 +1077,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
|
||||||
{
|
{
|
||||||
case 0: // R4
|
case 0: // R4
|
||||||
colmat[0] = colmat[4] = colmat[8] = colmat[12] = 1;
|
colmat[0] = colmat[4] = colmat[8] = colmat[12] = 1;
|
||||||
ColorMask[0] = 15.0f;
|
ColorMask[0] = 255.0f / 16.0f;
|
||||||
ColorMask[4] = 1.0f / 15.0f;
|
ColorMask[4] = 1.0f / 15.0f;
|
||||||
cbufid = 14;
|
cbufid = 14;
|
||||||
dstFormat |= _GX_TF_CTF;
|
dstFormat |= _GX_TF_CTF;
|
||||||
|
@ -1091,7 +1091,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
|
||||||
|
|
||||||
case 2: // RA4
|
case 2: // RA4
|
||||||
colmat[0] = colmat[4] = colmat[8] = colmat[15] = 1.0f;
|
colmat[0] = colmat[4] = colmat[8] = colmat[15] = 1.0f;
|
||||||
ColorMask[0] = ColorMask[3] = 15.0f;
|
ColorMask[0] = ColorMask[3] = 255.0f / 16.0f;
|
||||||
ColorMask[4] = ColorMask[7] = 1.0f / 15.0f;
|
ColorMask[4] = ColorMask[7] = 1.0f / 15.0f;
|
||||||
|
|
||||||
cbufid = 16;
|
cbufid = 16;
|
||||||
|
@ -1157,9 +1157,9 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
|
||||||
|
|
||||||
case 4: // RGB565
|
case 4: // RGB565
|
||||||
colmat[0] = colmat[5] = colmat[10] = 1.0f;
|
colmat[0] = colmat[5] = colmat[10] = 1.0f;
|
||||||
ColorMask[0] = ColorMask[2] = 31.0f;
|
ColorMask[0] = ColorMask[2] = 255.0f / 8.0f;
|
||||||
ColorMask[4] = ColorMask[6] = 1.0f / 31.0f;
|
ColorMask[4] = ColorMask[6] = 1.0f / 31.0f;
|
||||||
ColorMask[1] = 63.0f;
|
ColorMask[1] = 255.0f / 4.0f;
|
||||||
ColorMask[5] = 1.0f / 63.0f;
|
ColorMask[5] = 1.0f / 63.0f;
|
||||||
fConstAdd[3] = 1.0f; // set alpha to 1
|
fConstAdd[3] = 1.0f; // set alpha to 1
|
||||||
cbufid = 26;
|
cbufid = 26;
|
||||||
|
@ -1167,9 +1167,9 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
|
||||||
|
|
||||||
case 5: // RGB5A3
|
case 5: // RGB5A3
|
||||||
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1.0f;
|
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1.0f;
|
||||||
ColorMask[0] = ColorMask[1] = ColorMask[2] = 31.0f;
|
ColorMask[0] = ColorMask[1] = ColorMask[2] = 255.0f / 8.0f;
|
||||||
ColorMask[4] = ColorMask[5] = ColorMask[6] = 1.0f / 31.0f;
|
ColorMask[4] = ColorMask[5] = ColorMask[6] = 1.0f / 31.0f;
|
||||||
ColorMask[3] = 7.0f;
|
ColorMask[3] = 255.0f / 32.0f;
|
||||||
ColorMask[7] = 1.0f / 7.0f;
|
ColorMask[7] = 1.0f / 7.0f;
|
||||||
|
|
||||||
cbufid = 27;
|
cbufid = 27;
|
||||||
|
|
Loading…
Reference in New Issue