================
@@ -861,8 +861,23 @@ llvm::Type
*CommonSPIRTargetCodeGenInfo::getSPIRVImageTypeFromHLSLResource(
Ty->isSignedIntegerType() ? "spirv.SignedImage" : "spirv.Image";
// Dim
- // For now we assume everything is a buffer.
- IntParams[0] = 5;
+ switch (attributes.ResourceDimension) {
+ case llvm::dxil::ResourceDimension::Dimension1D:
+ IntParams[0] = 0;
+ break;
+ case llvm::dxil::ResourceDimension::Dimension2D:
+ IntParams[0] = 1;
+ break;
+ case llvm::dxil::ResourceDimension::Dimension3D:
+ IntParams[0] = 2;
+ break;
+ case llvm::dxil::ResourceDimension::DimensionCube:
+ IntParams[0] = 3;
+ break;
+ case llvm::dxil::ResourceDimension::DimensionUnknown:
+ IntParams[0] = 5;
----------------
Keenuts wrote:
Why is unknown mapped to `spv::Dim::Buffer`?
Also should you use `SPIV::Dim::` enum? looking at the `.td` file, seems those
are defined and can be used here
https://github.com/llvm/llvm-project/pull/177240
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits