From: Zebediah Figura <zfigura(a)codeweavers.com>
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.
---
dlls/wined3d/context_vk.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c
index dc793a839bb..377c437ee09 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -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,
- 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);
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
struct wined3d_rendertarget_view *view;
const VkPhysicalDeviceLimits *limits;
struct wined3d_query_vk *query_vk;
+ VkCommandBuffer vk_command_buffer;
VkRenderPassBeginInfo begin_info;
unsigned int attachment_count, i;
struct wined3d_texture *texture;
@@ -2814,6 +2815,12 @@ static bool wined3d_context_vk_begin_render_pass(struct
wined3d_context_vk *cont
++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,
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
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))
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");
return VK_NULL_HANDLE;
}
+ vk_command_buffer = context_vk->current_command_buffer.vk_command_buffer;
while (invalidate_rt)
{
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/2724