[dxvk] Change emitGraphicsBarrier to specify a dependency

This commit is contained in:
Philip Rebohle 2022-08-19 18:30:21 +02:00
parent 388288114a
commit e923cc5b69
3 changed files with 34 additions and 5 deletions

View File

@ -5316,7 +5316,11 @@ namespace dxvk {
void D3D9DeviceEx::MarkRenderHazards() {
EmitCs([](DxvkContext* ctx) {
ctx->emitGraphicsBarrier();
ctx->emitGraphicsBarrier(
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT);
});
for (uint32_t rtIdx : bit::BitMask(m_activeHazardsRT)) {

View File

@ -1498,9 +1498,26 @@ namespace dxvk {
}
void DxvkContext::emitGraphicsBarrier() {
if (!m_barrierControl.test(DxvkBarrierControl::IgnoreGraphicsBarriers))
this->spillRenderPass(true);
void DxvkContext::emitGraphicsBarrier(
VkPipelineStageFlags srcStages,
VkAccessFlags srcAccess,
VkPipelineStageFlags dstStages,
VkAccessFlags dstAccess) {
// Emit barrier early so we can fold this into
// the spill render pass barrier if possible
if (srcStages | dstStages) {
m_execBarriers.accessMemory(
srcStages, srcAccess,
dstStages, dstAccess);
}
this->spillRenderPass(true);
// Flush barriers if there was no active render pass.
// This is necessary because there are no resources
// associated with the barrier to allow tracking.
if (srcStages | dstStages)
m_execBarriers.recordCommands(m_cmd);
}

View File

@ -826,8 +826,16 @@ namespace dxvk {
* render target, or when subsequent draw calls access any
* given resource for writing. It is assumed that no hazards
* can happen between storage descriptors and other resources.
* \param [in] srcStages Source pipeline stages
* \param [in] srcAccess Source access
* \param [in] dstStages Destination pipeline stages
* \param [in] dstAccess Destination access
*/
void emitGraphicsBarrier();
void emitGraphicsBarrier(
VkPipelineStageFlags srcStages,
VkAccessFlags srcAccess,
VkPipelineStageFlags dstStages,
VkAccessFlags dstAccess);
/**
* \brief Generates mip maps