[clang] [HLSL] Add RasterizerOrderedStructuredBuffer definition to HLSLExternalSemaSource (PR #113648)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 29 13:30:44 PDT 2024


================
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.2-compute -finclude-default-header -fnative-half-type -emit-llvm -o - %s | FileCheck %s
+
+// NOTE: The number in type name and whether the struct is packed or not will mostly
+// likely change once subscript operators are properly implemented (llvm/llvm-project#95956) 
+// and theinterim field of the contained type is removed.
+
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer" = type <{ target("dx.RawBuffer", i16, 1, 1)
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.0" = type <{ target("dx.RawBuffer", i16, 1, 1)
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.2" = type { target("dx.RawBuffer", i32, 1, 1)
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.3" = type { target("dx.RawBuffer", i32, 1, 1)
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.4" = type { target("dx.RawBuffer", i64, 1, 1)
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.5" = type { target("dx.RawBuffer", i64, 1, 1)
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.6" = type <{ target("dx.RawBuffer", half, 1, 1) 
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.8" = type { target("dx.RawBuffer", float, 1, 1)
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.9" = type { target("dx.RawBuffer", double, 1, 1)
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.10" = type { target("dx.RawBuffer", <4 x i16>, 1, 1)
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.11" = type { target("dx.RawBuffer", <3 x i32>, 1, 1)
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.12" = type { target("dx.RawBuffer", <2 x half>, 1, 1)
+// CHECK: %"class.hlsl::RasterizerOrderedStructuredBuffer.13" = type { target("dx.RawBuffer", <3 x float>, 1, 1)
+
+RasterizerOrderedStructuredBuffer<int16_t> BufI16;
+RasterizerOrderedStructuredBuffer<uint16_t> BufU16;
+RasterizerOrderedStructuredBuffer<int> BufI32;
+RasterizerOrderedStructuredBuffer<uint> BufU32;
+RasterizerOrderedStructuredBuffer<int64_t> BufI64;
+RasterizerOrderedStructuredBuffer<uint64_t> BufU64;
+RasterizerOrderedStructuredBuffer<half> BufF16;
+RasterizerOrderedStructuredBuffer<float> BufF32;
+RasterizerOrderedStructuredBuffer<double> BufF64;
+RasterizerOrderedStructuredBuffer< vector<int16_t, 4> > BufI16x4;
+RasterizerOrderedStructuredBuffer< vector<uint, 3> > BufU32x3;
+RasterizerOrderedStructuredBuffer<half2> BufF16x2;
+RasterizerOrderedStructuredBuffer<float3> BufF32x3;
+// TODO: RasterizerOrderedStructuredBuffer<snorm half> BufSNormF16;
----------------
hekota wrote:

User defined types in StructuredBuffers are not yet supported by codegen because of the old way we are generating resource annotations in metadata. The UDT does not map to predefined `hlsl::ElementType` and it crashes.
This is the task to remove the old annotations: llvm/llvm-project#114126

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


More information about the cfe-commits mailing list