vkd3d: Introduce a helper function to chain vkd3d structures.

Analogous to vk_prepend_struct().

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Conor McCarthy 2021-10-15 01:37:44 +02:00 committed by Alexandre Julliard
parent e328d0b178
commit 6a88c57f5d
2 changed files with 17 additions and 5 deletions

View File

@ -2689,12 +2689,11 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
goto fail; goto fail;
} }
shader_interface.next = shader_stages[i].stage == xfb_stage ? &xfb_info : NULL; shader_interface.next = NULL;
if (shader_stages[i].stage == xfb_stage)
vkd3d_prepend_struct(&shader_interface, &xfb_info);
if (target_info) if (target_info)
{ vkd3d_prepend_struct(&shader_interface, target_info);
target_info->next = shader_interface.next;
shader_interface.next = target_info;
}
if (FAILED(hr = create_shader_stage(device, &graphics->stages[graphics->stage_count], if (FAILED(hr = create_shader_stage(device, &graphics->stages[graphics->stage_count],
shader_stages[i].stage, b, &shader_interface))) shader_stages[i].stage, b, &shader_interface)))

View File

@ -1395,4 +1395,17 @@ static inline void vk_prepend_struct(void *header, void *structure)
vk_header->pNext = vk_structure; vk_header->pNext = vk_structure;
} }
static inline void vkd3d_prepend_struct(void *header, void *structure)
{
struct
{
unsigned int type;
const void *next;
} *vkd3d_header = header, *vkd3d_structure = structure;
assert(!vkd3d_structure->next);
vkd3d_structure->next = vkd3d_header->next;
vkd3d_header->next = vkd3d_structure;
}
#endif /* __VKD3D_PRIVATE_H */ #endif /* __VKD3D_PRIVATE_H */