================
@@ -1589,6 +1629,39 @@
BuiltinTypeDeclBuilder::addTextureLoadMethods(ResourceDimension Dim,
.finalize();
}
+BuiltinTypeDeclBuilder &
+BuiltinTypeDeclBuilder::addTextureLoadMSMethods(ResourceDimension Dim,
+ bool IsArray) {
+ assert(!Record->isCompleteDefinition() && "record is already complete");
+ ASTContext &AST = Record->getASTContext();
+ uint32_t OffsetSize = getResourceDimensions(Dim);
+ // Multisampled textures use a plain location (no mip/LOD component).
+ uint32_t CoordSize = OffsetSize + (IsArray ? 1 : 0);
+ QualType IntTy = AST.IntTy;
+ QualType OffsetTy = AST.getExtVectorType(IntTy, OffsetSize);
+ QualType LocationTy = AST.getExtVectorType(IntTy, CoordSize);
+ QualType ReturnType = getHandleElementType();
+
+ using PH = BuiltinTypeMethodBuilder::PlaceHolder;
+
+ // T Load(int2 location, int sampleIndex)
+ BuiltinTypeMethodBuilder(*this, "Load", ReturnType)
+ .addParam("Location", LocationTy)
+ .addParam("SampleIndex", IntTy)
+ .callBuiltin("__builtin_hlsl_resource_load_ms", ReturnType, PH::Handle,
+ PH::_0, PH::_1)
+ .finalize();
+
+ // T Load(int2 location, int sampleIndex, int2 offset)
+ return BuiltinTypeMethodBuilder(*this, "Load", ReturnType)
----------------
bogner wrote:
I guess this matches `addTextureLoadMethods`, but I find this pattern
confusing. It'd be better to do both
`BuiltinTypeMethodBuilder(...)...finalize()` statements and then just `return
*this` like we do in the buffer versions of these functions.
https://github.com/llvm/llvm-project/pull/211972
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits