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`).
This commit is contained in:
Jelle Raaijmakers 2022-09-13 12:10:50 +02:00 committed by Andreas Kling
parent bac7a12fb9
commit 6dcc808994
Notes: sideshowbarker 2024-07-17 07:12:44 +09:00

View file

@ -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