wined3d: Don't explicitly clear the draw location before starting a renderpass.

Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Dösinger 2022-04-24 19:24:48 +03:00 committed by Alexandre Julliard
parent 2a283004ab
commit 4d4164a80e
1 changed files with 19 additions and 2 deletions

View File

@ -3375,7 +3375,12 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
if (wined3d_blend_state_get_writemask(state->blend_state, i)) if (wined3d_blend_state_get_writemask(state->blend_state, i))
{ {
wined3d_rendertarget_view_load_location(rtv, &context_vk->c, rtv->resource->draw_binding); /* 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);
invalidate_rt |= (1 << i); invalidate_rt |= (1 << i);
} }
else else
@ -3393,9 +3398,17 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
if ((dsv = state->fb.depth_stencil)) if ((dsv = state->fb.depth_stencil))
{ {
if (wined3d_state_uses_depth_buffer(state)) if (wined3d_state_uses_depth_buffer(state))
wined3d_rendertarget_view_load_location(dsv, &context_vk->c, dsv->resource->draw_binding); {
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);
}
else else
{
wined3d_rendertarget_view_prepare_location(dsv, &context_vk->c, dsv->resource->draw_binding); wined3d_rendertarget_view_prepare_location(dsv, &context_vk->c, dsv->resource->draw_binding);
}
if (!state->depth_stencil_state || state->depth_stencil_state->desc.depth_write) if (!state->depth_stencil_state || state->depth_stencil_state->desc.depth_write)
invalidate_ds = true; invalidate_ds = true;
@ -3484,11 +3497,15 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
{ {
i = wined3d_bit_scan(&invalidate_rt); i = wined3d_bit_scan(&invalidate_rt);
rtv = state->fb.render_targets[i]; rtv = state->fb.render_targets[i];
wined3d_rendertarget_view_validate_location(rtv, rtv->resource->draw_binding);
wined3d_rendertarget_view_invalidate_location(rtv, ~rtv->resource->draw_binding); wined3d_rendertarget_view_invalidate_location(rtv, ~rtv->resource->draw_binding);
} }
if (invalidate_ds) if (invalidate_ds)
{
wined3d_rendertarget_view_validate_location(dsv, dsv->resource->draw_binding);
wined3d_rendertarget_view_invalidate_location(dsv, ~dsv->resource->draw_binding); wined3d_rendertarget_view_invalidate_location(dsv, ~dsv->resource->draw_binding);
}
if (wined3d_context_vk_update_graphics_pipeline_key(context_vk, state, context_vk->graphics.vk_pipeline_layout, if (wined3d_context_vk_update_graphics_pipeline_key(context_vk, state, context_vk->graphics.vk_pipeline_layout,
&null_buffer_binding) || !context_vk->graphics.vk_pipeline) &null_buffer_binding) || !context_vk->graphics.vk_pipeline)