Removed glw_win.h.

This commit is contained in:
Artem Kharytoniuk 2017-05-05 14:06:20 +03:00
parent 5a5b0b4d2b
commit 37120cc892
6 changed files with 49 additions and 96 deletions

View File

@ -136,7 +136,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\src\engine\qcommon\cm_public.h" /> <ClInclude Include="..\..\src\engine\qcommon\cm_public.h" />
<ClInclude Include="..\..\src\engine\platform\glw_win.h" />
<ClInclude Include="..\..\src\engine\renderer\vk.h" /> <ClInclude Include="..\..\src\engine\renderer\vk.h" />
<ClInclude Include="..\..\src\game\q_shared.h" /> <ClInclude Include="..\..\src\game\q_shared.h" />
<ClInclude Include="..\..\src\engine\qcommon\qcommon.h" /> <ClInclude Include="..\..\src\engine\qcommon\qcommon.h" />

View File

@ -121,9 +121,6 @@
<ClInclude Include="..\..\src\engine\qcommon\cm_public.h"> <ClInclude Include="..\..\src\engine\qcommon\cm_public.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\engine\platform\glw_win.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\game\q_shared.h"> <ClInclude Include="..\..\src\game\q_shared.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>

View File

@ -1,36 +0,0 @@
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#ifndef _WIN32
# error You should not be including this file on this platform
#endif
#ifndef __GLW_WIN_H__
#define __GLW_WIN_H__
typedef struct
{
FILE *log_fp;
} glwstate_t;
extern glwstate_t glw_state;
#endif

View File

@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <assert.h> #include <assert.h>
#include "../renderer/tr_local.h" #include "../renderer/tr_local.h"
#include "../qcommon/qcommon.h" #include "../qcommon/qcommon.h"
#include "glw_win.h"
#include "win_local.h" #include "win_local.h"
static unsigned short s_oldHardwareGamma[3][256]; static unsigned short s_oldHardwareGamma[3][256];

View File

@ -38,7 +38,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../renderer/tr_local.h" #include "../renderer/tr_local.h"
#include "../qcommon/qcommon.h" #include "../qcommon/qcommon.h"
#include "resource.h" #include "resource.h"
#include "glw_win.h"
#include "win_local.h" #include "win_local.h"
extern void WG_CheckHardwareGamma( void ); extern void WG_CheckHardwareGamma( void );
@ -50,20 +49,14 @@ extern void WG_RestoreGamma( void );
static bool s_main_window_class_registered = false; static bool s_main_window_class_registered = false;
static bool s_api_compare_window_class_registered = false; static bool s_api_compare_window_class_registered = false;
//
// function declaration
//
void QGL_EnableLogging( qboolean enable ); void QGL_EnableLogging( qboolean enable );
qboolean QGL_Init( const char *dllname ); qboolean QGL_Init( const char *dllname );
void QGL_Shutdown( void ); void QGL_Shutdown( void );
//
// variable declarations
//
static HDC gl_hdc; // handle to device context static HDC gl_hdc; // handle to device context
static HGLRC gl_hglrc; // handle to GL rendering context static HGLRC gl_hglrc; // handle to GL rendering context
glwstate_t glw_state; FILE* log_fp;
static int GetDesktopCaps(int index) { static int GetDesktopCaps(int index) {
HDC hdc = GetDC(GetDesktopWindow()); HDC hdc = GetDC(GetDesktopWindow());
@ -779,16 +772,16 @@ void GLimp_Shutdown( void )
memset(&glConfig, 0, sizeof(glConfig)); memset(&glConfig, 0, sizeof(glConfig));
memset(&glState, 0, sizeof(glState)); memset(&glState, 0, sizeof(glState));
if (glw_state.log_fp) { if (log_fp) {
fclose(glw_state.log_fp); fclose(log_fp);
glw_state.log_fp = 0; log_fp = 0;
} }
} }
void GLimp_LogComment( char *comment ) void GLimp_LogComment( char *comment )
{ {
if ( glw_state.log_fp ) { if ( log_fp ) {
fprintf( glw_state.log_fp, "%s", comment ); fprintf( log_fp, "%s", comment );
} }
} }
@ -850,9 +843,9 @@ void vk_imp_shutdown() {
memset(&glConfig, 0, sizeof(glConfig)); memset(&glConfig, 0, sizeof(glConfig));
memset(&glState, 0, sizeof(glState)); memset(&glState, 0, sizeof(glState));
if (glw_state.log_fp) { if (log_fp) {
fclose(glw_state.log_fp); fclose(log_fp);
glw_state.log_fp = 0; log_fp = 0;
} }
} }

View File

@ -30,7 +30,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
** QGL_Shutdown() - unloads libraries, NULLs function pointers ** QGL_Shutdown() - unloads libraries, NULLs function pointers
*/ */
#include "../renderer/tr_local.h" #include "../renderer/tr_local.h"
#include "glw_win.h"
extern FILE* log_fp;
static HINSTANCE hinstOpenGL; // HINSTANCE for the OpenGL library static HINSTANCE hinstOpenGL; // HINSTANCE for the OpenGL library
@ -348,17 +349,17 @@ static const char * TypeToString( GLenum t )
static void APIENTRY logAlphaFunc(GLenum func, GLclampf ref) static void APIENTRY logAlphaFunc(GLenum func, GLclampf ref)
{ {
fprintf( glw_state.log_fp, "glAlphaFunc( 0x%x, %f )\n", func, ref ); fprintf( log_fp, "glAlphaFunc( 0x%x, %f )\n", func, ref );
dllAlphaFunc( func, ref ); dllAlphaFunc( func, ref );
} }
static void APIENTRY logBegin(GLenum mode) static void APIENTRY logBegin(GLenum mode)
{ {
fprintf( glw_state.log_fp, "glBegin( %s )\n", PrimToString( mode )); fprintf( log_fp, "glBegin( %s )\n", PrimToString( mode ));
dllBegin( mode ); dllBegin( mode );
} }
static void APIENTRY logBindTexture(GLenum target, GLuint texture) static void APIENTRY logBindTexture(GLenum target, GLuint texture)
{ {
fprintf( glw_state.log_fp, "glBindTexture( 0x%x, %u )\n", target, texture ); fprintf( log_fp, "glBindTexture( 0x%x, %u )\n", target, texture );
dllBindTexture( target, texture ); dllBindTexture( target, texture );
} }
static void BlendToName( char *n, GLenum f ) static void BlendToName( char *n, GLenum f )
@ -397,42 +398,42 @@ static void APIENTRY logBlendFunc(GLenum sfactor, GLenum dfactor)
BlendToName( sf, sfactor ); BlendToName( sf, sfactor );
BlendToName( df, dfactor ); BlendToName( df, dfactor );
fprintf( glw_state.log_fp, "glBlendFunc( %s, %s )\n", sf, df ); fprintf( log_fp, "glBlendFunc( %s, %s )\n", sf, df );
dllBlendFunc( sfactor, dfactor ); dllBlendFunc( sfactor, dfactor );
} }
static void APIENTRY logClear(GLbitfield mask) static void APIENTRY logClear(GLbitfield mask)
{ {
fprintf( glw_state.log_fp, "glClear( 0x%x = ", mask ); fprintf( log_fp, "glClear( 0x%x = ", mask );
if ( mask & GL_COLOR_BUFFER_BIT ) if ( mask & GL_COLOR_BUFFER_BIT )
fprintf( glw_state.log_fp, "GL_COLOR_BUFFER_BIT " ); fprintf( log_fp, "GL_COLOR_BUFFER_BIT " );
if ( mask & GL_DEPTH_BUFFER_BIT ) if ( mask & GL_DEPTH_BUFFER_BIT )
fprintf( glw_state.log_fp, "GL_DEPTH_BUFFER_BIT " ); fprintf( log_fp, "GL_DEPTH_BUFFER_BIT " );
if ( mask & GL_STENCIL_BUFFER_BIT ) if ( mask & GL_STENCIL_BUFFER_BIT )
fprintf( glw_state.log_fp, "GL_STENCIL_BUFFER_BIT " ); fprintf( log_fp, "GL_STENCIL_BUFFER_BIT " );
if ( mask & GL_ACCUM_BUFFER_BIT ) if ( mask & GL_ACCUM_BUFFER_BIT )
fprintf( glw_state.log_fp, "GL_ACCUM_BUFFER_BIT " ); fprintf( log_fp, "GL_ACCUM_BUFFER_BIT " );
fprintf( glw_state.log_fp, ")\n" ); fprintf( log_fp, ")\n" );
dllClear( mask ); dllClear( mask );
} }
static void APIENTRY logClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) static void APIENTRY logClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{ {
fprintf( glw_state.log_fp, "glClearColor\n" ); fprintf( log_fp, "glClearColor\n" );
dllClearColor( red, green, blue, alpha ); dllClearColor( red, green, blue, alpha );
} }
static void APIENTRY logClipPlane(GLenum plane, const GLdouble *equation) static void APIENTRY logClipPlane(GLenum plane, const GLdouble *equation)
{ {
fprintf( glw_state.log_fp, "glClipPlane\n" ); fprintf( log_fp, "glClipPlane\n" );
dllClipPlane( plane, equation ); dllClipPlane( plane, equation );
} }
static void APIENTRY logColor3f(GLfloat red, GLfloat green, GLfloat blue) static void APIENTRY logColor3f(GLfloat red, GLfloat green, GLfloat blue)
{ {
fprintf( glw_state.log_fp, "glColor3f\n" ); fprintf( log_fp, "glColor3f\n" );
dllColor3f( red, green, blue ); dllColor3f( red, green, blue );
} }
#define SIG( x ) fprintf( glw_state.log_fp, x "\n" ) #define SIG( x ) fprintf( log_fp, x "\n" )
static void APIENTRY logColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) static void APIENTRY logColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
{ {
@ -441,12 +442,12 @@ static void APIENTRY logColorMask(GLboolean red, GLboolean green, GLboolean blue
} }
static void APIENTRY logColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) static void APIENTRY logColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
{ {
fprintf( glw_state.log_fp, "glColorPointer( %d, %s, %d, MEM )\n", size, TypeToString( type ), stride ); fprintf( log_fp, "glColorPointer( %d, %s, %d, MEM )\n", size, TypeToString( type ), stride );
dllColorPointer( size, type, stride, pointer ); dllColorPointer( size, type, stride, pointer );
} }
static void APIENTRY logCullFace(GLenum mode) static void APIENTRY logCullFace(GLenum mode)
{ {
fprintf( glw_state.log_fp, "glCullFace( %s )\n", ( mode == GL_FRONT ) ? "GL_FRONT" : "GL_BACK" ); fprintf( log_fp, "glCullFace( %s )\n", ( mode == GL_FRONT ) ? "GL_FRONT" : "GL_BACK" );
dllCullFace( mode ); dllCullFace( mode );
} }
static void APIENTRY logDeleteTextures(GLsizei n, const GLuint *textures) static void APIENTRY logDeleteTextures(GLsizei n, const GLuint *textures)
@ -456,27 +457,27 @@ static void APIENTRY logDeleteTextures(GLsizei n, const GLuint *textures)
} }
static void APIENTRY logDepthFunc(GLenum func) static void APIENTRY logDepthFunc(GLenum func)
{ {
fprintf( glw_state.log_fp, "glDepthFunc( %s )\n", FuncToString( func ) ); fprintf( log_fp, "glDepthFunc( %s )\n", FuncToString( func ) );
dllDepthFunc( func ); dllDepthFunc( func );
} }
static void APIENTRY logDepthMask(GLboolean flag) static void APIENTRY logDepthMask(GLboolean flag)
{ {
fprintf( glw_state.log_fp, "glDepthMask( %s )\n", BooleanToString( flag ) ); fprintf( log_fp, "glDepthMask( %s )\n", BooleanToString( flag ) );
dllDepthMask( flag ); dllDepthMask( flag );
} }
static void APIENTRY logDepthRange(GLclampd zNear, GLclampd zFar) static void APIENTRY logDepthRange(GLclampd zNear, GLclampd zFar)
{ {
fprintf( glw_state.log_fp, "glDepthRange( %f, %f )\n", ( float ) zNear, ( float ) zFar ); fprintf( log_fp, "glDepthRange( %f, %f )\n", ( float ) zNear, ( float ) zFar );
dllDepthRange( zNear, zFar ); dllDepthRange( zNear, zFar );
} }
static void APIENTRY logDisable(GLenum cap) static void APIENTRY logDisable(GLenum cap)
{ {
fprintf( glw_state.log_fp, "glDisable( %s )\n", CapToString( cap ) ); fprintf( log_fp, "glDisable( %s )\n", CapToString( cap ) );
dllDisable( cap ); dllDisable( cap );
} }
static void APIENTRY logDisableClientState(GLenum array) static void APIENTRY logDisableClientState(GLenum array)
{ {
fprintf( glw_state.log_fp, "glDisableClientState( %s )\n", CapToString( array ) ); fprintf( log_fp, "glDisableClientState( %s )\n", CapToString( array ) );
dllDisableClientState( array ); dllDisableClientState( array );
} }
static void APIENTRY logDrawBuffer(GLenum mode) static void APIENTRY logDrawBuffer(GLenum mode)
@ -486,18 +487,18 @@ static void APIENTRY logDrawBuffer(GLenum mode)
} }
static void APIENTRY logDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices) static void APIENTRY logDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
{ {
fprintf( glw_state.log_fp, "glDrawElements( %s, %d, %s, MEM )\n", PrimToString( mode ), count, TypeToString( type ) ); fprintf( log_fp, "glDrawElements( %s, %d, %s, MEM )\n", PrimToString( mode ), count, TypeToString( type ) );
dllDrawElements( mode, count, type, indices ); dllDrawElements( mode, count, type, indices );
} }
static void APIENTRY logEnable(GLenum cap) static void APIENTRY logEnable(GLenum cap)
{ {
fprintf( glw_state.log_fp, "glEnable( %s )\n", CapToString( cap ) ); fprintf( log_fp, "glEnable( %s )\n", CapToString( cap ) );
dllEnable( cap ); dllEnable( cap );
} }
static void APIENTRY logEnableClientState(GLenum array) static void APIENTRY logEnableClientState(GLenum array)
{ {
fprintf( glw_state.log_fp, "glEnableClientState( %s )\n", CapToString( array ) ); fprintf( log_fp, "glEnableClientState( %s )\n", CapToString( array ) );
dllEnableClientState( array ); dllEnableClientState( array );
} }
@ -553,7 +554,7 @@ static void APIENTRY logOrtho(GLdouble left, GLdouble right, GLdouble bottom, GL
} }
static void APIENTRY logPolygonMode(GLenum face, GLenum mode) static void APIENTRY logPolygonMode(GLenum face, GLenum mode)
{ {
fprintf( glw_state.log_fp, "glPolygonMode( 0x%x, 0x%x )\n", face, mode ); fprintf( log_fp, "glPolygonMode( 0x%x, 0x%x )\n", face, mode );
dllPolygonMode( face, mode ); dllPolygonMode( face, mode );
} }
static void APIENTRY logPolygonOffset(GLfloat factor, GLfloat units) static void APIENTRY logPolygonOffset(GLfloat factor, GLfloat units)
@ -578,7 +579,7 @@ static void APIENTRY logReadPixels(GLint x, GLint y, GLsizei width, GLsizei heig
} }
static void APIENTRY logScissor(GLint x, GLint y, GLsizei width, GLsizei height) static void APIENTRY logScissor(GLint x, GLint y, GLsizei width, GLsizei height)
{ {
fprintf( glw_state.log_fp, "glScissor( %d, %d, %d, %d )\n", x, y, width, height ); fprintf( log_fp, "glScissor( %d, %d, %d, %d )\n", x, y, width, height );
dllScissor( x, y, width, height ); dllScissor( x, y, width, height );
} }
static void APIENTRY logStencilFunc(GLenum func, GLint ref, GLuint mask) static void APIENTRY logStencilFunc(GLenum func, GLint ref, GLuint mask)
@ -603,13 +604,13 @@ static void APIENTRY logTexCoord2fv(const GLfloat *v)
} }
static void APIENTRY logTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) static void APIENTRY logTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
{ {
fprintf( glw_state.log_fp, "glTexCoordPointer( %d, %s, %d, MEM )\n", size, TypeToString( type ), stride ); fprintf( log_fp, "glTexCoordPointer( %d, %s, %d, MEM )\n", size, TypeToString( type ), stride );
dllTexCoordPointer( size, type, stride, pointer ); dllTexCoordPointer( size, type, stride, pointer );
} }
static void APIENTRY logTexEnvf(GLenum target, GLenum pname, GLfloat param) static void APIENTRY logTexEnvf(GLenum target, GLenum pname, GLfloat param)
{ {
fprintf( glw_state.log_fp, "glTexEnvf( 0x%x, 0x%x, %f )\n", target, pname, param ); fprintf( log_fp, "glTexEnvf( 0x%x, 0x%x, %f )\n", target, pname, param );
dllTexEnvf( target, pname, param ); dllTexEnvf( target, pname, param );
} }
static void APIENTRY logTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels) static void APIENTRY logTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels)
@ -619,7 +620,7 @@ static void APIENTRY logTexImage2D(GLenum target, GLint level, GLint internalfor
} }
static void APIENTRY logTexParameterf(GLenum target, GLenum pname, GLfloat param) static void APIENTRY logTexParameterf(GLenum target, GLenum pname, GLfloat param)
{ {
fprintf( glw_state.log_fp, "glTexParameterf( 0x%x, 0x%x, %f )\n", target, pname, param ); fprintf( log_fp, "glTexParameterf( 0x%x, 0x%x, %f )\n", target, pname, param );
dllTexParameterf( target, pname, param ); dllTexParameterf( target, pname, param );
} }
static void APIENTRY logTexParameterfv(GLenum target, GLenum pname, const GLfloat *params) static void APIENTRY logTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
@ -649,12 +650,12 @@ static void APIENTRY logVertex3fv(const GLfloat *v)
} }
static void APIENTRY logVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) static void APIENTRY logVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
{ {
fprintf( glw_state.log_fp, "glVertexPointer( %d, %s, %d, MEM )\n", size, TypeToString( type ), stride ); fprintf( log_fp, "glVertexPointer( %d, %s, %d, MEM )\n", size, TypeToString( type ), stride );
dllVertexPointer( size, type, stride, pointer ); dllVertexPointer( size, type, stride, pointer );
} }
static void APIENTRY logViewport(GLint x, GLint y, GLsizei width, GLsizei height) static void APIENTRY logViewport(GLint x, GLint y, GLsizei width, GLsizei height)
{ {
fprintf( glw_state.log_fp, "glViewport( %d, %d, %d, %d )\n", x, y, width, height ); fprintf( log_fp, "glViewport( %d, %d, %d, %d )\n", x, y, width, height );
dllViewport( x, y, width, height ); dllViewport( x, y, width, height );
} }
@ -859,7 +860,7 @@ void QGL_EnableLogging( qboolean enable )
if ( enable ) if ( enable )
{ {
if ( !glw_state.log_fp ) if ( !log_fp )
{ {
struct tm *newtime; struct tm *newtime;
time_t aclock; time_t aclock;
@ -873,9 +874,9 @@ void QGL_EnableLogging( qboolean enable )
basedir = ri.Cvar_Get( "fs_basepath", "", 0 ); basedir = ri.Cvar_Get( "fs_basepath", "", 0 );
Com_sprintf( buffer, sizeof(buffer), "%s/gl.log", basedir->string ); Com_sprintf( buffer, sizeof(buffer), "%s/gl.log", basedir->string );
glw_state.log_fp = fopen( buffer, "wt" ); log_fp = fopen( buffer, "wt" );
fprintf( glw_state.log_fp, "%s\n", asctime( newtime ) ); fprintf( log_fp, "%s\n", asctime( newtime ) );
} }
qglAlphaFunc = logAlphaFunc; qglAlphaFunc = logAlphaFunc;
@ -933,10 +934,10 @@ void QGL_EnableLogging( qboolean enable )
} }
else else
{ {
if ( glw_state.log_fp ) { if ( log_fp ) {
fprintf( glw_state.log_fp, "*** CLOSING LOG ***\n" ); fprintf( log_fp, "*** CLOSING LOG ***\n" );
fclose( glw_state.log_fp ); fclose( log_fp );
glw_state.log_fp = NULL; log_fp = NULL;
} }
qglAlphaFunc = dllAlphaFunc; qglAlphaFunc = dllAlphaFunc;
qglBegin = dllBegin; qglBegin = dllBegin;