mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-27 22:42:29 +00:00
- restrict Vulkan to 64 bit builds.
This commit is contained in:
parent
d3c02c75ba
commit
a0b0467e91
5 changed files with 59 additions and 11 deletions
|
@ -155,6 +155,7 @@ target_architecture(ZDOOM_TARGET_ARCH)
|
||||||
|
|
||||||
if( ${ZDOOM_TARGET_ARCH} MATCHES "x86_64" )
|
if( ${ZDOOM_TARGET_ARCH} MATCHES "x86_64" )
|
||||||
set( HAVE_VM_JIT ON )
|
set( HAVE_VM_JIT ON )
|
||||||
|
set( HAVE_VULKAN ON )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# no, we're not using external asmjit for now, we made too many modifications to our's.
|
# no, we're not using external asmjit for now, we made too many modifications to our's.
|
||||||
|
@ -180,7 +181,11 @@ if( MSVC )
|
||||||
# String pooling
|
# String pooling
|
||||||
# Function-level linking
|
# Function-level linking
|
||||||
# Disable run-time type information
|
# Disable run-time type information
|
||||||
set( ALL_C_FLAGS "/GF /Gy /GR-" )
|
if ( HAVE_VULKAN )
|
||||||
|
set( ALL_C_FLAGS "/GF /Gy /GR- /DHAVE_VULKAN" )
|
||||||
|
else()
|
||||||
|
set( ALL_C_FLAGS "/GF /Gy /GR-" )
|
||||||
|
endif()
|
||||||
|
|
||||||
# Use SSE 2 as minimum always as the true color drawers needs it for __vectorcall
|
# Use SSE 2 as minimum always as the true color drawers needs it for __vectorcall
|
||||||
#set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:SSE2") # This is already the default
|
#set( ALL_C_FLAGS "${ALL_C_FLAGS} /arch:SSE2") # This is already the default
|
||||||
|
@ -229,7 +234,12 @@ if( MSVC )
|
||||||
string(REPLACE " /GR" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
|
string(REPLACE " /GR" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
|
||||||
else()
|
else()
|
||||||
set( REL_LINKER_FLAGS "" )
|
set( REL_LINKER_FLAGS "" )
|
||||||
set( ALL_C_FLAGS "-ffp-contract=off" )
|
if ( HAVE_VULKAN )
|
||||||
|
set( ALL_C_FLAGS "-ffp-contract=off -DHAVE_VULKAN" )
|
||||||
|
else()
|
||||||
|
set( ALL_C_FLAGS "-ffp-contract=off" )
|
||||||
|
endif()
|
||||||
|
|
||||||
set( REL_C_FLAGS "" )
|
set( REL_C_FLAGS "" )
|
||||||
set( DEB_C_FLAGS "" )
|
set( DEB_C_FLAGS "" )
|
||||||
|
|
||||||
|
@ -275,9 +285,11 @@ mark_as_advanced( FORCE_INTERNAL_GME )
|
||||||
option(FORCE_INTERNAL_ASMJIT "Use internal asmjit" ON)
|
option(FORCE_INTERNAL_ASMJIT "Use internal asmjit" ON)
|
||||||
mark_as_advanced( FORCE_INTERNAL_ASMJIT )
|
mark_as_advanced( FORCE_INTERNAL_ASMJIT )
|
||||||
|
|
||||||
add_subdirectory( glslang/glslang)
|
if (HAVE_VULKAN)
|
||||||
add_subdirectory( glslang/spirv )
|
add_subdirectory( glslang/glslang)
|
||||||
add_subdirectory( glslang/OGLCompilersDLL )
|
add_subdirectory( glslang/spirv )
|
||||||
|
add_subdirectory( glslang/OGLCompilersDLL )
|
||||||
|
endif()
|
||||||
|
|
||||||
# Fast math flags, required by some subprojects
|
# Fast math flags, required by some subprojects
|
||||||
set( ZD_FASTMATH_FLAG "" )
|
set( ZD_FASTMATH_FLAG "" )
|
||||||
|
|
|
@ -460,7 +460,10 @@ add_custom_target( revision_check ALL
|
||||||
# Libraries ZDoom needs
|
# Libraries ZDoom needs
|
||||||
|
|
||||||
message( STATUS "Fluid synth libs: ${FLUIDSYNTH_LIBRARIES}" )
|
message( STATUS "Fluid synth libs: ${FLUIDSYNTH_LIBRARIES}" )
|
||||||
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_LIBRARIES}" "${GME_LIBRARIES}" "${CMAKE_DL_LIBS}" "glslang" "SPIRV" "OGLCompiler" )
|
set( ZDOOM_LIBS ${ZDOOM_LIBS} "${ZLIB_LIBRARIES}" "${JPEG_LIBRARIES}" "${BZIP2_LIBRARIES}" "${GME_LIBRARIES}" "${CMAKE_DL_LIBS}" )
|
||||||
|
if (HAVE_VULKAN)
|
||||||
|
set( ZDOOM_LIBS ${ZDOOM_LIBS} "glslang" "SPIRV" "OGLCompiler")
|
||||||
|
endif()
|
||||||
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" )
|
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" )
|
||||||
|
|
||||||
if( ${HAVE_VM_JIT} )
|
if( ${HAVE_VM_JIT} )
|
||||||
|
@ -504,8 +507,12 @@ set( PLAT_WIN32_SOURCES
|
||||||
win32/gl_sysfb.cpp
|
win32/gl_sysfb.cpp
|
||||||
win32/base_sysfb.cpp
|
win32/base_sysfb.cpp
|
||||||
win32/win32basevideo.cpp
|
win32/win32basevideo.cpp
|
||||||
win32/win32glvideo.cpp
|
win32/win32glvideo.cpp)
|
||||||
win32/win32vulkanvideo.cpp )
|
|
||||||
|
if (HAVE_VULKAN)
|
||||||
|
set (PLAT_WIN32_SOURCES ${PLAT_WIN32_SOURCES} win32/win32vulkanvideo.cpp )
|
||||||
|
endif()
|
||||||
|
|
||||||
set( PLAT_POSIX_SOURCES
|
set( PLAT_POSIX_SOURCES
|
||||||
posix/i_cd.cpp
|
posix/i_cd.cpp
|
||||||
posix/i_steam.cpp )
|
posix/i_steam.cpp )
|
||||||
|
@ -892,9 +899,10 @@ set( FASTMATH_SOURCES
|
||||||
sound/opnmidi/opnmidi_midiplay.cpp
|
sound/opnmidi/opnmidi_midiplay.cpp
|
||||||
sound/opnmidi/opnmidi_opn2.cpp
|
sound/opnmidi/opnmidi_opn2.cpp
|
||||||
sound/opnmidi/opnmidi_private.cpp
|
sound/opnmidi/opnmidi_private.cpp
|
||||||
sound/opnmidi/wopn/wopn_file.c
|
sound/opnmidi/wopn/wopn_file.c)
|
||||||
|
|
||||||
#Vulkan stuff must go into a separate list later because it needs to be disabled for some platforms
|
#Vulkan stuff must go into a separate list later because it needs to be disabled for some platforms
|
||||||
|
set (VULKAN_SOURCES
|
||||||
rendering/vulkan/system/vk_device.cpp
|
rendering/vulkan/system/vk_device.cpp
|
||||||
rendering/vulkan/system/vk_swapchain.cpp
|
rendering/vulkan/system/vk_swapchain.cpp
|
||||||
rendering/vulkan/system/vk_builders.cpp
|
rendering/vulkan/system/vk_builders.cpp
|
||||||
|
@ -911,6 +919,10 @@ set( FASTMATH_SOURCES
|
||||||
rendering/vulkan/thirdparty/vk_mem_alloc/vk_mem_alloc.cpp
|
rendering/vulkan/thirdparty/vk_mem_alloc/vk_mem_alloc.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (HAVE_VULKAN)
|
||||||
|
set (FASTMATH_SOURCES ${FASTMATH_SOURCES} ${VULKAN_SOURCES})
|
||||||
|
endif()
|
||||||
|
|
||||||
set (PCH_SOURCES
|
set (PCH_SOURCES
|
||||||
am_map.cpp
|
am_map.cpp
|
||||||
b_bot.cpp
|
b_bot.cpp
|
||||||
|
|
|
@ -33,8 +33,10 @@
|
||||||
|
|
||||||
#include "gl_load/gl_load.h"
|
#include "gl_load/gl_load.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
#define VK_USE_PLATFORM_MACOS_MVK
|
#define VK_USE_PLATFORM_MACOS_MVK
|
||||||
#include "volk/volk.h"
|
#include "volk/volk.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "i_common.h"
|
#include "i_common.h"
|
||||||
|
|
||||||
|
@ -811,6 +813,7 @@ void I_SetWindowTitle(const char* title)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
void I_GetVulkanDrawableSize(int *width, int *height)
|
void I_GetVulkanDrawableSize(int *width, int *height)
|
||||||
{
|
{
|
||||||
NSWindow* const window = CocoaVideo::GetWindow();
|
NSWindow* const window = CocoaVideo::GetWindow();
|
||||||
|
@ -872,3 +875,4 @@ bool I_CreateVulkanSurface(VkInstance instance, VkSurfaceKHR *surface)
|
||||||
const VkResult result = vkCreateMacOSSurfaceMVK(instance, &windowCreateInfo, nullptr, surface);
|
const VkResult result = vkCreateMacOSSurfaceMVK(instance, &windowCreateInfo, nullptr, surface);
|
||||||
return result == VK_SUCCESS;
|
return result == VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#endif
|
|
@ -53,7 +53,9 @@
|
||||||
#include "gl/system/gl_framebuffer.h"
|
#include "gl/system/gl_framebuffer.h"
|
||||||
#include "gl/shaders/gl_shader.h"
|
#include "gl/shaders/gl_shader.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
#include "rendering/vulkan/system/vk_framebuffer.h"
|
#include "rendering/vulkan/system/vk_framebuffer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -100,9 +102,11 @@ namespace Priv
|
||||||
static TOptProc<library, RESULT(*)(__VA_ARGS__)> NAME("SDL_" #NAME)
|
static TOptProc<library, RESULT(*)(__VA_ARGS__)> NAME("SDL_" #NAME)
|
||||||
|
|
||||||
SDL2_OPTIONAL_FUNCTION(int, GetWindowBordersSize, SDL_Window *window, int *top, int *left, int *bottom, int *right);
|
SDL2_OPTIONAL_FUNCTION(int, GetWindowBordersSize, SDL_Window *window, int *top, int *left, int *bottom, int *right);
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
SDL2_OPTIONAL_FUNCTION(void, Vulkan_GetDrawableSize, SDL_Window *window, int *width, int *height);
|
SDL2_OPTIONAL_FUNCTION(void, Vulkan_GetDrawableSize, SDL_Window *window, int *width, int *height);
|
||||||
SDL2_OPTIONAL_FUNCTION(SDL_bool, Vulkan_GetInstanceExtensions, SDL_Window *window, unsigned int *count, const char **names);
|
SDL2_OPTIONAL_FUNCTION(SDL_bool, Vulkan_GetInstanceExtensions, SDL_Window *window, unsigned int *count, const char **names);
|
||||||
SDL2_OPTIONAL_FUNCTION(SDL_bool, Vulkan_CreateSurface, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface);
|
SDL2_OPTIONAL_FUNCTION(SDL_bool, Vulkan_CreateSurface, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface);
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef SDL2_OPTIONAL_FUNCTION
|
#undef SDL2_OPTIONAL_FUNCTION
|
||||||
|
|
||||||
|
@ -191,11 +195,14 @@ public:
|
||||||
DFrameBuffer *CreateFrameBuffer ();
|
DFrameBuffer *CreateFrameBuffer ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
VulkanDevice *device = nullptr;
|
VulkanDevice *device = nullptr;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
void I_GetVulkanDrawableSize(int *width, int *height)
|
void I_GetVulkanDrawableSize(int *width, int *height)
|
||||||
{
|
{
|
||||||
assert(Priv::vulkanEnabled);
|
assert(Priv::vulkanEnabled);
|
||||||
|
@ -217,6 +224,7 @@ bool I_CreateVulkanSurface(VkInstance instance, VkSurfaceKHR *surface)
|
||||||
assert(Priv::window != nullptr);
|
assert(Priv::window != nullptr);
|
||||||
return Priv::Vulkan_CreateSurface(Priv::window, instance, surface) == SDL_TRUE;
|
return Priv::Vulkan_CreateSurface(Priv::window, instance, surface) == SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
SDLVideo::SDLVideo ()
|
SDLVideo::SDLVideo ()
|
||||||
|
@ -233,6 +241,7 @@ SDLVideo::SDLVideo ()
|
||||||
Priv::library.Load({ "libSDL2.so", "libSDL2-2.0.so" });
|
Priv::library.Load({ "libSDL2.so", "libSDL2-2.0.so" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
Priv::vulkanEnabled = vid_backend == 0
|
Priv::vulkanEnabled = vid_backend == 0
|
||||||
&& Priv::Vulkan_GetDrawableSize && Priv::Vulkan_GetInstanceExtensions && Priv::Vulkan_CreateSurface;
|
&& Priv::Vulkan_GetDrawableSize && Priv::Vulkan_GetInstanceExtensions && Priv::Vulkan_CreateSurface;
|
||||||
|
|
||||||
|
@ -245,6 +254,7 @@ SDLVideo::SDLVideo ()
|
||||||
Priv::vulkanEnabled = false;
|
Priv::vulkanEnabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SDLVideo::~SDLVideo ()
|
SDLVideo::~SDLVideo ()
|
||||||
|
@ -257,6 +267,7 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer ()
|
||||||
SystemBaseFrameBuffer *fb = nullptr;
|
SystemBaseFrameBuffer *fb = nullptr;
|
||||||
|
|
||||||
// first try Vulkan, if that fails OpenGL
|
// first try Vulkan, if that fails OpenGL
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
if (Priv::vulkanEnabled)
|
if (Priv::vulkanEnabled)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -270,6 +281,7 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer ()
|
||||||
Priv::vulkanEnabled = false;
|
Priv::vulkanEnabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (fb == nullptr)
|
if (fb == nullptr)
|
||||||
{
|
{
|
||||||
|
@ -302,8 +314,10 @@ int SystemBaseFrameBuffer::GetClientWidth()
|
||||||
{
|
{
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
assert(Priv::vulkanEnabled);
|
assert(Priv::vulkanEnabled);
|
||||||
Priv::Vulkan_GetDrawableSize(Priv::window, &width, nullptr);
|
Priv::Vulkan_GetDrawableSize(Priv::window, &width, nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
@ -312,8 +326,10 @@ int SystemBaseFrameBuffer::GetClientHeight()
|
||||||
{
|
{
|
||||||
int height = 0;
|
int height = 0;
|
||||||
|
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
assert(Priv::vulkanEnabled);
|
assert(Priv::vulkanEnabled);
|
||||||
Priv::Vulkan_GetDrawableSize(Priv::window, nullptr, &height);
|
Priv::Vulkan_GetDrawableSize(Priv::window, nullptr, &height);
|
||||||
|
#endif
|
||||||
|
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,9 @@
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "win32glvideo.h"
|
#include "win32glvideo.h"
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
#include "win32vulkanvideo.h"
|
#include "win32vulkanvideo.h"
|
||||||
|
#endif
|
||||||
#include "doomerrors.h"
|
#include "doomerrors.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "swrenderer/r_swrenderer.h"
|
#include "swrenderer/r_swrenderer.h"
|
||||||
|
@ -128,6 +130,7 @@ void I_InitGraphics ()
|
||||||
// are the active app. Huh?
|
// are the active app. Huh?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_VULKAN
|
||||||
if (vid_backend == 0)
|
if (vid_backend == 0)
|
||||||
{
|
{
|
||||||
// first try Vulkan, if that fails OpenGL
|
// first try Vulkan, if that fails OpenGL
|
||||||
|
@ -141,6 +144,7 @@ void I_InitGraphics ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
Video = new Win32GLVideo();
|
Video = new Win32GLVideo();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue