SDSL does not support Texture2D arrays as shader resources (array-of-texture)
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 49
Description
Release Type: Official Release
Version: v4.3.0.2507
Platform(s): Windows
Describe the bug
SDSL currently does not support array-of-texture shader resources such as:
rgroup PerMaterial
{
stage Texture2D<float> HeightmapSlices[8];
}
To Reproduce
Steps to reproduce the behavior:
RT
Expected behavior
correct code generation,
correct reflection/parameter keys behavior,
correct descriptor binding behavior across backends.
Log and callstacks
error X3000: unrecognized identifier 'rgroup'
The problematic code snippet is as follows:
[ShaderLinker.cs]
230: else if (variable.Type is TextureType || variable.Type is GenericBaseType || variable.Type.IsByteAddressBufferType())
231: {
232: LinkVariable(effectReflection, variable.Name, parameterKey, slotCount);
233: }
234: else
235: {
236: ParseConstantBufferVariable(“$Globals”, variable);
237: }
Here, the type of Texture2D[8] is ArrayType(TextureType), so variable.Type is TextureType does not match, and the error proceeds to ParseConstantBufferVariable(...).
[StrideShaderMixer.cs]
1320: private bool IsOutOfCBufferVariable(Variable variable)
1321: {
1322: return variable.Type.IsSamplerType()
1323: || variable.Type is TextureType
1324: || variable.Type.IsStateType()
1325: || variable.Type.ResolveType() is ObjectType
1326: || variable.Qualifiers.Contains(StorageQualifier.Shared)
1327: || variable.Qualifiers.Contains(StorageQualifier.GroupShared);
1328: }
Similarly, ArrayType(TextureType) was omitted, causing array textures to not be recognized as resources that “should reside outside the cbuffer.”
[StrideShaderMixer.cs]
1303: if (variable.Type.IsSamplerType() || variable.Type is TextureType || variable.Type.ResolveType() is ObjectType)
1304: continue;
This “resource reservation” logic also has the same oversight; array resources are not covered by the protection.
Contributor guide
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.
Research direction
Start with the ArrayType handling in ShaderLinker.cs around the shown resource-linking branch, then inspect IsOutOfCBufferVariable and the resource-reservation logic in StrideShaderMixer.cs. Confirm that array textures receive correct code generation, reflection and parameter-key behavior, and descriptor binding across backends.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100