diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-03-13 06:28:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-13 18:28:03 +0800 |
| commit | 395302d2404e3429f3cdfa406e89fa76bc0d444b (patch) | |
| tree | 0114009e9573cd94007dc3c4c1dfcad844cc33f8 /source/slang/slang-emit-glsl.cpp | |
| parent | ee1995ba397c4f670c991aeeb05d3fcaaebb6771 (diff) | |
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 <ellieh@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit-glsl.cpp')
| -rw-r--r-- | source/slang/slang-emit-glsl.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp index 86699df48..ac98a0a3c 100644 --- a/source/slang/slang-emit-glsl.cpp +++ b/source/slang/slang-emit-glsl.cpp @@ -4,6 +4,7 @@ #include "../core/slang-writer.h" #include "slang-emit-source-writer.h" #include "slang-ir-call-graph.h" +#include "slang-ir-entry-point-decorations.h" #include "slang-ir-layout.h" #include "slang-ir-util.h" #include "slang-legalize-types.h" @@ -1415,6 +1416,23 @@ void GLSLSourceEmitter::emitParameterGroupImpl( _emitGLSLParameterGroup(varDecl, type); } +static String getOutputTopologyString(OutputTopologyType topology) +{ + SLANG_ASSERT(topology != OutputTopologyType::Unknown); + + switch (topology) + { + case OutputTopologyType::Point: + return "points"; + case OutputTopologyType::Line: + return "lines"; + case OutputTopologyType::Triangle: + return "triangles"; + default: + return ""; + } +} + void GLSLSourceEmitter::emitEntryPointAttributesImpl( IRFunc* irFunc, IREntryPointDecoration* entryPointDecor) @@ -1617,12 +1635,10 @@ void GLSLSourceEmitter::emitEntryPointAttributesImpl( } if (auto decor = as<IROutputTopologyDecoration>(decoration)) { - // TODO: Ellie validate here/elsewhere, what's allowed here is - // different from the tesselator - // The naming here is plural, so add an 's' m_writer->emit("layout("); - m_writer->emit(decor->getTopology()->getStringSlice()); - m_writer->emit("s) out;\n"); + m_writer->emit( + getOutputTopologyString(OutputTopologyType(decor->getTopologyType()))); + m_writer->emit(") out;\n"); } break; default: |
