From 9c11a87f8f811a9a110d73a24ab93443ea347506 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 1 Sep 2023 01:25:31 -0700 Subject: Fix GLSL code gen around RayQuery and HitObject types. (#3173) * Update slang-llvm. * Fix. * fix. * Fix unit tests for multi-thread execution. * Fix tests. * fixes. * update tests. * Add gfx-smoke to linux expected failure list. * Try fix test. --------- Co-authored-by: Yong He --- source/slang/slang-check-decl.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'source/slang/slang-check-decl.cpp') diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index f25821dac..76ab8655a 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -5615,6 +5615,39 @@ namespace Slang paramDecl->type = typeExpr; checkMeshOutputDecl(paramDecl); } + + if (auto declRefType = as(paramDecl->type.type)) + { + if (declRefType->getDeclRef().getDecl()->findModifier()) + { + // Always pass a non-copyable type by reference. + // Remove all existing direction modifiers, and replace them with a single Ref modifier. + List newModifiers; + bool hasRefModifier = false; + for (auto modifier : paramDecl->modifiers) + { + if (as(modifier) || as(modifier) || as(modifier)) + { + continue; + } + if (as(modifier)) + { + hasRefModifier = true; + } + newModifiers.add(modifier); + } + if (!hasRefModifier) + newModifiers.add(this->getASTBuilder()->create()); + paramDecl->modifiers.first = newModifiers.getFirst(); + for (Index i = 0; i < newModifiers.getCount(); i++) + { + if (i < newModifiers.getCount() - 1) + newModifiers[i]->next = newModifiers[i + 1]; + else + newModifiers[i]->next = nullptr; + } + } + } } // This checks that the declaration is marked as "out" and changes the hlsl -- cgit v1.2.3