vkd3d: Do not create pipeline variants for NULL DSV.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
This commit is contained in:
Philip Rebohle 2022-03-23 17:50:28 +01:00 committed by Hans-Kristian Arntzen
parent c9abcfa656
commit 1d3957fe6d
2 changed files with 5 additions and 36 deletions

View File

@ -4489,11 +4489,6 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearState(d3d12_command_list_i
d3d12_command_list_reset_api_state(list, pipeline_state);
}
static bool d3d12_graphics_pipeline_state_is_depth_stencil_sensitive(const struct d3d12_graphics_pipeline_state *graphics)
{
return graphics->dsv_format || d3d12_graphics_pipeline_state_has_unknown_dsv_format(graphics);
}
static bool d3d12_command_list_has_depth_stencil_view(struct d3d12_command_list *list)
{
const struct d3d12_graphics_pipeline_state *graphics;
@ -4559,12 +4554,6 @@ static bool d3d12_command_list_update_rendering_info(struct d3d12_command_list *
if (d3d12_command_list_has_depth_stencil_view(list))
{
if (!list->dsv.view)
{
FIXME("Invalid DSV.\n");
return false;
}
rendering_info->dsv.imageView = list->dsv.view->vk_image_view;
rendering_info->dsv.imageLayout = list->dsv_layout;
}
@ -8066,7 +8055,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_OMSetRenderTargets(d3d12_comman
{
graphics = &list->state->graphics;
if (prev_dsv_format != next_dsv_format && d3d12_graphics_pipeline_state_is_depth_stencil_sensitive(graphics))
if (prev_dsv_format != next_dsv_format && d3d12_graphics_pipeline_state_has_unknown_dsv_format(graphics))
{
/* If we change the NULL-ness of the depth-stencil attachment, we are
* at risk of having to use fallback pipelines. Invalidate the pipeline

View File

@ -3875,7 +3875,6 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
VkPipelineShaderStageCreateInfo stages[VKD3D_MAX_SHADER_STAGES];
VkFormat rtv_formats[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT];
VkPipelineTessellationStateCreateInfo tessellation_info;
VkPipelineDepthStencilStateCreateInfo fallback_ds_desc;
VkPipelineCreationFeedbackCreateInfoEXT feedback_info;
VkPipelineDynamicStateCreateInfo dynamic_create_info;
VkPipelineVertexInputStateCreateInfo input_desc;
@ -3985,21 +3984,8 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
/* A workaround for SottR, which creates pipelines with DSV_UNKNOWN, but still insists on using a depth buffer.
* If we notice that the base pipeline's DSV format does not match the dynamic DSV format, we fall-back to create a new render pass. */
if (graphics->dsv_format != dsv_format && d3d12_graphics_pipeline_state_has_unknown_dsv_format(graphics))
{
TRACE("Compiling %p with fallback DSV format %#x.\n", state,
dsv_format ? dsv_format->vk_format : VK_FORMAT_UNDEFINED);
}
else if (!dsv_format && graphics->dsv_format)
{
TRACE("Compiling %p with fallback NULL DSV format.\n", state);
fallback_ds_desc = graphics->ds_desc;
fallback_ds_desc.depthTestEnable = VK_FALSE;
fallback_ds_desc.depthWriteEnable = VK_FALSE;
fallback_ds_desc.depthBoundsTestEnable = VK_FALSE;
fallback_ds_desc.stencilTestEnable = VK_FALSE;
pipeline_desc.pDepthStencilState = &fallback_ds_desc;
}
if (d3d12_graphics_pipeline_state_has_unknown_dsv_format(graphics) && dsv_format)
TRACE("Compiling %p with fallback DSV format %#x.\n", state, dsv_format->vk_format);
graphics->dsv_plane_optimal_mask = d3d12_graphics_pipeline_state_get_plane_optimal_mask(graphics, dsv_format);
@ -4104,15 +4090,9 @@ VkPipeline d3d12_pipeline_state_get_pipeline(struct d3d12_pipeline_state *state,
if (!graphics->pipeline)
return VK_NULL_HANDLE;
/* Unknown DSV format workaround. */
if ((dsv_format != graphics->dsv_format) && (graphics->dsv_format ||
state->graphics.ds_desc.depthTestEnable ||
state->graphics.ds_desc.stencilTestEnable ||
state->graphics.ds_desc.depthBoundsTestEnable))
if (d3d12_graphics_pipeline_state_has_unknown_dsv_format(graphics) && dsv_format)
{
TRACE("DSV format mismatch, expected %u, got %u, buggy application!\n",
graphics->dsv_format ? graphics->dsv_format->vk_format : VK_FORMAT_UNDEFINED,
dsv_format ? dsv_format->vk_format : VK_FORMAT_UNDEFINED);
TRACE("Applying unknown DSV workaround with format %u buggy application!\n", dsv_format->vk_format);
return VK_NULL_HANDLE;
}