Fixing validation errors (needs a change in parallel-rdp WARNING)

This commit is contained in:
CocoSimone
2022-08-22 03:47:29 +02:00
parent 51c334fc1a
commit 68be852238
6 changed files with 15 additions and 67 deletions

View File

@@ -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();

View File

@@ -25,6 +25,7 @@ class SDLParallelRdpWindowInfo : public ParallelRdpWindowInfo {
}
};
VkRenderPass GetVkRenderPass();
VkQueue GetGraphicsQueue();
VkInstance GetVkInstance();
VkPhysicalDevice GetVkPhysicalDevice();

View File

@@ -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)

View File

@@ -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();

View File

@@ -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 <typename T, bool HToBE = false>
[[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);