summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-glsl.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-09-05 10:26:59 -0700
committerGitHub <noreply@github.com>2024-09-05 10:26:59 -0700
commita88055c6f5190ca62bb4aa853b4f0fa11546278f (patch)
tree0f4a417153110d43cf361c0abe29c8996b806f3c /source/slang/slang-emit-glsl.cpp
parent959f55de964ff108947db72a3f8d25b39995f2c8 (diff)
Respect matrix layout in uniform and in/out parameters for HLSL target. (#5013)
* Respect matrix layout in uniform and in/out parameters for HLSL target. * Update test. * Fix test. * fix test. * Fix metal layout calculation. * Fix compile error. * Fix compiler error. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit-glsl.cpp')
-rw-r--r--source/slang/slang-emit-glsl.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index fff1cddbe..56113409d 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -2850,28 +2850,28 @@ void GLSLSourceEmitter::emitVarDecorationsImpl(IRInst* varDecl)
}
-void GLSLSourceEmitter::emitMatrixLayoutModifiersImpl(IRVarLayout* layout)
+void GLSLSourceEmitter::emitMatrixLayoutModifiersImpl(IRType* varType)
{
// When a variable has a matrix type, we want to emit an explicit
// layout qualifier based on what the layout has been computed to be.
//
- auto typeLayout = layout->getTypeLayout()->unwrapArray();
+ auto matrixType = as<IRMatrixType>(unwrapArray(varType));
- if (auto matrixTypeLayout = as<IRMatrixTypeLayout>(typeLayout))
+ if (matrixType)
{
// Reminder: the meaning of row/column major layout
// in our semantics is the *opposite* of what GLSL
// calls them, because what they call "columns"
// are what we call "rows."
//
- switch (matrixTypeLayout->getMode())
+ switch (getIntVal(matrixType->getLayout()))
{
- case kMatrixLayoutMode_ColumnMajor:
+ case SLANG_MATRIX_LAYOUT_COLUMN_MAJOR:
m_writer->emit("layout(row_major)\n");
break;
- case kMatrixLayoutMode_RowMajor:
+ case SLANG_MATRIX_LAYOUT_ROW_MAJOR:
m_writer->emit("layout(column_major)\n");
break;
}