diff --git a/external/parallel-rdp/ParallelRDPWrapper.cpp b/external/parallel-rdp/ParallelRDPWrapper.cpp index 49ad83fe..835a5092 100644 --- a/external/parallel-rdp/ParallelRDPWrapper.cpp +++ b/external/parallel-rdp/ParallelRDPWrapper.cpp @@ -42,6 +42,12 @@ VkFormat GetVkFormat() { CommandBufferHandle requested_command_buffer; +VkRenderPass GetVkRenderPass() { + return wsi->get_device().request_render_pass( + wsi->get_device().get_swapchain_render_pass(SwapchainRenderPass::ColorOnly), true + ).get_render_pass(); +} + VkCommandBuffer GetVkCommandBuffer() { requested_command_buffer = wsi->get_device().request_command_buffer(); return requested_command_buffer->get_command_buffer(); @@ -111,10 +117,10 @@ public: return &appInfo; } - VkApplicationInfo appInfo { - .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, - .apiVersion = VK_API_VERSION_1_1 - }; + VkApplicationInfo appInfo { + .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, + .apiVersion = VK_API_VERSION_1_1 + }; }; Program* fullscreen_quad_program; diff --git a/external/parallel-rdp/ParallelRDPWrapper.hpp b/external/parallel-rdp/ParallelRDPWrapper.hpp index 4fa6cc89..3e526322 100644 --- a/external/parallel-rdp/ParallelRDPWrapper.hpp +++ b/external/parallel-rdp/ParallelRDPWrapper.hpp @@ -25,6 +25,7 @@ class SDLParallelRdpWindowInfo : public ParallelRdpWindowInfo { } }; +VkRenderPass GetVkRenderPass(); VkQueue GetGraphicsQueue(); VkInstance GetVkInstance(); VkPhysicalDevice GetVkPhysicalDevice(); diff --git a/external/parallel-rdp/parallel-rdp-standalone b/external/parallel-rdp/parallel-rdp-standalone index 428884de..17919ebd 160000 --- a/external/parallel-rdp/parallel-rdp-standalone +++ b/external/parallel-rdp/parallel-rdp-standalone @@ -1 +1 @@ -Subproject commit 428884deab9571cc04be756960e3649f678c8f63 +Subproject commit 17919ebd7ab530f5903905ed9041aeeb8e1e58ba diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1c779575..97f57e1a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,7 @@ project(natsukashii) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED true) -#add_compile_definitions(VULKAN_DEBUG) +add_compile_definitions(VULKAN_DEBUG) file(COPY ${CMAKE_SOURCE_DIR}/../resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) add_subdirectory(n64) diff --git a/src/frontend/imgui/Window.cpp b/src/frontend/imgui/Window.cpp index 3dc247d0..707e07df 100644 --- a/src/frontend/imgui/Window.cpp +++ b/src/frontend/imgui/Window.cpp @@ -93,43 +93,6 @@ void Window::InitImgui() { check_vk_result(err); } - VkRenderPass renderPass; - { - VkAttachmentDescription attachment = {}; - attachment.format = GetVkFormat(); - attachment.samples = VK_SAMPLE_COUNT_1_BIT; - attachment.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; - attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE; - attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; - attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; - attachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; - attachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - VkAttachmentReference colorAttachment = {}; - colorAttachment.attachment = 0; - colorAttachment.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; - VkSubpassDescription subpass = {}; - subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; - subpass.colorAttachmentCount = 1; - subpass.pColorAttachments = &colorAttachment; - VkSubpassDependency dependency = {}; - dependency.srcSubpass = VK_SUBPASS_EXTERNAL; - dependency.dstSubpass = 0; - dependency.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; - dependency.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; - dependency.srcAccessMask = 0; - dependency.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; - VkRenderPassCreateInfo info = {}; - info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; - info.attachmentCount = 1; - info.pAttachments = &attachment; - info.subpassCount = 1; - info.pSubpasses = &subpass; - info.dependencyCount = 1; - info.pDependencies = &dependency; - err = vkCreateRenderPass(device, &info, allocator, &renderPass); - check_vk_result(err); - } - // Setup Platform/Renderer backends ImGui_ImplSDL2_InitForVulkan(window); ImGui_ImplVulkan_InitInfo initInfo = {}; @@ -145,7 +108,7 @@ void Window::InitImgui() { initInfo.ImageCount = 2; initInfo.MSAASamples = VK_SAMPLE_COUNT_1_BIT; initInfo.CheckVkResultFn = check_vk_result; - ImGui_ImplVulkan_Init(&initInfo, renderPass); + ImGui_ImplVulkan_Init(&initInfo, GetVkRenderPass()); // Load Fonts // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. @@ -177,9 +140,6 @@ Window::~Window() { ImGui_ImplVulkan_Shutdown(); ImGui_ImplSDL2_Shutdown(); ImGui::DestroyContext(); - vkDestroyDescriptorPool(device, descriptorPool, nullptr); - vkDestroyDevice(device, nullptr); - vkDestroyInstance(instance, nullptr); SDL_DestroyWindow(window); SDL_DestroyWindow(g_Window); SDL_Quit(); diff --git a/src/util.hpp b/src/util.hpp index eaab66a0..7f8a51f3 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -51,25 +51,6 @@ constexpr void logdebug(const std::string& fmt, Args... args) { #endif } -#define TIMER(name) \ - struct Timer##name { \ - util::TimePoint start, end; \ - Timer##name() {} \ - ~Timer##name() {} \ - void Start() { \ - start = util::SteadyClock::now(); \ - } \ - \ - void End() { \ - end = util::SteadyClock::now(); \ - } \ - \ - void PrintDuration() { \ - auto diff = end - start; \ - util::info(#name + std::string(" took {:.3f}ms to run\n"), diff.count()); \ - } \ - } - template [[maybe_unused]] auto GetSwapFunc(T num) -> T { static_assert(sizeof(T) == 2 || sizeof(T) == 4 || sizeof(T) == 8, "GetSwapFunc used with invalid size!"); @@ -212,7 +193,7 @@ inline auto ReadFileBinary(const std::string& path, u32** buf) { std::ifstream file(path, std::ios::binary); file.unsetf(std::ios::skipws); if(!file.is_open()) { - util::panic("Could not load file!\n"); + panic("Could not load file!\n"); } file.seekg(0, std::ios::end);