Imgui and ParallelRDP stuff

This commit is contained in:
CocoSimone
2022-08-05 13:58:35 +02:00
parent 23ebc1edc1
commit d580dc6cdd
14 changed files with 162 additions and 319 deletions

View File

@@ -58,6 +58,10 @@ target_include_directories(parallel-rdp PUBLIC
../../src/cores
parallel-rdp-standalone
..
../../src/frontend
../imgui
../imgui/imgui
../imgui/imgui/backends
)
if(WIN32)

View File

@@ -4,6 +4,8 @@
#include <rdp_device.hpp>
#include <util.hpp>
#include <SDL2/SDL_vulkan.h>
#include <imgui/backends/imgui_impl_vulkan.h>
#include <imgui/Window.hpp>
using namespace Vulkan;
using namespace RDP;
@@ -196,7 +198,7 @@ void DrawFullscreenTexturedQuad(Util::IntrusivePtr<Image> image, Util::Intrusive
cmd->draw(3, 1);
}
void UpdateScreen(Util::IntrusivePtr<Image> image) {
void UpdateScreen(Window& imguiWindow, Util::IntrusivePtr<Image> image) {
wsi->begin_frame();
if (!image) {
@@ -225,13 +227,15 @@ void UpdateScreen(Util::IntrusivePtr<Image> image) {
cmd->begin_render_pass(wsi->get_device().get_swapchain_render_pass(SwapchainRenderPass::ColorOnly));
DrawFullscreenTexturedQuad(image, cmd);
//ImGui_ImplVulkan_RenderDrawData(imgui_frame(), cmd->get_command_buffer());
ImGui_ImplVulkan_RenderDrawData(imguiWindow.Present(), cmd->get_command_buffer());
cmd->end_render_pass();
wsi->get_device().submit(cmd);
wsi->end_frame();
}
void UpdateScreenParallelRdp(const n64::VI& vi) {
void UpdateScreenParallelRdp(Window& imguiWindow, const n64::VI& vi) {
command_processor->set_vi_register(VIRegister::Control, vi.status.raw);
command_processor->set_vi_register(VIRegister::Origin, vi.origin);
command_processor->set_vi_register(VIRegister::Width, vi.width);
@@ -257,12 +261,12 @@ void UpdateScreenParallelRdp(const n64::VI& vi) {
opts.downscale_steps = true;
opts.crop_overscan_pixels = true;
Util::IntrusivePtr<Image> image = command_processor->scanout(opts);
UpdateScreen(image);
UpdateScreen(imguiWindow, image);
command_processor->begin_frame_context();
}
void UpdateScreenParallelRdpNoGame() {
UpdateScreen(static_cast<Util::IntrusivePtr<Image>>(nullptr));
void UpdateScreenParallelRdpNoGame(Window& imguiWindow) {
UpdateScreen(imguiWindow, static_cast<Util::IntrusivePtr<Image>>(nullptr));
}
void ParallelRdpEnqueueCommand(int command_length, u32* buffer) {

View File

@@ -4,6 +4,8 @@
#include <SDL2/SDL.h>
#include <n64/core/mmio/VI.hpp>
struct Window;
static SDL_Window* window;
static u32 windowID;
VkQueue GetGraphicsQueue();
@@ -15,9 +17,9 @@ VkFormat GetVkFormat();
VkCommandBuffer GetVkCommandBuffer();
void SubmitRequestedVkCommandBuffer();
void LoadParallelRDP(const u8* rdram);
void UpdateScreenParallelRdp(const n64::VI& vi);
void UpdateScreenParallelRdp(Window& imguiWindow, const n64::VI& vi);
void ParallelRdpEnqueueCommand(int command_length, u32* buffer);
void ParallelRdpOnFullSync();
void UpdateScreenParallelRdpNoGame();
void UpdateScreenParallelRdpNoGame(Window& imguiWindow);
bool IsFramerateUnlocked();
void SetFramerateUnlocked(bool unlocked);