summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderGen.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2021-07-29 17:43:35 -0700
committerPokechu22 <Pokechu022@gmail.com>2021-11-17 21:27:32 -0800
commit93eea7cb1382cee1a265f330b824dcf1ca65294c (patch)
treec76b464a76f6689f8795e12ad1954b23f47bc71c /Source/Core/VideoCommon/PixelShaderGen.cpp
parentee80298ca4b4fb810b02334508e11c5405aa77d2 (diff)
VideoCommon: Add option to use old behavior (Fast Texture Sampling)
Co-authored-by: JosJuice <josjuice@gmail.com>
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index bff76d4246..fd9933c2ae 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -537,6 +537,7 @@ void UpdateBoundingBox(float2 rawpos) {{
fmt::arg("efb_height", EFB_HEIGHT), fmt::arg("efb_scale", I_EFBSCALE));
}
+ if (host_config.manual_texture_sampling)
{
if (api_type == APIType::OpenGL || api_type == APIType::Vulkan)
{
@@ -596,6 +597,21 @@ uint WrapCoord(int coord, uint wrap, int size) {{
"int2 uv, int layer) {{\n");
}
+ if (!host_config.manual_texture_sampling)
+ {
+ out.Write(" float size_s = float(" I_TEXDIMS "[texmap].x * 128);\n"
+ " float size_t = float(" I_TEXDIMS "[texmap].y * 128);\n"
+ " 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");
+ }
+ else if (api_type == APIType::D3D)
+ {
+ out.Write(" return iround(255.0 * tex.Sample(tex_samp, coords));\n}}\n");
+ }
+ }
+ else
{
out.Write(R"(
uint texmode0 = samp_texmode0(texmap);