From 4872eebaa26dad7809fb6c58f5569ec64099e0c1 Mon Sep 17 00:00:00 2001 From: Anders Leino Date: Fri, 28 Feb 2025 08:12:27 +0200 Subject: Don't add multiple matrix layout options when creating a session (#6476) The default matrix layout mode was applied in addition to any related options, and this caused the wrong matrix layout mode to be used. For example, tests/compute/column-major was failing when attempting to migrate to the new compilation API. This helps to address issue #4760 --- source/slang/slang.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index cd8cabfe5..fe7ecc4e9 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -816,8 +816,6 @@ Session::createSession(slang::SessionDesc const& inDesc, slang::ISession** outSe new TypeCheckingCache(*static_cast(m_typeCheckingCache.get())); } - linkage->setMatrixLayoutMode(desc.defaultMatrixLayoutMode); - Int searchPathCount = desc.searchPathCount; for (Int ii = 0; ii < searchPathCount; ++ii) { @@ -845,6 +843,10 @@ Session::createSession(slang::SessionDesc const& inDesc, slang::ISession** outSe linkage->m_optionSet.load(desc.compilerOptionEntryCount, desc.compilerOptionEntries); + if (!linkage->m_optionSet.hasOption(CompilerOptionName::MatrixLayoutColumn) && + !linkage->m_optionSet.hasOption(CompilerOptionName::MatrixLayoutRow)) + linkage->setMatrixLayoutMode(desc.defaultMatrixLayoutMode); + { const Int targetCount = desc.targetCount; const uint8_t* targetDescPtr = reinterpret_cast(desc.targets); -- cgit v1.2.3