microsoft / microsoft/DirectXShaderCompiler

the register assignment collision across shader stages

Open
#6,983 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

For example:
My vertex shader use cbuffer 'A' it get assign to register b0. At the same time, my pixel shader use cbuffer 'B' and after compilation it get assign to the same register b0.
As i can see, in order to resolve the collision i have a few options.

1.) use old school binding model. One descriptor table per stage ( VS / PS... ) with D3D12_SHADER_VISIBILITY flag.
2.) explicit register assignment in HLSL ( : register( b0 )... etc ). One descriptor table for all stages.
3.) bindless rendering

IMHO, all three is not a option for me.
So, the question is. Is there anyway to compile HLSL for specific shader stage with regards to previous shader stage inorder to resolve register collision?

My vertex shader use cbuffer 'A' it get assign to register b0. When time gets to compile pixel shader, somehow to pass to compiler a memory blob from previous stage, then cbuffer 'B' will get assign to the next free register b1 in my case.
In this case, i can put all my handles in one descriptor table for all stages.

Thanks,

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no source files, tests, or entry points. Start by investigating how HLSL resource registers are assigned across shader stages and whether the compiler supports carrying allocation state between compilations; done would require a documented, tested resolution to the cross-stage collision question.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.