summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2025-08-30 03:02:42 +0100
committerGitHub <noreply@github.com>2025-08-30 03:02:42 +0100
commit2ff3a7215b394e583b4c143676946c4a177e3e73 (patch)
tree5b1166b1a091a3b853980bd94320dc8da5c59aa3
parentb47a75fa2d858f370b7dbfc0d32d13007c59be2e (diff)
parentbc417bdceea9078f8f775eb488c4ca8579ea46a9 (diff)
Merge pull request #13902 from Tilka/fix_color_clamp
VideoSW: fix clamping after vertex color interpolation
-rw-r--r--Source/Core/VideoBackends/Software/Rasterizer.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/Source/Core/VideoBackends/Software/Rasterizer.cpp b/Source/Core/VideoBackends/Software/Rasterizer.cpp
index 6aaeb7c50a..a1d4dda0d3 100644
--- a/Source/Core/VideoBackends/Software/Rasterizer.cpp
+++ b/Source/Core/VideoBackends/Software/Rasterizer.cpp
@@ -173,12 +173,8 @@ static void Draw(s32 x, s32 y, s32 xi, s32 yi)
{
for (int comp = 0; comp < 4; comp++)
{
- u16 color = (u16)ColorSlopes[i][comp].GetValue(x, y);
-
- // clamp color value to 0
- u16 mask = ~(color >> 8);
-
- tev.Color[i][comp] = color & mask;
+ const float color = ColorSlopes[i][comp].GetValue(x, y);
+ tev.Color[i][comp] = (u8)std::clamp<float>(color, 0.0f, 255.0f);
}
}