From ca9086f3ba5eb65bba18930c9c226fec3fc3271b Mon Sep 17 00:00:00 2001 From: Triang3l Date: Mon, 19 Oct 2020 23:02:20 +0300 Subject: [PATCH] [GPU] Add a comment about non-positive tessellation factors --- src/xenia/gpu/d3d12/shaders/adaptive_quad.hs.hlsl | 5 +++++ src/xenia/gpu/d3d12/shaders/adaptive_triangle.hs.hlsl | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/xenia/gpu/d3d12/shaders/adaptive_quad.hs.hlsl b/src/xenia/gpu/d3d12/shaders/adaptive_quad.hs.hlsl index 3fa31b7e5..6e27fe80e 100644 --- a/src/xenia/gpu/d3d12/shaders/adaptive_quad.hs.hlsl +++ b/src/xenia/gpu/d3d12/shaders/adaptive_quad.hs.hlsl @@ -29,6 +29,11 @@ XeHSConstantDataOutput XePatchConstant( // [2] - between U1V1 and U0V1. // [3] - between U0V1 and U0V0. [unroll] for (i = 0u; i < 4u; ++i) { + // While Viva Pinata sets the factors to 0 for frustum-culled (quad) + // patches, in Halo 3 only allowing patches with factors above 0 makes + // distant (triangle) patches disappear - it appears that there are no + // special values for culled patches on the Xbox 360 (unlike 0 and NaN on + // Direct3D 11). output.edges[i] = clamp( asfloat(xe_input_patch[(i + 3u) & 3u].index_or_edge_factor) + 1.0f, xe_tessellation_factor_range.x, xe_tessellation_factor_range.y); diff --git a/src/xenia/gpu/d3d12/shaders/adaptive_triangle.hs.hlsl b/src/xenia/gpu/d3d12/shaders/adaptive_triangle.hs.hlsl index c4199482f..304fb16eb 100644 --- a/src/xenia/gpu/d3d12/shaders/adaptive_triangle.hs.hlsl +++ b/src/xenia/gpu/d3d12/shaders/adaptive_triangle.hs.hlsl @@ -38,6 +38,11 @@ XeHSConstantDataOutput XePatchConstant( // 3) r0.z * v0 + r0.y * v1 + r0.x * v2 by the guest. // With this order, there are no cracks in Halo 3 water. [unroll] for (i = 0u; i < 3u; ++i) { + // While Viva Pinata sets the factors to 0 for frustum-culled (quad) + // patches, in Halo 3 only allowing patches with factors above 0 makes + // distant (triangle) patches disappear - it appears that there are no + // special values for culled patches on the Xbox 360 (unlike 0 and NaN on + // Direct3D 11). output.edges[i] = clamp( asfloat(xe_input_patch[(i + 1u) % 3u].index_or_edge_factor) + 1.0f, xe_tessellation_factor_range.x, xe_tessellation_factor_range.y);