Pārlūkot izejas kodu

Shaders: centroid position with conservative depth

Pixel programs that write SV_DepthLessEqual or SV_DepthGreaterEqual
failed validation: "Interpolation mode for PS input position must be
linear_noperspective_centroid or linear_noperspective_sample when
outputting oDepthGE or oDepthLE". The position is now declared
linear_noperspective_centroid in those programs, as DXC declares it;
without multisampling the value is the same.

translate --validate on shaders.rpf: vertex/pixel 12172 -> 12186
validated; the error is gone from the list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Saitken91 3 dienas atpakaļ
vecāks
revīzija
c249f02dd5
1 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  1. 7 0
      crates/victory-shader/src/emit/mod.rs

+ 7 - 0
crates/victory-shader/src/emit/mod.rs

@@ -241,6 +241,13 @@ pub fn emit(
             _ => 0,
         };
     }
+    // With a conservative depth output (SV_DepthLessEqual, GreaterEqual) DXIL
+    // wants the position centroid (or per sample), as DXC declares it then.
+    if pixel && outputs.iter().any(|e| matches!(e.kind, 18 | 19)) {
+        for e in inputs.iter_mut().filter(|e| e.kind == 3) {
+            e.interp = 5;
+        }
+    }
     // Per-primitive outputs are constant. The console never exports a
     // primitive id or cull flag a mesh shader writes (it culls with the
     // primitive export), so those rows are left out.