<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/117715>117715</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[HLSL] static in cbuffer legality? Might require a test fix.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
HLSL
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Keenuts
</td>
</tr>
</table>
<pre>
Hello!
from clang/test/CodeGenHLSL/static_global_and_function_in_cb.hlsl
```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.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxUU8Fu4zYQ_RrqMrAgkZEVH3RwYqgLdLeXLYrejBE5kqahSJek7OTvC1oOmgUEiCCHj_Pem4cx8uSIOtG8iOZU4JpmH7rfidyaYjF489F9I2u9kLWojqI6jsEvoC26Scg-UUxC9q_e0G_kvn3_-V3IPiZMrM-T9QPaMzpzHlenE3t3ZnfWQznbaDcwsa-277Glh3UcKYBoX0R1BADYwGC0HhMMINQJlFD5VLSnrwgb4J8zR8hdgZ5Jv0UQ-2oQ-wo4gvYhkE72A2jhlMgARkDY-oQrBsbBUgkva8rlacYEdCUHlia0QvWiOp7-foU3dgbBeIpOyDYBWutvW_noA_y12jd0Qh3hRnDD4IR8hWFNoP1yYUuAzkCaycGInN-1bDCrU4rq-OPn6Y8v0Au5fLI1kyHnlC5RqKOQvZC9JQyuXFgHH_2YSu0XIXtyuzUK2d_YGX97rJQUsjecBVDmrrbszftuCniZWcdd3tpp72JCl-Im5tEZiOw0wcOXCBgI4nq5-EgGkoeBAEFIeWW6CSnBO0AH9J4oOLSwXcsCzHhlNwF-GmpoZEcG2EU29IVyJFog8DSnsjCdMgd1wIK6ulVyLw9NvS_m7rmpKzVSQ-1BPw0HOgwN6edhr0aUw9iMBXeykk91Lfe1ap5VU6q6bpvW7CW1OFI1iqeKFmRbWntdSh-mgmNcqavrtq2bwuJANt5DIeU21jLHI3S5fjesUxRPleWY4v8IiZO9B-l-oTl9UmX3qd82SZw-hOrhR-YIgf5dOWQV71M78ntZrMF2vxo9cZrX4eFvfvDx212C_4d0zuC9_2z2g8K1k_8FAAD__z-QQuk">