mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 13:20:27 -06:00
normalize the efb to texture process for color textures to make it work the same in all the plugins and with the same accuracy as real hardware (almost :))
please test for regressions and fixes. some little changes to make pixel shader more dx9 sm2.0 friendly. the condition is not to use pixel lighting ( sorry no hardware support for the quantity of parameters needed). git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6777 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -170,7 +170,7 @@ static LPDIRECT3DPIXELSHADER9 CreateCopyShader(int copyMatrixType, int depthConv
|
||||
|
||||
WRITE(p, "uniform sampler samp0 : register(s0);\n");
|
||||
if(copyMatrixType == COPY_TYPE_MATRIXCOLOR)
|
||||
WRITE(p, "uniform float4 cColMatrix[5] : register(c%d);\n", C_COLORMATRIX);
|
||||
WRITE(p, "uniform float4 cColMatrix[7] : register(c%d);\n", C_COLORMATRIX);
|
||||
WRITE(p, "void main(\n"
|
||||
"out float4 ocol0 : COLOR0,\n");
|
||||
|
||||
@ -208,6 +208,9 @@ static LPDIRECT3DPIXELSHADER9 CreateCopyShader(int copyMatrixType, int depthConv
|
||||
|
||||
if(copyMatrixType == COPY_TYPE_MATRIXCOLOR)
|
||||
{
|
||||
if(depthConversionType == DEPTH_CONVERSION_TYPE_NONE)
|
||||
WRITE(p, "texcol = round(texcol * cColMatrix[5])*cColMatrix[6];\n");
|
||||
|
||||
WRITE(p, "ocol0 = float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot(texcol,cColMatrix[3])) + cColMatrix[4];\n");
|
||||
}
|
||||
else
|
||||
@ -235,8 +238,7 @@ void PixelShaderCache::Init()
|
||||
}
|
||||
|
||||
int shaderModel = ((D3D::GetCaps().PixelShaderVersion >> 8) & 0xFF);
|
||||
int maxConstants = (shaderModel < 3) ? 32 : ((shaderModel < 4) ? 224 : 65536);
|
||||
bool canUseColorMatrix = (C_COLORMATRIX + 5 <= maxConstants);
|
||||
int maxConstants = (shaderModel < 3) ? 32 : ((shaderModel < 4) ? 224 : 65536);
|
||||
|
||||
// other screen copy/convert programs
|
||||
for(int copyMatrixType = 0; copyMatrixType < NUM_COPY_TYPES; copyMatrixType++)
|
||||
@ -253,11 +255,6 @@ void PixelShaderCache::Init()
|
||||
// so skip this attempt to avoid duplicate error messages.
|
||||
s_CopyProgram[copyMatrixType][depthType][ssaaMode] = NULL;
|
||||
}
|
||||
else if(copyMatrixType == COPY_TYPE_MATRIXCOLOR && !canUseColorMatrix)
|
||||
{
|
||||
// color matrix not supported, so substitute the nearest equivalent program that doesn't use it.
|
||||
s_CopyProgram[copyMatrixType][depthType][ssaaMode] = s_CopyProgram[COPY_TYPE_DIRECT][depthType][ssaaMode];
|
||||
}
|
||||
else
|
||||
{
|
||||
s_CopyProgram[copyMatrixType][depthType][ssaaMode] = CreateCopyShader(copyMatrixType, depthType, ssaaMode);
|
||||
@ -311,6 +308,7 @@ void PixelShaderCache::Shutdown()
|
||||
if (s_rgba6_to_rgb8) s_rgba6_to_rgb8->Release();
|
||||
s_rgba6_to_rgb8 = NULL;
|
||||
|
||||
|
||||
Clear();
|
||||
g_ps_disk_cache.Sync();
|
||||
g_ps_disk_cache.Close();
|
||||
|
Reference in New Issue
Block a user