diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2016-04-10 01:20:34 +0200 |
|---|---|---|
| committer | Pierre Bourdon <delroth@gmail.com> | 2016-04-10 01:20:34 +0200 |
| commit | c4af5889457c10e3cad6c35c41045fe9017d9633 (patch) | |
| tree | c3f01d75d6e6ba48f4822e935d600b7f9af33df5 /Source/Core/VideoCommon/PixelShaderManager.cpp | |
| parent | e98fb0af84f2cb65636240d282b6a074f939ea4f (diff) | |
| parent | 10e4f7e7bf214ad2c02470a722065875ccc1eee9 (diff) | |
Merge pull request #3772 from degasus/shader_opt
PixelShaderGen: Move constant multiplication to constant generation.
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/PixelShaderManager.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderManager.cpp b/Source/Core/VideoCommon/PixelShaderManager.cpp index 3fd0cfe0c8..2734f64827 100644 --- a/Source/Core/VideoCommon/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/PixelShaderManager.cpp @@ -137,13 +137,16 @@ void PixelShaderManager::SetDestAlpha() void PixelShaderManager::SetTexDims(int texmapid, u32 width, u32 height) { + float rwidth = 1.0f / (width * 128.0f); + float rheight = 1.0f / (height * 128.0f); + // TODO: move this check out to callee. There we could just call this function on texture changes // or better, use textureSize() in glsl - if (constants.texdims[texmapid][0] != 1.0f/width || constants.texdims[texmapid][1] != 1.0f/height) + if (constants.texdims[texmapid][0] != rwidth || constants.texdims[texmapid][1] != rheight) dirty = true; - constants.texdims[texmapid][0] = 1.0f/width; - constants.texdims[texmapid][1] = 1.0f/height; + constants.texdims[texmapid][0] = rwidth; + constants.texdims[texmapid][1] = rheight; } void PixelShaderManager::SetZTextureBias() @@ -238,8 +241,8 @@ void PixelShaderManager::SetZTextureTypeChanged() void PixelShaderManager::SetTexCoordChanged(u8 texmapid) { TCoordInfo& tc = bpmem.texcoords[texmapid]; - constants.texdims[texmapid][2] = (float)(tc.s.scale_minus_1 + 1); - constants.texdims[texmapid][3] = (float)(tc.t.scale_minus_1 + 1); + constants.texdims[texmapid][2] = (float)(tc.s.scale_minus_1 + 1) * 128.0f; + constants.texdims[texmapid][3] = (float)(tc.t.scale_minus_1 + 1) * 128.0f; dirty = true; } |
