Issue 126791
Summary [HLSL] Implement explicit layout for $Globals
Labels HLSL
Assignees
Reporter 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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to