From 395302d2404e3429f3cdfa406e89fa76bc0d444b Mon Sep 17 00:00:00 2001 From: Darren Wihandi <65404740+fairywreath@users.noreply.github.com> Date: Thu, 13 Mar 2025 06:28:03 -0400 Subject: Add mesh shader output topology checks (#6592) * initial wip * more wip * add test * add unexpected for invalid target * fixups and improve error message * fixups and improve error message * remove incorrect comment --------- Co-authored-by: Ellie Hermaszewska --- source/slang/slang-emit-spirv.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source/slang/slang-emit-spirv.cpp') diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index 3b8e5e1d1..d43af8ac2 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -4,6 +4,7 @@ #include "slang-compiler.h" #include "slang-emit-base.h" #include "slang-ir-call-graph.h" +#include "slang-ir-entry-point-decorations.h" #include "slang-ir-insts.h" #include "slang-ir-layout.h" #include "slang-ir-redundancy-removal.h" @@ -4684,7 +4685,7 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex entryPoint ? entryPoint->findDecoration() : nullptr; const auto o = cast(decoration); - const auto t = o->getTopology()->getStringSlice(); + const auto topologyType = OutputTopologyType(o->getTopologyType()); SpvExecutionMode m = SpvExecutionModeMax; if (entryPointDecor) @@ -4693,20 +4694,20 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex { case Stage::Domain: case Stage::Hull: - if (t == "triangle_cw") + if (topologyType == OutputTopologyType::TriangleCW) m = SpvExecutionModeVertexOrderCw; - else if (t == "triangle_ccw") + else if (topologyType == OutputTopologyType::TriangleCCW) m = SpvExecutionModeVertexOrderCcw; break; } } if (m == SpvExecutionModeMax) { - if (t == "triangle") + if (topologyType == OutputTopologyType::Triangle) m = SpvExecutionModeOutputTrianglesEXT; - else if (t == "line") + else if (topologyType == OutputTopologyType::Line) m = SpvExecutionModeOutputLinesEXT; - else if (t == "point") + else if (topologyType == OutputTopologyType::Point) m = SpvExecutionModeOutputPoints; } -- cgit v1.2.3