engine: get rid of stupid XASH_VULKAN. Vulkan support must be decided by the platform-code, not during build-time, and available if possible. Otherwise it can always return nothingness and refuse to create REF_VULKAN context
This commit is contained in:
parent
e0f0e5f0cb
commit
deeb84c5eb
|
@ -385,11 +385,9 @@ static ref_api_t gEngfuncs =
|
||||||
pfnDrawTransparentTriangles,
|
pfnDrawTransparentTriangles,
|
||||||
&clgame.drawFuncs,
|
&clgame.drawFuncs,
|
||||||
|
|
||||||
#ifdef XASH_VULKAN
|
|
||||||
XVK_GetInstanceExtensions,
|
XVK_GetInstanceExtensions,
|
||||||
XVK_GetVkGetInstanceProcAddr,
|
XVK_GetVkGetInstanceProcAddr,
|
||||||
XVK_CreateSurface,
|
XVK_CreateSurface,
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void R_UnloadProgs( void )
|
static void R_UnloadProgs( void )
|
||||||
|
|
|
@ -14,9 +14,7 @@ GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
#if !XASH_DEDICATED
|
#if !XASH_DEDICATED
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#ifdef XASH_VULKAN
|
|
||||||
#include <SDL_vulkan.h>
|
#include <SDL_vulkan.h>
|
||||||
#endif
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "mod_local.h"
|
#include "mod_local.h"
|
||||||
|
@ -641,11 +639,9 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
|
||||||
case REF_GL:
|
case REF_GL:
|
||||||
wndFlags |= SDL_WINDOW_OPENGL;
|
wndFlags |= SDL_WINDOW_OPENGL;
|
||||||
break;
|
break;
|
||||||
#ifdef XASH_VULKAN
|
|
||||||
case REF_VULKAN:
|
case REF_VULKAN:
|
||||||
wndFlags |= SDL_WINDOW_VULKAN;
|
wndFlags |= SDL_WINDOW_VULKAN;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !fullscreen )
|
if( !fullscreen )
|
||||||
|
@ -972,7 +968,6 @@ int GL_GetAttribute( int attr, int *val )
|
||||||
#define EGL_LIB NULL
|
#define EGL_LIB NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XASH_VULKAN
|
|
||||||
int XVK_GetInstanceExtensions( unsigned int count, const char **pNames )
|
int XVK_GetInstanceExtensions( unsigned int count, const char **pNames )
|
||||||
{
|
{
|
||||||
if (!SDL_Vulkan_GetInstanceExtensions(host.hWnd, &count, pNames))
|
if (!SDL_Vulkan_GetInstanceExtensions(host.hWnd, &count, pNames))
|
||||||
|
@ -1001,7 +996,6 @@ VkSurfaceKHR XVK_CreateSurface( VkInstance instance )
|
||||||
|
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
|
@ -1050,10 +1044,8 @@ qboolean R_Init_Video( const int type )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef XASH_VULKAN
|
|
||||||
case REF_VULKAN:
|
case REF_VULKAN:
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
Host_Error( "Can't initialize unknown context type %d!\n", type );
|
Host_Error( "Can't initialize unknown context type %d!\n", type );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -433,11 +433,9 @@ typedef struct ref_api_s
|
||||||
void (*pfnDrawTransparentTriangles)( void );
|
void (*pfnDrawTransparentTriangles)( void );
|
||||||
render_interface_t *drawFuncs;
|
render_interface_t *drawFuncs;
|
||||||
|
|
||||||
#ifdef XASH_VULKAN
|
|
||||||
int (*XVK_GetInstanceExtensions)( unsigned int count, const char **pNames );
|
int (*XVK_GetInstanceExtensions)( unsigned int count, const char **pNames );
|
||||||
void *(*XVK_GetVkGetInstanceProcAddr)( void );
|
void *(*XVK_GetVkGetInstanceProcAddr)( void );
|
||||||
VkSurfaceKHR (*XVK_CreateSurface)( VkInstance instance );
|
VkSurfaceKHR (*XVK_CreateSurface)( VkInstance instance );
|
||||||
#endif
|
|
||||||
} ref_api_t;
|
} ref_api_t;
|
||||||
|
|
||||||
struct mip_s;
|
struct mip_s;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#ifndef REF_VULKAN_H
|
||||||
|
#define REF_VULKAN_H
|
||||||
#ifdef XASH_VULKAN
|
|
||||||
|
|
||||||
// Define Vulkan handles without depending on vulkan.h
|
// Define Vulkan handles without depending on vulkan.h
|
||||||
#ifndef VULKAN_H_
|
#ifndef VULKAN_H_
|
||||||
|
@ -22,4 +21,4 @@ int XVK_GetInstanceExtensions( unsigned int count, const char **pNames );
|
||||||
void *XVK_GetVkGetInstanceProcAddr( void );
|
void *XVK_GetVkGetInstanceProcAddr( void );
|
||||||
VkSurfaceKHR XVK_CreateSurface( VkInstance instance );
|
VkSurfaceKHR XVK_CreateSurface( VkInstance instance );
|
||||||
|
|
||||||
#endif // ifdef XASH_VULKAN
|
#endif /* REF_VULKAN_H */
|
||||||
|
|
|
@ -97,7 +97,6 @@ def configure(conf):
|
||||||
conf.define_cond('XASH_64BIT', conf.env.DEST_SIZEOF_VOID_P != 4)
|
conf.define_cond('XASH_64BIT', conf.env.DEST_SIZEOF_VOID_P != 4)
|
||||||
conf.define_cond('DBGHELP', conf.env.DEST_OS == 'win32')
|
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('PSAPI_VERSION', conf.env.DEST_OS == 'win32') # will be defined as 1
|
||||||
conf.define_cond('XASH_VULKAN', conf.options.VK)
|
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
is_cxx_link = False
|
is_cxx_link = False
|
||||||
|
|
|
@ -39,7 +39,6 @@ def configure(conf):
|
||||||
conf.load('glslc')
|
conf.load('glslc')
|
||||||
|
|
||||||
conf.define('REF_DLL', 1)
|
conf.define('REF_DLL', 1)
|
||||||
conf.define('XASH_VULKAN', 1)
|
|
||||||
|
|
||||||
if conf.options.NSIGHT_AFTERMATH_SDK:
|
if conf.options.NSIGHT_AFTERMATH_SDK:
|
||||||
conf.start_msg('Nvidia Nsight Aftermath SDK')
|
conf.start_msg('Nvidia Nsight Aftermath SDK')
|
||||||
|
@ -63,6 +62,9 @@ def configure(conf):
|
||||||
# TODO if debug
|
# TODO if debug
|
||||||
conf.env.GLSLCFLAGS += ['-g']
|
conf.env.GLSLCFLAGS += ['-g']
|
||||||
|
|
||||||
|
if '-Werror=declaration-after-statement' in conf.env.CFLAGS:
|
||||||
|
conf.env.CFLAGS.remove('-Werror=declaration-after-statement')
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
if not bld.env.VK:
|
if not bld.env.VK:
|
||||||
return
|
return
|
||||||
|
|
4
wscript
4
wscript
|
@ -148,8 +148,6 @@ def configure(conf):
|
||||||
conf.options.NANOGL = True
|
conf.options.NANOGL = True
|
||||||
conf.options.GLWES = True
|
conf.options.GLWES = True
|
||||||
conf.options.GL = False
|
conf.options.GL = False
|
||||||
# Vulkan is not supported on Android yet for CI reasons: requres NDK>12, glslc lookup etc.
|
|
||||||
conf.options.VK = False
|
|
||||||
elif conf.env.MAGX:
|
elif conf.env.MAGX:
|
||||||
conf.options.USE_SELECT = True
|
conf.options.USE_SELECT = True
|
||||||
conf.options.SDL12 = True
|
conf.options.SDL12 = True
|
||||||
|
@ -163,8 +161,6 @@ def configure(conf):
|
||||||
enforce_pic = False
|
enforce_pic = False
|
||||||
elif conf.env.DEST_OS == 'dos':
|
elif conf.env.DEST_OS == 'dos':
|
||||||
conf.options.SINGLE_BINARY = True
|
conf.options.SINGLE_BINARY = True
|
||||||
else:
|
|
||||||
conf.options.VK = True
|
|
||||||
|
|
||||||
if conf.env.STATIC_LINKING:
|
if conf.env.STATIC_LINKING:
|
||||||
enforce_pic = False # PIC may break full static builds
|
enforce_pic = False # PIC may break full static builds
|
||||||
|
|
Loading…
Reference in New Issue