microsoft / microsoft/DirectXShaderCompiler

[Crash] Assertion failure assigning resource to static local resource

Open
#8,580 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

RWByteAddressBuffer gBuf0 : register(u0);

uint Pass_StaticLocal(uint idx) {
    static RWByteAddressBuffer buf = gBuf0;
    buf.Store(idx * 4, 1);

    return 1;
}

[numthreads(1,1,1)]
void main(uint3 tid : SV_DispatchThreadID) {
    Pass_StaticLocal(tid.x);
}

https://godbolt.org/z/dv4718TeW
There is an assertion failure of

Internal Compiler error: cast<X>() argument of incompatible type!

Compiler returned: 29

When compiling and codegen target is DXIL, but it does not trigger when the codegen target is SPIRV.

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

Start with the HLSL reproducer in the issue and compile it on Godbolt with the DXIL target, confirming the assertion and comparing the SPIR-V result. Trace the DXIL code-generation path for assigning gBuf0 to the static resource buf; done means the reproducer compiles without the incompatible-type assertion while preserving the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.