Skip to content

[HLSL] static in cbuffer legality? Might require a test fix. #117715

@Keenuts

Description

@Keenuts

Hello!

from clang/test/CodeGenHLSL/static_global_and_function_in_cb.hlsl

cbuffer {
    static float b = 3;
}

This test checks b is correctly emitted as a global variable. But is that even legal?
DXC kinda doesn't allow that for Vulkan: we warn, but compile and then fail validation.
MSDN doesn't mentions that: https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-constants

And since cbuffers are supposed to be a "view" on an external buffer, having a static defined inside doesn't seem right.

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Support

Type

No type

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions