upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-26 09:16:34 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-26 09:16:34 -0500
commit062623063ea32b86252b74c6deeece37461f4a9e (patch)
tree2013b73bf237eac2d4a400614df6a6a82f5b32d7 /runtime/src
parent0f7868ffad60926f500c9b59c68a23880c2b7097 (diff)
parentb986d274bf6443aff485e39d220a7717aa48e56f (diff)
Merge #2097 from Snooozs: a mesh PSO with conservative rasterization needs no topology type (RT-MESH-PSO-CONSERVATIVE-TOPOLOGY)
Head b986d274b. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/conservative_raster.h17
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.
52inline 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