Skip to content

Commit

Permalink
Update tests for changes to allowed typed buffer elements
Browse files Browse the repository at this point in the history
  • Loading branch information
pow2clk committed Feb 7, 2025
1 parent c1a1661 commit 4633d6b
Show file tree
Hide file tree
Showing 30 changed files with 49 additions and 507 deletions.
20 changes: 0 additions & 20 deletions tools/clang/test/CodeGenHLSL/BigStructInBuffer.hlsl

This file was deleted.

13 changes: 0 additions & 13 deletions tools/clang/test/CodeGenHLSL/EmptyStructInBuffer.hlsl

This file was deleted.

2 changes: 1 addition & 1 deletion tools/clang/test/CodeGenSPIRV/error.no.validation.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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<S> buff;

[numthreads(1, 1, 1)]
Expand Down
22 changes: 0 additions & 22 deletions tools/clang/test/CodeGenSPIRV/op.buffer.access.bitfield.hlsl

This file was deleted.

33 changes: 0 additions & 33 deletions tools/clang/test/CodeGenSPIRV/op.buffer.access.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ RWBuffer<int4> int4buf;
RWBuffer<uint4> uint4buf;
RWBuffer<float4> float4buf;

struct S {
float a;
float2 b;
float1 c;
};

// CHECK: %type_buffer_image_11 = OpTypeImage %float Buffer 2 0 0 1 Rgba32f
Buffer<S> sBuf;

void main() {
int address;

Expand Down Expand Up @@ -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;
}
19 changes: 0 additions & 19 deletions tools/clang/test/CodeGenSPIRV/op.texture.access.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ Texture2DArray <int3> 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 <S> tStruct;

// CHECK: [[cu12:%[0-9]+]] = OpConstantComposite %v2uint %uint_1 %uint_2
// CHECK: [[cu123:%[0-9]+]] = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3

Expand Down Expand Up @@ -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;
}
7 changes: 1 addition & 6 deletions tools/clang/test/CodeGenSPIRV/rich.debug.texture.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ Texture2D <int4> t0 : register(t0);
TextureCubeArray <float4> t1 : register(t1);
Texture2DMS <int3> t2 : register(t2);

struct S {
float a;
float b;
};

Texture2DArray<S> t3;
Texture2DArray<float2> t3;

void main() {
}
16 changes: 0 additions & 16 deletions tools/clang/test/CodeGenSPIRV/type.buffer.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,6 @@ RWBuffer<uint4> uint4rwbuf;
RWBuffer<float3> float3rwbuf;
RWBuffer<float4> float4rwbuf;

struct S {
float a;
float b;
};

struct T {
float1 a;
float2 b;
};

Buffer<S> sBuf;

Buffer<T> 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
Expand All @@ -119,7 +105,5 @@ Buffer<T> 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() {}
14 changes: 0 additions & 14 deletions tools/clang/test/CodeGenSPIRV/type.buffer.struct.error1.hlsl

This file was deleted.

14 changes: 0 additions & 14 deletions tools/clang/test/CodeGenSPIRV/type.buffer.struct.error2.hlsl

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 6 additions & 6 deletions tools/clang/test/CodeGenSPIRV/type.rwbuffer.struct.error.hlsl
Original file line number Diff line number Diff line change
@@ -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<S> MyRWBuffer;

// CHECK: error: cannot instantiate RasterizerOrderedBuffer with struct type 'S'
RasterizerOrderedBuffer<S> MyROVBuffer;
// BUF: error: Elements of typed buffers and textures must be scalars or vectors
// ROV: error: cannot instantiate RasterizerOrderedBuffer with struct type 'S'
BUF<S> Buf;

float4 main() : A {
return 1.0;
}

18 changes: 0 additions & 18 deletions tools/clang/test/CodeGenSPIRV/type.texture.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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 <float4> t1 : register(t1);
// CHECK: %t2 = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant
Expand All @@ -56,21 +53,6 @@ Texture2DMSArray <uint4> t9 : register(t9);
// CHECK: %t10 = OpVariable %_ptr_UniformConstant_type_2d_image_1 UniformConstant
Texture2D <bool> 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<S> sTex;
// CHECK: %tTex = OpVariable %_ptr_UniformConstant_type_2d_image_array_1 UniformConstant
Texture2DArray<T> tTex;

void main() {
// CHECK-LABEL: %main = OpFunction
}
11 changes: 3 additions & 8 deletions tools/clang/test/HLSL/cpp-errors-hv2015.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -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'}}
Expand Down
11 changes: 3 additions & 8 deletions tools/clang/test/HLSL/cpp-errors.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -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'}}
Expand Down
16 changes: 8 additions & 8 deletions tools/clang/test/HLSLFileCheck/d3dreflect/comp-groupshared.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,7 +33,7 @@
// CHECK: Resources: <0:RecordArrayRef<RuntimeDataResourceInfo>[2]> = {
// CHECK: [0]: <0:RuntimeDataResourceInfo> = {
// CHECK: Class: SRV
// CHECK: Kind: TypedBuffer
// CHECK: Kind: StructuredBuffer
// CHECK: ID: 0
// CHECK: Space: 0
// CHECK: LowerBound: 1
Expand Down Expand Up @@ -85,20 +85,20 @@
// CHECK: Shader Version: Compute 6.5
// CHECK: Creator: <nullptr>
// 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
Expand All @@ -116,7 +116,7 @@ struct Foo {
int d[2];
};

Buffer<Foo> inputs : register(t1);
StructuredBuffer<Foo> inputs : register(t1);
RWBuffer< int > g_Intensities : register(u1);

groupshared Foo sharedData;
Expand All @@ -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];
}
}
Loading

0 comments on commit 4633d6b

Please sign in to comment.