From 7f8a9994d0bd99a171a1daa0bce46d92c02ccffd Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 21 May 2021 16:38:33 -0700 Subject: [gfx] Support StructuredBuffer. (#1851) Co-authored-by: T. Foley --- slang.h | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'slang.h') diff --git a/slang.h b/slang.h index 4b7ed9955..61768bc7b 100644 --- a/slang.h +++ b/slang.h @@ -3859,6 +3859,11 @@ namespace slang }; + enum class ContainerType + { + None, UnsizedArray, StructuredBuffer, ConstantBuffer, ParameterBlock + }; + /** A session provides a scope for code that is loaded. A session can be used to load modules of Slang source code, @@ -3950,11 +3955,23 @@ namespace slang LayoutRules rules = LayoutRules::Default, ISlangBlob** outDiagnostics = nullptr) = 0; - virtual SLANG_NO_THROW TypeLayoutReflection* SLANG_MCALL getParameterBlockLayout( + /** Get a container type from `elementType`. For example, given type `T`, returns + a type that represents `StructuredBuffer`. + + @param `elementType`: the element type to wrap around. + @param `containerType`: the type of the container to wrap `elementType` in. + @param `outDiagnostics`: a blob to receive diagnostic messages. + */ + virtual SLANG_NO_THROW TypeReflection* SLANG_MCALL getContainerType( TypeReflection* elementType, - SlangInt targetIndex = 0, - LayoutRules rules = LayoutRules::Default, - ISlangBlob** outDiagnostics = nullptr) = 0; + ContainerType containerType, + ISlangBlob** outDiagnostics = nullptr) = 0; + + /** Return a `TypeReflection` that represents the `__Dynamic` type. + This type can be used as a specialization argument to indicate using + dynamic dispatch. + */ + virtual SLANG_NO_THROW TypeReflection* SLANG_MCALL getDynamicType() = 0; /** Get the mangled name for a type RTTI object. */ @@ -4202,6 +4219,14 @@ namespace slang /** A type specialization argument, used for `Kind::Type`. */ TypeReflection* type; }; + + static SpecializationArg fromType(TypeReflection* inType) + { + SpecializationArg rs; + rs.kind = Kind::Type; + rs.type = inType; + return rs; + } }; } -- cgit v1.2.3