Skip to content

Commit e7f9b36

Browse files
vkd3d: Get rid of inline resume optimizations.
It gets really painful to deal with this now and it doesn't really solve any known issues. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
1 parent 04bce60 commit e7f9b36

File tree

1 file changed

+6
-75
lines changed

1 file changed

+6
-75
lines changed

libs/vkd3d/command.c

Lines changed: 6 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -7050,14 +7050,6 @@ static bool d3d12_command_list_has_depth_stencil_view(struct d3d12_command_list
70507050
d3d12_graphics_pipeline_state_has_unknown_dsv_format_with_test(graphics));
70517051
}
70527052

7053-
static void vkd3d_copy_resolve_attachment_info(VkRenderingAttachmentInfo *dst,
7054-
const VkRenderingAttachmentInfo *src)
7055-
{
7056-
dst->resolveMode = src->resolveMode;
7057-
dst->resolveImageLayout = src->resolveImageLayout;
7058-
dst->resolveImageView = src->resolveImageView;
7059-
}
7060-
70617053
static bool d3d12_command_list_update_rendering_info(struct d3d12_command_list *list)
70627054
{
70637055
struct d3d12_graphics_pipeline_state *graphics = list->active_pipeline_type == VKD3D_PIPELINE_TYPE_GRAPHICS ||
@@ -18833,16 +18825,13 @@ static void STDMETHODCALLTYPE d3d12_command_list_BeginRenderPass(d3d12_command_l
1883318825
UINT rt_count, const D3D12_RENDER_PASS_RENDER_TARGET_DESC *render_targets,
1883418826
const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *depth_stencil, D3D12_RENDER_PASS_FLAGS flags)
1883518827
{
18836-
VkRenderingAttachmentInfo rtv_attachments[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT];
1883718828
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
18838-
VkRenderingAttachmentInfo depth, stencil;
1883918829
struct d3d12_rtv_desc *rtv_desc;
1884018830
VkImageAspectFlags dsv_aspects;
1884118831
bool relaxed_attachment_op;
1884218832
bool resuming, suspending;
1884318833
VkFormat prev_dsv_format;
1884418834
unsigned int i, rt_index;
18845-
bool inline_resuming;
1884618835

1884718836
TRACE("iface %p, rt_count %u, render_targets %p, depth_stencil %p, flags %#x.\n",
1884818837
iface, rt_count, render_targets, depth_stencil, flags);
@@ -18854,7 +18843,6 @@ static void STDMETHODCALLTYPE d3d12_command_list_BeginRenderPass(d3d12_command_l
1885418843
* annoying as usual. */
1885518844
resuming = !!(flags & D3D12_RENDER_PASS_FLAG_RESUMING_PASS);
1885618845
suspending = !!(flags & D3D12_RENDER_PASS_FLAG_SUSPENDING_PASS);
18857-
inline_resuming = resuming && (list->rendering_info.state_flags & VKD3D_RENDERING_ACTIVE);
1885818846
relaxed_attachment_op = list->device->workarounds.tiler_suspend_resume_relax_load_store_op;
1885918847

1886018848
/* If this could link up to a previous command buffer, don't block resume. */
@@ -18864,13 +18852,9 @@ static void STDMETHODCALLTYPE d3d12_command_list_BeginRenderPass(d3d12_command_l
1886418852
"Non-resuming BeginRenderPass called inside a render pass.\n", true);
1886518853
}
1886618854

18867-
if (!inline_resuming)
18868-
{
18869-
/* Force a new render pass since we may need to enforce loadOps.
18870-
* loadOps don't apply to resuming passes. */
18871-
d3d12_command_list_invalidate_rendering_info(list);
18872-
d3d12_command_list_end_current_render_pass(list, false);
18873-
}
18855+
/* Force a new render pass since we may need to enforce loadOps. */
18856+
d3d12_command_list_invalidate_rendering_info(list);
18857+
d3d12_command_list_end_current_render_pass(list, false);
1887418858

1887518859
if (!resuming)
1887618860
d3d12_command_list_debug_mark_begin_region(list, "BeginRenderPass");
@@ -19020,10 +19004,6 @@ static void STDMETHODCALLTYPE d3d12_command_list_BeginRenderPass(d3d12_command_l
1902019004

1902119005
rt_index = 0;
1902219006

19023-
memset(rtv_attachments, 0, sizeof(rtv_attachments));
19024-
memset(&depth, 0, sizeof(depth));
19025-
memset(&stencil, 0, sizeof(stencil));
19026-
1902719007
for (i = 0; i < rt_count; i++)
1902819008
{
1902919009
const D3D12_RENDER_PASS_RENDER_TARGET_DESC *rt = &render_targets[i];
@@ -19036,7 +19016,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_BeginRenderPass(d3d12_command_l
1903619016
VK_IMAGE_ASPECT_COLOR_BIT, flags, false, false))
1903719017
{
1903819018
d3d12_command_list_setup_render_pass_attachment_resolve(list,
19039-
&rtv_attachments[rt_index], &rt->EndingAccess.Resolve, VK_IMAGE_ASPECT_COLOR_BIT);
19019+
&list->rendering_info.rtv[rt_index], &rt->EndingAccess.Resolve, VK_IMAGE_ASPECT_COLOR_BIT);
1904019020

1904119021
/* If possible, we should avoid redundant resolves.
1904219022
* We only hit this path if we can assume relaxed load-op/store-op rules.
@@ -19091,7 +19071,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_BeginRenderPass(d3d12_command_l
1909119071
VK_IMAGE_ASPECT_DEPTH_BIT, flags, requires_independent_ds_none, requires_independent_ds))
1909219072
{
1909319073
d3d12_command_list_setup_render_pass_attachment_resolve(list,
19094-
&depth, &depth_stencil->DepthEndingAccess.Resolve,
19074+
&list->rendering_info.depth, &depth_stencil->DepthEndingAccess.Resolve,
1909519075
VK_IMAGE_ASPECT_DEPTH_BIT);
1909619076

1909719077
if (!suspending)
@@ -19111,7 +19091,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_BeginRenderPass(d3d12_command_l
1911119091
VK_IMAGE_ASPECT_STENCIL_BIT, flags, requires_independent_ds_none, requires_independent_ds))
1911219092
{
1911319093
d3d12_command_list_setup_render_pass_attachment_resolve(list,
19114-
&stencil, &depth_stencil->StencilEndingAccess.Resolve,
19094+
&list->rendering_info.stencil, &depth_stencil->StencilEndingAccess.Resolve,
1911519095
VK_IMAGE_ASPECT_STENCIL_BIT);
1911619096

1911719097
if (!suspending)
@@ -19124,55 +19104,6 @@ static void STDMETHODCALLTYPE d3d12_command_list_BeginRenderPass(d3d12_command_l
1912419104
}
1912519105
}
1912619106

19127-
/* Verify compatibility. Keep using the same render pass instance. */
19128-
if (inline_resuming)
19129-
{
19130-
VkImageAspectFlags bound_dsv_aspects = list->dsv.view ? list->dsv.format->vk_aspect_mask : 0;
19131-
bool valid = list->rendering_info.info.colorAttachmentCount == rt_index;
19132-
19133-
if (valid)
19134-
valid = bound_dsv_aspects == dsv_aspects;
19135-
19136-
if (valid && (bound_dsv_aspects & VK_IMAGE_ASPECT_DEPTH_BIT))
19137-
{
19138-
valid = (list->dsv.view ? list->dsv.view->vk_image_view : VK_NULL_HANDLE) ==
19139-
list->rendering_info.depth.imageView;
19140-
}
19141-
19142-
if (valid && (bound_dsv_aspects & VK_IMAGE_ASPECT_STENCIL_BIT))
19143-
{
19144-
valid = (list->dsv.view ? list->dsv.view->vk_image_view : VK_NULL_HANDLE) ==
19145-
list->rendering_info.stencil.imageView;
19146-
}
19147-
19148-
if (valid)
19149-
{
19150-
/* Resolve layout is always GENERAL if view is non-null. */
19151-
valid = depth.resolveImageView == list->rendering_info.depth.resolveImageView &&
19152-
stencil.resolveImageView == list->rendering_info.stencil.resolveImageView;
19153-
}
19154-
19155-
for (i = 0; valid && i < rt_index; i++)
19156-
{
19157-
valid = (list->rtvs[i].view ? list->rtvs[i].view->vk_image_view : VK_NULL_HANDLE) ==
19158-
list->rendering_info.rtv[i].imageView &&
19159-
rtv_attachments[i].resolveImageView == list->rendering_info.rtv[i].resolveImageView;
19160-
}
19161-
19162-
if (!valid)
19163-
{
19164-
FIXME_ONCE("Application is attempting to resume a render pass, but the attachments are incompatible.\n");
19165-
d3d12_command_list_invalidate_rendering_info(list);
19166-
d3d12_command_list_end_current_render_pass(list, false);
19167-
}
19168-
}
19169-
19170-
/* Now it's safe to clobber list->rendering_info. */
19171-
for (i = 0; i < rt_index; i++)
19172-
vkd3d_copy_resolve_attachment_info(&list->rendering_info.rtv[i], &rtv_attachments[i]);
19173-
vkd3d_copy_resolve_attachment_info(&list->rendering_info.depth, &depth);
19174-
vkd3d_copy_resolve_attachment_info(&list->rendering_info.stencil, &stencil);
19175-
1917619107
list->rendering_info.info.colorAttachmentCount = rt_index;
1917719108
d3d12_command_list_invalidate_ds_state(list, prev_dsv_format);
1917819109

0 commit comments

Comments
 (0)