[clang] [HLSL] Add RWStructuredBuffer definition to HLSLExternalSemaSource (PR #113477)

Joshua Batista via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 23 10:42:16 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::RWStructuredBuffer" = type <{ target("dx.RawBuffer", i16, 1, 0)
+// CHECK: %"class.hlsl::RWStructuredBuffer.0" = type <{ target("dx.RawBuffer", i16, 1, 0)
+// CHECK: %"class.hlsl::RWStructuredBuffer.2" = type { target("dx.RawBuffer", i32, 1, 0)
+// CHECK: %"class.hlsl::RWStructuredBuffer.3" = type { target("dx.RawBuffer", i32, 1, 0)
+// CHECK: %"class.hlsl::RWStructuredBuffer.4" = type { target("dx.RawBuffer", i64, 1, 0)
+// CHECK: %"class.hlsl::RWStructuredBuffer.5" = type { target("dx.RawBuffer", i64, 1, 0)
+// CHECK: %"class.hlsl::RWStructuredBuffer.6" = type <{ target("dx.RawBuffer", half, 1, 0) 
+// CHECK: %"class.hlsl::RWStructuredBuffer.8" = type { target("dx.RawBuffer", float, 1, 0)
+// CHECK: %"class.hlsl::RWStructuredBuffer.9" = type { target("dx.RawBuffer", double, 1, 0)
+// CHECK: %"class.hlsl::RWStructuredBuffer.10" = type { target("dx.RawBuffer", <4 x i16>, 1, 0)
+// CHECK: %"class.hlsl::RWStructuredBuffer.11" = type { target("dx.RawBuffer", <3 x i32>, 1, 0)
+// CHECK: %"class.hlsl::RWStructuredBuffer.12" = type { target("dx.RawBuffer", <2 x half>, 1, 0)
+// CHECK: %"class.hlsl::RWStructuredBuffer.13" = type { target("dx.RawBuffer", <3 x float>, 1, 0)
+
+RWStructuredBuffer<int16_t> BufI16;
+RWStructuredBuffer<uint16_t> BufU16;
+RWStructuredBuffer<int> BufI32;
+RWStructuredBuffer<uint> BufU32;
+RWStructuredBuffer<int64_t> BufI64;
+RWStructuredBuffer<uint64_t> BufU64;
+RWStructuredBuffer<half> BufF16;
+RWStructuredBuffer<float> BufF32;
+RWStructuredBuffer<double> BufF64;
+RWStructuredBuffer< vector<int16_t, 4> > BufI16x4;
+RWStructuredBuffer< vector<uint, 3> > BufU32x3;
+RWStructuredBuffer<half2> BufF16x2;
+RWStructuredBuffer<float3> BufF32x3;
+// TODO: RWStructuredBuffer<snorm half> BufSNormF16; -> 11
----------------
bob80905 wrote:

What does -> 11 mean?

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


More information about the cfe-commits mailing list