vkd3d: Simplify checking for render pass compatibility.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-05-17 10:39:17 +02:00 committed by Alexandre Julliard
parent 1930e60ab3
commit e7e0f4180d
3 changed files with 13 additions and 32 deletions

View File

@ -2415,6 +2415,7 @@ static bool d3d12_command_list_update_current_framebuffer(struct d3d12_command_l
static bool d3d12_command_list_update_current_pipeline(struct d3d12_command_list *list)
{
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
VkRenderPass vk_render_pass;
VkPipeline vk_pipeline;
if (list->current_pipeline != VK_NULL_HANDLE)
@ -2427,11 +2428,20 @@ static bool d3d12_command_list_update_current_pipeline(struct d3d12_command_list
}
if (!(vk_pipeline = d3d12_pipeline_state_get_or_create_pipeline(list->state,
list->primitive_topology, list->strides, list->dsv_format, &list->pso_render_pass)))
list->primitive_topology, list->strides, list->dsv_format, &vk_render_pass)))
return false;
if (!list->pso_render_pass)
list->pso_render_pass = list->state->u.graphics.render_pass;
if (!vk_render_pass)
vk_render_pass = list->state->u.graphics.render_pass;
/* The render pass cache ensures that we use the same Vulkan render pass
* object for compatible render passes. */
if (list->pso_render_pass != vk_render_pass)
{
list->pso_render_pass = vk_render_pass;
d3d12_command_list_invalidate_current_framebuffer(list);
d3d12_command_list_invalidate_current_render_pass(list);
}
VK_CALL(vkCmdBindPipeline(list->vk_command_buffer, list->state->vk_bind_point, vk_pipeline));
list->current_pipeline = vk_pipeline;
@ -3648,11 +3658,6 @@ static void STDMETHODCALLTYPE d3d12_command_list_SetPipelineState(ID3D12Graphics
}
else
{
if (!d3d12_pipeline_state_is_render_pass_compatible(list->state, state))
{
d3d12_command_list_invalidate_current_framebuffer(list);
d3d12_command_list_invalidate_current_render_pass(list);
}
d3d12_command_list_invalidate_current_pipeline(list);
}

View File

@ -2027,28 +2027,6 @@ static unsigned int vkd3d_get_rt_format_swizzle(const struct vkd3d_format *forma
return VKD3D_NO_SWIZZLE;
}
/*
* This must return results in accordance with render passes created by
* d3d12_pipeline_state_init_graphics().
*/
bool d3d12_pipeline_state_is_render_pass_compatible(const struct d3d12_pipeline_state *state_a,
const struct d3d12_pipeline_state *state_b)
{
const struct d3d12_graphics_pipeline_state *a = &state_a->u.graphics;
const struct d3d12_graphics_pipeline_state *b = &state_b->u.graphics;
if (!state_a != !state_b)
return false;
if (!state_a && !state_b)
return true;
if (state_a->vk_bind_point != VK_PIPELINE_BIND_POINT_GRAPHICS
|| state_b->vk_bind_point != VK_PIPELINE_BIND_POINT_GRAPHICS)
return false;
return a->render_pass == b->render_pass;
}
STATIC_ASSERT(sizeof(struct vkd3d_shader_transform_feedback_element) == sizeof(D3D12_SO_DECLARATION_ENTRY));
static HRESULT d3d12_graphics_pipeline_state_create_render_pass(

View File

@ -743,8 +743,6 @@ HRESULT d3d12_pipeline_state_create_graphics(struct d3d12_device *device,
VkPipeline d3d12_pipeline_state_get_or_create_pipeline(struct d3d12_pipeline_state *state,
D3D12_PRIMITIVE_TOPOLOGY topology, const uint32_t *strides, VkFormat dsv_format,
VkRenderPass *vk_render_pass) DECLSPEC_HIDDEN;
bool d3d12_pipeline_state_is_render_pass_compatible(const struct d3d12_pipeline_state *state_a,
const struct d3d12_pipeline_state *state_b) DECLSPEC_HIDDEN;
struct d3d12_pipeline_state *unsafe_impl_from_ID3D12PipelineState(ID3D12PipelineState *iface) DECLSPEC_HIDDEN;
struct vkd3d_buffer