diff options
| author | Yong He <yonghe@outlook.com> | 2023-09-01 01:25:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-01 01:25:31 -0700 |
| commit | 9c11a87f8f811a9a110d73a24ab93443ea347506 (patch) | |
| tree | 9b1b0f154cff0faf7efd8d77fcd7f7911aea4a44 /source/slang/slang-check-decl.cpp | |
| parent | b7d19330c2d42937835d674758a05af3891e025b (diff) | |
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 <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
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<DeclRefType>(paramDecl->type.type)) + { + if (declRefType->getDeclRef().getDecl()->findModifier<NonCopyableTypeAttribute>()) + { + // Always pass a non-copyable type by reference. + // Remove all existing direction modifiers, and replace them with a single Ref modifier. + List<Modifier*> newModifiers; + bool hasRefModifier = false; + for (auto modifier : paramDecl->modifiers) + { + if (as<InModifier>(modifier) || as<InOutModifier>(modifier) || as<OutModifier>(modifier)) + { + continue; + } + if (as<RefModifier>(modifier)) + { + hasRefModifier = true; + } + newModifiers.add(modifier); + } + if (!hasRefModifier) + newModifiers.add(this->getASTBuilder()->create<RefModifier>()); + 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 |
