mirror of
https://github.com/rt64/rt64.git
synced 2024-12-26 03:15:44 +00:00
Add option and behavior to create the Vulkan interface correctly.
This commit is contained in:
parent
7997da230e
commit
f7d04a6503
@ -10,6 +10,8 @@ if (${RT64_BUILD_EXAMPLES})
|
||||
set(RT64_STATIC ON)
|
||||
endif()
|
||||
|
||||
option(RT64_SDL_WINDOW_VULKAN "Build RT64 to expect an SDL Window outside of Windows" OFF)
|
||||
|
||||
if (NOT ${RT64_STATIC})
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
@ -235,6 +237,10 @@ add_compile_definitions(
|
||||
IMGUI_IMPL_VULKAN_NO_PROTOTYPES
|
||||
)
|
||||
|
||||
if (RT64_SDL_WINDOW_VULKAN)
|
||||
add_compile_definitions("RT64_SDL_WINDOW_VULKAN")
|
||||
endif()
|
||||
|
||||
set (SOURCES
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_common.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/common/rt64_dynamic_libraries.cpp"
|
||||
|
@ -22,7 +22,20 @@ namespace RT64 {
|
||||
// External functions to create the backends.
|
||||
|
||||
extern std::unique_ptr<RenderInterface> CreateD3D12Interface();
|
||||
|
||||
#ifdef RT64_SDL_WINDOW_VULKAN
|
||||
extern std::unique_ptr<RenderInterface> CreateVulkanInterface(RenderWindow renderWindow);
|
||||
#else
|
||||
extern std::unique_ptr<RenderInterface> CreateVulkanInterface();
|
||||
#endif
|
||||
|
||||
static std::unique_ptr<RenderInterface> CreateVulkanInterfaceWrapper(RenderWindow renderWindow) {
|
||||
#ifdef RT64_SDL_WINDOW_VULKAN
|
||||
return CreateVulkanInterface(renderWindow);
|
||||
#else
|
||||
return CreateVulkanInterface();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Application::Core
|
||||
|
||||
@ -135,7 +148,7 @@ namespace RT64 {
|
||||
return SetupResult::InvalidGraphicsAPI;
|
||||
# endif
|
||||
case UserConfiguration::GraphicsAPI::Vulkan:
|
||||
renderInterface = CreateVulkanInterface();
|
||||
renderInterface = CreateVulkanInterfaceWrapper(appWindow->windowHandle);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown Graphics API specified in configuration.\n");
|
||||
@ -182,7 +195,7 @@ namespace RT64 {
|
||||
if (isRDNA3 && useHDRinD3D12) {
|
||||
device.reset();
|
||||
renderInterface.reset();
|
||||
renderInterface = CreateVulkanInterface();
|
||||
renderInterface = CreateVulkanInterfaceWrapper(appWindow->windowHandle);
|
||||
if (renderInterface == nullptr) {
|
||||
fprintf(stderr, "Unable to initialize graphics API.\n");
|
||||
return SetupResult::GraphicsAPINotFound;
|
||||
|
Loading…
Reference in New Issue
Block a user