mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 14:18:31 +09:00
[Feat] (Diligent, CMake): enable DiligentCore and add initial Diligent/Vulkan backend skeleton
- Add MOBILEGL_ENABLE_DILIGENT option; build DiligentCore Vulkan-only after MobileGL's existing 3rdparty targets so shared glslang/SPIRV-Cross/xxHash targets are reused instead of duplicated. - Add BackendType::DiligentVulkan, config parsing, and backend-object switch. - Add DiligentBackend::BackendObject_Diligent skeleton: creates a Diligent Vulkan device/context when an adapter is available, advertises GL 3.2 core, and returns an empty GL function table for now. - Add local DiligentVulkanSanityTest that compiles/runs on the host (skips device creation gracefully when no Vulkan adapter is present). - Fix GLXImpl EGLDisplay member shadowing the X11 Display typedef, exposed by GCC 16 + Diligent header include order.
This commit is contained in:
+41
-1
@@ -199,7 +199,6 @@ set(SPIRV_REFLECT_ENABLE_ASSERTS OFF CACHE BOOL "Enable asserts for debugging"
|
||||
set(SPIRV_REFLECT_ENABLE_ASAN OFF CACHE BOOL "Use address sanitization" FORCE)
|
||||
set(SPIRV_REFLECT_INSTALL OFF CACHE BOOL "Whether to install" FORCE)
|
||||
|
||||
# add_subdirectory(3rdparty/DiligentCore)
|
||||
add_subdirectory(3rdparty/glslang)
|
||||
add_subdirectory(3rdparty/SPIRV-Cross)
|
||||
add_subdirectory(3rdparty/VulkanMemoryAllocator)
|
||||
@@ -211,6 +210,23 @@ set(XXHASH_BUILD_XXHSUM OFF)
|
||||
option(BUILD_SHARED_LIBS OFF)
|
||||
add_subdirectory(3rdparty/xxHash/build/cmake xxhash_build EXCLUDE_FROM_ALL)
|
||||
|
||||
# Diligent-based backend. Enabled by default on local builds; only the Vulkan
|
||||
# engine from DiligentCore is built. Added after the other 3rdparty projects so
|
||||
# DiligentCore reuses the glslang / SPIRV-Cross / SPIRV-Tools / xxHash targets
|
||||
# already defined by MobileGL instead of building its bundled copies.
|
||||
option(MOBILEGL_ENABLE_DILIGENT "Enable the Diligent/Vulkan backend" ON)
|
||||
if(MOBILEGL_ENABLE_DILIGENT)
|
||||
set(DILIGENT_NO_DIRECT3D11 ON CACHE BOOL "Disable Direct3D11 backend" FORCE)
|
||||
set(DILIGENT_NO_DIRECT3D12 ON CACHE BOOL "Disable Direct3D12 backend" FORCE)
|
||||
set(DILIGENT_NO_OPENGL ON CACHE BOOL "Disable OpenGL backend" FORCE)
|
||||
set(DILIGENT_NO_METAL ON CACHE BOOL "Disable Metal backend" FORCE)
|
||||
set(DILIGENT_NO_WEBGPU ON CACHE BOOL "Disable WebGPU backend" FORCE)
|
||||
set(DILIGENT_NO_ARCHIVER ON CACHE BOOL "Disable Archiver" FORCE)
|
||||
set(DILIGENT_BUILD_TESTS OFF CACHE BOOL "Build Diligent tests" FORCE)
|
||||
set(DILIGENT_INSTALL_CORE OFF CACHE BOOL "Install DiligentCore" FORCE)
|
||||
add_subdirectory(3rdparty/DiligentCore)
|
||||
endif()
|
||||
|
||||
set(TRACY_ENABLE ${MOBILEGL_ENABLE_TRACY} CACHE BOOL "Enable Tracy, this is an internal variable" FORCE)
|
||||
|
||||
if (TRACY_ENABLE)
|
||||
@@ -396,6 +412,13 @@ set(SOURCE_FILES
|
||||
MobileGL/MG_State/GLState/RenderbufferState/RenderbufferState.cpp
|
||||
)
|
||||
|
||||
if(MOBILEGL_ENABLE_DILIGENT)
|
||||
list(APPEND SOURCE_FILES
|
||||
MobileGL/MG_Backend/Diligent/BackendObject_Diligent.cpp
|
||||
MobileGL/MG_Backend/Diligent/DiligentVulkan.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (APPLE AND NOT MOBILEGL_IOS)
|
||||
list(APPEND SOURCE_FILES
|
||||
MobileGL/MG_Impl/CGLImpl/CGLImpl.cpp
|
||||
@@ -436,6 +459,21 @@ set(MOBILEGL_LINK_LIBRARIES
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
if(MOBILEGL_ENABLE_DILIGENT)
|
||||
list(APPEND MOBILEGL_LINK_LIBRARIES
|
||||
Diligent-GraphicsEngineVk-static
|
||||
Diligent-GraphicsEngine
|
||||
Diligent-GraphicsEngineNextGenBase
|
||||
Diligent-GraphicsAccessories
|
||||
Diligent-ShaderTools
|
||||
Diligent-GraphicsTools
|
||||
Diligent-Common
|
||||
Diligent-Primitives
|
||||
Diligent-TargetPlatform
|
||||
Vulkan::Headers
|
||||
)
|
||||
endif()
|
||||
|
||||
set(MOBILEGL_COMPILE_DEF
|
||||
-DVMA_STATIC_VULKAN_FUNCTIONS=0
|
||||
-DVMA_DYNAMIC_VULKAN_FUNCTIONS=1
|
||||
@@ -501,6 +539,7 @@ target_compile_definitions(${CMAKE_PROJECT_NAME}
|
||||
${MOBILEGL_COMPILE_DEF}
|
||||
MOBILEGL_LOG_ACTIVE_LEVEL=${MOBILEGL_LOG_ACTIVE_LEVEL}
|
||||
$<$<BOOL:${MOBILEGL_TRACE_ANGLE_VARIANTS}>:MOBILEGL_TRACE_ANGLE_VARIANTS=1>
|
||||
$<$<BOOL:${MOBILEGL_ENABLE_DILIGENT}>:MOBILEGL_ENABLE_DILIGENT=1>
|
||||
)
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
@@ -559,6 +598,7 @@ if(NOT ANDROID)
|
||||
PUBLIC
|
||||
${MOBILEGL_COMPILE_DEF}
|
||||
MOBILEGL_LOG_ACTIVE_LEVEL=${MOBILEGL_LOG_ACTIVE_LEVEL}
|
||||
$<$<BOOL:${MOBILEGL_ENABLE_DILIGENT}>:MOBILEGL_ENABLE_DILIGENT=1>
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user