From 6dcc808994d14de3134a6fa406a118f0100a7980 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Tue, 13 Sep 2022 12:10:50 +0200 Subject: [PATCH] LibSoftGPU: Reduce subpixel precision from 6 to 4 bits With 6 bits of precision, the maximum triangle coordinate we can handle is sqrt(2^31 / (1 << 6)^2) = ~724. Rendering to a target of 800x600 or higher quickly becomes a mess because of integer overflow. By reducing the subpixel precision to 4 bits, we support coordinates up to ~2896, which means that we can (try to) render to target sizes like 2560x1440. This fixes the main menu backdrop for the Half-Life port. It also introduces more white pixel artifacts in Quake's water / lava rendering, but this is a level geometry visualization bug (see `r_novis`). --- Userland/Libraries/LibSoftGPU/Config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibSoftGPU/Config.h b/Userland/Libraries/LibSoftGPU/Config.h index 52ed67ead8c..93aaac9077f 100644 --- a/Userland/Libraries/LibSoftGPU/Config.h +++ b/Userland/Libraries/LibSoftGPU/Config.h @@ -21,7 +21,7 @@ static constexpr int MILLISECONDS_PER_STATISTICS_PERIOD = 500; static constexpr int NUM_LIGHTS = 8; static constexpr int MAX_CLIP_PLANES = 6; static constexpr float MAX_TEXTURE_LOD_BIAS = 2.f; -static constexpr int SUBPIXEL_BITS = 6; +static constexpr int SUBPIXEL_BITS = 4; // See: https://www.khronos.org/opengl/wiki/Common_Mistakes#Texture_edge_color_problem // FIXME: make this dynamically configurable through ConfigServer