more vulkan init progress
This commit is contained in:
parent
f6388c367e
commit
ef6da6bddb
|
@ -1,9 +1,11 @@
|
|||
#pragma once
|
||||
#include <types.h>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
namespace HLE::Libs::Graphics {
|
||||
struct GraphicCtx {
|
||||
u32 screen_width = 0;
|
||||
u32 screen_height = 0;
|
||||
VkInstance m_instance = nullptr;
|
||||
};
|
||||
} // namespace HLE::Libs::Graphics
|
|
@ -11,6 +11,7 @@ struct WindowCtx {
|
|||
Lib::ConditionVariable m_graphic_initialized_cond;
|
||||
SDL_Window* m_window = nullptr;
|
||||
bool is_window_hidden = true;
|
||||
VkSurfaceKHR m_surface = nullptr;
|
||||
};
|
||||
|
||||
struct EmuPrivate {
|
||||
|
|
|
@ -18,6 +18,30 @@ void Graphics::Vulkan::vulkanCreate(Emulator::WindowCtx* ctx) {
|
|||
app_info.pEngineName = "shadps4";
|
||||
app_info.engineVersion = 1;
|
||||
app_info.apiVersion = VK_API_VERSION_1_2;
|
||||
|
||||
VkInstanceCreateInfo inst_info{};
|
||||
inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
inst_info.pNext = nullptr;
|
||||
inst_info.flags = 0;
|
||||
inst_info.pApplicationInfo = &app_info;
|
||||
inst_info.enabledExtensionCount = ext.required_extensions.size();
|
||||
inst_info.ppEnabledExtensionNames = ext.required_extensions.data();
|
||||
inst_info.enabledLayerCount = 0;
|
||||
inst_info.ppEnabledLayerNames = nullptr;
|
||||
|
||||
VkResult result = vkCreateInstance(&inst_info, nullptr, &ctx->m_graphic_ctx.m_instance);
|
||||
if (result == VK_ERROR_INCOMPATIBLE_DRIVER) {
|
||||
LOG_CRITICAL_IF(log_file_vulkanutil, "Can't find an compatiblie vulkan driver\n");
|
||||
std::exit(0);
|
||||
} else if (result != VK_SUCCESS) {
|
||||
LOG_CRITICAL_IF(log_file_vulkanutil, "Can't create an vulkan instance\n");
|
||||
std::exit(0);
|
||||
}
|
||||
|
||||
if (SDL_Vulkan_CreateSurface(ctx->m_window, ctx->m_graphic_ctx.m_instance, &ctx->m_surface) == SDL_FALSE) {
|
||||
LOG_CRITICAL_IF(log_file_vulkanutil, "Can't create an vulkan surface\n");
|
||||
std::exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::Vulkan::vulkanGetExtensions(VulkanExt* ext) {
|
||||
|
|
Loading…
Reference in New Issue