diff options
Diffstat (limited to 'Source/Core/VideoCommon/Src/PixelShaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderManager.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp index f2ead54b32..49200f401b 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2003-2008 Dolphin Project. +// Copyright (C) 2003-2009 Dolphin Project. // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -35,6 +35,7 @@ static bool s_bFogColorChanged; static bool s_bFogParamChanged; static float lastDepthRange[2] = {0}; // 0 = far z, 1 = far - near static float lastRGBAfull[2][4][4]; +static float lastCustomTexScale[8][2]; static u8 s_nTexDimsChanged; static u8 s_nIndTexScaleChanged; static u32 lastAlpha = 0; @@ -55,6 +56,8 @@ void PixelShaderManager::Init() s_bAlphaChanged = s_bZBiasChanged = s_bZTextureTypeChanged = s_bDepthRangeChanged = true; s_bFogColorChanged = s_bFogParamChanged = true; memset(lastRGBAfull, 0, sizeof(lastRGBAfull)); + for (int i = 0; i < 8; i++) + lastCustomTexScale[i][0] = lastCustomTexScale[i][1] = 1.0f; } void PixelShaderManager::Shutdown() @@ -186,6 +189,8 @@ void PixelShaderManager::SetConstants() SetPSConstant4f(C_FOG + 1, a, b, bpmem.fog.c_proj_fsel.GetC(), 0); s_bFogParamChanged = false; } + for (int i = 0; i < 8; i++) + lastCustomTexScale[i][0] = lastCustomTexScale[i][1] = 1.0f; } void PixelShaderManager::SetPSTextureDims(int texid) @@ -198,15 +203,15 @@ void PixelShaderManager::SetPSTextureDims(int texid) TCoordInfo& tc = bpmem.texcoords[texid]; fdims[0] = (float)(lastTexDims[texid]&0xffff); fdims[1] = (float)((lastTexDims[texid]>>16)&0xfff); - fdims[2] = (float)(tc.s.scale_minus_1+1); - fdims[3] = (float)(tc.t.scale_minus_1+1); + fdims[2] = (float)(tc.s.scale_minus_1+1)*lastCustomTexScale[texid][0]; + fdims[3] = (float)(tc.t.scale_minus_1+1)*lastCustomTexScale[texid][1]; } else { TCoordInfo& tc = bpmem.texcoords[texid]; fdims[0] = 1.0f/(float)(lastTexDims[texid]&0xffff); fdims[1] = 1.0f/(float)((lastTexDims[texid]>>16)&0xfff); - fdims[2] = (float)(tc.s.scale_minus_1+1); - fdims[3] = (float)(tc.t.scale_minus_1+1); + fdims[2] = (float)(tc.s.scale_minus_1+1)*lastCustomTexScale[texid][0]; + fdims[3] = (float)(tc.t.scale_minus_1+1)*lastCustomTexScale[texid][1]; } PRIM_LOG("texdims%d: %f %f %f %f\n", texid, fdims[0], fdims[1], fdims[2], fdims[3]); @@ -253,6 +258,12 @@ void PixelShaderManager::SetTexDims(int texmapid, u32 width, u32 height, u32 wra } } +void PixelShaderManager::SetCustomTexScale(int texmapid, float x, float y) +{ + lastCustomTexScale[texmapid][0] = x; + lastCustomTexScale[texmapid][1] = y; +} + void PixelShaderManager::SetZTextureBias(u32 bias) { if (lastZBias != bias) { |
