It renders something, crashes because ImGui exhausts the display list. Need to find a better way for thread sync. Message queue?

This commit is contained in:
irisz64
2025-05-22 09:16:58 +02:00
parent 668edbcd91
commit 326b4b43cd
7 changed files with 25 additions and 43 deletions

View File

@@ -6,6 +6,7 @@
#include <resources/vert.spv.h>
#include <resources/frag.spv.h>
#include <KaizenGui.hpp>
#include <imgui_impl_vulkan.h>
using namespace Vulkan;
using namespace RDP;
@@ -157,7 +158,7 @@ void ParallelRDP::DrawFullscreenTexturedQuad(Util::IntrusivePtr<Image> image,
cmd->draw(3, 1);
}
void ParallelRDP::UpdateScreen(Util::IntrusivePtr<Image> image, KaizenGui& kaizenGui) const {
void ParallelRDP::UpdateScreen(Util::IntrusivePtr<Image> image) const {
wsi->begin_frame();
if (!image) {
@@ -183,13 +184,15 @@ void ParallelRDP::UpdateScreen(Util::IntrusivePtr<Image> image, KaizenGui& kaize
cmd->begin_render_pass(wsi->get_device().get_swapchain_render_pass(SwapchainRenderPass::ColorOnly));
DrawFullscreenTexturedQuad(image, cmd);
kaizenGui.RenderUI();
auto drawData = ImGui::GetDrawData();
if(drawData)
ImGui_ImplVulkan_RenderDrawData(drawData, cmd->get_command_buffer());
cmd->end_render_pass();
wsi->get_device().submit(cmd);
wsi->end_frame();
}
void ParallelRDP::UpdateScreen(const n64::VI &vi, KaizenGui& kaizenGui, bool playing) const {
void ParallelRDP::UpdateScreen(const n64::VI &vi, bool playing) const {
if(playing) {
command_processor->set_vi_register(VIRegister::Control, vi.status.raw);
command_processor->set_vi_register(VIRegister::Origin, vi.origin);
@@ -215,12 +218,12 @@ void ParallelRDP::UpdateScreen(const n64::VI &vi, KaizenGui& kaizenGui, bool pla
opts.downscale_steps = true;
opts.crop_overscan_pixels = true;
Util::IntrusivePtr<Image> image = command_processor->scanout(opts);
UpdateScreen(image, kaizenGui);
UpdateScreen(image);
command_processor->begin_frame_context();
return;
}
UpdateScreen(static_cast<Util::IntrusivePtr<Image>>(nullptr), kaizenGui);
UpdateScreen(static_cast<Util::IntrusivePtr<Image>>(nullptr));
}
void ParallelRDP::EnqueueCommand(int command_length, const u32 *buffer) const {

View File

@@ -7,8 +7,6 @@ namespace n64 {
struct VI;
}
class KaizenGui;
class ParallelRDP {
public:
class WindowInfo {
@@ -25,7 +23,7 @@ public:
const std::shared_ptr<WindowInfo> &, const u8 *);
ParallelRDP() = default;
void UpdateScreen(const n64::VI &, KaizenGui&, bool = true) const;
void UpdateScreen(const n64::VI &, bool = true) const;
void EnqueueCommand(int, const u32 *) const;
void OnFullSync() const;
bool IsFramerateUnlocked() const;
@@ -38,5 +36,5 @@ public:
private:
void LoadWSIPlatform(const std::shared_ptr<Vulkan::WSIPlatform> &, const std::shared_ptr<WindowInfo> &);
void DrawFullscreenTexturedQuad(Util::IntrusivePtr<Vulkan::Image>, Util::IntrusivePtr<Vulkan::CommandBuffer>) const;
void UpdateScreen(Util::IntrusivePtr<Vulkan::Image>, KaizenGui&) const;
void UpdateScreen(Util::IntrusivePtr<Vulkan::Image>) const;
};