make vulkan deps conditional at configure time

This commit is contained in:
Ivan Avdeev 2021-07-11 15:47:51 -07:00
parent 76d381388b
commit 02da9652bf
6 changed files with 17 additions and 6 deletions

View File

@ -386,11 +386,7 @@ static ref_api_t gEngfuncs =
pfnDrawTransparentTriangles,
&clgame.drawFuncs,
#if XASH_ANDROID
NULL,
NULL,
NULL,
#else
#ifdef XASH_VULKAN
XVK_GetInstanceExtensions,
XVK_GetVkGetInstanceProcAddr,
XVK_CreateSurface,

View File

@ -14,7 +14,9 @@ GNU General Public License for more details.
*/
#if !XASH_DEDICATED
#include <SDL.h>
#ifdef XASH_VULKAN
#include <SDL_vulkan.h>
#endif
#include "common.h"
#include "client.h"
#include "mod_local.h"
@ -639,9 +641,11 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
case REF_GL:
wndFlags |= SDL_WINDOW_OPENGL;
break;
#ifdef XASH_VULKAN
case REF_VULKAN:
wndFlags |= SDL_WINDOW_VULKAN;
break;
#endif
}
if( !fullscreen )
@ -968,6 +972,7 @@ int GL_GetAttribute( int attr, int *val )
#define EGL_LIB NULL
#endif
#ifdef XASH_VULKAN
int XVK_GetInstanceExtensions( unsigned int count, const char **pNames )
{
if (!SDL_Vulkan_GetInstanceExtensions(host.hWnd, &count, pNames))
@ -996,6 +1001,7 @@ VkSurfaceKHR XVK_CreateSurface( VkInstance instance )
return surface;
}
#endif
/*
==================
@ -1044,8 +1050,10 @@ qboolean R_Init_Video( const int type )
return false;
}
break;
#ifdef XASH_VULKAN
case REF_VULKAN:
break;
#endif
default:
Host_Error( "Can't initialize unknown context type %d!\n", type );
break;

View File

@ -434,10 +434,11 @@ typedef struct ref_api_s
void (*pfnDrawTransparentTriangles)( void );
render_interface_t *drawFuncs;
// Vulkan
#ifdef XASH_VULKAN
int (*XVK_GetInstanceExtensions)( unsigned int count, const char **pNames );
void *(*XVK_GetVkGetInstanceProcAddr)( void );
VkSurfaceKHR (*XVK_CreateSurface)( VkInstance instance );
#endif
} ref_api_t;
struct mip_s;

View File

@ -1,5 +1,7 @@
#pragma once
#ifdef XASH_VULKAN
// Define Vulkan handles without depending on vulkan.h
#ifndef VULKAN_H_
#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
@ -19,3 +21,5 @@ VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
int XVK_GetInstanceExtensions( unsigned int count, const char **pNames );
void *XVK_GetVkGetInstanceProcAddr( void );
VkSurfaceKHR XVK_CreateSurface( VkInstance instance );
#endif // ifdef XASH_VULKAN

View File

@ -97,6 +97,7 @@ def configure(conf):
conf.define_cond('XASH_64BIT', conf.env.DEST_SIZEOF_VOID_P != 4)
conf.define_cond('DBGHELP', conf.env.DEST_OS == 'win32')
conf.define_cond('PSAPI_VERSION', conf.env.DEST_OS == 'win32') # will be defined as 1
conf.define_cond('XASH_VULKAN', conf.env.VK)
def build(bld):
is_cxx_link = False

View File

@ -39,6 +39,7 @@ def configure(conf):
conf.load('glslc')
conf.define('REF_DLL', 1)
conf.define('XASH_VULKAN', 1)
if conf.options.NSIGHT_AFTERMATH_SDK:
conf.start_msg('Nvidia Nsight Aftermath SDK')