From 088d0c39dced9b75c79ca88ac8b45af5221ab32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 10 Jan 2023 12:01:25 +0100 Subject: [PATCH] Remove the FS_TEXTURE_AT_OFFSET fragment shader flag --- GPU/Common/FragmentShaderGenerator.cpp | 15 ++++----------- GPU/Common/ShaderId.cpp | 3 --- GPU/Common/ShaderId.h | 3 +-- GPU/GLES/ShaderManagerGLES.cpp | 2 +- GPU/Vulkan/ShaderManagerVulkan.cpp | 2 +- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/GPU/Common/FragmentShaderGenerator.cpp b/GPU/Common/FragmentShaderGenerator.cpp index dc2c1efb3f..9224b07999 100644 --- a/GPU/Common/FragmentShaderGenerator.cpp +++ b/GPU/Common/FragmentShaderGenerator.cpp @@ -133,7 +133,6 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu bool needShaderTexClamp = id.Bit(FS_BIT_SHADER_TEX_CLAMP); GETexFunc texFunc = (GETexFunc)id.Bits(FS_BIT_TEXFUNC, 3); - bool textureAtOffset = id.Bit(FS_BIT_TEXTURE_AT_OFFSET); ReplaceBlendType replaceBlend = static_cast(id.Bits(FS_BIT_REPLACE_BLEND, 3)); @@ -243,9 +242,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu } if (needShaderTexClamp && doTexture) { WRITE(p, "vec4 u_texclamp : register(c%i);\n", CONST_PS_TEXCLAMP); - if (textureAtOffset) { - WRITE(p, "vec2 u_texclampoff : register(c%i);\n", CONST_PS_TEXCLAMPOFF); - } + WRITE(p, "vec2 u_texclampoff : register(c%i);\n", CONST_PS_TEXCLAMPOFF); } if (enableAlphaTest || enableColorTest) { @@ -378,9 +375,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu if (needShaderTexClamp && doTexture) { *uniformMask |= DIRTY_TEXCLAMP; WRITE(p, "uniform vec4 u_texclamp;\n"); - if (id.Bit(FS_BIT_TEXTURE_AT_OFFSET)) { - WRITE(p, "uniform vec2 u_texclampoff;\n"); - } + WRITE(p, "uniform vec2 u_texclampoff;\n"); } if (enableAlphaTest || enableColorTest) { @@ -607,10 +602,8 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu } else { vcoord = modulo + "(" + vcoord + ", u_texclamp.y)"; } - if (textureAtOffset) { - ucoord = "(" + ucoord + " + u_texclampoff.x)"; - vcoord = "(" + vcoord + " + u_texclampoff.y)"; - } + ucoord = "(" + ucoord + " + u_texclampoff.x)"; + vcoord = "(" + vcoord + " + u_texclampoff.y)"; WRITE(p, " vec2 fixedcoord = vec2(%s, %s);\n", ucoord.c_str(), vcoord.c_str()); truncate_cpy(texcoord, "fixedcoord"); diff --git a/GPU/Common/ShaderId.cpp b/GPU/Common/ShaderId.cpp index bc447c735d..605b1a1657 100644 --- a/GPU/Common/ShaderId.cpp +++ b/GPU/Common/ShaderId.cpp @@ -192,7 +192,6 @@ std::string FragmentShaderDesc(const FShaderID &id) { if (id.Bit(FS_BIT_CLEARMODE)) desc << "Clear "; if (id.Bit(FS_BIT_DO_TEXTURE)) desc << (id.Bit(FS_BIT_3D_TEXTURE) ? "Tex3D " : "Tex "); if (id.Bit(FS_BIT_DO_TEXTURE_PROJ)) desc << "TexProj "; - if (id.Bit(FS_BIT_TEXTURE_AT_OFFSET)) desc << "TexOffs "; if (id.Bit(FS_BIT_FLATSHADE)) desc << "Flat "; if (id.Bit(FS_BIT_BGRA_TEXTURE)) desc << "BGRA "; switch ((ShaderDepalMode)id.Bits(FS_BIT_SHADER_DEPAL_MODE, 2)) { @@ -303,12 +302,10 @@ void ComputeFragmentShaderID(FShaderID *id_out, const ComputedPipelineState &pip id.SetBit(FS_BIT_DO_TEXTURE); id.SetBits(FS_BIT_TEXFUNC, 3, gstate.getTextureFunction()); if (gstate_c.needShaderTexClamp) { - bool textureAtOffset = gstate_c.curTextureXOffset != 0 || gstate_c.curTextureYOffset != 0; // 4 bits total. id.SetBit(FS_BIT_SHADER_TEX_CLAMP); id.SetBit(FS_BIT_CLAMP_S, gstate.isTexCoordClampedS()); id.SetBit(FS_BIT_CLAMP_T, gstate.isTexCoordClampedT()); - id.SetBit(FS_BIT_TEXTURE_AT_OFFSET, textureAtOffset); } id.SetBit(FS_BIT_BGRA_TEXTURE, gstate_c.bgraTexture); id.SetBits(FS_BIT_SHADER_DEPAL_MODE, 2, (int)shaderDepalMode); diff --git a/GPU/Common/ShaderId.h b/GPU/Common/ShaderId.h index 032042193a..54b18b7713 100644 --- a/GPU/Common/ShaderId.h +++ b/GPU/Common/ShaderId.h @@ -72,8 +72,7 @@ enum FShaderBit : uint8_t { FS_BIT_SHADER_TEX_CLAMP = 7, FS_BIT_CLAMP_S = 8, FS_BIT_CLAMP_T = 9, - FS_BIT_TEXTURE_AT_OFFSET = 10, - // 1 bit free + // 2 bits free FS_BIT_ALPHA_TEST = 12, FS_BIT_ALPHA_TEST_FUNC = 13, // 3 bits FS_BIT_ALPHA_AGAINST_ZERO = 16, diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index b7bd5711d6..5cb0ba71f6 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -951,7 +951,7 @@ enum class CacheDetectFlags { }; #define CACHE_HEADER_MAGIC 0x83277592 -#define CACHE_VERSION 23 +#define CACHE_VERSION 24 struct CacheHeader { uint32_t magic; uint32_t version; diff --git a/GPU/Vulkan/ShaderManagerVulkan.cpp b/GPU/Vulkan/ShaderManagerVulkan.cpp index 4cdcab138c..d1c3b52d0b 100644 --- a/GPU/Vulkan/ShaderManagerVulkan.cpp +++ b/GPU/Vulkan/ShaderManagerVulkan.cpp @@ -516,7 +516,7 @@ enum class VulkanCacheDetectFlags { }; #define CACHE_HEADER_MAGIC 0xff51f420 -#define CACHE_VERSION 37 +#define CACHE_VERSION 38 struct VulkanCacheHeader { uint32_t magic; uint32_t version;