mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-10-11 22:49:55 +00:00
vk: Pause the driver manager routine when capturing media
- These are out-of-band events and should not be treated as 'real' sync points.
This commit is contained in:
@@ -96,6 +96,12 @@ namespace vk
|
||||
|
||||
void driver_manager_t::notify_completed(u64 eid)
|
||||
{
|
||||
if (!m_enabled)
|
||||
{
|
||||
// Do not wake
|
||||
return;
|
||||
}
|
||||
|
||||
m_eid_ctr.atomic_op([eid](u64& value)
|
||||
{
|
||||
value = std::max(value, eid);
|
||||
@@ -133,4 +139,9 @@ namespace vk
|
||||
thread_ctrl::wait_on(m_completed_signal, completion_token);
|
||||
}
|
||||
}
|
||||
|
||||
void driver_manager_t::set_enabled(bool state)
|
||||
{
|
||||
m_enabled.store(state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,12 +56,16 @@ namespace vk
|
||||
void notify_completed(u64 eid);
|
||||
void drain();
|
||||
|
||||
void set_enabled(bool state);
|
||||
|
||||
private:
|
||||
atomic_t<u64> m_eid_ctr = 0ull;
|
||||
atomic_t<u64> m_last_completed_eid = 0ull;
|
||||
|
||||
atomic_t<u32> m_wake_event = 0u;
|
||||
atomic_t<u32> m_completed_signal = 0u; //<- Works around atomic_engine's lack of 64-bit observables support
|
||||
|
||||
atomic_t<bool> m_enabled = true;
|
||||
};
|
||||
|
||||
using driver_manager_thread = named_thread<driver_manager_t>;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "VKCommandStream.h"
|
||||
#include "VKGSRender.h"
|
||||
#include "vkutils/buffer_object.h"
|
||||
#include "vkutils/memory.h"
|
||||
@@ -752,14 +753,21 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
|
||||
vk::copy_image_to_buffer(*m_current_command_buffer, image_to_copy, &sshot_vkbuf, copy_info);
|
||||
image_to_copy->pop_layout(*m_current_command_buffer);
|
||||
|
||||
// We need to disable the driver manager temporarily as this next section is out of sequence.
|
||||
// We're not supposed to be halting the GPU here and we certainly do not want to run driver management as we will end up deleting temp resources too early.
|
||||
auto& driver_manager = g_fxo->get<vk::driver_manager_thread>();
|
||||
driver_manager.set_enabled(false);
|
||||
|
||||
flush_command_queue(true);
|
||||
const auto src = sshot_vkbuf.map(0, sshot_size);
|
||||
std::vector<u8> sshot_frame(sshot_size);
|
||||
memcpy(sshot_frame.data(), src, sshot_size);
|
||||
sshot_vkbuf.unmap();
|
||||
|
||||
const bool is_bgra = image_to_copy->format() == VK_FORMAT_B8G8R8A8_UNORM;
|
||||
// Restore the driver manager state to keep things from crashing...
|
||||
driver_manager.set_enabled(true);
|
||||
|
||||
const bool is_bgra = image_to_copy->format() == VK_FORMAT_B8G8R8A8_UNORM;
|
||||
if (user_asked_for_screenshot)
|
||||
{
|
||||
m_frame->take_screenshot(std::move(sshot_frame), buffer_width, buffer_height, is_bgra);
|
||||
|
||||
Reference in New Issue
Block a user