Skip to content

Commit 2f473a3

Browse files
committed
[lit][SPIRV] convert shaders to lit FileCheck test (36 left to go)
Convert the moved shaders to lit FileCheck test.
1 parent 016288f commit 2f473a3

25 files changed

+90
-90
lines changed

tools/clang/test/CodeGenSPIRV_Lit/class.enum.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %dxc -T ps_6_2 -E PSMain
1+
// RUN: %dxc -T ps_6_2 -E PSMain -fcgl %s -spirv | FileCheck %s
22

33
// The value for the enum is stored in a variable, which will be optimized
44
// away when optimizations are enabled.
5-
// CHECK: [[enum_var:%\w+]] = OpVariable %_ptr_Private_int Private %int_1
5+
// CHECK: [[enum_var:%[a-zA-Z0-9_]+]] = OpVariable %_ptr_Private_int Private %int_1
66
struct TestStruct {
77
enum EnumInTestStruct {
88
A = 1,
@@ -11,7 +11,7 @@ struct TestStruct {
1111

1212
// CHECK: %testFunc = OpFunction %int
1313
// CHECK-NEXT: OpLabel
14-
// CHECK-NEXT: [[ld:%\w+]] = OpLoad %int [[enum_var]]
14+
// CHECK-NEXT: [[ld:%[a-zA-Z0-9_]+]] = OpLoad %int [[enum_var]]
1515
// CHECK-NEXT: OpReturnValue [[ld]]
1616
TestStruct::EnumInTestStruct testFunc() {
1717
return TestStruct::A;

tools/clang/test/CodeGenSPIRV_Lit/type.array.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %dxc -T vs_6_0 -E main
1+
// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s
22

33
// CHECK: %_arr_uint_uint_4 = OpTypeArray %uint %uint_4
44

tools/clang/test/CodeGenSPIRV_Lit/type.buffer.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %dxc -T ps_6_0 -E main
1+
// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s
22

33
// CHECK: OpCapability SampledBuffer
44
// CHECK: OpCapability StorageImageExtendedFormats

tools/clang/test/CodeGenSPIRV_Lit/type.cbuffer.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %dxc -T vs_6_0 -E main
1+
// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s
22

33
// CHECK: OpName %type_MyCbuffer "type.MyCbuffer"
44
// CHECK-NEXT: OpMemberName %type_MyCbuffer 0 "a"

tools/clang/test/CodeGenSPIRV_Lit/type.cbuffer.including.resource.hlsl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %dxc -T ps_6_0 -E main
1+
// RUN: %dxc -T ps_6_0 -E main -fcgl %s -spirv | FileCheck %s
22

33
// CHECK-NOT: OpDecorate %buf3
44

@@ -42,19 +42,19 @@ cbuffer buf3 : register(b2) {
4242
}
4343

4444
float4 main(float2 uv : TEXCOORD) : SV_TARGET {
45-
// CHECK: [[ptr_x:%\d+]] = OpAccessChain %_ptr_Uniform_v4float %buf2 %int_0
46-
// CHECK: [[x:%\d+]] = OpLoad %v4float [[ptr_x]]
47-
48-
// CHECK: [[y:%\d+]] = OpLoad %type_2d_image %y
49-
// CHECK: [[z:%\d+]] = OpLoad %type_sampler %z
50-
// CHECK: [[yz:%\d+]] = OpSampledImage %type_sampled_image [[y]] [[z]]
51-
// CHECK: [[sample0:%\d+]] = OpImageSampleImplicitLod %v4float [[yz]]
52-
// CHECK: [[add0:%\d+]] = OpFAdd %v4float [[x]] [[sample0]]
53-
54-
// CHECK: [[y:%\d+]] = OpLoad %type_2d_image %y
55-
// CHECK: [[w:%\d+]] = OpLoad %type_sampler %w
56-
// CHECK: [[yw:%\d+]] = OpSampledImage %type_sampled_image [[y]] [[w]]
57-
// CHECK: [[sample1:%\d+]] = OpImageSampleImplicitLod %v4float [[yw]]
45+
// CHECK: [[ptr_x:%[0-9]+]] = OpAccessChain %_ptr_Uniform_v4float %buf2 %int_0
46+
// CHECK: [[x:%[0-9]+]] = OpLoad %v4float [[ptr_x]]
47+
48+
// CHECK: [[y:%[0-9]+]] = OpLoad %type_2d_image %y
49+
// CHECK: [[z:%[0-9]+]] = OpLoad %type_sampler %z
50+
// CHECK: [[yz:%[0-9]+]] = OpSampledImage %type_sampled_image [[y]] [[z]]
51+
// CHECK: [[sample0:%[0-9]+]] = OpImageSampleImplicitLod %v4float [[yz]]
52+
// CHECK: [[add0:%[0-9]+]] = OpFAdd %v4float [[x]] [[sample0]]
53+
54+
// CHECK: [[y_0:%[0-9]+]] = OpLoad %type_2d_image %y
55+
// CHECK: [[w:%[0-9]+]] = OpLoad %type_sampler %w
56+
// CHECK: [[yw:%[0-9]+]] = OpSampledImage %type_sampled_image [[y_0]] [[w]]
57+
// CHECK: [[sample1:%[0-9]+]] = OpImageSampleImplicitLod %v4float [[yw]]
5858
// CHECK: OpFAdd %v4float [[add0]] [[sample1]]
5959
return x + y.Sample(z, uv) + y.Sample(w, uv);
6060
}

tools/clang/test/CodeGenSPIRV_Lit/type.class.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %dxc -T vs_6_0 -E main
1+
// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s
22

33
// CHECK: OpName %N "N"
44

tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.assign.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %dxc -T vs_6_0 -E main
1+
// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s
22

33
// CHECK: OpName %type_ConstantBuffer_S "type.ConstantBuffer.S"
44
// CHECK-NEXT: OpMemberName %type_ConstantBuffer_S 0 "someFloat"
@@ -24,7 +24,7 @@ void main()
2424
{
2525
// CHECK: %local = OpVariable %_ptr_Function_type_ConstantBuffer_S Function
2626

27-
// CHECK: [[val:%\d+]] = OpLoad %type_ConstantBuffer_S %buffer
27+
// CHECK: [[val:%[0-9]+]] = OpLoad %type_ConstantBuffer_S %buffer
2828
// CHECK: OpStore %local [[val]]
2929
ConstantBuffer<S> local;
3030
local = buffer;

tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.bindless.array.hlsl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
// RUN: %dxc -T vs_6_0 -E main
1+
// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s
22

33
// Used for ConstantBuffer definition.
4-
// CHECK: [[type_CB_PerDraw:%\w+]] = OpTypeStruct %mat4v4float
4+
// CHECK: [[type_CB_PerDraw:%[a-zA-Z0-9_]+]] = OpTypeStruct %mat4v4float
55
// Used for PerDraw local variable.
6-
// CHECK: [[type_PerDraw:%\w+]] = OpTypeStruct %mat4v4float
6+
// CHECK: [[type_PerDraw:%[a-zA-Z0-9_]+]] = OpTypeStruct %mat4v4float
77

88
struct PerDraw {
99
float4x4 Transform;
1010
};
1111

12-
// CHECK: [[ptr_type_CB_PerDraw:%\w+]] = OpTypePointer Uniform [[type_CB_PerDraw]]
12+
// CHECK: [[ptr_type_CB_PerDraw:%[a-zA-Z0-9_]+]] = OpTypePointer Uniform [[type_CB_PerDraw]]
1313
// Used for ConstantBuffer to PerDraw type cast.
1414

1515

@@ -23,9 +23,9 @@ struct VSInput {
2323
};
2424

2525
float4 main(in VSInput input) : SV_POSITION {
26-
// CHECK: [[ptr:%\w+]] = OpAccessChain [[ptr_type_CB_PerDraw]] %PerDraws
27-
// CHECK: [[cb_PerDraw:%\w+]] = OpLoad [[type_CB_PerDraw]] [[ptr]]
28-
// CHECK: [[float4x4:%\w+]] = OpCompositeExtract %mat4v4float [[cb_PerDraw]] 0
26+
// CHECK: [[ptr:%[a-zA-Z0-9_]+]] = OpAccessChain [[ptr_type_CB_PerDraw]] %PerDraws
27+
// CHECK: [[cb_PerDraw:%[a-zA-Z0-9_]+]] = OpLoad [[type_CB_PerDraw]] [[ptr]]
28+
// CHECK: [[float4x4:%[a-zA-Z0-9_]+]] = OpCompositeExtract %mat4v4float [[cb_PerDraw]] 0
2929
// CHECK: OpCompositeConstruct [[type_PerDraw]] [[float4x4]]
3030
const PerDraw perDraw = PerDraws[input.DrawIdx];
3131
return mul(float4(input.Position, 1.0f), perDraw.Transform);

tools/clang/test/CodeGenSPIRV_Lit/type.constant-buffer.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %dxc -T vs_6_0 -E main
1+
// RUN: %dxc -T vs_6_0 -E main -fcgl %s -spirv | FileCheck %s
22

33
// CHECK: OpName %type_ConstantBuffer_T "type.ConstantBuffer.T"
44
// CHECK-NEXT: OpMemberName %type_ConstantBuffer_T 0 "a"
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
// RUN: %dxc -T ps_6_0 -E main -fspv-target-env=universal1.5
1+
// RUN: %dxc -T ps_6_0 -E main -fspv-target-env=universal1.5 -fcgl %s -spirv | FileCheck %s
22

33
struct Foo {
44
float4 a;
55
int2 b;
66
};
77

8-
// CHECK: [[s01:%\w+]] = OpTypeStruct %v4float %v2int
9-
// CHECK: [[s02:%\w+]] = OpTypeArray [[s01]] %uint_3
10-
// CHECK: [[s03:%\w+]] = OpTypeArray [[s02]] %uint_2
11-
// CHECK: [[s04:%\w+]] = OpTypePointer Uniform [[s03]]
8+
// CHECK: [[s01:%[a-zA-Z0-9_]+]] = OpTypeStruct %v4float %v2int
9+
// CHECK: [[s02:%[a-zA-Z0-9_]+]] = OpTypeArray [[s01]] %uint_3
10+
// CHECK: [[s03:%[a-zA-Z0-9_]+]] = OpTypeArray [[s02]] %uint_2
11+
// CHECK: [[s04:%[a-zA-Z0-9_]+]] = OpTypePointer Uniform [[s03]]
1212
ConstantBuffer<Foo> myCB2[2][3] : register(b0, space1);
1313

1414
struct VSOutput {
1515
float2 TexCoord : TEXCOORD;
1616
};
1717

1818
float4 main(VSOutput input) : SV_TARGET {
19-
// CHECK: [[s05:%\w+]] = OpTypePointer Uniform %v4float
20-
// CHECK: [[s06:%\w+]] = OpVariable [[s04:%\w+]] Uniform
19+
// CHECK: [[s05:%[a-zA-Z0-9_]+]] = OpTypePointer Uniform %v4float
20+
// CHECK: [[s06:%[a-zA-Z0-9_]+]] = OpVariable [[s04_0:%[a-zA-Z0-9_]+]] Uniform
2121
// CHECK: OpAccessChain [[s05]] [[s06]] %int_1 %int_0 %int_0
2222
return float4(1.0, 1.0, 1.0, 1.0) * myCB2[1][0].a;
2323
}

0 commit comments

Comments
 (0)