microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] Static class member initializer not implemented

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

Nobody has claimed this yet.

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

Description

Description
Static class member initializer not implemented for SPIR-V.

Steps to Reproduce
dxc -T ps_6_0 -E main -O0 -spirv

class S {
    float4 b;
};

class T {
    static S N;
};

S T::N = {1., 2., 3., 4.};

float4 main(float4 input: A) : SV_Target {
    return 1.0;
}

https://godbolt.org/z/soMxxsjYj

Actual Behavior

<source>:11:10: error: initializer for type 'S' unimplemented
S T::N = {1., 2., 3., 4.};

Succeeds with DXIL backend.

Environment

  • DXC version: 8e9cefa1d5074142a05641f694e58b68812b35a0
  • Host Operating System: Linux

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 by running the reported dxc command with the HLSL reproducer and compare its SPIR-V failure with the successful DXIL backend result. Trace the SPIR-V handling of the static class member initializer for S T::N; done means the reproducer compiles successfully to SPIR-V with the initialized values preserved.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.