summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-01-06 17:20:42 -0500
committerGitHub <noreply@github.com>2023-01-06 17:20:42 -0500
commitb985b1bdada76b02b51b4f2ea3cbd985c9b8a210 (patch)
tree087ef448358312bf72775249a3416fd5bbc5ba86
parent33fb95980b0120cdd4d4f2d51f5f116e808dd4aa (diff)
Fix small issue around emitInterpolationModifiersImpl when layout is nullptr. (#2583)
* #include an absolute path didn't work - because paths were taken to always be relative. * Fix output when layout is nullptr in emitInterpolatioModifiersImpl
-rw-r--r--source/slang/slang-emit-glsl.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index e3bd771df..b1b92e7e7 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -2262,8 +2262,14 @@ void GLSLSourceEmitter::emitInterpolationModifiersImpl(IRInst* varInst, IRType*
{
bool anyModifiers = false;
- auto stage = layout->getStage();
- auto isInput = layout->findOffsetAttr(LayoutResourceKind::VaryingInput) != nullptr;
+ Stage stage = Stage::Unknown;
+ bool isInput = false;
+
+ if (layout)
+ {
+ stage = layout->getStage();
+ isInput = layout->findOffsetAttr(LayoutResourceKind::VaryingInput) != nullptr;
+ }
for (auto dd : varInst->getDecorations())
{
@@ -2314,7 +2320,8 @@ void GLSLSourceEmitter::emitInterpolationModifiersImpl(IRInst* varInst, IRType*
// output everything with `flat` except for
// fragment *outputs* (and maybe vertex inputs).
//
- if (layout && layout->getStage() == Stage::Fragment
+ if (layout
+ && layout->getStage() == Stage::Fragment
&& layout->usesResourceKind(LayoutResourceKind::VaryingInput))
{
_maybeEmitGLSLFlatModifier(valueType);