diff options
| author | JMC47 <JMC4789@gmail.com> | 2021-11-18 13:08:23 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-18 13:08:23 -0500 |
| commit | 6f4bbac528682389e34a1a4985820ee5137619c7 (patch) | |
| tree | 9f07e21fa1da14c7485fddac611a2618888afcf0 /Source/Core/VideoCommon/PixelShaderManager.cpp | |
| parent | 8b57aad8edd82ccc414775d22e96d896bcac6176 (diff) | |
| parent | 95b99410443e7ae47df1f3e9436e275c80dd3678 (diff) | |
Merge pull request #9956 from Pokechu22/non-power-of-2-wrap-2
VideoCommon: Manually handle texture wrapping and sampling
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/PixelShaderManager.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderManager.cpp b/Source/Core/VideoCommon/PixelShaderManager.cpp index 436db9dd50..f63722c9c1 100644 --- a/Source/Core/VideoCommon/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/PixelShaderManager.cpp @@ -273,16 +273,22 @@ void PixelShaderManager::SetDestAlphaChanged() 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] != rwidth || constants.texdims[texmapid][1] != rheight) + if (constants.texdims[texmapid][0] != width || constants.texdims[texmapid][1] != height) + dirty = true; + + constants.texdims[texmapid][0] = width; + constants.texdims[texmapid][1] = height; +} + +void PixelShaderManager::SetSamplerState(int texmapid, u32 tm0, u32 tm1) +{ + if (constants.pack2[texmapid][2] != tm0 || constants.pack2[texmapid][3] != tm1) dirty = true; - constants.texdims[texmapid][0] = rwidth; - constants.texdims[texmapid][1] = rheight; + constants.pack2[texmapid][2] = tm0; + constants.pack2[texmapid][3] = tm1; } void PixelShaderManager::SetZTextureBias() @@ -382,8 +388,8 @@ void PixelShaderManager::SetZTextureOpChanged() void PixelShaderManager::SetTexCoordChanged(u8 texmapid) { TCoordInfo& tc = bpmem.texcoords[texmapid]; - 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; + constants.texdims[texmapid][2] = tc.s.scale_minus_1 + 1; + constants.texdims[texmapid][3] = tc.t.scale_minus_1 + 1; dirty = true; } |
