mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
37dd10fbbe
This replaces the fixed point subpixel precision logic. GLQuake now effectively renders artifact-free. Previously white/gray pixels would sometimes be visible at triangle edges, caused by slightly misaligned triangle edges as a result of converting the vertex window coordinates to `int`. These artifacts were reduced by the introduction of subpixel precision, but not completely eliminated. Some interesting changes in this commit: * Applying the top-left rule for our counter-clockwise vertices is now done with simpler conditions: every vertex that has a Y coordinate lower than or equal to the previous vertex' Y coordinate is counted as a top or left edge. A float epsilon is used to emulate a switch between `> 0` and `>= 0` comparisons. * Fog depth calculation into a `f32x4` is now done once per triangle instead of once per fragment, and only if fog is enabled. * The `one_over_area` value was previously calculated as `1.0f / area`, where `area` was an `int`. This resulted in a lower quality reciprocal value whereas we can now retain floating point precision. The effect of this can be seen in Tux Racer, where the ice reflection is noticeably smoother.
26 lines
790 B
C++
26 lines
790 B
C++
/*
|
|
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#define INCREASE_STATISTICS_COUNTER(stat, n) \
|
|
do { \
|
|
if constexpr (ENABLE_STATISTICS_OVERLAY) \
|
|
stat += (n); \
|
|
} while (0)
|
|
|
|
namespace SoftGPU {
|
|
|
|
static constexpr bool ENABLE_STATISTICS_OVERLAY = false;
|
|
static constexpr int NUM_SAMPLERS = 2;
|
|
static constexpr int MILLISECONDS_PER_STATISTICS_PERIOD = 500;
|
|
static constexpr int NUM_LIGHTS = 8;
|
|
|
|
// See: https://www.khronos.org/opengl/wiki/Common_Mistakes#Texture_edge_color_problem
|
|
// FIXME: make this dynamically configurable through ConfigServer
|
|
static constexpr bool CLAMP_DEPRECATED_BEHAVIOR = false;
|
|
|
|
}
|