[PATCH vkd3d 8/8] vkd3d: Simplify checking for render pass compatibility.
Józef Kucia
joseph.kucia at gmail.com
Fri May 17 03:39:17 CDT 2019
From: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
libs/vkd3d/command.c | 21 +++++++++++++--------
libs/vkd3d/state.c | 22 ----------------------
libs/vkd3d/vkd3d_private.h | 2 --
3 files changed, 13 insertions(+), 32 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index d5283275786f..9187ad02d836 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -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);
}
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index a447eb5e5c74..c5f66b699548 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -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(
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index 44e61c2aaac6..0f0d77fea38d 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -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
--
2.21.0
More information about the wine-devel
mailing list