[PATCH vkd3d 3/5] vkd3d: Introduce a helper function to chain vkd3d shader interface structures.
Conor McCarthy
cmccarthy at codeweavers.com
Tue Oct 12 08:37:45 CDT 2021
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
---
libs/vkd3d/state.c | 8 +++++---
libs/vkd3d/vkd3d_private.h | 9 +++++++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 701af891..8c514bd4 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -2676,11 +2676,13 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
goto fail;
}
- shader_interface.next = shader_stages[i].stage == xfb_stage ? &xfb_info : NULL;
+ if (shader_stages[i].stage == xfb_stage)
+ {
+ vkd3d_prepend_struct(&shader_interface, &xfb_info);
+ }
if (target_info)
{
- target_info->next = shader_interface.next;
- shader_interface.next = target_info;
+ vkd3d_prepend_struct(&shader_interface, target_info);
}
if (FAILED(hr = create_shader_stage(device, &graphics->stages[graphics->stage_count],
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index f8474caa..d5fb0753 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -1395,4 +1395,13 @@ static inline void vk_prepend_struct(void *header, void *structure)
vk_header->pNext = vk_structure;
}
+static inline void vkd3d_prepend_struct(void *header, void *structure)
+{
+ struct vkd3d_shader_base_in_structure *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 */
--
2.32.0
More information about the wine-devel
mailing list