microsoft / microsoft/DirectXShaderCompiler

Warning for mix packoffset for static variable.

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

Nobody has claimed this yet.

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

Description

Description

cbuffer A
{
uint a: packoffset(c0);
uint4 b[1] : packoffset(c2);
static uint c[3] = (uint[3])b;
};
will get warning: cannot mix packoffset elements with nonpackoffset elements in a cbuffer
Steps to Reproduce
dxc -Tlib_6_3

Expected Behavior
No warning.

Actual Behavior

Warning (cannot mix packoffset elements with nonpackoffset elements in a cbuffer) is reported.

Environment

  • DXC version : 1.8.2405
  • Host Operating System: Windows

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

Reproduce the warning with dxc -Tlib_6_3 using the cbuffer example from the issue, or run it through the linked Godbolt case. Investigate how static variables and packoffset elements are classified during cbuffer validation; done means the example compiles without the cannot-mix warning while invalid mixtures still warn.

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
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.