From a8db46a6b8202b404c14ae3bd440f29aff5d0565 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 13 Jun 2025 20:54:00 +1000 Subject: [PATCH] GPU/HW: Use signed difference in luma_distance() Fixes the warning, and also underflowing, since both were unsigned it would overflow if the second was greater the first. --- src/core/gpu_hw_shadergen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/gpu_hw_shadergen.cpp b/src/core/gpu_hw_shadergen.cpp index a8a8b0e1e..6a3f5f9a9 100644 --- a/src/core/gpu_hw_shadergen.cpp +++ b/src/core/gpu_hw_shadergen.cpp @@ -787,7 +787,7 @@ float rgb_distance(uint a, uint b) // Calculate the luminance difference between two ABGR8 colors and normalize it float luma_distance(uint a, uint b) { - return abs(luma(a) - luma(b)) * 0.0006535948f; // Multiplicative replacement for division by 1530 + return abs(int(luma(a)) - int(luma(b))) * 0.0006535948f; // Multiplicative replacement for division by 1530 } /*=============================================================================