Rename: r_renderAPICompareWindow -> r_twinMode.
This commit is contained in:
parent
37120cc892
commit
7800172337
|
|
@ -44,10 +44,10 @@ extern void WG_CheckHardwareGamma( void );
|
|||
extern void WG_RestoreGamma( void );
|
||||
|
||||
#define MAIN_WINDOW_CLASS_NAME "Quake 3: Arena"
|
||||
#define API_COMPARE_WINDOW_CLASS_NAME "Quake 3: Arena [API compare]"
|
||||
#define TWIN_WINDOW_CLASS_NAME "Quake 3: Arena [Twin]"
|
||||
|
||||
static bool s_main_window_class_registered = false;
|
||||
static bool s_api_compare_window_class_registered = false;
|
||||
static bool s_twin_window_class_registered = false;
|
||||
|
||||
void QGL_EnableLogging( qboolean enable );
|
||||
qboolean QGL_Init( const char *dllname );
|
||||
|
|
@ -431,12 +431,12 @@ static HWND create_main_window(int width, int height, qboolean fullscreen)
|
|||
return hwnd;
|
||||
}
|
||||
|
||||
static HWND create_api_compare_window(int width, int height)
|
||||
static HWND create_twin_window(int width, int height)
|
||||
{
|
||||
//
|
||||
// register the window class if necessary
|
||||
//
|
||||
if (!s_api_compare_window_class_registered)
|
||||
if (!s_twin_window_class_registered)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
|
|
@ -451,14 +451,14 @@ static HWND create_api_compare_window(int width, int height)
|
|||
wc.hCursor = LoadCursor (NULL,IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH) (void *)COLOR_GRAYTEXT;
|
||||
wc.lpszMenuName = 0;
|
||||
wc.lpszClassName = API_COMPARE_WINDOW_CLASS_NAME;
|
||||
wc.lpszClassName = TWIN_WINDOW_CLASS_NAME;
|
||||
|
||||
if ( !RegisterClass( &wc ) )
|
||||
{
|
||||
ri.Error( ERR_FATAL, "create_api_compare_window: could not register window class" );
|
||||
ri.Error( ERR_FATAL, "create_twin_window: could not register window class" );
|
||||
}
|
||||
s_api_compare_window_class_registered = true;
|
||||
ri.Printf( PRINT_ALL, "...registered api compare window class\n" );
|
||||
s_twin_window_class_registered = true;
|
||||
ri.Printf( PRINT_ALL, "...registered twin window class\n" );
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -499,14 +499,14 @@ static HWND create_api_compare_window(int width, int height)
|
|||
y = ( desktop_height - h );
|
||||
}
|
||||
|
||||
// If r_renderAPI = 0 (OpenGL) then compare window uses Vulkan API.
|
||||
// If r_renderAPI = 1 (Vulkan) then compare window uses OpenGL API.
|
||||
// If r_renderAPI = 0 (OpenGL) then twin window uses Vulkan API.
|
||||
// If r_renderAPI = 1 (Vulkan) then twin window uses OpenGL API.
|
||||
char window_name[1024];
|
||||
sprintf(window_name, "%s [%s]", MAIN_WINDOW_CLASS_NAME, r_renderAPI->integer ? "OpenGL" : "Vulkan");
|
||||
sprintf(window_name, "%s [%s]", MAIN_WINDOW_CLASS_NAME, r_renderAPI->integer == 0 ? "Vulkan" : "OpenGL");
|
||||
|
||||
HWND hwnd = CreateWindowEx(
|
||||
0,
|
||||
API_COMPARE_WINDOW_CLASS_NAME,
|
||||
TWIN_WINDOW_CLASS_NAME,
|
||||
window_name,
|
||||
stylebits,
|
||||
x, y, w, h,
|
||||
|
|
@ -517,12 +517,12 @@ static HWND create_api_compare_window(int width, int height)
|
|||
|
||||
if (!hwnd)
|
||||
{
|
||||
ri.Error (ERR_FATAL, "create_api_compare_window() - Couldn't create window");
|
||||
ri.Error (ERR_FATAL, "create_twin_window() - Couldn't create window");
|
||||
}
|
||||
|
||||
ShowWindow(hwnd, SW_SHOW);
|
||||
UpdateWindow(hwnd);
|
||||
ri.Printf(PRINT_ALL, "...created api compare window@%d,%d (%dx%d)\n", x, y, w, h);
|
||||
ri.Printf(PRINT_ALL, "...created twin window@%d,%d (%dx%d)\n", x, y, w, h);
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
|
|
@ -704,7 +704,7 @@ void GLimp_Init( void )
|
|||
g_wv.hWnd_opengl = create_main_window(glConfig.vidWidth, glConfig.vidHeight, (qboolean)r_fullscreen->integer);
|
||||
g_wv.hWnd = g_wv.hWnd_opengl;
|
||||
} else {
|
||||
g_wv.hWnd_opengl = create_api_compare_window(glConfig.vidWidth, glConfig.vidHeight);
|
||||
g_wv.hWnd_opengl = create_twin_window(glConfig.vidWidth, glConfig.vidHeight);
|
||||
}
|
||||
|
||||
if (!GLW_InitDriver(g_wv.hWnd_opengl)) {
|
||||
|
|
@ -788,7 +788,7 @@ void GLimp_LogComment( char *comment )
|
|||
void vk_imp_init() {
|
||||
ri.Printf(PRINT_ALL, "Initializing Vulkan subsystem\n");
|
||||
|
||||
if (!gl_enabled) {
|
||||
if (!gl_enabled()) {
|
||||
QGL_Init(nullptr); // this will set qgl pointers to no-op placeholders
|
||||
qglActiveTextureARB = [] (GLenum) {};
|
||||
qglClientActiveTextureARB = [](GLenum) {};
|
||||
|
|
@ -800,7 +800,7 @@ void vk_imp_init() {
|
|||
g_wv.hWnd_vulkan = create_main_window(glConfig.vidWidth, glConfig.vidHeight, (qboolean)r_fullscreen->integer);
|
||||
g_wv.hWnd = g_wv.hWnd_vulkan;
|
||||
} else {
|
||||
g_wv.hWnd_vulkan = create_api_compare_window(glConfig.vidWidth, glConfig.vidHeight);
|
||||
g_wv.hWnd_vulkan = create_twin_window(glConfig.vidWidth, glConfig.vidHeight);
|
||||
}
|
||||
|
||||
// In order to create surface we need to create VkInstance first.
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ static void APIENTRY logViewport(GLint x, GLint y, GLsizei width, GLsizei height
|
|||
*/
|
||||
void QGL_Shutdown( void )
|
||||
{
|
||||
if (gl_enabled) {
|
||||
if (gl_enabled()) {
|
||||
ri.Printf( PRINT_ALL, "...shutting down QGL\n" );
|
||||
|
||||
if ( hinstOpenGL )
|
||||
|
|
@ -739,7 +739,7 @@ void QGL_Shutdown( void )
|
|||
}
|
||||
|
||||
# pragma warning (disable : 4113 4133 4047 )
|
||||
# define GPA( a ) (gl_enabled ? (void*)GetProcAddress(hinstOpenGL, #a) : (void*)(&no ## a))
|
||||
# define GPA( a ) (gl_enabled() ? (void*)GetProcAddress(hinstOpenGL, #a) : (void*)(&no ## a))
|
||||
|
||||
/*
|
||||
** QGL_Init
|
||||
|
|
@ -752,7 +752,7 @@ void QGL_Shutdown( void )
|
|||
*/
|
||||
qboolean QGL_Init( const char *dllname )
|
||||
{
|
||||
if (gl_enabled) {
|
||||
if (gl_enabled()) {
|
||||
assert( hinstOpenGL == 0 );
|
||||
|
||||
ri.Printf( PRINT_ALL, "...initializing QGL\n" );
|
||||
|
|
@ -830,7 +830,7 @@ qboolean QGL_Init( const char *dllname )
|
|||
qglLockArraysEXT = 0;
|
||||
qglUnlockArraysEXT = 0;
|
||||
|
||||
if (gl_enabled) {
|
||||
if (gl_enabled()) {
|
||||
// check logging
|
||||
QGL_EnableLogging( (qboolean) r_logFile->integer );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ Vk_Resources vk_resources;
|
|||
static void GfxInfo_f( void );
|
||||
|
||||
cvar_t *r_renderAPI;
|
||||
cvar_t *r_renderAPICompareWindow;
|
||||
cvar_t *r_twinMode;
|
||||
|
||||
cvar_t *r_flareSize;
|
||||
cvar_t *r_flareFade;
|
||||
|
|
@ -193,11 +193,11 @@ static void InitRenderAPI( void )
|
|||
//
|
||||
if ( glConfig.vidWidth == 0 )
|
||||
{
|
||||
if (gl_enabled)
|
||||
if (gl_enabled())
|
||||
GLimp_Init();
|
||||
|
||||
// VULKAN
|
||||
if (vk_enabled) {
|
||||
if (vk_enabled()) {
|
||||
vk_imp_init();
|
||||
vk_initialize();
|
||||
}
|
||||
|
|
@ -788,7 +788,7 @@ R_Register
|
|||
void R_Register( void )
|
||||
{
|
||||
r_renderAPI = ri.Cvar_Get( "r_renderAPI", "0", CVAR_ARCHIVE | CVAR_LATCH ) ;
|
||||
r_renderAPICompareWindow = ri.Cvar_Get( "r_renderAPICompareWindow", "0", 0 ) ;
|
||||
r_twinMode = ri.Cvar_Get( "r_twinMode", "0", CVAR_LATCH ) ;
|
||||
|
||||
//
|
||||
// latched and archived variables
|
||||
|
|
|
|||
|
|
@ -947,8 +947,12 @@ extern Vk_Resources vk_resources; // this data is cleared during ref re-init
|
|||
//
|
||||
// cvars
|
||||
//
|
||||
extern cvar_t *r_renderAPI;
|
||||
extern cvar_t *r_renderAPICompareWindow;
|
||||
extern cvar_t *r_renderAPI; // 3D API to use: 0 - OpenGL, 1 - Vulkan.
|
||||
|
||||
extern cvar_t *r_twinMode; // If enabled, renderer creates two separate windows.
|
||||
// The first window uses rendering API specified by r_renderAPI,
|
||||
// the second window uses rendering API corresponding to (1 - r_renderAPI).
|
||||
|
||||
extern cvar_t *r_flareSize;
|
||||
extern cvar_t *r_flareFade;
|
||||
|
||||
|
|
@ -1422,8 +1426,8 @@ void RB_CalcDiffuseColor( unsigned char *colors );
|
|||
|
||||
void myGlMultMatrix( const float *a, const float *b, float *out );
|
||||
|
||||
#define gl_enabled (r_renderAPI->integer == 0 || r_renderAPICompareWindow->integer)
|
||||
#define vk_enabled (r_renderAPI->integer != 0 || r_renderAPICompareWindow->integer)
|
||||
inline bool gl_enabled() { return r_renderAPI->integer == 0 || r_twinMode->integer; }
|
||||
inline bool vk_enabled() { return r_renderAPI->integer != 0 || r_twinMode->integer; }
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user