[dxvk] Use self-dependency to synchronize SSBO writes

While this doesn't support vertex stages yet, it should be faster
when the pipeline writes to storage resources from the fragment
shader.

We should analyze the vertex stage shaders for SSBO writes in
order to determine whether to spill the render pass.
This commit is contained in:
Philip Rebohle 2018-10-30 14:11:27 +01:00
parent 43ed820be9
commit 76b63efedb
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 15 additions and 7 deletions

View File

@ -3032,11 +3032,14 @@ namespace dxvk {
void DxvkContext::commitGraphicsPostBarriers() {
// Render pass dependencies always act as a full memory barrier. We
// have to do this because writes from the vertex shader in one draw
// need to be visible to the fragment shader in the next draw, etc.
if (m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasStorageDescriptors))
this->spillRenderPass();
if (m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasStorageDescriptors)) {
// FIXME support vertex stage SSBO synchronization
this->emitMemoryBarrier(
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
VK_ACCESS_SHADER_WRITE_BIT,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT);
}
}

View File

@ -121,7 +121,7 @@ namespace dxvk {
if (m_format.depth.format == VK_FORMAT_UNDEFINED)
subpass.pDepthStencilAttachment = nullptr;
const std::array<VkSubpassDependency, 3> subpassDeps = {{
const std::array<VkSubpassDependency, 4> subpassDeps = {{
{ VK_SUBPASS_EXTERNAL, 0,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
@ -132,9 +132,14 @@ namespace dxvk {
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, 0 },
{ 0, 0,
VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT,
VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT,
VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT, /* XXX */
VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT,
VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT, 0 },
{ 0, 0,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
VK_ACCESS_SHADER_WRITE_BIT,
VK_ACCESS_SHADER_READ_BIT, 0 },
{ 0, VK_SUBPASS_EXTERNAL,
VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,