summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-glsl.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-01-07 22:26:31 -0800
committerGitHub <noreply@github.com>2025-01-07 22:26:31 -0800
commitc43f6fa55aca23365c86c6ec1737d42be74d9d3e (patch)
tree2c49bc1dbd12ae5f46d682a3f240465931471060 /source/slang/slang-emit-glsl.cpp
parent1a56f58fdd0c704e6dc0fad0f0ec33a25a35e60b (diff)
Lower varying parameters as pointers instead of SSA values. (#5919)
* Add executable test on matrix-typed vertex input. * Fix emit logic of matrix layout qualifier. * Pass fragment shader varying input by constref to allow EvaluateAttributeAtCentroid etc. to be implemented correctly.
Diffstat (limited to 'source/slang/slang-emit-glsl.cpp')
-rw-r--r--source/slang/slang-emit-glsl.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index a863e7eb1..23fff37ac 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -3166,6 +3166,11 @@ void GLSLSourceEmitter::emitSimpleTypeImpl(IRType* type)
emitSimpleTypeImpl(cast<IRAtomicType>(type)->getElementType());
return;
}
+ case kIROp_ConstRefType:
+ {
+ emitSimpleTypeImpl(as<IRConstRefType>(type)->getValueType());
+ return;
+ }
default:
break;
}
@@ -3471,15 +3476,18 @@ void GLSLSourceEmitter::emitMatrixLayoutModifiersImpl(IRType* varType)
//
auto matrixType = as<IRMatrixType>(unwrapArray(varType));
-
if (matrixType)
{
+ auto layout = getIntVal(matrixType->getLayout());
+ if (layout == getTargetProgram()->getOptionSet().getMatrixLayoutMode())
+ return;
+
// 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 (getIntVal(matrixType->getLayout()))
+ switch (layout)
{
case SLANG_MATRIX_LAYOUT_COLUMN_MAJOR:
m_writer->emit("layout(row_major)\n");