diff options
Diffstat (limited to 'source/slang/syntax.cpp')
| -rw-r--r-- | source/slang/syntax.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp index 21b3f92c2..320fc576b 100644 --- a/source/slang/syntax.cpp +++ b/source/slang/syntax.cpp @@ -1241,6 +1241,36 @@ void Type::accept(IValVisitor* visitor, void* extra) return findInnerMostGenericSubstitution(declRef.substitutions)->args[2].As<IntVal>().Ptr(); } + RefPtr<Type> MatrixExpressionType::getRowType() + { + if( !mRowType ) + { + mRowType = getSession()->getVectorType(getElementType(), getColumnCount()); + } + return mRowType; + } + + RefPtr<VectorExpressionType> Session::getVectorType( + RefPtr<Type> elementType, + RefPtr<IntVal> elementCount) + { + auto vectorGenericDecl = findMagicDecl( + this, "Vector").As<GenericDecl>(); + auto vectorTypeDecl = vectorGenericDecl->inner; + + auto substitutions = new GenericSubstitution(); + substitutions->genericDecl = vectorGenericDecl.Ptr(); + substitutions->args.Add(elementType); + substitutions->args.Add(elementCount); + + auto declRef = DeclRef<Decl>(vectorTypeDecl.Ptr(), substitutions); + + return DeclRefType::Create( + this, + declRef)->As<VectorExpressionType>(); + } + + // PtrTypeBase Type* PtrTypeBase::getValueType() |
