From 9ef228503abe24820985e431ef942c6ebb312442 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 24 Jul 2021 15:58:55 -0700 Subject: VideoCommon: Provide raw texdims to shaders --- Source/Core/VideoCommon/PixelShaderManager.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'Source/Core/VideoCommon/PixelShaderManager.cpp') diff --git a/Source/Core/VideoCommon/PixelShaderManager.cpp b/Source/Core/VideoCommon/PixelShaderManager.cpp index 436db9dd50..3a232903af 100644 --- a/Source/Core/VideoCommon/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/PixelShaderManager.cpp @@ -273,16 +273,13 @@ 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] = rwidth; - constants.texdims[texmapid][1] = rheight; + constants.texdims[texmapid][0] = width; + constants.texdims[texmapid][1] = height; } void PixelShaderManager::SetZTextureBias() @@ -382,8 +379,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; } -- cgit v1.2.3 From 4a9b26de86aa7e99af51016e07a755968b8777e0 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 8 Aug 2021 21:11:50 -0700 Subject: VideoCommon: Expose SamplerState to shaders The benefit to exposing this over the raw BP state is that adjustments Dolphin makes, such as LOD biases from arbitrary mipmap detection, will work properly. --- Source/Core/VideoCommon/PixelShaderManager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Source/Core/VideoCommon/PixelShaderManager.cpp') diff --git a/Source/Core/VideoCommon/PixelShaderManager.cpp b/Source/Core/VideoCommon/PixelShaderManager.cpp index 3a232903af..f63722c9c1 100644 --- a/Source/Core/VideoCommon/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/PixelShaderManager.cpp @@ -282,6 +282,15 @@ void PixelShaderManager::SetTexDims(int texmapid, u32 width, u32 height) 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.pack2[texmapid][2] = tm0; + constants.pack2[texmapid][3] = tm1; +} + void PixelShaderManager::SetZTextureBias() { constants.zbias[1][3] = bpmem.ztex1.bias; -- cgit v1.2.3