KhronosGroup / KhronosGroup/glslang

HLSL Bindings issue

Open
#1,957 2 comments 0 reactions 0 assignees View on GitHub
HLSL question
Dominant language
C++
Stars
3.6k
Forks
990
Avg merge
1d 2h
Merged PRs (30d)
31

Description

In HLSL we could register different resources with the same ids. For example,

sampler sampleType : register(s0);
cbuffer Matrices : register(b0)
{
matrix wvp;
float4 fillColor;
};
And in SPIR-V output we will have same ids for different resources (in this case we will have both 0) which is unacceptable for Vulkan. I know we could define binding shift for each resource, but this seems to me also not so convenient especially in case of automatically processing of shaders. In this case you cannot be sure on what value it will be safe to shift binding.

So, my question is: Is this a bug or a feature?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the HLSL example with sampler sampleType at s0 and cbuffer Matrices at b0, then inspect the generated SPIR-V bindings. Determine how the compiler currently assigns IDs to these resource types and define what output is required for Vulkan compatibility; the issue is done when the collision is resolved and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.