summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderGen.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2021-12-28 02:45:14 -0500
committerGitHub <noreply@github.com>2021-12-28 02:45:14 -0500
commit01e8e950e8f381c852c842183fe6831d5e83b503 (patch)
tree6ebe9d05ef1ffc320c8480c06b6d8088623b145e /Source/Core/VideoCommon/PixelShaderGen.cpp
parent8d237eb1020dd57d7521f1ea5af16045e7991bf4 (diff)
parent056613ecc5c79941d4bc9747bdc6f79fe332183a (diff)
Merge pull request #10292 from OatmealDome/lodbias-take-two
PixelShaderGen: Use LOD bias when sampling texture on Metal and OpenGL ES
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)
{