75 lines · plain
1// RUN: %clang_cc1 -triple spirv-pc-vulkan-compute -finclude-default-header -fnative-half-type -emit-llvm -o - %s | FileCheck %s2 3// Signed integers4// CHECK: %"class.hlsl::RWBuffer" = type { target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 24) }5RWBuffer<int> rwb_int;6// CHECK: %"class.hlsl::RWBuffer.0" = type { target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 25) }7RWBuffer<int2> rwb_int2;8// CHECK: %"class.hlsl::RWBuffer.1" = type { target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 0) }9RWBuffer<int3> rwb_int3;10// CHECK: %"class.hlsl::RWBuffer.2" = type { target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 21) }11RWBuffer<int4> rwb_int4;12 13// Unsigned integers14// CHECK: %"class.hlsl::RWBuffer.3" = type { target("spirv.Image", i32, 5, 2, 0, 0, 2, 33) }15RWBuffer<uint> rwb_uint;16// CHECK: %"class.hlsl::RWBuffer.4" = type { target("spirv.Image", i32, 5, 2, 0, 0, 2, 35) }17RWBuffer<uint2> rwb_uint2;18// CHECK: %"class.hlsl::RWBuffer.5" = type { target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) }19RWBuffer<uint3> rwb_uint3;20// CHECK: %"class.hlsl::RWBuffer.6" = type { target("spirv.Image", i32, 5, 2, 0, 0, 2, 30) }21RWBuffer<uint4> rwb_uint4;22 23// 64-bit integers24// CHECK: %"class.hlsl::RWBuffer.7" = type { target("spirv.SignedImage", i64, 5, 2, 0, 0, 2, 41) }25RWBuffer<int64_t> rwb_i64;26// CHECK: %"class.hlsl::RWBuffer.8" = type { target("spirv.SignedImage", i64, 5, 2, 0, 0, 2, 0) }27RWBuffer<int64_t2> rwb_i64_2;28// CHECK: %"class.hlsl::RWBuffer.9" = type { target("spirv.Image", i64, 5, 2, 0, 0, 2, 40) }29RWBuffer<uint64_t> rwb_u64;30// CHECK: %"class.hlsl::RWBuffer.10" = type { target("spirv.Image", i64, 5, 2, 0, 0, 2, 0) }31RWBuffer<uint64_t2> rwb_u64_2;32 33// Floats34// CHECK: %"class.hlsl::RWBuffer.11" = type { target("spirv.Image", float, 5, 2, 0, 0, 2, 3) }35RWBuffer<float> rwb_float;36// CHECK: %"class.hlsl::RWBuffer.12" = type { target("spirv.Image", float, 5, 2, 0, 0, 2, 6) }37RWBuffer<float2> rwb_float2;38// CHECK: %"class.hlsl::RWBuffer.13" = type { target("spirv.Image", float, 5, 2, 0, 0, 2, 0) }39RWBuffer<float3> rwb_float3;40// CHECK: %"class.hlsl::RWBuffer.14" = type { target("spirv.Image", float, 5, 2, 0, 0, 2, 1) }41RWBuffer<float4> rwb_float4;42 43// Other types that should get Unknown format44// CHECK: %"class.hlsl::RWBuffer.15" = type { target("spirv.Image", half, 5, 2, 0, 0, 2, 0) }45RWBuffer<half> rwb_half;46// CHECK: %"class.hlsl::RWBuffer.16" = type { target("spirv.Image", double, 5, 2, 0, 0, 2, 0) }47RWBuffer<double> rwb_double;48 49// Non-UAV resource50// CHECK: %"class.hlsl::Buffer" = type { target("spirv.SignedImage", i32, 5, 2, 0, 0, 1, 0) }51Buffer<int> b_int;52 53[numthreads(1,1,1)]54void main(int GI : SV_GroupIndex) {55 rwb_int[GI] = 0;56 rwb_int2[GI] = 0;57 rwb_int3[GI] = 0;58 rwb_int4[GI] = 0;59 rwb_uint[GI] = 0;60 rwb_uint2[GI] = 0;61 rwb_uint3[GI] = 0;62 rwb_uint4[GI] = 0;63 rwb_i64[GI] = 0;64 rwb_i64_2[GI] = 0;65 rwb_u64[GI] = 0;66 rwb_u64_2[GI] = 0;67 rwb_float[GI] = 0;68 rwb_float2[GI] = 0;69 rwb_float3[GI] = 0;70 rwb_float4[GI] = 0;71 rwb_half[GI] = 0;72 rwb_double[GI] = 0;73 int val = b_int[GI];74}75