[clang] [llvm] [HLSL] Add Texture2DMS (PR #211972)

Deric C. via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 18:58:18 PDT 2026


================
@@ -297,6 +297,24 @@ static BuiltinTypeDeclBuilder setupRWTextureType(CXXRecordDecl *Decl, Sema &S,
       .addStaticInitializationFunctions(false);
 }
 
+/// Set up Texture2DMS (multisampled) type: SRV texture with only operator[]
+/// and sample-indexed Load. It does not support sampling, gather, LOD, or mips.
+static BuiltinTypeDeclBuilder setupMSTextureType(CXXRecordDecl *Decl, Sema &S,
+                                                 bool IsArray,
+                                                 ResourceDimension Dim) {
+  return BuiltinTypeDeclBuilder(S, Decl)
+      .addTextureHandle(ResourceClass::SRV, /*IsROV=*/false, IsArray, Dim,
+                        /*IsMultiSampled=*/true)
+      .addTextureLoadMSMethods(Dim, IsArray)
+      .addArraySubscriptOperators(Dim, IsArray)
+      // TODO: Add MS-specific GetDimensions (with a NumberOfSamples output);
+      // the generic addGetDimensionsMethods is mip-based and unsuitable here.
----------------
Icohedron wrote:

I linked to https://github.com/llvm/wg-hlsl/issues/347 which I made a subissue of https://github.com/llvm/wg-hlsl/issues/409 which tracks implementation of GetDimensions for texture types among other things.

https://github.com/llvm/llvm-project/pull/211972


More information about the llvm-commits mailing list