Vulkan: Replace explicit command buffer submits with wrapper function
Should we ever introduce anything else that has to be done when a command buffer is executed (e.g. invalidating constants from previous commit), we don't have to update all the callers.
This commit is contained in:
parent
3adeacb78d
commit
6a4eba1153
|
@ -738,9 +738,7 @@ bool FramebufferManager::PopulateColorReadbackTexture()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until the copy is complete.
|
// Wait until the copy is complete.
|
||||||
g_command_buffer_mgr->ExecuteCommandBuffer(false, true);
|
Util::ExecuteCurrentCommandsAndRestoreState(false, true);
|
||||||
StateTracker::GetInstance()->InvalidateDescriptorSets();
|
|
||||||
StateTracker::GetInstance()->SetPendingRebind();
|
|
||||||
|
|
||||||
// Map to host memory.
|
// Map to host memory.
|
||||||
if (!m_color_readback_texture->IsMapped() && !m_color_readback_texture->Map())
|
if (!m_color_readback_texture->IsMapped() && !m_color_readback_texture->Map())
|
||||||
|
@ -822,9 +820,7 @@ bool FramebufferManager::PopulateDepthReadbackTexture()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until the copy is complete.
|
// Wait until the copy is complete.
|
||||||
g_command_buffer_mgr->ExecuteCommandBuffer(false, true);
|
Util::ExecuteCurrentCommandsAndRestoreState(false, true);
|
||||||
StateTracker::GetInstance()->InvalidateDescriptorSets();
|
|
||||||
StateTracker::GetInstance()->SetPendingRebind();
|
|
||||||
|
|
||||||
// Map to host memory.
|
// Map to host memory.
|
||||||
if (!m_depth_readback_texture->IsMapped() && !m_depth_readback_texture->Map())
|
if (!m_depth_readback_texture->IsMapped() && !m_depth_readback_texture->Map())
|
||||||
|
@ -1212,7 +1208,7 @@ void FramebufferManager::DrawPokeVertices(const EFBPokeVertex* vertices, size_t
|
||||||
{
|
{
|
||||||
// Kick a command buffer first.
|
// Kick a command buffer first.
|
||||||
WARN_LOG(VIDEO, "Kicking command buffer due to no EFB poke space.");
|
WARN_LOG(VIDEO, "Kicking command buffer due to no EFB poke space.");
|
||||||
Util::ExecuteCurrentCommandsAndRestoreState(true);
|
Util::ExecuteCurrentCommandsAndRestoreState(false);
|
||||||
command_buffer = g_command_buffer_mgr->GetCurrentCommandBuffer();
|
command_buffer = g_command_buffer_mgr->GetCurrentCommandBuffer();
|
||||||
|
|
||||||
if (!m_poke_vertex_stream_buffer->ReserveMemory(vertices_size, sizeof(EfbPokeData), true, true,
|
if (!m_poke_vertex_stream_buffer->ReserveMemory(vertices_size, sizeof(EfbPokeData), true, true,
|
||||||
|
|
|
@ -326,6 +326,7 @@ void Renderer::BeginFrame()
|
||||||
// Ensure that the state tracker rebinds everything, and allocates a new set
|
// Ensure that the state tracker rebinds everything, and allocates a new set
|
||||||
// of descriptors out of the next pool.
|
// of descriptors out of the next pool.
|
||||||
StateTracker::GetInstance()->InvalidateDescriptorSets();
|
StateTracker::GetInstance()->InvalidateDescriptorSets();
|
||||||
|
StateTracker::GetInstance()->InvalidateConstants();
|
||||||
StateTracker::GetInstance()->SetPendingRebind();
|
StateTracker::GetInstance()->SetPendingRebind();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -710,11 +710,7 @@ bool StateTracker::Bind(bool rebind_all /*= false*/)
|
||||||
{
|
{
|
||||||
// We can fail to allocate descriptors if we exhaust the pool for this command buffer.
|
// We can fail to allocate descriptors if we exhaust the pool for this command buffer.
|
||||||
WARN_LOG(VIDEO, "Failed to get a descriptor set, executing buffer");
|
WARN_LOG(VIDEO, "Failed to get a descriptor set, executing buffer");
|
||||||
|
Util::ExecuteCurrentCommandsAndRestoreState(false, false);
|
||||||
// Try again after executing the current buffer.
|
|
||||||
g_command_buffer_mgr->ExecuteCommandBuffer(false, false);
|
|
||||||
InvalidateDescriptorSets();
|
|
||||||
SetPendingRebind();
|
|
||||||
if (!UpdateDescriptorSet())
|
if (!UpdateDescriptorSet())
|
||||||
{
|
{
|
||||||
// Something strange going on.
|
// Something strange going on.
|
||||||
|
@ -777,10 +773,7 @@ void StateTracker::OnDraw()
|
||||||
m_scheduled_command_buffer_kicks.end(), m_draw_counter))
|
m_scheduled_command_buffer_kicks.end(), m_draw_counter))
|
||||||
{
|
{
|
||||||
// Kick a command buffer on the background thread.
|
// Kick a command buffer on the background thread.
|
||||||
EndRenderPass();
|
Util::ExecuteCurrentCommandsAndRestoreState(true);
|
||||||
g_command_buffer_mgr->ExecuteCommandBuffer(true, false);
|
|
||||||
InvalidateDescriptorSets();
|
|
||||||
SetPendingRebind();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,10 +145,10 @@ void TextureCache::CopyEFB(u8* dst, u32 format, u32 native_width, u32 bytes_per_
|
||||||
else
|
else
|
||||||
src_texture = FramebufferManager::GetInstance()->ResolveEFBColorTexture(region);
|
src_texture = FramebufferManager::GetInstance()->ResolveEFBColorTexture(region);
|
||||||
|
|
||||||
// End render pass before barrier (since we have no self-dependencies)
|
// End render pass before barrier (since we have no self-dependencies).
|
||||||
|
// The barrier has to happen after the render pass, not inside it, as we are going to be
|
||||||
|
// reading from the texture immediately afterwards.
|
||||||
StateTracker::GetInstance()->EndRenderPass();
|
StateTracker::GetInstance()->EndRenderPass();
|
||||||
StateTracker::GetInstance()->SetPendingRebind();
|
|
||||||
StateTracker::GetInstance()->InvalidateDescriptorSets();
|
|
||||||
StateTracker::GetInstance()->OnReadback();
|
StateTracker::GetInstance()->OnReadback();
|
||||||
|
|
||||||
// Transition to shader resource before reading.
|
// Transition to shader resource before reading.
|
||||||
|
@ -666,9 +666,7 @@ bool TextureCache::TCacheEntry::Save(const std::string& filename, unsigned int l
|
||||||
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||||
|
|
||||||
// Block until the GPU has finished copying to the staging texture.
|
// Block until the GPU has finished copying to the staging texture.
|
||||||
g_command_buffer_mgr->ExecuteCommandBuffer(false, true);
|
Util::ExecuteCurrentCommandsAndRestoreState(false, true);
|
||||||
StateTracker::GetInstance()->InvalidateDescriptorSets();
|
|
||||||
StateTracker::GetInstance()->SetPendingRebind();
|
|
||||||
|
|
||||||
// Map the staging texture so we can copy the contents out.
|
// Map the staging texture so we can copy the contents out.
|
||||||
if (staging_texture->Map())
|
if (staging_texture->Map())
|
||||||
|
|
|
@ -121,9 +121,7 @@ void TextureEncoder::EncodeTextureToRam(VkImageView src_texture, u8* dest_ptr, u
|
||||||
render_width, render_height, 0, 0);
|
render_width, render_height, 0, 0);
|
||||||
|
|
||||||
// Block until the GPU has finished copying to the staging texture.
|
// Block until the GPU has finished copying to the staging texture.
|
||||||
g_command_buffer_mgr->ExecuteCommandBuffer(false, true);
|
Util::ExecuteCurrentCommandsAndRestoreState(false, true);
|
||||||
StateTracker::GetInstance()->InvalidateDescriptorSets();
|
|
||||||
StateTracker::GetInstance()->SetPendingRebind();
|
|
||||||
|
|
||||||
// Copy from staging texture to the final destination, adjusting pitch if necessary.
|
// Copy from staging texture to the final destination, adjusting pitch if necessary.
|
||||||
m_download_texture->ReadTexels(0, 0, render_width, render_height, dest_ptr, memory_stride);
|
m_download_texture->ReadTexels(0, 0, render_width, render_height, dest_ptr, memory_stride);
|
||||||
|
|
Loading…
Reference in New Issue