[PATCH vkd3d] vkd3d: Save and restore the last stencil reference value.
Rémi Bernon
rbernon at codeweavers.com
Thu Dec 12 12:36:21 CST 2019
This fixes The Turing Test rendering on NVIDIA GPUs.
It also fixes this Vulkan validation error:
Dynamic stencil reference state not set for this command buffer..
The Vulkan spec states: If the VkPipeline object bound to the pipeline
bind point used by this command requires any dynamic state, that state
must have been set for commandBuffer.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
libs/vkd3d/command.c | 5 +++++
libs/vkd3d/vkd3d_private.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index c6e08744..b0147607 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -2397,6 +2397,7 @@ static void d3d12_command_list_reset_state(struct d3d12_command_list *list,
list->is_predicated = false;
+ list->current_stencil_ref = 0;
list->current_framebuffer = VK_NULL_HANDLE;
list->current_pipeline = VK_NULL_HANDLE;
list->pso_render_pass = VK_NULL_HANDLE;
@@ -2602,6 +2603,8 @@ static bool d3d12_command_list_update_graphics_pipeline(struct d3d12_command_lis
VK_CALL(vkCmdBindPipeline(list->vk_command_buffer, list->state->vk_bind_point, vk_pipeline));
list->current_pipeline = vk_pipeline;
+ VK_CALL(vkCmdSetStencilReference(list->vk_command_buffer, VK_STENCIL_FRONT_AND_BACK, list->current_stencil_ref));
+
return true;
}
@@ -3793,6 +3796,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_OMSetStencilRef(ID3D12GraphicsC
TRACE("iface %p, stencil_ref %u.\n", iface, stencil_ref);
+ list->current_stencil_ref = stencil_ref;
+
vk_procs = &list->device->vk_procs;
VK_CALL(vkCmdSetStencilReference(list->vk_command_buffer, VK_STENCIL_FRONT_AND_BACK, stencil_ref));
}
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index d9290db7..a5ffbb4b 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -961,6 +961,7 @@ struct d3d12_command_list
bool is_predicated;
+ uint32_t current_stencil_ref;
VkFramebuffer current_framebuffer;
VkPipeline current_pipeline;
VkRenderPass pso_render_pass;
--
2.24.0
More information about the wine-devel
mailing list