<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118531>118531</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[HLSL] Translate `cbuffer` blocks to LLVM target type for simple cases with no arrays or embedded structs
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hekota
</td>
</tr>
</table>
<pre>
Implement `cbuffer` codegen for simple constant buffers that have no arrays or embedded structs. The constant buffer will be translated to LLVM target type `target("dx.CBuffer", ...)` and should include the cbuffer type, size, and a sequence of numbers specifying the layout (list of offset for each field).
For example:
```
cbuffer MyConstants {
float2 a;
float b;
int4 c;
};
```
will be translated to `target("dx.CBuffer", { <2 x float>, [2 x float], i32}, 32, 0, 8, 16)`.
Note that this might not be the final way how we are going to encode the constant buffer layout. They way to encode layout of constant buffers that contain arrays and embedded structures is still TBD and might change how the simple case is encoded as well.
Doing the simple case first will unblock tasks that are dependent of cbuffer codegen: llvm/llvm-project#104862, llvm/llvm-project#114126, llvm/llvm-project#112992
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVF2TqzYM_TXmRVPGmBDCAw_5aKad2duX7vRdYAHuOnaKxWbTX98xkNmdvfduZzIQC8k6OjoShmB6R1SL4iCKU4ITD36sB3rxjEnj9b3-_XK1dCHHILaybaauo1FsJbReU08OOj9CMNEJWu8Co2NYvALwgAwDvhI4DziOeA_gR6BLQ1qThsDj1HJI4Xn4LhpuxlpoCHhEFywyaWAPT09_fQPGsScGvl8polqOQu2EUvotPR4WkEoJdYQ0TYWqImJ0GsLgJ6vBuNZOmoBj3jVfvC0GBPPv_I7uCIH-mci1BL4DN12aWFa4Umu6u3H9fIHFu58YhNpZEzg6-q4LxDM1hO0AnSGrhapSIfdC7s_R_oaRM5HvF5vYyvUn9w9E3-7HlZMAojwIuQforEdWgCL_cIbmcTSON9AuJ1Ge1j8f7hZy_2Ni_49HUR5A5EcFb0tOkf86m4vDu6k4RZPJVUytjpDPkTI-dvGRbZdWrDz84ZkWjfBgAlxMPzA4zzO4gaAzDi3c8A6Dv8GNAEeC3s-8eyAXJbi08JN0lo7MsrrP8e_ua7N89xO1tt4xGvdQaxTBJ7lOIwUwAQJHHp8Pp9lpAd8O6Hqa4UZcj7nAQDFigaABA9zI2hQWGk7-oaSP_p0ZAy9DMLnG-vYFGMPLCjMyoelKTsfJjNWspa9jKfI9WPt6EeocX79cR_83tSxUnsnNbjv35Sffs02mtl99V1WlEl3nusorTKjOyjxXhSqlTIaaZC6REEtsUO62lS61LDQ2VZsXJcosMbWSapMpmWeVLKRMyyIvtN5mVBbNZrcpxUbSBY1NY-LUj31iQpiozrJdkWeJxYZsmBeWUo5uMH-NIi1OyVjPaJupD2Ij4ziG92vYsJ033W9Pfz6J4gTPjwH4tNpmtsMPt83HbYeBAtwMD19vt2QabT0wX0McdnUW6twbHqYmbf2D3-9oPs9VBaHOa9mvtfovAAD__6vn208">