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:
Alibek Omarov 2021-12-10 02:55:26 +03:00
parent e0f0e5f0cb
commit deeb84c5eb
7 changed files with 6 additions and 22 deletions

View File

@ -385,11 +385,9 @@ static ref_api_t gEngfuncs =
pfnDrawTransparentTriangles,
&clgame.drawFuncs,
#ifdef XASH_VULKAN
XVK_GetInstanceExtensions,
XVK_GetVkGetInstanceProcAddr,
XVK_CreateSurface,
#endif
};
static void R_UnloadProgs( void )

View File

@ -14,9 +14,7 @@ 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"
@ -641,11 +639,9 @@ 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 )
@ -972,7 +968,6 @@ 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))
@ -1001,7 +996,6 @@ VkSurfaceKHR XVK_CreateSurface( VkInstance instance )
return surface;
}
#endif
/*
==================
@ -1050,10 +1044,8 @@ 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

@ -433,11 +433,9 @@ typedef struct ref_api_s
void (*pfnDrawTransparentTriangles)( void );
render_interface_t *drawFuncs;
#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,6 +1,5 @@
#pragma once
#ifdef XASH_VULKAN
#ifndef REF_VULKAN_H
#define REF_VULKAN_H
// Define Vulkan handles without depending on vulkan.h
#ifndef VULKAN_H_
@ -22,4 +21,4 @@ int XVK_GetInstanceExtensions( unsigned int count, const char **pNames );
void *XVK_GetVkGetInstanceProcAddr( void );
VkSurfaceKHR XVK_CreateSurface( VkInstance instance );
#endif // ifdef XASH_VULKAN
#endif /* REF_VULKAN_H */

View File

@ -97,7 +97,6 @@ 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.options.VK)
def build(bld):
is_cxx_link = False

View File

@ -39,7 +39,6 @@ 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')
@ -63,6 +62,9 @@ def configure(conf):
# TODO if debug
conf.env.GLSLCFLAGS += ['-g']
if '-Werror=declaration-after-statement' in conf.env.CFLAGS:
conf.env.CFLAGS.remove('-Werror=declaration-after-statement')
def build(bld):
if not bld.env.VK:
return

View File

@ -148,8 +148,6 @@ def configure(conf):
conf.options.NANOGL = True
conf.options.GLWES = True
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:
conf.options.USE_SELECT = True
conf.options.SDL12 = True
@ -163,8 +161,6 @@ def configure(conf):
enforce_pic = False
elif conf.env.DEST_OS == 'dos':
conf.options.SINGLE_BINARY = True
else:
conf.options.VK = True
if conf.env.STATIC_LINKING:
enforce_pic = False # PIC may break full static builds