diff options
| author | Snooozs <0randale196@gmail.com> | 2026-11-25 21:20:01 +0100 |
|---|---|---|
| committer | Snooozs <0randale196@gmail.com> | 2026-11-25 21:20:01 +0100 |
| commit | b986d274bf6443aff485e39d220a7717aa48e56f (patch) | |
| tree | 51a9b996222fb91c3cd6a9914f24ffa33f762161 /runtime/src | |
| parent | db1a22d290f5e86fff9282fce3d4e02e788b05b4 (diff) | |
d3d12: a mesh PSO with conservative rasterization needs no topology type (RT-MESH-PSO-CONSERVATIVE-TOPOLOGY)
Finding by Undefined3301 in #1608.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/conservative_raster.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/src/conservative_raster.h b/runtime/src/conservative_raster.h index 469066d17..82d6dfaca 100644 --- a/runtime/src/conservative_raster.h +++ b/runtime/src/conservative_raster.h | |||
| @@ -46,4 +46,21 @@ inline InnerCoverageRequirements inner_coverage_requirements(std::span<const std | |||
| 46 | result.valid = true; | 46 | result.valid = true; |
| 47 | return result; | 47 | return result; |
| 48 | } | 48 | } |
| 49 | |||
| 50 | // True when the mesh shader module outputs triangles (OutputTrianglesEXT, 5298). A module with lines (5269), points (27) | ||
| 51 | // or no output mode does not. Each mesh entry point of a valid module has exactly one of the three. | ||
| 52 | inline bool mesh_outputs_triangles(std::span<const std::uint32_t> words) { | ||
| 53 | if (words.size() < 5 || words[0] != 0x07230203) return false; | ||
| 54 | bool triangles = false; | ||
| 55 | for (std::size_t i = 5; i < words.size();) { | ||
| 56 | const auto count = words[i] >> 16, op = words[i] & 0xffff; | ||
| 57 | if (!count || count > words.size() - i) return false; | ||
| 58 | if (op == 16 && count >= 3) { // OpExecutionMode | ||
| 59 | if (words[i + 2] == 5298) triangles = true; | ||
| 60 | else if (words[i + 2] == 5269 || words[i + 2] == 27) return false; | ||
| 61 | } | ||
| 62 | i += count; | ||
| 63 | } | ||
| 64 | return triangles; | ||
| 65 | } | ||
| 49 | } // namespace leonida::conservative_raster | 66 | } // namespace leonida::conservative_raster |