================
@@ -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;
----------------
s-perron wrote:

I'm not sure which td file you're referring to. However, if you are looking at 
the SPIRV TD file in the backend that is unavailable in clang.  You can still 
build clang without the spirv backend

https://github.com/llvm/llvm-project/pull/177240
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to