Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/dxil.c:
+int vkd3d_shader_sm6_parser_create(const struct vkd3d_shader_compile_info *compile_info,
struct vkd3d_shader_message_context *message_context, struct vkd3d_shader_desc *shader_desc,
struct vkd3d_shader_parser **parser)
+{
- struct vkd3d_shader_sm6_parser *sm6;
- if (!(sm6 = vkd3d_calloc(1, sizeof(*sm6) + align(shader_desc->byte_code_size, sizeof(uint32_t)))))
- {
ERR("Failed to allocate parser.\n");
return VKD3D_ERROR_OUT_OF_MEMORY;
- }
- sm6->p.shader_desc = *shader_desc;
- shader_desc = &sm6->p.shader_desc;
- /* LLVM bitcode should be 32-bit aligned, but this is not done in the DXBC container.
* Get an aligned copy to prevent unaligned access. */
Have you seen DXBC files with unaligned chunks in the wild? I have never, it seems that all chunks are always aligned to four bytes. So I would suggest to enforce this behavior `parse_dxbc()` and avoid a copy here.