vkd3d: Handle illegal rendering to NULL DSV.
Guardians of the Galaxy hits this case. Fallback is to disable depth attachment entirely in a fallback pipeline. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
45ae742526
commit
3937e1a298
|
@ -4361,7 +4361,7 @@ static bool d3d12_command_list_has_depth_stencil_view(struct d3d12_command_list
|
||||||
assert(d3d12_pipeline_state_is_graphics(list->state));
|
assert(d3d12_pipeline_state_is_graphics(list->state));
|
||||||
graphics = &list->state->graphics;
|
graphics = &list->state->graphics;
|
||||||
|
|
||||||
return graphics->dsv_format || (d3d12_pipeline_state_has_unknown_dsv_format(list->state) && list->dsv.format);
|
return list->dsv.format && (graphics->dsv_format || d3d12_pipeline_state_has_unknown_dsv_format(list->state));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void d3d12_command_list_get_fb_extent(struct d3d12_command_list *list,
|
static void d3d12_command_list_get_fb_extent(struct d3d12_command_list *list,
|
||||||
|
@ -4583,14 +4583,6 @@ static bool d3d12_command_list_update_graphics_pipeline(struct d3d12_command_lis
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Detect error case early, otherwise, we end up creating new pipelines
|
|
||||||
* and crash later when looking at DSV formats. */
|
|
||||||
if (!list->dsv.view && list->state->graphics.dsv_format)
|
|
||||||
{
|
|
||||||
FIXME_ONCE("Attempting to render to NULL DSV with non-NULL format in PSO. Skipping draw call.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
variant_flags = d3d12_command_list_variant_flags(list);
|
variant_flags = d3d12_command_list_variant_flags(list);
|
||||||
|
|
||||||
/* Try to grab the pipeline we compiled ahead of time. If we cannot do so, fall back. */
|
/* Try to grab the pipeline we compiled ahead of time. If we cannot do so, fall back. */
|
||||||
|
|
|
@ -2855,15 +2855,18 @@ static HRESULT d3d12_graphics_pipeline_state_create_render_pass_for_plane_mask(
|
||||||
key.rtv_active_mask = rtv_active_mask;
|
key.rtv_active_mask = rtv_active_mask;
|
||||||
key.flags = 0;
|
key.flags = 0;
|
||||||
|
|
||||||
if (graphics->dsv_format)
|
if (dynamic_dsv_format)
|
||||||
{
|
{
|
||||||
dsv_format = graphics->dsv_format->vk_format;
|
if (graphics->dsv_format)
|
||||||
aspects = graphics->dsv_format->vk_aspect_mask;
|
{
|
||||||
}
|
dsv_format = graphics->dsv_format->vk_format;
|
||||||
else if (dynamic_dsv_format && (graphics->null_attachment_mask & dsv_attachment_mask(graphics)))
|
aspects = graphics->dsv_format->vk_aspect_mask;
|
||||||
{
|
}
|
||||||
dsv_format = dynamic_dsv_format->vk_format;
|
else if (graphics->null_attachment_mask & dsv_attachment_mask(graphics))
|
||||||
aspects = dynamic_dsv_format->vk_aspect_mask;
|
{
|
||||||
|
dsv_format = dynamic_dsv_format->vk_format;
|
||||||
|
aspects = dynamic_dsv_format->vk_aspect_mask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dsv_format)
|
if (dsv_format)
|
||||||
|
@ -4009,6 +4012,7 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
|
||||||
struct d3d12_graphics_pipeline_state *graphics = &state->graphics;
|
struct d3d12_graphics_pipeline_state *graphics = &state->graphics;
|
||||||
VkPipelineVertexInputDivisorStateCreateInfoEXT input_divisor_info;
|
VkPipelineVertexInputDivisorStateCreateInfoEXT input_divisor_info;
|
||||||
VkPipelineTessellationStateCreateInfo tessellation_info;
|
VkPipelineTessellationStateCreateInfo tessellation_info;
|
||||||
|
VkPipelineDepthStencilStateCreateInfo fallback_ds_desc;
|
||||||
VkPipelineDynamicStateCreateInfo dynamic_create_info;
|
VkPipelineDynamicStateCreateInfo dynamic_create_info;
|
||||||
VkPipelineVertexInputStateCreateInfo input_desc;
|
VkPipelineVertexInputStateCreateInfo input_desc;
|
||||||
VkPipelineInputAssemblyStateCreateInfo ia_desc;
|
VkPipelineInputAssemblyStateCreateInfo ia_desc;
|
||||||
|
@ -4101,6 +4105,16 @@ VkPipeline d3d12_pipeline_state_create_pipeline_variant(struct d3d12_pipeline_st
|
||||||
TRACE("Compiling %p with fallback DSV format %#x.\n", state,
|
TRACE("Compiling %p with fallback DSV format %#x.\n", state,
|
||||||
dsv_format ? dsv_format->vk_format : VK_FORMAT_UNDEFINED);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
rtv_active_mask = key ? key->rtv_active_mask : graphics->rtv_active_mask;
|
rtv_active_mask = key ? key->rtv_active_mask : graphics->rtv_active_mask;
|
||||||
if (graphics->rtv_active_mask != rtv_active_mask)
|
if (graphics->rtv_active_mask != rtv_active_mask)
|
||||||
|
|
Loading…
Reference in New Issue