GPU: using if constexpr C++17 optimization

This commit is contained in:
Герман Семенов authored and Henrik Rydgård committed 2023-04-02 16:36:37 +02:00
1 parent 8d5af48efd
commit 122b63b9a8
8 files changed
+89 -79

No files matched your search

+1 -1
View File
@@ -177,7 +177,7 @@ static ScreenCoords ClipToScreenInternal(Vec3f scaled, const ClipCoords &coords,
const float SCREEN_BOUND = 4095.0f + (15.5f / 16.0f);
// This matches hardware tests - depth is clamped when this flag is on.
if (depthClamp) {
if constexpr (depthClamp) {
// Note: if the depth is clipped (z/w <= -1.0), the outside_range_flag should NOT be set, even for x and y.
if ((alwaysCheckRange || coords.z > -coords.w) && (scaled.x >= SCREEN_BOUND || scaled.y >= SCREEN_BOUND || scaled.x < 0 || scaled.y < 0)) {
*outside_range_flag = true;