Browse Source

fixup descriptor

lizzie/vk-sched-suprious-crash
lizzie 3 days ago
committed by crueter
parent
commit
699fe4cb4c
  1. 11
      src/video_core/renderer_vulkan/vk_update_descriptor.cpp
  2. 5
      src/video_core/renderer_vulkan/vk_update_descriptor.h

11
src/video_core/renderer_vulkan/vk_update_descriptor.cpp

@ -18,8 +18,7 @@ namespace Vulkan {
UpdateDescriptorQueue::UpdateDescriptorQueue(const Device& device_) UpdateDescriptorQueue::UpdateDescriptorQueue(const Device& device_)
: device{device_} : device{device_}
{ {
payload_start = payload.data();
payload_cursor = payload.data();
payload_start = payload_cursor = payload.data();
} }
UpdateDescriptorQueue::~UpdateDescriptorQueue() = default; UpdateDescriptorQueue::~UpdateDescriptorQueue() = default;
@ -33,12 +32,8 @@ void UpdateDescriptorQueue::TickFrame() {
} }
void UpdateDescriptorQueue::Acquire(Scheduler& scheduler) { void UpdateDescriptorQueue::Acquire(Scheduler& scheduler) {
// Minimum number of entries required.
// This is the maximum number of entries a single draw call might use.
static constexpr size_t MIN_ENTRIES = 0x400;
if (std::distance(payload_start, payload_cursor) + MIN_ENTRIES >= FRAME_PAYLOAD_SIZE) {
LOG_WARNING(Render_Vulkan, "Payload overflow, waiting for worker thread");
if (std::distance(payload_start, payload_cursor) + MIN_ENTRIES > ptrdiff_t(FRAME_PAYLOAD_SIZE)) {
LOG_WARNING(Render_Vulkan, "Payload overflow {}, waiting for worker thread", std::distance(payload_start, payload_cursor));
scheduler.WaitWorker(); scheduler.WaitWorker();
payload_cursor = payload_start; payload_cursor = payload_start;
} }

5
src/video_core/renderer_vulkan/vk_update_descriptor.h

@ -27,10 +27,13 @@ union DescriptorUpdateEntry {
}; };
class UpdateDescriptorQueue final { class UpdateDescriptorQueue final {
// Minimum number of entries required. This is the maximum number of entries a single draw call might use.
static constexpr size_t MIN_ENTRIES = 0x400;
// This should be plenty for the vast majority of cases. Most desktop platforms only // This should be plenty for the vast majority of cases. Most desktop platforms only
// provide up to 3 swapchain images. // provide up to 3 swapchain images.
static constexpr size_t FRAMES_IN_FLIGHT = 8; static constexpr size_t FRAMES_IN_FLIGHT = 8;
static constexpr size_t FRAME_PAYLOAD_SIZE = 0x20000;
// Mario Jamboree on minigames uses up to 0x21xxx entries at a time
static constexpr size_t FRAME_PAYLOAD_SIZE = 0x24000;
static constexpr size_t PAYLOAD_SIZE = FRAME_PAYLOAD_SIZE * FRAMES_IN_FLIGHT; static constexpr size_t PAYLOAD_SIZE = FRAME_PAYLOAD_SIZE * FRAMES_IN_FLIGHT;
public: public:

Loading…
Cancel
Save