Commit e7db99d8 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Retrieve the VkCommandBuffer from wined3d_context_vk after executing RTV barriers.

Part of beginning a render pass involves executing an RTV barrier, which itself needs to call wined3d_context_vk_get_command_buffer(). However, that function may decide to submit the command buffer, in order to prevent resource buildup, or [in the future] because it has been some length of time since the last submission. Therefore we cannot retrieve and store a VkCommandBuffer pointer before executing an RTV barrier and then use it later.
parent 79fb59e2
...@@ -2699,7 +2699,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte ...@@ -2699,7 +2699,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
} }
static bool wined3d_context_vk_begin_render_pass(struct wined3d_context_vk *context_vk, static bool wined3d_context_vk_begin_render_pass(struct wined3d_context_vk *context_vk,
VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, const struct wined3d_vk_info *vk_info) const struct wined3d_state *state, const struct wined3d_vk_info *vk_info)
{ {
struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device); struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
VkClearValue clear_values[WINED3D_MAX_RENDER_TARGETS + 1]; VkClearValue clear_values[WINED3D_MAX_RENDER_TARGETS + 1];
...@@ -2709,6 +2709,7 @@ static bool wined3d_context_vk_begin_render_pass(struct wined3d_context_vk *cont ...@@ -2709,6 +2709,7 @@ static bool wined3d_context_vk_begin_render_pass(struct wined3d_context_vk *cont
struct wined3d_rendertarget_view *view; struct wined3d_rendertarget_view *view;
const VkPhysicalDeviceLimits *limits; const VkPhysicalDeviceLimits *limits;
struct wined3d_query_vk *query_vk; struct wined3d_query_vk *query_vk;
VkCommandBuffer vk_command_buffer;
VkRenderPassBeginInfo begin_info; VkRenderPassBeginInfo begin_info;
unsigned int attachment_count, i; unsigned int attachment_count, i;
struct wined3d_texture *texture; struct wined3d_texture *texture;
...@@ -2814,6 +2815,12 @@ static bool wined3d_context_vk_begin_render_pass(struct wined3d_context_vk *cont ...@@ -2814,6 +2815,12 @@ static bool wined3d_context_vk_begin_render_pass(struct wined3d_context_vk *cont
++attachment_count; ++attachment_count;
} }
if (!(vk_command_buffer = wined3d_context_vk_get_command_buffer(context_vk)))
{
ERR("Failed to get command buffer.\n");
return false;
}
if (!(context_vk->vk_render_pass = wined3d_context_vk_get_render_pass(context_vk, &state->fb, if (!(context_vk->vk_render_pass = wined3d_context_vk_get_render_pass(context_vk, &state->fb,
ARRAY_SIZE(state->fb.render_targets), !!state->fb.depth_stencil, 0))) ARRAY_SIZE(state->fb.render_targets), !!state->fb.depth_stencil, 0)))
{ {
...@@ -3772,19 +3779,15 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c ...@@ -3772,19 +3779,15 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
wined3d_context_vk_load_buffers(context_vk, state, indirect_vk, indexed); wined3d_context_vk_load_buffers(context_vk, state, indirect_vk, indexed);
if (!(vk_command_buffer = wined3d_context_vk_get_command_buffer(context_vk)))
{
ERR("Failed to get command buffer.\n");
return VK_NULL_HANDLE;
}
if (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_FRAMEBUFFER)) if (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_FRAMEBUFFER))
wined3d_context_vk_end_current_render_pass(context_vk); wined3d_context_vk_end_current_render_pass(context_vk);
if (!wined3d_context_vk_begin_render_pass(context_vk, vk_command_buffer, state, vk_info))
if (!wined3d_context_vk_begin_render_pass(context_vk, state, vk_info))
{ {
ERR("Failed to begin render pass.\n"); ERR("Failed to begin render pass.\n");
return VK_NULL_HANDLE; return VK_NULL_HANDLE;
} }
vk_command_buffer = context_vk->current_command_buffer.vk_command_buffer;
while (invalidate_rt) while (invalidate_rt)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment