Skip to content

Commit 611f0bb

Browse files
author
joaosaffran
committed
adding tests
1 parent fb9c7c4 commit 611f0bb

14 files changed

+252
-8
lines changed

llvm/lib/Target/DirectX/DXILRootSignature.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,10 @@ static bool validate(LLVMContext *Ctx, const mcdxbc::RootSignatureDesc &RSD) {
666666
return reportValueError(Ctx, "AddressU", Sampler.AddressU);
667667

668668
if (!verifyAddress(Sampler.AddressV))
669-
return reportValueError(Ctx, "AddressU", Sampler.AddressV);
669+
return reportValueError(Ctx, "AddressV", Sampler.AddressV);
670670

671671
if (!verifyAddress(Sampler.AddressW))
672-
return reportValueError(Ctx, "AddressU", Sampler.AddressW);
672+
return reportValueError(Ctx, "AddressW", Sampler.AddressW);
673673

674674
if (!verifyMipLODBias(Sampler.MipLODBias))
675675
return reportValueError(Ctx, "MipLODBias", Sampler.MipLODBias);
@@ -680,17 +680,14 @@ static bool validate(LLVMContext *Ctx, const mcdxbc::RootSignatureDesc &RSD) {
680680
if (!verifyComparisonFunc(Sampler.ComparisonFunc))
681681
return reportValueError(Ctx, "ComparisonFunc", Sampler.ComparisonFunc);
682682

683-
if (!verifyComparisonFunc(Sampler.ComparisonFunc))
684-
return reportValueError(Ctx, "ComparisonFunc", Sampler.ComparisonFunc);
685-
686683
if (!verifyBorderColor(Sampler.BorderColor))
687-
return reportValueError(Ctx, "BorderColor ", Sampler.BorderColor);
684+
return reportValueError(Ctx, "BorderColor", Sampler.BorderColor);
688685

689686
if (!verifyLOD(Sampler.MinLOD))
690-
return reportValueError(Ctx, "MinLOD ", Sampler.MinLOD);
687+
return reportValueError(Ctx, "MinLOD", Sampler.MinLOD);
691688

692689
if (!verifyLOD(Sampler.MaxLOD))
693-
return reportValueError(Ctx, "MaxLOD ", Sampler.MaxLOD);
690+
return reportValueError(Ctx, "MaxLOD", Sampler.MaxLOD);
694691

695692
if (!verifyRegisterValue(Sampler.ShaderRegister))
696693
return reportValueError(Ctx, "ShaderRegister", Sampler.ShaderRegister);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s
2+
3+
4+
target triple = "dxil-unknown-shadermodel6.0-compute"
5+
6+
; CHECK: error: Invalid value for AddressU: 666
7+
; CHECK-NOT: Root Signature Definitions
8+
9+
define void @main() #0 {
10+
entry:
11+
ret void
12+
}
13+
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
14+
15+
16+
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
17+
!2 = !{ ptr @main, !3 } ; function, root signature
18+
!3 = !{ !5 } ; list of root signature elements
19+
!5 = !{ !"StaticSampler", i32 4, i32 666, 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 }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s
2+
3+
4+
target triple = "dxil-unknown-shadermodel6.0-compute"
5+
6+
; CHECK: error: Invalid value for AddressV: 666
7+
; CHECK-NOT: Root Signature Definitions
8+
9+
define void @main() #0 {
10+
entry:
11+
ret void
12+
}
13+
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
14+
15+
16+
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
17+
!2 = !{ ptr @main, !3 } ; function, root signature
18+
!3 = !{ !5 } ; list of root signature elements
19+
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 666, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s
2+
3+
4+
target triple = "dxil-unknown-shadermodel6.0-compute"
5+
6+
; CHECK: error: Invalid value for AddressW: 666
7+
; CHECK-NOT: Root Signature Definitions
8+
9+
define void @main() #0 {
10+
entry:
11+
ret void
12+
}
13+
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
14+
15+
16+
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
17+
!2 = !{ ptr @main, !3 } ; function, root signature
18+
!3 = !{ !5 } ; list of root signature elements
19+
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 666, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s
2+
3+
4+
target triple = "dxil-unknown-shadermodel6.0-compute"
5+
6+
; CHECK: error: Invalid value for BorderColor: 666
7+
; CHECK-NOT: Root Signature Definitions
8+
9+
define void @main() #0 {
10+
entry:
11+
ret void
12+
}
13+
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
14+
15+
16+
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
17+
!2 = !{ ptr @main, !3 } ; function, root signature
18+
!3 = !{ !5 } ; list of root signature elements
19+
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 666, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s
2+
3+
4+
target triple = "dxil-unknown-shadermodel6.0-compute"
5+
6+
; CHECK: error: Invalid value for ComparisonFunc: 666
7+
; CHECK-NOT: Root Signature Definitions
8+
9+
define void @main() #0 {
10+
entry:
11+
ret void
12+
}
13+
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
14+
15+
16+
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
17+
!2 = !{ ptr @main, !3 } ; function, root signature
18+
!3 = !{ !5 } ; list of root signature elements
19+
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 666, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s
2+
3+
4+
target triple = "dxil-unknown-shadermodel6.0-compute"
5+
6+
; CHECK: error: Invalid value for Filter: 666
7+
; CHECK-NOT: Root Signature Definitions
8+
9+
define void @main() #0 {
10+
entry:
11+
ret void
12+
}
13+
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
14+
15+
16+
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
17+
!2 = !{ ptr @main, !3 } ; function, root signature
18+
!3 = !{ !5 } ; list of root signature elements
19+
!5 = !{ !"StaticSampler", i32 666, 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 }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s
2+
3+
4+
target triple = "dxil-unknown-shadermodel6.0-compute"
5+
6+
; CHECK: error: Invalid value for MaxAnisotropy: 666
7+
; CHECK-NOT: Root Signature Definitions
8+
9+
define void @main() #0 {
10+
entry:
11+
ret void
12+
}
13+
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
14+
15+
16+
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
17+
!2 = !{ ptr @main, !3 } ; function, root signature
18+
!3 = !{ !5 } ; list of root signature elements
19+
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 666, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s
2+
3+
4+
target triple = "dxil-unknown-shadermodel6.0-compute"
5+
6+
; CHECK: error: Invalid value for MaxLOD: 0
7+
; CHECK-NOT: Root Signature Definitions
8+
9+
define void @main() #0 {
10+
entry:
11+
ret void
12+
}
13+
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
14+
15+
16+
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
17+
!2 = !{ ptr @main, !3 } ; function, root signature
18+
!3 = !{ !5 } ; list of root signature elements
19+
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 0x7FF8000000000000, i32 42, i32 0, i32 0 }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s
2+
3+
4+
target triple = "dxil-unknown-shadermodel6.0-compute"
5+
6+
; CHECK: error: Invalid value for MinLOD: 0
7+
; CHECK-NOT: Root Signature Definitions
8+
9+
define void @main() #0 {
10+
entry:
11+
ret void
12+
}
13+
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
14+
15+
16+
!dx.rootsignatures = !{!2} ; list of function/root signature pairs
17+
!2 = !{ ptr @main, !3 } ; function, root signature
18+
!3 = !{ !5 } ; list of root signature elements
19+
!5 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float 0x7FF8000000000000, float 1.280000e+02, i32 42, i32 0, i32 0 }

0 commit comments

Comments
 (0)