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