summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-03-12 19:31:25 -0700
committerGitHub <noreply@github.com>2024-03-12 19:31:25 -0700
commit6f7c8271710b43349d34b8f7569ceb6957400548 (patch)
tree288c18bb4b9a2cf32de7e400c1fe8b56385b727e /source/slang/slang.cpp
parenteef7e208bf7436a4f111a9290f37204e3220d82b (diff)
Fix `sessionDesc.defaultMatrixLayoutMode` being ineffective. (#3753)
* Fix `sessionDesc.defaultMatrixLayoutMode` being ineffective. * Fix matrix layout in buffer pointer. * Attempt to fix. * Fix buffer element type lowering for buffer pointers. * Add comment. * Fix test. * Fix member lookup in `Ref<T>`. * Fix validation error. * Enhance test.
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 69c0f0e14..978dff7c4 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -594,17 +594,6 @@ SLANG_NO_THROW SlangResult SLANG_MCALL Session::createSession(
slang::SessionDesc desc = makeFromSizeVersioned<slang::SessionDesc>((uint8_t*)&inDesc);
RefPtr<Linkage> linkage = new Linkage(this, astBuilder, getBuiltinLinkage());
- linkage->m_optionSet.load(desc.compilerOptionEntryCount, desc.compilerOptionEntries);
-
- {
- const Int targetCount = desc.targetCount;
- const uint8_t* targetDescPtr = reinterpret_cast<const uint8_t*>(desc.targets);
- for (Int ii = 0; ii < targetCount; ++ii, targetDescPtr += _getStructureSize(targetDescPtr))
- {
- const auto targetDesc = makeFromSizeVersioned<slang::TargetDesc>(targetDescPtr);
- linkage->addTarget(targetDesc);
- }
- }
linkage->setMatrixLayoutMode(desc.defaultMatrixLayoutMode);
@@ -630,6 +619,19 @@ SLANG_NO_THROW SlangResult SLANG_MCALL Session::createSession(
{
linkage->m_optionSet.set(CompilerOptionName::EnableEffectAnnotations, desc.enableEffectAnnotations);
}
+
+ linkage->m_optionSet.load(desc.compilerOptionEntryCount, desc.compilerOptionEntries);
+
+ {
+ const Int targetCount = desc.targetCount;
+ const uint8_t* targetDescPtr = reinterpret_cast<const uint8_t*>(desc.targets);
+ for (Int ii = 0; ii < targetCount; ++ii, targetDescPtr += _getStructureSize(targetDescPtr))
+ {
+ const auto targetDesc = makeFromSizeVersioned<slang::TargetDesc>(targetDescPtr);
+ linkage->addTarget(targetDesc);
+ }
+ }
+
*outSession = asExternal(linkage.detach());
return SLANG_OK;
}