Skip to content

[HLSL] Implement explicit layout for $Globals #126791

@hekota

Description

@hekota

All non-resource variable declarations in the global scope are implicitly added to $Global constant buffer.
The declarations can have an explicit layout specifies by using the : register(c#) annotation. This task is to track implementation of the explicit layout of $Globals constant buffer.

https://godbolt.org/z/3PvocPr6v

For this global constants:

int a;
float b : register(c1);

The buffer layout should look like this:

cbuffer $Globals
{
  struct $Globals
  {
     int a;                         ; Offset:   20
     float b;                       ; Offset:   16
  } $Globals;                       ; Offset:    0 Size:    24
}

The declarations without register(c#) annotations are placed in the buffer after the explicit ones.

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Supportclang:codegenIR generation bugs: mangling, exceptions, etc.

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions