From 19332575aa37def859de4bb7bc6f65f7395b2b33 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Tue, 20 Jul 2021 12:53:32 -0700 Subject: [PATCH] WrapMode=3 behaves the same as Clamp --- Source/Core/VideoCommon/BPMemory.h | 2 ++ Source/Core/VideoCommon/RenderState.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Core/VideoCommon/BPMemory.h b/Source/Core/VideoCommon/BPMemory.h index 441fafe36c..27ef97e35e 100644 --- a/Source/Core/VideoCommon/BPMemory.h +++ b/Source/Core/VideoCommon/BPMemory.h @@ -713,6 +713,8 @@ enum class WrapMode : u32 Clamp = 0, Repeat = 1, Mirror = 2, + // Hardware testing indicates that WrapMode set to 3 behaves the same as clamp, though this is an + // invalid value }; template <> struct fmt::formatter : EnumFormatter diff --git a/Source/Core/VideoCommon/RenderState.cpp b/Source/Core/VideoCommon/RenderState.cpp index 52aed4613d..291aa9ce91 100644 --- a/Source/Core/VideoCommon/RenderState.cpp +++ b/Source/Core/VideoCommon/RenderState.cpp @@ -240,8 +240,9 @@ void SamplerState::Generate(const BPMemory& bp, u32 index) lod_bias = SamplerCommon::AreBpTexMode0MipmapsEnabled(tm0) ? tm0.lod_bias * (256 / 32) : 0; // Address modes + // Hardware testing indicates that wrap_mode set to 3 behaves the same as clamp. static constexpr std::array address_modes = { - {AddressMode::Clamp, AddressMode::Repeat, AddressMode::MirroredRepeat, AddressMode::Repeat}}; + {AddressMode::Clamp, AddressMode::Repeat, AddressMode::MirroredRepeat, AddressMode::Clamp}}; wrap_u = address_modes[u32(tm0.wrap_s.Value())]; wrap_v = address_modes[u32(tm0.wrap_t.Value())]; anisotropic_filtering = 0;