From 367d5af7a26cbf4f6842b0d7428179c22eac1fe6 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Sun, 22 Mar 2020 13:22:45 +0100 Subject: [PATCH] Fixed Windows build --- neo/CMakeLists.txt | 4 ++-- neo/idlib/geometry/DrawVert.h | 4 ++-- neo/renderer/RenderBackend.h | 9 ++++++--- neo/renderer/Vulkan/RenderBackend_VK.cpp | 14 ++++++++++---- neo/renderer/Vulkan/RenderProgs_VK.cpp | 3 ++- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index c8c5d3cf..99f73eb1 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -362,7 +362,7 @@ if(USE_VULKAN) # options required by November 2018 release SET_OPTION(ENABLE_SPVREMAPPER OFF) - SET_OPTION(ENABLE_GLSLANG_BINARIES ON) + SET_OPTION(ENABLE_GLSLANG_BINARIES OFF) SET_OPTION(ENABLE_HLSL OFF) SET_OPTION(ENABLE_OPT ON) SET_OPTION(SPIRV_SKIP_EXECUTABLES ON) @@ -376,7 +376,7 @@ if(USE_VULKAN) set(GLSLANG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/glslang) add_subdirectory(${GLSLANG_DIR}) - include_directories(${GLSLANG_DIR}) + include_directories(${GLSLANG_DIR}/glslang) endif() else() diff --git a/neo/idlib/geometry/DrawVert.h b/neo/idlib/geometry/DrawVert.h index e4c2e45f..e6a0d746 100644 --- a/neo/idlib/geometry/DrawVert.h +++ b/neo/idlib/geometry/DrawVert.h @@ -122,11 +122,11 @@ class idDrawVert public: idVec3 xyz; // 12 bytes +private: + // RB: don't let the old tools code mess with these values halfFloat_t st[2]; // 4 bytes byte normal[4]; // 4 bytes byte tangent[4]; // 4 bytes -- [3] is texture polarity sign -//private: - // RB: don't let the old tools code mess with these values public: byte color[4]; // 4 bytes byte color2[4]; // 4 bytes -- weights for skinning diff --git a/neo/renderer/RenderBackend.h b/neo/renderer/RenderBackend.h index 0bf8355c..3e08ddf2 100644 --- a/neo/renderer/RenderBackend.h +++ b/neo/renderer/RenderBackend.h @@ -131,8 +131,11 @@ void RB_SetVertexColorParms( stageVertexColor_t svc ); //bool CreateGameWindow( gfxImpParms_t parms ); #if defined( USE_VULKAN ) -#include -#include + +#if defined(__linux__) + #include + #include +#endif struct gpuInfo_t { @@ -150,7 +153,7 @@ struct vulkanContext_t { // Eric: If on linux, use this to pass SDL_Window pointer to the SDL_Vulkan_* methods not in sdl_vkimp.cpp file. #if defined(__linux__) - SDL_Window* sdlWindow = nullptr; + SDL_Window* sdlWindow = nullptr; #endif uint64 frameCounter; uint32 frameParity; diff --git a/neo/renderer/Vulkan/RenderBackend_VK.cpp b/neo/renderer/Vulkan/RenderBackend_VK.cpp index 76a54d11..43f5ff91 100644 --- a/neo/renderer/Vulkan/RenderBackend_VK.cpp +++ b/neo/renderer/Vulkan/RenderBackend_VK.cpp @@ -51,6 +51,8 @@ idCVar r_syncEveryFrame( "r_syncEveryFrame", "1", CVAR_BOOL, "Don't let the GPU idCVar r_vkEnableValidationLayers( "r_vkEnableValidationLayers", "0", CVAR_BOOL | CVAR_INIT, "" ); +vulkanContext_t vkcontext; + #if defined(_WIN32) static const int g_numInstanceExtensions = 2; static const char* g_instanceExtensions[ g_numInstanceExtensions ] = @@ -723,11 +725,15 @@ static VkExtent2D ChooseSurfaceExtent( VkSurfaceCapabilitiesKHR& caps ) { VkExtent2D extent; - int width; - int height; + int width = glConfig.nativeScreenWidth; + int height = glConfig.nativeScreenHeight; + +#if defined(__linux__) SDL_Vulkan_GetDrawableSize( vkcontext.sdlWindow, &width, &height ); - width = CLAMP( width, caps.minImageExtent.width, caps.maxImageExtent.width ); - height = CLAMP( height, caps.minImageExtent.height, caps.maxImageExtent.height ); + + width = idMath::ClampInt( caps.minImageExtent.width, caps.maxImageExtent.width, width ); + height = idMath::ClampInt( caps.minImageExtent.height, caps.maxImageExtent.height, height ); +#endif if( caps.currentExtent.width == -1 ) { diff --git a/neo/renderer/Vulkan/RenderProgs_VK.cpp b/neo/renderer/Vulkan/RenderProgs_VK.cpp index 16fa2649..79602cb3 100644 --- a/neo/renderer/Vulkan/RenderProgs_VK.cpp +++ b/neo/renderer/Vulkan/RenderProgs_VK.cpp @@ -407,7 +407,8 @@ namespace glslang // These are the default resources for TBuiltInResources, used for both // - parsing this string for the case where the user didn't supply one, // - dumping out a template for user construction of a config file. -#if 1 +#if 0 +// RB: if you want to use this then you need to compile GLSLANG with ENABLE_GLSLANG_BINARIES ON extern const TBuiltInResource DefaultTBuiltInResource; #else