diff --git a/tools/clang/test/CodeGenHLSL/BigStructInBuffer.hlsl b/tools/clang/test/CodeGenHLSL/BigStructInBuffer.hlsl deleted file mode 100644 index f4688d97a3..0000000000 --- a/tools/clang/test/CodeGenHLSL/BigStructInBuffer.hlsl +++ /dev/null @@ -1,20 +0,0 @@ -// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s - -// CHECK: elements of typed buffers and textures must fit in four 32-bit quantities - -struct Foo { - float2 a; - float b; - float c; - float d[2]; -}; - -Buffer inputs : register(t1); - -RWBuffer< int > g_Intensities : register(u1); - -[ numthreads( 64, 2, 2 ) ] -void main( uint GI : SV_GroupIndex) -{ - g_Intensities = inputs[GI].d[0]; -} \ No newline at end of file diff --git a/tools/clang/test/CodeGenHLSL/EmptyStructInBuffer.hlsl b/tools/clang/test/CodeGenHLSL/EmptyStructInBuffer.hlsl deleted file mode 100644 index fc845675f5..0000000000 --- a/tools/clang/test/CodeGenHLSL/EmptyStructInBuffer.hlsl +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s - -// CHECK: object's templated type must have at least one element - -struct Empty {}; -Buffer eb; - - -[ numthreads( 64, 2, 2 ) ] -void main( uint GI : SV_GroupIndex) -{ - eb[GI]; -} \ No newline at end of file diff --git a/tools/clang/test/CodeGenSPIRV/error.no.validation.hlsl b/tools/clang/test/CodeGenSPIRV/error.no.validation.hlsl index 0ff8822967..d4e5d0bba3 100644 --- a/tools/clang/test/CodeGenSPIRV/error.no.validation.hlsl +++ b/tools/clang/test/CodeGenSPIRV/error.no.validation.hlsl @@ -13,7 +13,7 @@ struct S { float a; }; -// CHECK: error: cannot instantiate RWBuffer with struct type 'S' +// CHECK: error: Elements of typed buffers and textures must be scalars or vectors RWBuffer buff; [numthreads(1, 1, 1)] diff --git a/tools/clang/test/CodeGenSPIRV/op.buffer.access.bitfield.hlsl b/tools/clang/test/CodeGenSPIRV/op.buffer.access.bitfield.hlsl deleted file mode 100644 index 48c87fb1f7..0000000000 --- a/tools/clang/test/CodeGenSPIRV/op.buffer.access.bitfield.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: %dxc -T ps_6_6 -E main -HV 2021 -fcgl %s -spirv | FileCheck %s - -struct S1 { - uint f1 : 1; - uint f2 : 1; -}; - -Buffer input_1; - -void main() { -// CHECK: [[img:%[0-9]+]] = OpLoad %type_buffer_image %input_1 -// CHECK: [[tmp:%[0-9]+]] = OpImageFetch %v4uint [[img]] %uint_0 None -// CHECK: [[tmp_0:%[0-9]+]] = OpVectorShuffle %v2uint [[tmp]] [[tmp]] 0 1 -// CHECK: [[tmp_f1:%[0-9]+]] = OpCompositeExtract %uint [[tmp_0]] 0 -// CHECK: [[tmp_s1:%[0-9]+]] = OpCompositeConstruct %S1 [[tmp_f1]] -// CHECK: OpStore [[tmp_var_S1:%[a-zA-Z0-9_]+]] [[tmp_s1]] -// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Function_uint [[tmp_var_S1]] %int_0 -// CHECK: [[load:%[0-9]+]] = OpLoad %uint [[ptr]] -// CHECK: [[extract:%[0-9]+]] = OpBitFieldUExtract %uint [[load]] %uint_1 %uint_1 -// CHECK: OpStore %tmp [[extract]] - uint tmp = input_1[0].f2; -} diff --git a/tools/clang/test/CodeGenSPIRV/op.buffer.access.hlsl b/tools/clang/test/CodeGenSPIRV/op.buffer.access.hlsl index e68677e527..b67a949300 100644 --- a/tools/clang/test/CodeGenSPIRV/op.buffer.access.hlsl +++ b/tools/clang/test/CodeGenSPIRV/op.buffer.access.hlsl @@ -28,15 +28,6 @@ RWBuffer int4buf; RWBuffer uint4buf; RWBuffer float4buf; -struct S { - float a; - float2 b; - float1 c; -}; - -// CHECK: %type_buffer_image_11 = OpTypeImage %float Buffer 2 0 0 1 Rgba32f -Buffer sBuf; - void main() { int address; @@ -125,28 +116,4 @@ void main() { // CHECK-NEXT: OpStore %b [[b]] float b = float4buf[address][2]; -// CHECK: [[img:%[0-9]+]] = OpLoad %type_buffer_image_11 %sBuf -// CHECK-NEXT: [[fetch:%[0-9]+]] = OpImageFetch %v4float [[img]] %uint_0 None -// CHECK-NEXT: [[s_a:%[0-9]+]] = OpCompositeExtract %float [[fetch]] 0 -// CHECK-NEXT: [[s_b:%[0-9]+]] = OpVectorShuffle %v2float [[fetch]] [[fetch]] 1 2 -// CHECK-NEXT: [[s_c:%[0-9]+]] = OpCompositeExtract %float [[fetch]] 3 -// CHECK-NEXT: [[s:%[0-9]+]] = OpCompositeConstruct %S [[s_a]] [[s_b]] [[s_c]] -// CHECK-NEXT: OpStore %temp_var_S [[s]] -// CHECK-NEXT: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Function_float %temp_var_S %int_0 -// CHECK-NEXT: [[c:%[0-9]+]] = OpLoad %float [[ptr]] -// CHECK-NEXT: OpStore %c [[c]] - float c = sBuf[0].a; - -// CHECK: [[img_0:%[0-9]+]] = OpLoad %type_buffer_image_11 %sBuf -// CHECK-NEXT: [[fetch_0:%[0-9]+]] = OpImageFetch %v4float [[img_0]] %uint_1 None -// CHECK-NEXT: [[s_a_0:%[0-9]+]] = OpCompositeExtract %float [[fetch_0]] 0 -// CHECK-NEXT: [[s_b_0:%[0-9]+]] = OpVectorShuffle %v2float [[fetch_0]] [[fetch_0]] 1 2 -// CHECK-NEXT: [[s_c_0:%[0-9]+]] = OpCompositeExtract %float [[fetch_0]] 3 -// CHECK-NEXT: [[s_0:%[0-9]+]] = OpCompositeConstruct %S [[s_a_0]] [[s_b_0]] [[s_c_0]] -// CHECK-NEXT: OpStore %temp_var_S_0 [[s_0]] -// CHECK-NEXT: [[ptr_0:%[0-9]+]] = OpAccessChain %_ptr_Function_v2float %temp_var_S_0 %int_1 -// CHECK-NEXT: [[val:%[0-9]+]] = OpLoad %v2float [[ptr_0]] -// CHECK-NEXT: [[d:%[0-9]+]] = OpCompositeExtract %float [[val]] 1 -// CHECK-NEXT: OpStore %d [[d]] - float d = sBuf[1].b.y; } diff --git a/tools/clang/test/CodeGenSPIRV/op.texture.access.hlsl b/tools/clang/test/CodeGenSPIRV/op.texture.access.hlsl index 3cb4784d83..6f11eb9abb 100644 --- a/tools/clang/test/CodeGenSPIRV/op.texture.access.hlsl +++ b/tools/clang/test/CodeGenSPIRV/op.texture.access.hlsl @@ -10,14 +10,6 @@ Texture2DArray t6; // There is no operator[] for TextureCubeArray in HLSL reference. // There is no operator[] for Texture2DMSArray in HLSL reference. -struct S { - float a; - float2 b; - float1 c; -}; - -Texture2D tStruct; - // CHECK: [[cu12:%[0-9]+]] = OpConstantComposite %v2uint %uint_1 %uint_2 // CHECK: [[cu123:%[0-9]+]] = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3 @@ -63,15 +55,4 @@ void main() { // CHECK-NEXT: OpStore %a6 [[result6]] int3 a6 = t6[uint3(1,2,3)]; -// CHECK: [[tex:%[0-9]+]] = OpLoad %type_2d_image_1 %tStruct -// CHECK-NEXT: [[fetch:%[0-9]+]] = OpImageFetch %v4float [[tex]] {{%[0-9]+}} Lod %uint_0 -// CHECK-NEXT: [[a:%[0-9]+]] = OpCompositeExtract %float [[fetch]] 0 -// CHECK-NEXT: [[b:%[0-9]+]] = OpVectorShuffle %v2float [[fetch]] [[fetch]] 1 2 -// CHECK-NEXT: [[c:%[0-9]+]] = OpCompositeExtract %float [[fetch]] 3 -// CHECK-NEXT: [[s:%[0-9]+]] = OpCompositeConstruct %S [[a]] [[b]] [[c]] -// CHECK-NEXT: OpStore %temp_var_S [[s]] -// CHECK-NEXT: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Function_float %temp_var_S %int_2 -// CHECK-NEXT: [[val:%[0-9]+]] = OpLoad %float [[ptr]] -// CHECK-NEXT: OpStore %a7 [[val]] - float a7 = tStruct[uint2(1, 2)].c; } diff --git a/tools/clang/test/CodeGenSPIRV/rich.debug.texture.hlsl b/tools/clang/test/CodeGenSPIRV/rich.debug.texture.hlsl index f3fd2b4197..3d2a496230 100644 --- a/tools/clang/test/CodeGenSPIRV/rich.debug.texture.hlsl +++ b/tools/clang/test/CodeGenSPIRV/rich.debug.texture.hlsl @@ -29,12 +29,7 @@ Texture2D t0 : register(t0); TextureCubeArray t1 : register(t1); Texture2DMS t2 : register(t2); -struct S { - float a; - float b; -}; - -Texture2DArray t3; +Texture2DArray t3; void main() { } diff --git a/tools/clang/test/CodeGenSPIRV/type.buffer.hlsl b/tools/clang/test/CodeGenSPIRV/type.buffer.hlsl index aeb3aa3459..35d1b868a8 100644 --- a/tools/clang/test/CodeGenSPIRV/type.buffer.hlsl +++ b/tools/clang/test/CodeGenSPIRV/type.buffer.hlsl @@ -81,20 +81,6 @@ RWBuffer uint4rwbuf; RWBuffer float3rwbuf; RWBuffer float4rwbuf; -struct S { - float a; - float b; -}; - -struct T { - float1 a; - float2 b; -}; - -Buffer sBuf; - -Buffer tBuf; - // CHECK: %intbuf = OpVariable %_ptr_UniformConstant_type_buffer_image UniformConstant // CHECK: %uintbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_0 UniformConstant // CHECK: %floatbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_1 UniformConstant @@ -119,7 +105,5 @@ Buffer tBuf; // CHECK: %uint4rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_20 UniformConstant // CHECK: %float3rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_21 UniformConstant // CHECK: %float4rwbuf = OpVariable %_ptr_UniformConstant_type_buffer_image_22 UniformConstant -// CHECK: %sBuf = OpVariable %_ptr_UniformConstant_type_buffer_image_7 UniformConstant -// CHECK: %tBuf = OpVariable %_ptr_UniformConstant_type_buffer_image_15 UniformConstant void main() {} diff --git a/tools/clang/test/CodeGenSPIRV/type.buffer.struct.error1.hlsl b/tools/clang/test/CodeGenSPIRV/type.buffer.struct.error1.hlsl deleted file mode 100644 index 6b4bc57ac2..0000000000 --- a/tools/clang/test/CodeGenSPIRV/type.buffer.struct.error1.hlsl +++ /dev/null @@ -1,14 +0,0 @@ -// RUN: not %dxc -T ps_6_0 -E main -fcgl %s -spirv 2>&1 | FileCheck %s - -struct S { - float4 a; - float3 b; -}; - -Buffer MyBuffer; - -float4 main(): SV_Target { - return MyBuffer[0].a; -} - -// CHECK: :3:8: error: resource template element type 'S' cannot fit into four 32-bit scalars diff --git a/tools/clang/test/CodeGenSPIRV/type.buffer.struct.error2.hlsl b/tools/clang/test/CodeGenSPIRV/type.buffer.struct.error2.hlsl deleted file mode 100644 index dc255faefd..0000000000 --- a/tools/clang/test/CodeGenSPIRV/type.buffer.struct.error2.hlsl +++ /dev/null @@ -1,14 +0,0 @@ -// RUN: not %dxc -T ps_6_0 -E main -fcgl %s -spirv 2>&1 | FileCheck %s - -struct S { - float2 a; - int1 b; -}; - -Buffer MyBuffer; - -float4 main(): SV_Target { - return MyBuffer[0].a.x; -} - -// CHECK: :3:8: error: all struct members should have the same element type for resource template instantiation diff --git a/tools/clang/test/CodeGenSPIRV/type.buffer.struct.error3.hlsl b/tools/clang/test/CodeGenSPIRV/type.buffer.struct.error3.hlsl index 816c1ac40d..93a8b534a2 100644 --- a/tools/clang/test/CodeGenSPIRV/type.buffer.struct.error3.hlsl +++ b/tools/clang/test/CodeGenSPIRV/type.buffer.struct.error3.hlsl @@ -15,4 +15,4 @@ float4 main(): SV_Target { return MyBuffer[0].a.x; } -// CHECK: :7:8: error: unsupported struct element type for resource template instantiation +// CHECK: :12:1: error: Elements of typed buffers and textures must be scalars or vectors diff --git a/tools/clang/test/CodeGenSPIRV/type.rwbuffer.struct.error.hlsl b/tools/clang/test/CodeGenSPIRV/type.rwbuffer.struct.error.hlsl index 2204dd1b55..509667a137 100644 --- a/tools/clang/test/CodeGenSPIRV/type.rwbuffer.struct.error.hlsl +++ b/tools/clang/test/CodeGenSPIRV/type.rwbuffer.struct.error.hlsl @@ -1,16 +1,16 @@ -// RUN: not %dxc -T vs_6_0 -E main -fcgl %s -spirv 2>&1 | FileCheck %s +// RUN: not %dxc -DBUF=RWBuffer -T vs_6_0 -E main -fcgl %s -spirv 2>&1 | FileCheck %s -check-prefix=BUF +// RUN: not %dxc -DBUF=RasterizerOrderedBuffer -T vs_6_0 -E main -fcgl %s -spirv 2>&1 | FileCheck %s -check-prefix=ROV struct S { float a; float b; }; -// CHECK: error: cannot instantiate RWBuffer with struct type 'S' -RWBuffer MyRWBuffer; - -// CHECK: error: cannot instantiate RasterizerOrderedBuffer with struct type 'S' -RasterizerOrderedBuffer MyROVBuffer; +// BUF: error: Elements of typed buffers and textures must be scalars or vectors +// ROV: error: cannot instantiate RasterizerOrderedBuffer with struct type 'S' +BUF Buf; float4 main() : A { return 1.0; } + diff --git a/tools/clang/test/CodeGenSPIRV/type.texture.hlsl b/tools/clang/test/CodeGenSPIRV/type.texture.hlsl index 1e1004a64e..b01cdc9569 100644 --- a/tools/clang/test/CodeGenSPIRV/type.texture.hlsl +++ b/tools/clang/test/CodeGenSPIRV/type.texture.hlsl @@ -29,9 +29,6 @@ // CHECK: %type_2d_image_array_0 = OpTypeImage %uint 2D 2 1 1 1 Unknown // CHECK: %_ptr_UniformConstant_type_2d_image_array_0 = OpTypePointer UniformConstant %type_2d_image_array_0 -// CHECK: %type_2d_image_array_1 = OpTypeImage %float 2D 2 1 0 1 Unknown -// CHECK: %_ptr_UniformConstant_type_2d_image_array_1 = OpTypePointer UniformConstant %type_2d_image_array_1 - // CHECK: %t1 = OpVariable %_ptr_UniformConstant_type_1d_image UniformConstant Texture1D t1 : register(t1); // CHECK: %t2 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant @@ -56,21 +53,6 @@ Texture2DMSArray t9 : register(t9); // CHECK: %t10 = OpVariable %_ptr_UniformConstant_type_2d_image_1 UniformConstant Texture2D t10 : register(t10); -struct S { - float a; - float b; -}; - -struct T { - float1 a; - float2 b; -}; - -// CHECK: %sTex = OpVariable %_ptr_UniformConstant_type_1d_image UniformConstant -Texture1D sTex; -// CHECK: %tTex = OpVariable %_ptr_UniformConstant_type_2d_image_array_1 UniformConstant -Texture2DArray tTex; - void main() { // CHECK-LABEL: %main = OpFunction } diff --git a/tools/clang/test/HLSL/cpp-errors-hv2015.hlsl b/tools/clang/test/HLSL/cpp-errors-hv2015.hlsl index f40f580304..0ae5034341 100644 --- a/tools/clang/test/HLSL/cpp-errors-hv2015.hlsl +++ b/tools/clang/test/HLSL/cpp-errors-hv2015.hlsl @@ -356,12 +356,7 @@ class c_outer_typedef { typedef int local_int; // expected-error {{nested typedefs are not supported in HLSL}} }; -class c_outer_fn { - int fn() { - class local_class { int j; }; - typedef int local_int; - } -}; +typedef float4 c_outer_td; class c_public { public: int i; // expected-error {{'public' is a reserved keyword in HLSL}} @@ -576,8 +571,8 @@ void expressions() internal->fn(); // expected-error {{operator is not supported}} local_i = (int3) { 1, 2, 3 }; // expected-error {{compound literal is unsupported in HLSL}} - // `class` ok, but component count should be checked earlier (1 to 4 uniform components): - Texture2D<::c_outer_fn> local_texture; + // ok, but component count should be checked earlier (1 to 4 uniform components): + Texture2D<::c_outer_td> local_texture; ::new local_new; // expected-error {{new' is a reserved keyword in HLSL}} ::template foo local_template; // expected-error {{'template' is a reserved keyword in HLSL}} expected-error {{unknown type name 'foo'}} diff --git a/tools/clang/test/HLSL/cpp-errors.hlsl b/tools/clang/test/HLSL/cpp-errors.hlsl index f34756e3d2..c3172f4256 100644 --- a/tools/clang/test/HLSL/cpp-errors.hlsl +++ b/tools/clang/test/HLSL/cpp-errors.hlsl @@ -352,12 +352,7 @@ class c_outer_typedef { typedef int local_int; // expected-error {{nested typedefs are not supported in HLSL}} }; -class c_outer_fn { - int fn() { - class local_class { int j; }; - typedef int local_int; - } -}; +typedef float3 c_outer_td; class c_public { public: int i; // expected-error {{'public' is a reserved keyword in HLSL}} @@ -572,8 +567,8 @@ void expressions() internal->fn(); // expected-error {{operator is not supported}} local_i = (int3) { 1, 2, 3 }; // expected-error {{compound literal is unsupported in HLSL}} - // `class` ok, but component count should be checked earlier (1 to 4 uniform components): - Texture2D<::c_outer_fn> local_texture; + // ok, but component count should be checked earlier (1 to 4 uniform components): + Texture2D<::c_outer_td> local_texture; ::new local_new; // expected-error {{new' is a reserved keyword in HLSL}} ::template foo local_template; // expected-error {{'template' is a reserved keyword in HLSL}} expected-error {{unknown type name 'foo'}} diff --git a/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl b/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl index 8d17d3da83..9ea997b936 100644 --- a/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl +++ b/tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl @@ -7,7 +7,7 @@ // CHECK: RecordTable (stride = {{[0-9]+}} bytes) ResourceTable[2] = { // CHECK: <0:RuntimeDataResourceInfo> = { // CHECK: Class: SRV -// CHECK: Kind: TypedBuffer +// CHECK: Kind: StructuredBuffer // CHECK: ID: 0 // CHECK: Space: 0 // CHECK: LowerBound: 1 @@ -33,7 +33,7 @@ // CHECK: Resources: <0:RecordArrayRef[2]> = { // CHECK: [0]: <0:RuntimeDataResourceInfo> = { // CHECK: Class: SRV -// CHECK: Kind: TypedBuffer +// CHECK: Kind: StructuredBuffer // CHECK: ID: 0 // CHECK: Space: 0 // CHECK: LowerBound: 1 @@ -85,20 +85,20 @@ // CHECK: Shader Version: Compute 6.5 // CHECK: Creator: // CHECK: Flags: 0 -// CHECK: ConstantBuffers: 0 +// CHECK: ConstantBuffers: 1 // CHECK: BoundResources: 2 // CHECK: FunctionParameterCount: 0 // CHECK: HasReturn: FALSE // CHECK: Bound Resources: // CHECK: D3D12_SHADER_INPUT_BIND_DESC: Name: inputs -// CHECK: Type: D3D_SIT_TEXTURE +// CHECK: Type: D3D_SIT_STRUCTURED // CHECK: uID: 0 // CHECK: BindCount: 1 // CHECK: BindPoint: 1 // CHECK: Space: 0 -// CHECK: ReturnType: D3D_RETURN_TYPE_SINT +// CHECK: ReturnType: D3D_RETURN_TYPE_MIXED // CHECK: Dimension: D3D_SRV_DIMENSION_BUFFER -// CHECK: NumSamples (or stride): 4294967295 +// CHECK: NumSamples (or stride): 16 // CHECK: uFlags: 0 // CHECK: D3D12_SHADER_INPUT_BIND_DESC: Name: g_Intensities // CHECK: Type: D3D_SIT_UAV_RWTYPED @@ -116,7 +116,7 @@ struct Foo { int d[2]; }; -Buffer inputs : register(t1); +StructuredBuffer inputs : register(t1); RWBuffer< int > g_Intensities : register(u1); groupshared Foo sharedData; @@ -130,4 +130,4 @@ void main( uint GI : SV_GroupIndex) int rtn; InterlockedAdd(sharedData.d[0], g_Intensities[GI], rtn); g_Intensities[GI] = rtn + sharedData.d[0]; -} \ No newline at end of file +} diff --git a/tools/clang/test/HLSLFileCheck/hlsl/intrinsics/atomic/atomic_on_members.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/intrinsics/atomic/atomic_on_members.hlsl deleted file mode 100644 index 7f8c1f7c2b..0000000000 --- a/tools/clang/test/HLSLFileCheck/hlsl/intrinsics/atomic/atomic_on_members.hlsl +++ /dev/null @@ -1,79 +0,0 @@ -// RUN: %dxc -HV 2021 -T cs_6_0 -DOP=InterlockedOr -DDEST=Str %s | FileCheck %s -check-prefix=CHKBIN -// RUN: %dxc -HV 2021 -T cs_6_0 -DOP=InterlockedCompareStore -DDEST=Str %s | FileCheck %s -check-prefix=CHKXCH -// RUN: %dxc -HV 2021 -T cs_6_0 -DOP=InterlockedOr -DDEST=Gs %s | FileCheck %s -check-prefix=CHKGSB -// RUN: %dxc -HV 2021 -T cs_6_0 -DOP=InterlockedCompareStore -DDEST=Gs %s | FileCheck %s -check-prefix=CHKGSX -// RUN: %dxc -HV 2021 -T cs_6_0 -DOP=InterlockedOr -DDEST=Buf %s | FileCheck %s -check-prefix=CHKERR -// RUN: %dxc -HV 2021 -T cs_6_0 -DOP=InterlockedCompareStore -DDEST=Buf %s | FileCheck %s -check-prefix=CHKERR - -// Ensure that atomic operations fail when used with struct members of a typed resource -// The only typed resource that can use structs is RWBuffer -// Use a binary op and an exchange op because they use different code paths - -struct Simple { - uint i; - uint longEnding[1]; -}; - -struct Complex { - Simple s; - uint theEnd; -}; - -struct TexCoords { - uint s, t, r, q; -}; - -#define _PASTE(pre, res) pre##res -#define PASTE(pre, res) _PASTE(pre, res) - -RWBuffer Buf; -RWBuffer simpBuf; -RWBuffer cplxBuf; - -RWStructuredBuffer Str; -RWStructuredBuffer simpStr; -RWStructuredBuffer cplxStr; - -groupshared TexCoords Gs[1]; -groupshared Simple simpGs[1]; -groupshared Complex cplxGs[1]; - -[numthreads(8,8,1)] -void main( uint3 gtid : SV_GroupThreadID , uint gid : SV_GroupIndex) -{ - uint orig = 0; - uint a = gid; - uint b = gtid.x; - uint c = gtid.y; - uint d = gtid.z; - - // CHKBIN: call i32 @dx.op.atomicBinOp.i32(i32 78 - // CHKBIN: call i32 @dx.op.atomicBinOp.i32(i32 78 - // CHKBIN: call i32 @dx.op.atomicBinOp.i32(i32 78 - // CHKBIN: call i32 @dx.op.atomicBinOp.i32(i32 78 - - // CHKXCH: call i32 @dx.op.atomicCompareExchange.i32(i32 79, - // CHKXCH: call i32 @dx.op.atomicCompareExchange.i32(i32 79, - // CHKXCH: call i32 @dx.op.atomicCompareExchange.i32(i32 79, - // CHKXCH: call i32 @dx.op.atomicCompareExchange.i32(i32 79, - - // CHKGSB: atomicrmw or i32 addrspace(3) - // CHKGSB: atomicrmw or i32 addrspace(3) - // CHKGSB: atomicrmw or i32 addrspace(3) - // CHKGSB: atomicrmw or i32 addrspace(3) - - // CHKGSX: cmpxchg i32 addrspace(3) - // CHKGSX: cmpxchg i32 addrspace(3) - // CHKGSX: cmpxchg i32 addrspace(3) - // CHKGSX: cmpxchg i32 addrspace(3) - - // CHKERR: error: Typed resources used in atomic operations must have a scalar element type. - // CHKERR: error: Typed resources used in atomic operations must have a scalar element type. - // CHKERR: error: Typed resources used in atomic operations must have a scalar element type. - // CHKERR: error: Typed resources used in atomic operations must have a scalar element type. - - OP( PASTE( ,DEST)[a].q, 2, orig ); - OP( PASTE(simp, DEST)[a].i, 2, orig ); - OP( PASTE(cplx, DEST)[a].s.i, 2, orig ); - OP( PASTE(cplx, DEST)[a].s.longEnding[d].x, 2, orig ); -} diff --git a/tools/clang/test/HLSLFileCheck/hlsl/objects/AppendStructuredBuffer/struct_loads.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/objects/AppendStructuredBuffer/struct_loads.hlsl deleted file mode 100644 index d62189468d..0000000000 --- a/tools/clang/test/HLSLFileCheck/hlsl/objects/AppendStructuredBuffer/struct_loads.hlsl +++ /dev/null @@ -1,66 +0,0 @@ -// RUN: %dxc -E main -T vs_6_2 %s | FileCheck %s - -// Test that individual fields can be loaded from a typed buffer based on a struct type. -// The buffer load offset should be aligned to element sizes. -// Regression test for GitHub #2258 - -AppendStructuredBuffer output; - -struct Scalars { int a, b; }; -Buffer buf_scalars; - -struct Vectors { int2 a, b; }; -Buffer buf_vectors; - -struct Array { int a; int b[3]; }; -Buffer buf_array; - -int i; - -void main() -{ - // Float at offset > 0 - // CHECK: %[[scalretres:.*]] = call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32(i32 68, {{.*}}, i32 0, i32 undef) - // CHECK: %[[scalval:.*]] = extractvalue %dx.types.ResRet.i32 %[[scalretres]], 1 - // CHECK: call void @dx.op.rawBufferStore.i32(i32 140, {{.*}}, i32 {{.*}}, i32 0, i32 %[[scalval]], i32 0, i32 0, i32 0, i8 15, i32 4) - output.Append(int4(buf_scalars[0].b, 0, 0, 0)); - - // Vector at offset > 0 - // CHECK: %[[vecretres:.*]] = call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32(i32 68, {{.*}}, i32 0, i32 undef) - // CHECK: %[[vecvalx:.*]] = extractvalue %dx.types.ResRet.i32 %[[vecretres]], 2 - // CHECK: %[[vecvaly:.*]] = extractvalue %dx.types.ResRet.i32 %[[vecretres]], 3 - // CHECK: call void @dx.op.rawBufferStore.i32(i32 140, {{.*}}, i32 {{.*}}, i32 0, i32 %[[vecvalx]], i32 %[[vecvaly]], i32 0, i32 0, i8 15, i32 4) - output.Append(int4(buf_vectors[0].b, 0, 0)); - - // Array at offset > 0, dynamically indexed - - // Convert index to offset in struct - // CHECK: shl i32 %{{.*}}, 2 - // CHECK: add i32 %{{.*}}, 4 - - // Load entire struct elements - // CHECK: call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32 - // CHECK: extractvalue %dx.types.ResRet.i32 %{{.*}}, 0 - // CHECK: extractvalue %dx.types.ResRet.i32 %{{.*}}, 1 - // CHECK: extractvalue %dx.types.ResRet.i32 %{{.*}}, 2 - // CHECK: extractvalue %dx.types.ResRet.i32 %{{.*}}, 3 - - // Fill temporary array - // CHECK: getelementptr [4 x i32] - // CHECK: store i32 - // CHECK: getelementptr [4 x i32] - // CHECK: store i32 - // CHECK: getelementptr [4 x i32] - // CHECK: store i32 - // CHECK: getelementptr [4 x i32] - // CHECK: store i32 - - // Index into array - // CHECK: lshr exact i32 %{{.*}}, 2 - // CHECK: getelementptr [4 x i32] - // CHECK: load i32 - - // Store result - // CHECK: call void @dx.op.rawBufferStore.i32 - output.Append(int4(buf_array[0].b[i], 0, 0, 0)); -} \ No newline at end of file diff --git a/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/EmptyStructInBuffer.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/EmptyStructInBuffer.hlsl deleted file mode 100644 index fc845675f5..0000000000 --- a/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/EmptyStructInBuffer.hlsl +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s - -// CHECK: object's templated type must have at least one element - -struct Empty {}; -Buffer eb; - - -[ numthreads( 64, 2, 2 ) ] -void main( uint GI : SV_GroupIndex) -{ - eb[GI]; -} \ No newline at end of file diff --git a/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/structInBuffer.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/structInBuffer.hlsl deleted file mode 100644 index dc47a6fa12..0000000000 --- a/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/structInBuffer.hlsl +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s - -// CHECK: @main -struct Foo { - int a; - int b; - int c; - int d; -}; - -Buffer inputs : register(t1); -RWBuffer< int > g_Intensities : register(u1); - -groupshared Foo sharedData; - -[ numthreads( 64, 2, 2 ) ] -void main( uint GI : SV_GroupIndex) -{ - if (GI==0) - sharedData = inputs[GI]; - - int rtn; - InterlockedAdd(sharedData.d, g_Intensities[GI], rtn); - g_Intensities[GI] = rtn + sharedData.d; -} \ No newline at end of file diff --git a/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/structInBuffer2.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/structInBuffer2.hlsl deleted file mode 100644 index ac17136900..0000000000 --- a/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/structInBuffer2.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s - -// CHECK: @main -struct Foo { - int a[2]; - int d[2]; -}; - -Buffer inputs : register(t1); -RWBuffer< int > g_Intensities : register(u1); - -groupshared Foo sharedData; - -[ numthreads( 64, 2, 2 ) ] -void main( uint GI : SV_GroupIndex) -{ - if (GI==0) - sharedData = inputs[GI]; - int rtn; - InterlockedAdd(sharedData.d[0], g_Intensities[GI], rtn); - g_Intensities[GI] = rtn + sharedData.d[0]; -} \ No newline at end of file diff --git a/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/structInBuffer3.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/structInBuffer3.hlsl deleted file mode 100644 index 895ef47344..0000000000 --- a/tools/clang/test/HLSLFileCheck/hlsl/objects/Buffer/structInBuffer3.hlsl +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: %dxc -E main -T cs_6_0 %s | FileCheck %s - -// CHECK: all template type components must have the same type - -struct Foo { - int a; - int b; - float c; - int d; -}; - -Buffer inputs : register(t1); -RWBuffer< int > g_Intensities : register(u1); - -groupshared Foo sharedData; - -[ numthreads( 64, 2, 2 ) ] -void main( uint GI : SV_GroupIndex) -{ - if(GI==0) - sharedData = inputs[GI]; - int rtn; - InterlockedAdd(sharedData.d, g_Intensities[GI], rtn); - g_Intensities[GI] = rtn + sharedData.d; -} \ No newline at end of file diff --git a/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/gather_raw_badtypes.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/gather_raw_badtypes.hlsl index 4aee5526ae..a24b72433d 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/gather_raw_badtypes.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/gather_raw_badtypes.hlsl @@ -8,13 +8,13 @@ Texture2DArray g_texArrf16 : register(t4); Texture2DArray g_texArrf32 : register(t5); Texture2DArray g_texArrf64 : register(t6); -Texture2D g_tex16 : register(t7); -Texture2D g_tex32 : register(t8); -Texture2D g_tex64 : register(t9); +Texture2D g_tex16 : register(t7); +Texture2D g_tex32 : register(t8); +Texture2D g_tex64 : register(t9); -Texture2DArray g_texArr16 : register(t10); +Texture2DArray g_texArr16 : register(t10); Texture2DArray g_texArr32 : register(t11); -Texture2DArray g_texArr64 : register(t12); +Texture2DArray g_texArr64 : register(t12); SamplerState g_samp : register(s5); @@ -39,29 +39,29 @@ SamplerState g_samp : register(s5); //CHECK: error: cannot GatherRaw from resource containing double //CHECK: error: cannot GatherRaw from resource containing double +//CHECK: error: cannot GatherRaw from resource containing short4 +//CHECK: error: cannot GatherRaw from resource containing short4 +//CHECK: error: cannot GatherRaw from resource containing short4 + //CHECK: error: cannot GatherRaw from resource containing ushort4 //CHECK: error: cannot GatherRaw from resource containing ushort4 //CHECK: error: cannot GatherRaw from resource containing ushort4 -//CHECK: error: cannot GatherRaw from resource containing ushort2 -//CHECK: error: cannot GatherRaw from resource containing ushort2 -//CHECK: error: cannot GatherRaw from resource containing ushort2 - -//CHECK: error: cannot GatherRaw from resource containing uint2 -//CHECK: error: cannot GatherRaw from resource containing uint2 -//CHECK: error: cannot GatherRaw from resource containing uint2 +//CHECK: error: cannot GatherRaw from resource containing int3 +//CHECK: error: cannot GatherRaw from resource containing int3 +//CHECK: error: cannot GatherRaw from resource containing int3 //CHECK: error: cannot GatherRaw from resource containing uint3 //CHECK: error: cannot GatherRaw from resource containing uint3 //CHECK: error: cannot GatherRaw from resource containing uint3 -//CHECK: error: cannot GatherRaw from resource containing ulong3 -//CHECK: error: cannot GatherRaw from resource containing ulong3 -//CHECK: error: cannot GatherRaw from resource containing ulong3 +//CHECK: error: cannot GatherRaw from resource containing long2 +//CHECK: error: cannot GatherRaw from resource containing long2 +//CHECK: error: cannot GatherRaw from resource containing long2 -//CHECK: error: cannot GatherRaw from resource containing ulong4 -//CHECK: error: cannot GatherRaw from resource containing ulong4 -//CHECK: error: cannot GatherRaw from resource containing ulong4 +//CHECK: error: cannot GatherRaw from resource containing ulong2 +//CHECK: error: cannot GatherRaw from resource containing ulong2 +//CHECK: error: cannot GatherRaw from resource containing ulong2 float4 main(float2 a : A) : SV_Target { diff --git a/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_array_error.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_array_error.hlsl index 1e85fb9b3d..1e6128d731 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_array_error.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_array_error.hlsl @@ -1,5 +1,5 @@ // RUN: %dxc -T ps_6_0 -E main %s | FileCheck %s -// CHECK: error: texture resource texel type must be scalar or vector +// CHECK: error: Elements of typed buffers and textures must be scalars or vectors typedef float a[4]; Texture2D t; RWTexture2D rwt; @@ -10,4 +10,4 @@ float main(float2 f2 : F2, int2 i2 : I) : SV_TARGET rwt[i2] = t.Load(int3(i2, 0)); t.Gather(s, f2, i2); // Test template resolution with INTRIN_COMPTYPE_FROM_TYPE_ELT0 return 0; -} \ No newline at end of file +} diff --git a/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_matrix_error.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_matrix_error.hlsl index c5e37ba3d7..630d944394 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_matrix_error.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_matrix_error.hlsl @@ -1,6 +1,6 @@ // RUN: %dxc -T ps_6_0 -E main %s | FileCheck %s // Note: FXC accepts this -// CHECK: error: texture resource texel type must be scalar or vector +// CHECK: error: Elements of typed buffers and textures must be scalars or vectors Texture2D t; RWTexture2D rwt; SamplerState s; @@ -10,4 +10,4 @@ float main(float2 f2 : F2, int2 i2 : I) : SV_TARGET rwt[i2] = t.Load(int3(i2, 0)); t.Gather(s, f2, i2); // Test template resolution with INTRIN_COMPTYPE_FROM_TYPE_ELT0 return 0; -} \ No newline at end of file +} diff --git a/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_struct_error.hlsl b/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_struct_error.hlsl index a10168eecd..394d9222d2 100644 --- a/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_struct_error.hlsl +++ b/tools/clang/test/HLSLFileCheck/hlsl/objects/Texture/texture_of_struct_error.hlsl @@ -1,5 +1,5 @@ // RUN: %dxc -T ps_6_0 -E main %s | FileCheck %s -// CHECK: error: texture resource texel type must be scalar or vector +// CHECK: error: Elements of typed buffers and textures must be scalars or vectors struct Struct { float f; }; Texture2D t; RWTexture2D rwt; @@ -10,4 +10,4 @@ float main(float2 f2 : F2, int2 i2 : I) : SV_TARGET rwt[i2] = t.Load(int3(i2, 0)); t.Gather(s, f2, i2); // Test template resolution with INTRIN_COMPTYPE_FROM_TYPE_ELT0 return 0; -} \ No newline at end of file +} diff --git a/tools/clang/test/HLSLFileCheck/validation/BigStructInBuffer.hlsl b/tools/clang/test/HLSLFileCheck/validation/BigStructInBuffer.hlsl deleted file mode 100644 index f4688d97a3..0000000000 --- a/tools/clang/test/HLSLFileCheck/validation/BigStructInBuffer.hlsl +++ /dev/null @@ -1,20 +0,0 @@ -// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s - -// CHECK: elements of typed buffers and textures must fit in four 32-bit quantities - -struct Foo { - float2 a; - float b; - float c; - float d[2]; -}; - -Buffer inputs : register(t1); - -RWBuffer< int > g_Intensities : register(u1); - -[ numthreads( 64, 2, 2 ) ] -void main( uint GI : SV_GroupIndex) -{ - g_Intensities = inputs[GI].d[0]; -} \ No newline at end of file diff --git a/tools/clang/test/SemaHLSL/atomics-on-bitfields.hlsl b/tools/clang/test/SemaHLSL/atomics-on-bitfields.hlsl index afb69dd7dd..90ac07dc34 100644 --- a/tools/clang/test/SemaHLSL/atomics-on-bitfields.hlsl +++ b/tools/clang/test/SemaHLSL/atomics-on-bitfields.hlsl @@ -13,7 +13,6 @@ struct TexCoords { uint q : 8; }; -RWBuffer buf; RWStructuredBuffer str; groupshared TexCoords gs; @@ -21,9 +20,6 @@ groupshared TexCoords gs; [numthreads(8,8,1)] void main( uint2 tid : SV_DispatchThreadID) { - InterlockedOr(buf[tid.y].q, 2); /* expected-error {{no matching function for call to 'InterlockedOr'}} expected-note {{candidate function not viable: no known conversion from 'uint' to 'unsigned int &' for 1st argument}} expected-note {{candidate function not viable: no known conversion from 'uint' to 'unsigned long long &' for 1st argument}} */ - InterlockedCompareStore(buf[tid.y].q, 3, 1); /* expected-error {{no matching function for call to 'InterlockedCompareStore'}} expected-note {{candidate function not viable: no known conversion from 'uint' to 'unsigned int &' for 1st argument}} expected-note {{candidate function not viable: no known conversion from 'uint' to 'unsigned long long &' for 1st argument}} */ - InterlockedOr(str[tid.y].q, 2); /* expected-error {{no matching function for call to 'InterlockedOr'}} expected-note {{candidate function not viable: no known conversion from 'uint' to 'unsigned int &' for 1st argument}} expected-note {{candidate function not viable: no known conversion from 'uint' to 'unsigned long long &' for 1st argument}} */ InterlockedCompareStore(str[tid.y].q, 3, 1); /* expected-error {{no matching function for call to 'InterlockedCompareStore'}} expected-note {{candidate function not viable: no known conversion from 'uint' to 'unsigned int &' for 1st argument}} expected-note {{candidate function not viable: no known conversion from 'uint' to 'unsigned long long &' for 1st argument}} */ diff --git a/tools/clang/test/SemaHLSL/template-checks.hlsl b/tools/clang/test/SemaHLSL/template-checks.hlsl index 62528521de..4dec8cfb43 100644 --- a/tools/clang/test/SemaHLSL/template-checks.hlsl +++ b/tools/clang/test/SemaHLSL/template-checks.hlsl @@ -13,19 +13,9 @@ matrix m_bool; // vector v_float_small; // vector v_obj_sampler; -struct s_float2_float3 -{ - float2 f_float2; - float3 f_float3; -}; -RWBuffer rwb_struct; /* fxc-error {{X3037: elements of typed buffers and textures must fit in four 32-bit quantities}} */ +RWBuffer rwb_struct; /* expected-error {{Elements of typed buffers and textures must fit in four 32-bit quantities}} fxc-error {{X3037: elements of typed buffers and textures must fit in four 32-bit quantities}} */ -struct s_float4_sampler -{ - float4 f_float4; - SamplerState f_sampler; -}; -RWBuffer rwb_struct_objs; /* expected-error {{'SamplerState' is an object and cannot be used as a type parameter}} expected-note {{usage of 'SamplerState' found in field 'f_sampler' of type 's_float4_sampler'}} fxc-pass {{}} */ +RWBuffer rwb_struct_objs; /* expected-error {{'SamplerState' is an object and cannot be used as a type parameter}} fxc-pass {{}} */ void vain() { // Nothing to do here. diff --git a/tools/clang/unittests/HLSL/ValidationTest.cpp b/tools/clang/unittests/HLSL/ValidationTest.cpp index 8008541bfa..972ef281fd 100644 --- a/tools/clang/unittests/HLSL/ValidationTest.cpp +++ b/tools/clang/unittests/HLSL/ValidationTest.cpp @@ -137,8 +137,6 @@ class ValidationTest : public ::testing::Test { TEST_METHOD(IllegalSampleOffset4) TEST_METHOD(NoFunctionParam) TEST_METHOD(I8Type) - TEST_METHOD(EmptyStructInBuffer) - TEST_METHOD(BigStructInBuffer) // TODO: enable this. // TEST_METHOD(TGSMRaceCond) @@ -1755,14 +1753,6 @@ TEST_F(ValidationTest, I8Type) { /*bRegex*/ true); } -TEST_F(ValidationTest, EmptyStructInBuffer) { - TestCheck(L"..\\CodeGenHLSL\\EmptyStructInBuffer.hlsl"); -} - -TEST_F(ValidationTest, BigStructInBuffer) { - TestCheck(L"..\\CodeGenHLSL\\BigStructInBuffer.hlsl"); -} - // TODO: enable this. // TEST_F(ValidationTest, TGSMRaceCond) { // TestCheck(L"..\\CodeGenHLSL\\RaceCond.hlsl");