-
Notifications
You must be signed in to change notification settings - Fork 686
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPIR-V] Add -fvk-bind-*-heap flag to DXC (#6919)
Those flags allow the user to hardcode the binding ID for the heaps. This allow the user to either force heap aliasing, or simply have more control over the heaps. Fixes #6913 --------- Signed-off-by: Nathan Gauër <[email protected]>
- Loading branch information
Showing
18 changed files
with
277 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.aliasing.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// RUN: %dxc -T ps_6_6 -spirv %s -fvk-bind-sampler-heap 4 7 -fvk-bind-resource-heap 4 7 | FileCheck %s | ||
|
||
// CHECK-DAG: OpDecorate %ResourceDescriptorHeap DescriptorSet 7 | ||
// CHECK-DAG: OpDecorate %ResourceDescriptorHeap Binding 4 | ||
// CHECK-DAG: OpDecorate %SamplerDescriptorHeap DescriptorSet 7 | ||
// CHECK-DAG: OpDecorate %SamplerDescriptorHeap Binding 4 | ||
|
||
float4 main() : SV_Target { | ||
SamplerState Sampler = SamplerDescriptorHeap[2]; | ||
Texture2D Texture = ResourceDescriptorHeap[3]; | ||
return Texture.Sample(Sampler, float2(0, 0)); | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.flag.invalid.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-sampler-heap a 2 | FileCheck %s --check-prefix=CHECK-SAMPLER-A | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-sampler-heap 1 b | FileCheck %s --check-prefix=CHECK-SAMPLER-B | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-resource-heap a 2 | FileCheck %s --check-prefix=CHECK-RESOURCE-A | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-resource-heap 1 b | FileCheck %s --check-prefix=CHECK-RESOURCE-B | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-counter-heap a 2 | FileCheck %s --check-prefix=CHECK-COUNTER-A | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-counter-heap 1 b | FileCheck %s --check-prefix=CHECK-COUNTER-B | ||
|
||
// CHECK-SAMPLER-A: invalid -fvk-bind-sampler-heap argument: 'a' | ||
// CHECK-RESOURCE-A: invalid -fvk-bind-resource-heap argument: 'a' | ||
// CHECK-COUNTER-A: invalid -fvk-bind-counter-heap argument: 'a' | ||
// CHECK-SAMPLER-B: invalid -fvk-bind-sampler-heap argument: 'b' | ||
// CHECK-RESOURCE-B: invalid -fvk-bind-resource-heap argument: 'b' | ||
// CHECK-COUNTER-B: invalid -fvk-bind-counter-heap argument: 'b' | ||
[numthreads(1, 1, 1)] | ||
void main() { | ||
SamplerState Sampler = SamplerDescriptorHeap[0]; | ||
} |
14 changes: 14 additions & 0 deletions
14
tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.flag.missing.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-sampler-heap 1 | FileCheck %s --check-prefix=CHECK-SAMPLER | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-sampler-heap | FileCheck %s --check-prefix=CHECK-SAMPLER | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-resource-heap 1 | FileCheck %s --check-prefix=CHECK-RESOURCE | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-resource-heap | FileCheck %s --check-prefix=CHECK-RESOURCE | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-counter-heap 1 | FileCheck %s --check-prefix=CHECK-COUNTER | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-counter-heap | FileCheck %s --check-prefix=CHECK-COUNTER | ||
|
||
// CHECK-SAMPLER: Argument to '-fvk-bind-sampler-heap' is missing. | ||
// CHECK-RESOURCE: Argument to '-fvk-bind-resource-heap' is missing. | ||
// CHECK-COUNTER: Argument to '-fvk-bind-counter-heap' is missing. | ||
[numthreads(1, 1, 1)] | ||
void main() { | ||
SamplerState Sampler = SamplerDescriptorHeap[0]; | ||
} |
14 changes: 14 additions & 0 deletions
14
tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.flag.negative.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-sampler-heap -1 2 | FileCheck %s --check-prefix=CHECK-SAMPLER | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-sampler-heap 1 -1 | FileCheck %s --check-prefix=CHECK-SAMPLER | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-resource-heap -1 2 | FileCheck %s --check-prefix=CHECK-RESOURCE | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-resource-heap 1 -1 | FileCheck %s --check-prefix=CHECK-RESOURCE | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-counter-heap -1 2 | FileCheck %s --check-prefix=CHECK-COUNTER | ||
// RUN: not %dxc -T cs_6_6 -spirv %s 2>&1 -fvk-bind-counter-heap 1 -1 | FileCheck %s --check-prefix=CHECK-COUNTER | ||
|
||
// CHECK-SAMPLER: expected positive integer for -fvk-bind-sampler-heap, got: -1 | ||
// CHECK-RESOURCE: expected positive integer for -fvk-bind-resource-heap, got: -1 | ||
// CHECK-COUNTER: expected positive integer for -fvk-bind-counter-heap, got: -1 | ||
[numthreads(1, 1, 1)] | ||
void main() { | ||
SamplerState Sampler = SamplerDescriptorHeap[0]; | ||
} |
16 changes: 16 additions & 0 deletions
16
tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.implicit-bindings.cbuffer.flag.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// RUN: %dxc -T ps_6_6 -E main %s -spirv -fvk-bind-resource-heap 6 7 | FileCheck %s | ||
|
||
// CHECK-DAG: OpDecorate %a DescriptorSet 0 | ||
// CHECK-DAG: OpDecorate %a Binding 0 | ||
cbuffer a { | ||
float4 value; | ||
} | ||
|
||
float4 main() : SV_Target { | ||
// CHECK-DAG: OpDecorate %ResourceDescriptorHeap DescriptorSet 7 | ||
// CHECK-DAG: OpDecorate %ResourceDescriptorHeap Binding 6 | ||
RWStructuredBuffer<float4> buffer = ResourceDescriptorHeap[1]; | ||
buffer[0] = value; | ||
return value; | ||
} | ||
|
2 changes: 1 addition & 1 deletion
2
tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.implicit-bindings.cbuffer.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.implicit-bindings.counter.flag.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// RUN: %dxc -T cs_6_6 -E main -fcgl %s -spirv -fvk-bind-counter-heap 4 5 | FileCheck %s | ||
|
||
// CHECK-DAG: OpDecorate %a DescriptorSet 4 | ||
// CHECK-DAG: OpDecorate %a Binding 3 | ||
// CHECK-DAG: OpDecorate %counter_var_a DescriptorSet 4 | ||
// CHECK-DAG: OpDecorate %counter_var_a Binding 0 | ||
[[vk::binding(3, 4)]] | ||
RWStructuredBuffer<uint> a; | ||
|
||
[numthreads(1, 1, 1)] | ||
void main() { | ||
// CHECK-DAG: OpDecorate %ResourceDescriptorHeap DescriptorSet 0 | ||
// CHECK-DAG: OpDecorate %ResourceDescriptorHeap Binding 0 | ||
// CHECK-DAG: OpDecorate %counter_var_ResourceDescriptorHeap DescriptorSet 5 | ||
// CHECK-DAG: OpDecorate %counter_var_ResourceDescriptorHeap Binding 4 | ||
RWStructuredBuffer<uint> b = ResourceDescriptorHeap[1]; | ||
|
||
a.IncrementCounter(); | ||
b.IncrementCounter(); | ||
} | ||
|
2 changes: 1 addition & 1 deletion
2
tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.implicit-bindings.counter.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.implicit-bindings.flag.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// RUN: %dxc -T ps_6_6 -E main -fcgl %s -spirv -fvk-bind-sampler-heap 3 4 | FileCheck %s | ||
|
||
// CHECK-DAG: OpDecorate %Texture DescriptorSet 0 | ||
// CHECK-DAG: OpDecorate %Texture Binding 0 | ||
Texture2D Texture; | ||
|
||
float4 main() : SV_Target { | ||
// CHECK-DAG: OpDecorate %SamplerDescriptorHeap DescriptorSet 4 | ||
// CHECK-DAG: OpDecorate %SamplerDescriptorHeap Binding 3 | ||
SamplerState Sampler = SamplerDescriptorHeap[0]; | ||
return Texture.Sample(Sampler, float2(0, 0)); | ||
} | ||
|
2 changes: 1 addition & 1 deletion
2
tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.implicit-bindings.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tools/clang/test/CodeGenSPIRV/sm6_6.descriptorheap.implicit-bindings.reserved.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: %dxc -T cs_6_6 -E main -fcgl %s -spirv | FileCheck %s --check-prefix=CHECK-DEFAULT | ||
// RUN: %dxc -T cs_6_6 -E main -fcgl %s -spirv -fvk-bind-resource-heap 0 0 -fvk-bind-counter-heap 1 0 -fvk-bind-sampler-heap 2 0 | FileCheck %s --check-prefix=CHECK-RESERVED | ||
|
||
// CHECK-DEFAULT-DAG: OpDecorate %a DescriptorSet 0 | ||
// CHECK-DEFAULT-DAG: OpDecorate %a Binding 0 | ||
// CHECK-DEFAULT-DAG: OpDecorate %counter_var_a DescriptorSet 0 | ||
// CHECK-DEFAULT-DAG: OpDecorate %counter_var_a Binding 1 | ||
|
||
// CHECK-RESERVED-DAG: OpDecorate %a DescriptorSet 0 | ||
// CHECK-RESERVED-DAG: OpDecorate %a Binding 3 | ||
// CHECK-RESERVED-DAG: OpDecorate %counter_var_a DescriptorSet 0 | ||
// CHECK-RESERVED-DAG: OpDecorate %counter_var_a Binding 4 | ||
RWStructuredBuffer<uint> a; | ||
|
||
[numthreads(1, 1, 1)] | ||
void main() { | ||
a.IncrementCounter(); | ||
} |
Oops, something went wrong.