From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/command.c | 19 +++++++++++++++++++ libs/vkd3d/state.c | 3 +++ libs/vkd3d/vkd3d_private.h | 4 ++++ 3 files changed, 26 insertions(+)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 8402668f3a05..9c3165c98765 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -1304,6 +1304,13 @@ static void d3d12_command_list_end_current_render_pass(struct d3d12_command_list { const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
+ if (list->xfb_enabled) + { + VK_CALL(vkCmdEndTransformFeedbackEXT(list->vk_command_buffer, 0, ARRAY_SIZE(list->so_counter_buffers), + list->so_counter_buffers, list->so_counter_buffer_offsets)); + list->xfb_enabled = false; + } + if (list->current_render_pass) VK_CALL(vkCmdEndRenderPass(list->vk_command_buffer));
@@ -1746,6 +1753,8 @@ static void d3d12_command_list_reset_state(struct d3d12_command_list *list, list->fb_height = 0; list->fb_layer_count = 0;
+ list->xfb_enabled = false; + list->current_framebuffer = VK_NULL_HANDLE; list->current_pipeline = VK_NULL_HANDLE; list->current_render_pass = VK_NULL_HANDLE; @@ -2252,6 +2261,7 @@ static void d3d12_command_list_update_descriptors(struct d3d12_command_list *lis static bool d3d12_command_list_begin_render_pass(struct d3d12_command_list *list) { const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs; + struct d3d12_graphics_pipeline_state *graphics; struct VkRenderPassBeginInfo begin_desc; VkRenderPass vk_render_pass;
@@ -2287,6 +2297,15 @@ static bool d3d12_command_list_begin_render_pass(struct d3d12_command_list *list
list->current_render_pass = vk_render_pass;
+ graphics = &list->state->u.graphics; + if (graphics->xfb_enabled) + { + VK_CALL(vkCmdBeginTransformFeedbackEXT(list->vk_command_buffer, 0, ARRAY_SIZE(list->so_counter_buffers), + list->so_counter_buffers, list->so_counter_buffer_offsets)); + + list->xfb_enabled = true; + } + return true; }
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 77538ebb3dce..a9a463de97e2 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -2165,6 +2165,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s } }
+ graphics->xfb_enabled = false; if (so_desc->NumEntries) { if (!vk_info->EXT_transform_feedback) @@ -2174,6 +2175,8 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s goto fail; }
+ graphics->xfb_enabled = true; + xfb_info.type = VKD3D_SHADER_STRUCTURE_TYPE_TRANSFORM_FEEDBACK_INFO; xfb_info.next = NULL;
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 4564b9635fe5..65fcd9f5ce11 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -620,6 +620,8 @@ struct d3d12_graphics_pipeline_state const struct d3d12_root_signature *root_signature;
struct list compiled_pipelines; + + bool xfb_enabled; };
struct d3d12_compute_pipeline_state @@ -788,6 +790,8 @@ struct d3d12_command_list unsigned int fb_height; unsigned int fb_layer_count;
+ bool xfb_enabled; + VkFramebuffer current_framebuffer; VkPipeline current_pipeline; VkRenderPass current_render_pass;