summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderGen.cpp
diff options
context:
space:
mode:
authorOatmealDome <julian@oatmealdome.me>2021-12-25 15:36:09 -0500
committerOatmealDome <julian@oatmealdome.me>2021-12-28 02:10:45 -0500
commit056613ecc5c79941d4bc9747bdc6f79fe332183a (patch)
tree7964c85d5b596cba71d0982fe95eacd963b27776 /Source/Core/VideoCommon/PixelShaderGen.cpp
parent4e12d6e871680fe70bb45e7909f00a89539f7a3f (diff)
PixelShaderGen: Add LOD bias to texture() call on systems that don't support it in the sampler
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index c8f3bf5b15..ce607242c0 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -648,7 +648,19 @@ uint WrapCoord(int coord, uint wrap, int size) {{
" float3 coords = float3(float(uv.x) / size_s, float(uv.y) / size_t, layer);\n");
if (api_type == APIType::OpenGL || api_type == APIType::Vulkan)
{
- out.Write(" return iround(255.0 * texture(tex, coords));\n}}\n");
+ if (!host_config.backend_sampler_lod_bias)
+ {
+ out.Write(" uint texmode0 = samp_texmode0(texmap);\n"
+ " float lod_bias = {} / 256.0f;\n"
+ " return iround(255.0 * texture(tex, coords, lod_bias));\n",
+ BitfieldExtract<&SamplerState::TM0::lod_bias>("texmode0"));
+ }
+ else
+ {
+ out.Write(" return iround(255.0 * texture(tex, coords));\n");
+ }
+
+ out.Write("}}\n");
}
else if (api_type == APIType::D3D)
{