1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[dxvk] Spill render pass after draws with storage resources

This commit is contained in:
Philip Rebohle 2018-10-29 10:52:04 +01:00
parent 9decfb34b7
commit fd52022fff
4 changed files with 28 additions and 9 deletions

View File

@ -953,6 +953,8 @@ namespace dxvk {
m_cmd->cmdDraw( m_cmd->cmdDraw(
vertexCount, instanceCount, vertexCount, instanceCount,
firstVertex, firstInstance); firstVertex, firstInstance);
this->commitGraphicsPostBarriers();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -973,6 +975,7 @@ namespace dxvk {
descriptor.buffer.offset + offset, descriptor.buffer.offset + offset,
count, stride); count, stride);
this->commitGraphicsPostBarriers();
this->trackDrawBuffer(); this->trackDrawBuffer();
} }
@ -993,6 +996,8 @@ namespace dxvk {
indexCount, instanceCount, indexCount, instanceCount,
firstIndex, vertexOffset, firstIndex, vertexOffset,
firstInstance); firstInstance);
this->commitGraphicsPostBarriers();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1013,6 +1018,7 @@ namespace dxvk {
descriptor.buffer.offset + offset, descriptor.buffer.offset + offset,
count, stride); count, stride);
this->commitGraphicsPostBarriers();
this->trackDrawBuffer(); this->trackDrawBuffer();
} }
@ -1033,6 +1039,8 @@ namespace dxvk {
physicalSlice.handle(), physicalSlice.handle(),
physicalSlice.offset(), physicalSlice.offset(),
counterBias, counterDivisor); counterBias, counterDivisor);
this->commitGraphicsPostBarriers();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -2403,9 +2411,12 @@ namespace dxvk {
m_state.gp.vs.shader, m_state.gp.vs.shader,
m_state.gp.tcs.shader, m_state.gp.tes.shader, m_state.gp.tcs.shader, m_state.gp.tes.shader,
m_state.gp.gs.shader, m_state.gp.fs.shader); m_state.gp.gs.shader, m_state.gp.fs.shader);
m_state.gp.flags = DxvkGraphicsPipelineFlags();
if (m_state.gp.pipeline != nullptr) if (m_state.gp.pipeline != nullptr) {
m_state.gp.flags = m_state.gp.pipeline->flags();
m_cmd->trackResource(m_state.gp.pipeline); m_cmd->trackResource(m_state.gp.pipeline);
}
} }
} }
@ -2820,11 +2831,7 @@ namespace dxvk {
void DxvkContext::updateTransformFeedbackState() { void DxvkContext::updateTransformFeedbackState() {
bool hasTransformFeedback = if (!m_state.gp.flags.test(DxvkGraphicsPipelineFlag::HasTransformFeedback))
m_state.gp.pipeline != nullptr
&& m_state.gp.pipeline->flags().test(DxvkGraphicsPipelineFlag::HasTransformFeedback);
if (!hasTransformFeedback)
return; return;
if (m_flags.test(DxvkContextFlag::GpDirtyXfbBuffers)) { if (m_flags.test(DxvkContextFlag::GpDirtyXfbBuffers)) {
@ -3022,6 +3029,15 @@ 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();
}
void DxvkContext::emitMemoryBarrier( void DxvkContext::emitMemoryBarrier(

View File

@ -849,6 +849,8 @@ namespace dxvk {
void commitComputeInitBarriers(); void commitComputeInitBarriers();
void commitComputePostBarriers(); void commitComputePostBarriers();
void commitGraphicsPostBarriers();
void emitMemoryBarrier( void emitMemoryBarrier(
VkPipelineStageFlags srcStages, VkPipelineStageFlags srcStages,

View File

@ -110,6 +110,7 @@ namespace dxvk {
DxvkShaderStage fs; DxvkShaderStage fs;
DxvkGraphicsPipelineStateInfo state; DxvkGraphicsPipelineStateInfo state;
DxvkGraphicsPipelineFlags flags;
Rc<DxvkGraphicsPipeline> pipeline; Rc<DxvkGraphicsPipeline> pipeline;
}; };

View File

@ -24,7 +24,7 @@ namespace dxvk {
HasStorageDescriptors, HasStorageDescriptors,
}; };
using DxvkGraphicsCommonPipelineFlags = Flags<DxvkGraphicsPipelineFlag>; using DxvkGraphicsPipelineFlags = Flags<DxvkGraphicsPipelineFlag>;
/** /**
@ -171,7 +171,7 @@ namespace dxvk {
* \brief Returns graphics pipeline flags * \brief Returns graphics pipeline flags
* \returns Graphics pipeline property flags * \returns Graphics pipeline property flags
*/ */
DxvkGraphicsCommonPipelineFlags flags() const { DxvkGraphicsPipelineFlags flags() const {
return m_flags; return m_flags;
} }
@ -232,7 +232,7 @@ namespace dxvk {
uint32_t m_vsIn = 0; uint32_t m_vsIn = 0;
uint32_t m_fsOut = 0; uint32_t m_fsOut = 0;
DxvkGraphicsCommonPipelineFlags m_flags; DxvkGraphicsPipelineFlags m_flags;
DxvkGraphicsCommonPipelineStateInfo m_common; DxvkGraphicsCommonPipelineStateInfo m_common;
// List of pipeline instances, shared between threads // List of pipeline instances, shared between threads