Skip to content

Commit ae969d4

Browse files
committed
updating test to account all flags and remove unecessary metadata generatio
1 parent f02d18e commit ae969d4

File tree

3 files changed

+18
-22
lines changed

3 files changed

+18
-22
lines changed

llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ struct StaticSampler {
131131
float MaxLOD = std::numeric_limits<float>::max();
132132
uint32_t Space = 0;
133133
dxbc::ShaderVisibility Visibility = dxbc::ShaderVisibility::All;
134-
// Flags added in Root Signature 1.2
135-
dxbc::StaticSamplerFlags Flags = dxbc::StaticSamplerFlags::None;
136134
};
137135

138136
/// Models RootElement : RootFlags | RootConstants | RootParam

llvm/lib/Frontend/HLSL/RootSignatureMetadata.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ MDNode *MetadataBuilder::BuildStaticSampler(const StaticSampler &Sampler) {
212212
ConstantAsMetadata::get(Builder.getInt32(Sampler.Space)),
213213
ConstantAsMetadata::get(
214214
Builder.getInt32(to_underlying(Sampler.Visibility))),
215-
ConstantAsMetadata::get(
216-
Builder.getInt32(to_underlying(Sampler.Visibility))),
215+
ConstantAsMetadata::get(Builder.getInt32(0))
217216
};
218217
return MDNode::get(Ctx, Operands);
219218
}

llvm/test/CodeGen/DirectX/ContainerData/RootSignature-StaticSamplers_V3.ll

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
target triple = "dxil-unknown-shadermodel6.0-compute"
55

6-
; CHECK: @dx.rts0 = private constant [80 x i8] c"{{.*}}", section "RTS0", align 4
6+
; CHECK: @dx.rts0 = private constant [248 x i8] c"{{.*}}", section "RTS0", align 4
77

88
define void @main() #0 {
99
entry:
@@ -14,30 +14,29 @@ attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
1414

1515
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
1616
!2 = !{ ptr @main, !3, i32 3 } ; function, root signature
17-
!3 = !{ !5 } ; list of root signature elements
17+
!3 = !{ !5, !6, !7, !8 } ; list of root signature elements
1818
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0, i32 1 }
19+
!6 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 43, i32 0, i32 0, i32 2 }
20+
!7 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 44, i32 0, i32 0, i32 0 }
21+
!8 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 45, i32 0, i32 0, i32 3 }
1922

2023
; DXC: - Name: RTS0
21-
; DXC-NEXT: Size: 80
24+
; DXC-NEXT: Size: 248
2225
; DXC-NEXT: RootSignature:
2326
; DXC-NEXT: Version: 3
2427
; DXC-NEXT: NumRootParameters: 0
2528
; DXC-NEXT: RootParametersOffset: 24
26-
; DXC-NEXT: NumStaticSamplers: 1
29+
; DXC-NEXT: NumStaticSamplers: 4
2730
; DXC-NEXT: StaticSamplersOffset: 24
2831
; DXC-NEXT: Parameters: []
2932
; DXC-NEXT: Samplers:
30-
; DXC-NEXT: - Filter: MinPointMagLinearMipPoint
31-
; DXC-NEXT: AddressU: Mirror
32-
; DXC-NEXT: AddressV: Clamp
33-
; DXC-NEXT: AddressW: MirrorOnce
34-
; DXC-NEXT: MipLODBias: 1.425
35-
; DXC-NEXT: MaxAnisotropy: 9
36-
; DXC-NEXT: ComparisonFunc: Equal
37-
; DXC-NEXT: BorderColor: OpaqueWhite
38-
; DXC-NEXT: MinLOD: -128
39-
; DXC-NEXT: MaxLOD: 128
40-
; DXC-NEXT: ShaderRegister: 42
41-
; DXC-NEXT: RegisterSpace: 0
42-
; DXC-NEXT: ShaderVisibility: All
43-
; DXC-NEXT: SAMPLER_FLAG_UINT_BORDER_COLOR: true
33+
; DXC-LABEL: ShaderRegister: 42
34+
; DXC: SAMPLER_FLAG_UINT_BORDER_COLOR: true
35+
; DXC-LABEL: ShaderRegister: 43
36+
; DXC: SAMPLER_FLAG_NON_NORMALIZED_COORDINATES: true
37+
; DXC-LABEL: ShaderRegister: 44
38+
; DXC-NOT: SAMPLER_FLAG_NON_NORMALIZED_COORDINATES:
39+
; DXC-NOT: SAMPLER_FLAG_UINT_BORDER_COLOR:
40+
; DXC-LABEL: ShaderRegister: 45
41+
; DXC: SAMPLER_FLAG_UINT_BORDER_COLOR: true
42+
; DXC-NEXT: SAMPLER_FLAG_NON_NORMALIZED_COORDINATES: true

0 commit comments

Comments
 (0)