From: Evan Tang etang@codeweavers.com
--- dlls/d3d11/tests/d3d11.c | 5 ----- dlls/wined3d/context_vk.c | 28 ++++++++++++++++------------ 2 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 452045852c4..cd36780ddcd 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -35361,7 +35361,6 @@ static void test_clear_during_render(void) ID3D11DeviceContext_Draw(context, 4, 0); get_texture_readback(tex, 0, &rb); color = get_readback_color(&rb, 0, 0, 0); - todo_wine_if(damavand) ok(color == 0xff0000ff, "Got unexpected color 0x%08lx instead of 0xff0000ff.\n", color); color = get_readback_color(&rb, 1, 0, 0); ok(color == 0xff000000, "Got unexpected color 0x%08lx instead of 0xff000000.\n", color); @@ -35384,7 +35383,6 @@ static void test_clear_during_render(void) ID3D11DeviceContext_Draw(context, 4, 0); get_texture_readback(tex, 0, &rb); color = get_readback_color(&rb, 0, 0, 0); - todo_wine_if(damavand) ok(color == 0xff000000, "Got unexpected color 0x%08lx instead of 0xff000000.\n", color); color = get_readback_color(&rb, 1, 0, 0); ok(color == 0xff000000, "Got unexpected color 0x%08lx instead of 0xff000000.\n", color); @@ -35414,10 +35412,8 @@ static void test_clear_during_render(void) release_resource_readback(&rb); get_texture_readback(dstex, 0, &rb); depth = get_readback_float(&rb, 0, 0); - todo_wine_if(damavand) ok(depth == 0.25f, "Got unexpected depth %.8e instead of 0.25.\n", depth); depth = get_readback_float(&rb, 1, 0); - todo_wine_if(damavand) ok(depth == 0.0f, "Got unexpected depth %.8e instead of 0.0.\n", depth); release_resource_readback(&rb);
@@ -35433,7 +35429,6 @@ static void test_clear_during_render(void) color = get_readback_color(&rb, 0, 0, 0); ok(color == 0xff0000ff, "Got unexpected color 0x%08lx instead of 0xff0000ff.\n", color); color = get_readback_color(&rb, 1, 0, 0); - todo_wine_if(damavand) ok(color == 0xff00ff00, "Got unexpected color 0x%08lx instead of 0xff00ff00.\n", color); release_resource_readback(&rb);
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 859e8fb5949..abd75066f29 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -3565,6 +3565,20 @@ static void wined3d_context_vk_load_shader_resources(struct wined3d_context_vk * } }
+static void wined3d_context_prepare_used_rtv(struct wined3d_context *context, struct wined3d_rendertarget_view *rtv) +{ + if (wined3d_rendertarget_view_get_locations(rtv) & WINED3D_LOCATION_CLEARED) + { + /* Need to restart render pass or the clear won't happen. */ + context_invalidate_state(context, STATE_FRAMEBUFFER); + wined3d_rendertarget_view_prepare_location(rtv, context, rtv->resource->draw_binding); + } + else + { + wined3d_rendertarget_view_load_location(rtv, context, rtv->resource->draw_binding); + } +} + VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *context_vk, const struct wined3d_state *state, struct wined3d_buffer_vk *indirect_vk, bool indexed) { @@ -3607,10 +3621,7 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c { /* We handle clears at the beginning of the render pass, no need for an explicit clear * first. */ - if (wined3d_rendertarget_view_get_locations(rtv) & WINED3D_LOCATION_CLEARED) - wined3d_rendertarget_view_prepare_location(rtv, &context_vk->c, rtv->resource->draw_binding); - else - wined3d_rendertarget_view_load_location(rtv, &context_vk->c, rtv->resource->draw_binding); + wined3d_context_prepare_used_rtv(&context_vk->c, rtv); invalidate_rt |= (1 << i); } else @@ -3628,16 +3639,9 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c if ((dsv = state->fb.depth_stencil)) { if (wined3d_state_uses_depth_buffer(state)) - { - if (wined3d_rendertarget_view_get_locations(dsv) & WINED3D_LOCATION_CLEARED) - wined3d_rendertarget_view_prepare_location(dsv, &context_vk->c, dsv->resource->draw_binding); - else - wined3d_rendertarget_view_load_location(dsv, &context_vk->c, dsv->resource->draw_binding); - } + wined3d_context_prepare_used_rtv(&context_vk->c, dsv); else - { wined3d_rendertarget_view_prepare_location(dsv, &context_vk->c, dsv->resource->draw_binding); - }
if (!state->depth_stencil_state || state->depth_stencil_state->writes_ds) invalidate_ds = true;