summaryrefslogtreecommitdiff
path: root/source/slang/emit.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2017-07-11 12:41:05 -0700
committerGitHub <noreply@github.com>2017-07-11 12:41:05 -0700
commita60dd57e5ac0d3cc43fddf62dbf72677d377121f (patch)
tree2e4911b6da6573d334117a08130be5c945c31b15 /source/slang/emit.cpp
parent98b3e5bc95b6de081885798840c2deb79905a68f (diff)
parentbd7105ff8683a680d1270eca8cd74f9002144dbd (diff)
Merge pull request #72 from tfoleyNV/resources-in-structs
Resources in structs
Diffstat (limited to 'source/slang/emit.cpp')
-rw-r--r--source/slang/emit.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index b2366f564..309a356f4 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -1816,9 +1816,9 @@ struct EmitVisitor
// Try to find a suitable sampler-type shader parameter in the global scope
// (fingers crossed)
RefPtr<VarDeclBase> samplerVar;
- for (auto d : context->shared->program->Members)
+ for (auto dd : context->shared->program->Members)
{
- if (auto varDecl = d.As<VarDeclBase>())
+ if (auto varDecl = dd.As<VarDeclBase>())
{
if (auto samplerType = varDecl->Type.type->As<SamplerStateType>())
{
@@ -3203,6 +3203,14 @@ struct EmitVisitor
void visitVarDeclBase(RefPtr<VarDeclBase> decl, DeclEmitArg const& arg)
{
+ // Skip fields that have been tuple-ified and don't contribute
+ // any fields of "ordinary" type.
+ if (auto tupleFieldMod = decl->FindModifier<TupleFieldModifier>())
+ {
+ if (!tupleFieldMod->hasAnyNonTupleFields)
+ return;
+ }
+
RefPtr<VarLayout> layout = arg.layout;
layout = maybeFetchLayout(decl, layout);