From fbf7d1025a6f48d5dd739344b61bff9d28b76129 Mon Sep 17 00:00:00 2001 From: Professor Hastig Date: Thu, 14 Sep 2023 08:48:47 +0200 Subject: [PATCH] - fixed bad clamp in software renderer This one can have its upper bound below its lower bound which triggers the validation within std::clamp. Fixes #2125 --- src/rendering/swrenderer/line/r_walldraw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rendering/swrenderer/line/r_walldraw.cpp b/src/rendering/swrenderer/line/r_walldraw.cpp index 0e2338d1e9..bd7ae48c4a 100644 --- a/src/rendering/swrenderer/line/r_walldraw.cpp +++ b/src/rendering/swrenderer/line/r_walldraw.cpp @@ -108,7 +108,7 @@ namespace swrenderer { for (int j = x1; j < x2; ++j) { - down[j] = clamp(most3.ScreenY[j], up[j], dwal[j]); + down[j] = max(min(most3.ScreenY[j], up[j]), dwal[j]); // this cannot use clamp due to failing range checks. } ProcessNormalWall(up, down, texcoords); up = down;