Conor McCarthy : vkd3d: Introduce a helper function to chain vkd3d structures.
Alexandre Julliard
julliard at winehq.org
Fri Oct 15 15:39:49 CDT 2021
Module: vkd3d
Branch: master
Commit: 6a88c57f5d776ad4978ffad3918e4c3a75b9c332
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=6a88c57f5d776ad4978ffad3918e4c3a75b9c332
Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date: Fri Oct 15 01:37:44 2021 +0200
vkd3d: Introduce a helper function to chain vkd3d structures.
Analogous to vk_prepend_struct().
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d/state.c | 9 ++++-----
libs/vkd3d/vkd3d_private.h | 13 +++++++++++++
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 277afe4..29d8618 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -2689,12 +2689,11 @@ 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;
+ shader_interface.next = 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],
shader_stages[i].stage, b, &shader_interface)))
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index f8474ca..0594eea 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -1395,4 +1395,17 @@ 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
+ {
+ 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 */
More information about the wine-cvs
mailing list