llvm / llvm/offload-test-suite
Disallow Mixed Descriptor Sets and Allow Samplers in DirectX Root Parameters
@Icohedron is already working on this.
Since Aug 7, 2026.
- Dominant language
- C++
- Stars
- 18
- Forks
- 39
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 40
Description
DX/Device.cpp is currently returning an error for samplers in explicit root signatures.
https://github.com/Traverse-Research/offload-test-suite/blob/0fa225ad3ee14c2c009ca6f913c0b7dd81bb8e7e/lib/API/DX/Device.cpp#L2735
``` // Samplers are not supported in RootParams, error if we do find any.
for (const auto &Set : P.Sets) {
for (const auto &R : Set.Resources) {
if (R.isSampler())
return llvm::createStringError(
"Descriptor tables containing samplers are not yet supported "
"with explicit RootParameters.");
}
}
```
This error triggers if-and-only-if both of the following conditions are satisfied:
1. The pipeline YAML has a non-empty `RuntimeSettings.DirectX.RootParameters` list.
2. Any resource in any `DescriptorSet` has `Kind: Sampler`
## Overview of the problem
**A single descriptor table in DirectX 12 can not contain both samplers and SRVs/UAVs/CBVs.**
Given a shader such as:
```hlsl
Texture2D In : register(t0);
SamplerState Samp: register(s0);
RWBuffer Out : register(u0);
[RootSignature("DescriptorTable(SRV(t0), UAV(u0)), DescriptorTable(Sampler(s0))")]
```
A pipeline YAML with explicit `RuntimeSettings.DirectX.RootParameters` may look like this:
```yaml
RuntimeSettings:
DirectX:
RootParameters:
- Kind: DescriptorTable
- Kind: DescriptorTable
DescriptorSets:
- Resources:
- { Name: In, Kind: Texture2D, DirectXBinding: { Register: 0, Space: 0 } }
- { Name: Samp, Kind: Sampler, DirectXBinding: { Register: 0, Space: 0 } }
- { Name: Out, Kind: RWBuffer, DirectXBinding: { Register: 0, Space: 0 } }
```
Note that there is only one DescriptorSet and it contains both a sampler and SRV/UAV. Therefore the harness needs to split the DescriptorSet into two descriptor tables for DirectX 12 to separate the samplers from the resource views:
```
CBV/SRV/UAV heap: [0] In (SRV) [1] Out (UAV)
SAMPLER heap: [0] Samp
```
The current implementation and [documentation of explicit root signatures](https://github.com/Traverse-Research/offload-test-suite/blob/0fa225ad3ee14c2c009ca6f913c0b7dd81bb8e7e/docs/UsingRootSignatures.md#explicit-root-signatures) states:
> 1. An explicit root parameter list must contain as many DescriptorTable root parameters as the pipeline has elements in the DescriptorSet array.
> 2. The order of root descriptor tables will match the order of DescriptorSet entries.
However, condition 1 is not true in this case because the root parameter list contains 2 DescriptorTables and there is only one DescriptorSet. The harness implicitly splits the DescriptorSet into two, but the explicit root signature implementation does not account for that.
Furthermore, "The order of root descriptor tables will match the order of DescriptorSet entries." is now partially ambiguous since, without additional information from/about the shader, it is unknown how to match the descriptor tables to the descriptor sets.
### Design discussion (Aug 11, 2026)
We have decided to enforce a strict 1:1 mapping of DirectX descriptor tables to YAML descriptor sets, **even in the case of auto-generated root signatures**.
This will be a breaking change to existing tests that mix resources with samplers in descriptor sets, but it is better to enforce this rule uniformly rather than breaking up descriptor sets and ambiguously assigning them to descriptor tables in DirectX.
## ACs:
1. Add code to enforce the rule that a YAML descriptor set can not contain both resources and samplers.
2. Remove the bail-out from the explicit root signatures path
3. Update existing tests with mixed descriptor sets so that resources and samplers are in separate descriptor sets. (They should fail/error after step 1, so it should be easy to identify all of them and fix them).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.