Commit ab9e4dd3 authored by Evan Tang's avatar Evan Tang Committed by Alexandre Julliard

wined3d: Restart vk render pass on RT clear.

parent 8de2846c
......@@ -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);
......@@ -3565,6 +3565,20 @@ static void wined3d_context_vk_load_shader_resources(struct wined3d_context_vk *
}
}
static void wined3d_context_vk_prepare_used_rtv(struct wined3d_context_vk *context_vk, 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. */
wined3d_context_vk_end_current_render_pass(context_vk);
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);
}
}
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_vk_prepare_used_rtv(context_vk, 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_vk_prepare_used_rtv(context_vk, 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;
......
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