diff options
| author | Rodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com> | 2009-10-25 23:10:30 +0000 |
|---|---|---|
| committer | Rodolfo Osvaldo Bogado <rodolfoosvaldobogado@gmail.com> | 2009-10-25 23:10:30 +0000 |
| commit | 0511d6e1858efecd8fc872e2cff8bd38caf7daae (patch) | |
| tree | 2a132fb76cb655e673eb19e8aabcc5be705fd0db /Source/Core/VideoCommon/Src/PixelShaderManager.cpp | |
| parent | 1adc944115c091661a2cb99f86c9707523766f84 (diff) | |
some work on zscale and zoffset, don't know if this is correct but at least it seem to fix one or two games.
thanks a lot to chaoscode he make possible to test this on nvidia. please test this a lot and give me feedback :)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4468 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon/Src/PixelShaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderManager.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp index c6a3e3da08..f298629536 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp @@ -31,7 +31,7 @@ static bool s_bZTextureTypeChanged; static bool s_bDepthRangeChanged; static bool s_bFogColorChanged; static bool s_bFogParamChanged; -static float lastDepthRange[2]; // 0 = far z, 1 = far - near +static float lastDepthRange[4]; // 0 = far z, 1 = far - near, 2 = scale , 3 = offset static float lastRGBAfull[2][4][4]; static float lastCustomTexScale[8][2]; static u8 s_nTexDimsChanged; @@ -54,6 +54,10 @@ void PixelShaderManager::Init() lastZBias = 0; s_texturemask = 0; memset(lastRGBAfull, 0, sizeof(lastRGBAfull)); + lastDepthRange[0]=16777216.0f; + lastDepthRange[1]=16777216.0f; + lastDepthRange[2]=16777216.0f; + lastDepthRange[3]=0.0f; Dirty(); } @@ -132,7 +136,7 @@ void PixelShaderManager::SetConstants() if (s_bZBiasChanged || s_bDepthRangeChanged) { //ERROR_LOG("pixel=%x,%x, bias=%x\n", bpmem.zcontrol.pixel_format, bpmem.ztex2.type, lastZBias); - SetPSConstant4f(C_ZBIAS+1, lastDepthRange[0] / 16777215.0f, lastDepthRange[1] / 16777215.0f, 0, (float)( (((int)lastZBias<<8)>>8))/16777215.0f); + SetPSConstant4f(C_ZBIAS+1, (lastDepthRange[0] + lastDepthRange[3]) / lastDepthRange[2], (lastDepthRange[1] + lastDepthRange[3]) / lastDepthRange[2], 0, (float)( (((int)lastZBias<<8)>>8))/16777215.0f); s_bZBiasChanged = s_bDepthRangeChanged = false; } @@ -326,6 +330,24 @@ void PixelShaderManager::SetViewport(float* viewport) } } +void PixelShaderManager::SetZScale(float data) +{ + if (lastDepthRange[2] != data) + { + lastDepthRange[2] = data; + s_bDepthRangeChanged = true; + } +} + +void PixelShaderManager::SetZOffset(float data) +{ + if (lastDepthRange[3] != data) + { + lastDepthRange[3] = data; + s_bDepthRangeChanged = true; + } +} + void PixelShaderManager::SetIndTexScaleChanged(u8 stagemask) { s_nIndTexScaleChanged |= stagemask; |
