2004-08-22 22:29:09 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program 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 .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2011-05-19 13:34:07 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2004-08-22 22:29:09 +00:00
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
// gl_vidnt.c -- NT GL vid component
2016-12-13 11:50:15 +00:00
// note that this file also handles win32 vulkan window things
// and can also use either EGL or WGL.
2004-08-22 22:29:09 +00:00
# include "quakedef.h"
2016-12-13 11:50:15 +00:00
# if defined(_WIN32) && (defined(GLQUAKE) || defined(VKQUAKE))
2004-08-22 22:29:09 +00:00
# include "glquake.h"
# include "winquake.h"
# include "resource.h"
2012-07-05 19:42:36 +00:00
# include "shader.h"
2020-05-14 15:50:26 +00:00
# include "vr.h"
2004-08-22 22:29:09 +00:00
# include <commctrl.h>
2016-12-13 11:50:15 +00:00
# ifdef USE_EGL
# ifdef GLQUAKE
# include "gl_videgl.h"
# else
# undef USE_EGL
# endif
# endif
# ifdef GLQUAKE
# define USE_WGL
# endif
# ifdef VKQUAKE
# include "../vk/vkrenderer.h"
# endif
static enum
{
# ifdef USE_WGL
MODE_WGL ,
# endif
# ifdef USE_EGL
MODE_EGL ,
# endif
# ifdef VKQUAKE
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
MODE_VULKAN , //proper vulkan
# ifdef USE_WGL
MODE_NVVULKAN , //vulkan accessed via nvidia's render-to-image-then-copy-to-gl-backbuffer-then-copy-that opengl extension.
# endif
2016-12-13 11:50:15 +00:00
# endif
} platform_rendermode ;
2012-08-04 01:35:52 +00:00
void STT_Event ( void ) ;
2009-04-01 22:03:56 +00:00
# ifndef SetWindowLongPtr //yes its a define, for unicode support
# define SetWindowLongPtr SetWindowLong
# endif
2004-08-22 22:29:09 +00:00
# ifndef CDS_FULLSCREEN
2006-02-06 01:06:17 +00:00
# define CDS_FULLSCREEN 4
2004-08-22 22:29:09 +00:00
# endif
# ifndef WM_XBUTTONDOWN
# define WM_XBUTTONDOWN 0x020B
# define WM_XBUTTONUP 0x020C
# endif
# ifndef MK_XBUTTON1
# define MK_XBUTTON1 0x0020
2009-01-18 01:47:48 +00:00
# endif
# ifndef MK_XBUTTON2
2004-08-22 22:29:09 +00:00
# define MK_XBUTTON2 0x0040
2009-01-18 01:47:48 +00:00
# endif
2005-06-18 22:30:57 +00:00
// copied from DarkPlaces in an attempt to grab more buttons
2009-01-18 01:47:48 +00:00
# ifndef MK_XBUTTON3
2005-06-18 22:30:57 +00:00
# define MK_XBUTTON3 0x0080
2009-01-18 01:47:48 +00:00
# endif
# ifndef MK_XBUTTON4
2005-06-18 22:30:57 +00:00
# define MK_XBUTTON4 0x0100
2009-01-18 01:47:48 +00:00
# endif
# ifndef MK_XBUTTON5
2005-06-18 22:30:57 +00:00
# define MK_XBUTTON5 0x0200
2009-01-18 01:47:48 +00:00
# endif
# ifndef MK_XBUTTON6
2005-06-18 22:30:57 +00:00
# define MK_XBUTTON6 0x0400
2009-01-18 01:47:48 +00:00
# endif
# ifndef MK_XBUTTON7
2005-06-18 22:30:57 +00:00
# define MK_XBUTTON7 0x0800
2009-01-18 01:47:48 +00:00
# endif
2004-08-22 22:29:09 +00:00
2005-06-29 21:20:34 +00:00
# ifndef WM_INPUT
# define WM_INPUT 255
# endif
2004-08-22 22:29:09 +00:00
2009-04-06 00:34:32 +00:00
# ifndef WS_EX_LAYERED
# define WS_EX_LAYERED 0x00080000
2009-04-06 01:01:31 +00:00
# endif
# ifndef LWA_ALPHA
2009-04-06 00:34:32 +00:00
# define LWA_ALPHA 0x00000002
# endif
2011-05-19 13:34:07 +00:00
typedef BOOL ( WINAPI * lpfnSetLayeredWindowAttributes ) ( HWND hwnd , COLORREF crKey , BYTE bAlpha , DWORD dwFlags ) ;
2009-04-06 00:34:32 +00:00
2006-04-02 09:11:37 +00:00
extern cvar_t vid_conwidth , vid_conautoscale ;
2004-08-22 22:29:09 +00:00
2015-06-04 06:15:14 +00:00
# define WINDOW_CLASS_NAME_W L"FTEGLQuake"
# define WINDOW_CLASS_NAME_A "FTEGLQuake"
2004-08-22 22:29:09 +00:00
2009-04-06 00:34:32 +00:00
extern cvar_t vid_width ;
extern cvar_t vid_height ;
extern cvar_t vid_wndalpha ;
2017-07-28 01:49:25 +00:00
extern cvar_t vid_winthread ;
2009-04-06 00:34:32 +00:00
2016-07-12 00:40:13 +00:00
static qboolean VID_SetWindowedMode ( rendererstate_t * info ) ; //-1 on bpp or hz for default.
static qboolean VID_SetFullDIBMode ( rendererstate_t * info ) ; //-1 on bpp or hz for default.
2004-08-22 22:29:09 +00:00
2017-07-28 01:49:25 +00:00
# ifdef MULTITHREAD
2016-12-13 11:50:15 +00:00
# define WTHREAD //While the user is resizing a window, the entire thread that owns said window becomes frozen. in order to cope with window resizing, its easiest to just create a separate thread to be microsoft's plaything. our main game thread can then just keep rendering. hopefully that won't bug out on the present.
# endif
2015-05-03 19:57:46 +00:00
# ifdef WTHREAD
static HANDLE windowthread ;
# endif
2004-08-22 22:29:09 +00:00
static DEVMODE gdevmode ;
static qboolean vid_initialized = false ;
static qboolean vid_canalttab = false ;
static qboolean vid_wassuspended = false ;
extern qboolean mouseactive ; // from in_win.c
static HICON hIcon ;
extern qboolean vid_isfullscreen ;
2016-12-13 11:50:15 +00:00
static unsigned short originalgammaramps [ 3 ] [ 256 ] ;
2004-09-20 23:25:38 +00:00
2009-07-16 22:06:59 +00:00
qboolean vid_initializing ;
2004-08-22 22:29:09 +00:00
2016-12-13 11:50:15 +00:00
static int DIBWidth , DIBHeight ;
static RECT WindowRect ;
static DWORD WindowStyle , ExWindowStyle ;
2004-08-22 22:29:09 +00:00
2016-12-13 11:50:15 +00:00
HWND mainwindow ;
static HWND dibwindow ;
2004-08-22 22:29:09 +00:00
2016-12-13 11:50:15 +00:00
static HDC maindc ;
2004-08-22 22:29:09 +00:00
HWND WINAPI InitializeWindow ( HINSTANCE hInstance , int nCmdShow ) ;
viddef_t vid ; // global video state
//unsigned short d_8to16rgbtable[256];
//unsigned d_8to24rgbtable[256];
//unsigned short d_8to16bgrtable[256];
//unsigned d_8to24bgrtable[256];
2017-07-12 08:15:27 +00:00
static enum { MS_WINDOWED , MS_FULLDIB , MS_FULLWINDOW , MS_UNINIT } modestate = MS_UNINIT ;
2004-08-22 22:29:09 +00:00
2013-03-12 23:16:20 +00:00
extern float gammapending ;
2004-08-22 22:29:09 +00:00
//====================================
// Note that 0 is MODE_WINDOWED
extern cvar_t vid_mode ;
// Note that 3 is MODE_FULLSCREEN_DEFAULT
2014-02-07 08:38:40 +00:00
extern cvar_t vid_vsync ;
2004-09-20 23:25:38 +00:00
extern cvar_t vid_hardwaregamma ;
2005-10-18 04:42:13 +00:00
extern cvar_t vid_desktopgamma ;
2004-11-18 17:55:04 +00:00
extern cvar_t gl_lateswap ;
2008-01-09 00:37:17 +00:00
extern cvar_t vid_preservegamma ;
2004-08-22 22:29:09 +00:00
2016-12-13 11:50:15 +00:00
int window_x , window_y ;
static int window_width , window_height ;
int window_center_x , window_center_y ;
RECT window_rect ;
static LONG WINAPI GLMainWndProc ( HWND hWnd , UINT uMsg , WPARAM wParam , LPARAM lParam ) ;
static qboolean GLAppActivate ( BOOL fActive , BOOL minimize ) ;
static void ClearAllStates ( void ) ;
static void VID_UpdateWindowStatus ( HWND hWnd ) ;
static BOOL ( WINAPI * qGetDeviceGammaRamp ) ( HDC hDC , void * ramp ) ;
static BOOL ( WINAPI * qSetDeviceGammaRamp ) ( HDC hDC , void * ramp ) ;
//==========================================================
# ifdef USE_WGL
static HGLRC baseRC ;
static const char * wgl_extensions ;
static qboolean VID_AttachGL ( rendererstate_t * info ) ;
static BOOL bSetupPixelFormat ( HDC hDC , rendererstate_t * info ) ;
2017-02-19 00:15:42 +00:00
static BOOL CheckForcePixelFormat ( rendererstate_t * info ) ;
2016-12-13 11:50:15 +00:00
2009-11-04 21:16:50 +00:00
extern cvar_t vid_gl_context_version ;
extern cvar_t vid_gl_context_debug ;
2014-02-07 08:38:40 +00:00
extern cvar_t vid_gl_context_es ;
2009-11-04 21:16:50 +00:00
extern cvar_t vid_gl_context_forwardcompatible ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
extern cvar_t vid_gl_context_compatibility ;
2014-10-22 19:41:20 +00:00
extern cvar_t vid_gl_context_robustness ;
extern cvar_t vid_gl_context_selfreset ;
2017-06-21 01:24:25 +00:00
extern cvar_t vid_gl_context_noerror ;
2009-11-04 21:16:50 +00:00
2016-12-13 11:50:15 +00:00
static dllhandle_t * hInstGL = NULL ;
static dllhandle_t * hInstwgl = NULL ;
2011-10-27 16:16:29 +00:00
static qboolean usingminidriver ;
static char reqminidriver [ MAX_OSPATH ] ;
static char opengldllname [ MAX_OSPATH ] ;
2004-08-22 22:29:09 +00:00
2016-12-13 11:50:15 +00:00
static HGLRC ( WINAPI * qwglCreateContext ) ( HDC ) ;
static BOOL ( WINAPI * qwglDeleteContext ) ( HGLRC ) ;
static HGLRC ( WINAPI * qwglGetCurrentContext ) ( VOID ) ;
static HDC ( WINAPI * qwglGetCurrentDC ) ( VOID ) ;
static PROC ( WINAPI * qwglGetProcAddress ) ( LPCSTR ) ;
static BOOL ( WINAPI * qwglMakeCurrent ) ( HDC , HGLRC ) ;
static BOOL ( WINAPI * qSwapBuffers ) ( HDC ) ;
static BOOL ( WINAPI * qwglSwapLayerBuffers ) ( HDC , UINT ) ;
static int ( WINAPI * qChoosePixelFormat ) ( HDC , CONST PIXELFORMATDESCRIPTOR * ) ;
static BOOL ( WINAPI * qSetPixelFormat ) ( HDC , int , CONST PIXELFORMATDESCRIPTOR * ) ;
static int ( WINAPI * qDescribePixelFormat ) ( HDC , int , UINT , LPPIXELFORMATDESCRIPTOR ) ;
static BOOL ( WINAPI * qwglSwapIntervalEXT ) ( int ) ;
static BOOL ( APIENTRY * qwglChoosePixelFormatARB ) ( HDC hdc , const int * piAttribIList , const FLOAT * pfAttribFList , UINT nMaxFormats , int * piFormats , UINT * nNumFormats ) ;
2017-07-12 08:15:27 +00:00
static BOOL ( APIENTRY * qwglGetPixelFormatAttribfvARB ) ( HDC hdc , int iPixelFormat , int iLayerPlane , UINT nAttributes , int * piAttributes , FLOAT * pfValues ) ;
2016-12-13 11:50:15 +00:00
static HGLRC ( APIENTRY * qwglCreateContextAttribsARB ) ( HDC hDC , HGLRC hShareContext , const int * attribList ) ;
2017-06-21 01:24:25 +00:00
# define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
# define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
# define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
# define WGL_CONTEXT_FLAGS_ARB 0x2094
# define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
# define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
# define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x0004 /*WGL_ARB_create_context_robustness*/
# define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 /*WGL_ARB_create_context_profile*/
# define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
# define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
# define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 /*WGL_CONTEXT_ES2_PROFILE_BIT_EXT*/
# define ERROR_INVALID_VERSION_ARB 0x2095
# define ERROR_INVALID_PROFILE_ARB 0x2096
2016-12-13 11:50:15 +00:00
# define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 /*WGL_ARB_create_context_robustness*/
# define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
# define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
2017-06-21 01:24:25 +00:00
# define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 /*WGL_ARB_create_context_no_error*/
2016-12-13 11:50:15 +00:00
//pixel format stuff
# define WGL_DRAW_TO_WINDOW_ARB 0x2001
# define WGL_ACCELERATION_ARB 0x2003
# define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
# define WGL_SUPPORT_OPENGL_ARB 0x2010
# define WGL_DOUBLE_BUFFER_ARB 0x2011
# define WGL_STEREO_ARB 0x2012
# define WGL_COLOR_BITS_ARB 0x2014
# define WGL_ALPHA_BITS_ARB 0x201B
# define WGL_DEPTH_BITS_ARB 0x2022
# define WGL_STENCIL_BITS_ARB 0x2023
# define WGL_FULL_ACCELERATION_ARB 0x2027
2018-03-04 14:41:16 +00:00
# define WGL_PIXEL_TYPE_ARB 0x2013
# define WGL_TYPE_RGBA_ARB 0x202B
# define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
# define WGL_RED_BITS_ARB 0x2015
# define WGL_GREEN_BITS_ARB 0x2017
# define WGL_BLUE_BITS_ARB 0x2019
2016-12-13 11:50:15 +00:00
2012-04-24 07:59:11 +00:00
# ifdef _DEBUG
2014-02-07 08:38:40 +00:00
//this is a list of the functions that exist in opengles2, as well as wglCreateContextAttribsARB.
//functions not in this list *should* be stubs that just return errors, but we can't always depend on drivers for that... they shouldn't get called.
//this list is just to make it easier to test+debug android gles2 stuff using windows.
2012-04-24 07:59:11 +00:00
static char * gles2funcs [ ] =
{
# define f(n) #n,
f ( glActiveTexture )
f ( glAttachShader )
f ( glBindAttribLocation )
f ( glBindBuffer )
f ( glBindFramebuffer )
f ( glBindRenderbuffer )
f ( glBindTexture )
f ( glBlendColor )
f ( glBlendEquation )
f ( glBlendEquationSeparate )
f ( glBlendFunc )
f ( glBlendFuncSeparate )
f ( glBufferData )
f ( glBufferSubData )
f ( glCheckFramebufferStatus )
f ( glClear )
f ( glClearColor )
f ( glClearDepthf )
f ( glClearStencil )
f ( glColorMask )
f ( glCompileShader )
f ( glCompressedTexImage2D )
f ( glCompressedTexSubImage2D )
f ( glCopyTexImage2D )
f ( glCopyTexSubImage2D )
f ( glCreateProgram )
f ( glCreateShader )
f ( glCullFace )
f ( glDeleteBuffers )
f ( glDeleteFramebuffers )
f ( glDeleteProgram )
f ( glDeleteRenderbuffers )
f ( glDeleteShader )
f ( glDeleteTextures )
f ( glDepthFunc )
f ( glDepthMask )
f ( glDepthRangef )
f ( glDetachShader )
f ( glDisable )
f ( glDisableVertexAttribArray )
f ( glDrawArrays )
f ( glDrawElements )
f ( glEnable )
f ( glEnableVertexAttribArray )
f ( glFinish )
f ( glFlush )
f ( glFramebufferRenderbuffer )
f ( glFramebufferTexture2D )
f ( glFrontFace )
f ( glGenBuffers )
f ( glGenerateMipmap )
f ( glGenFramebuffers )
f ( glGenRenderbuffers )
f ( glGenTextures )
f ( glGetActiveAttrib )
f ( glGetActiveUniform )
f ( glGetAttachedShaders )
f ( glGetAttribLocation )
f ( glGetBooleanv )
f ( glGetBufferParameteriv )
f ( glGetError )
f ( glGetFloatv )
f ( glGetFramebufferAttachmentParameteriv )
f ( glGetIntegerv )
f ( glGetProgramiv )
f ( glGetProgramInfoLog )
f ( glGetRenderbufferParameteriv )
f ( glGetShaderiv )
f ( glGetShaderInfoLog )
f ( glGetShaderPrecisionFormat )
f ( glGetShaderSource )
f ( glGetString )
f ( glGetTexParameterfv )
f ( glGetTexParameteriv )
f ( glGetUniformfv )
f ( glGetUniformiv )
f ( glGetUniformLocation )
f ( glGetVertexAttribfv )
f ( glGetVertexAttribiv )
f ( glGetVertexAttribPointerv )
f ( glHint )
f ( glIsBuffer )
f ( glIsEnabled )
f ( glIsFramebuffer )
f ( glIsProgram )
f ( glIsRenderbuffer )
f ( glIsShader )
f ( glIsTexture )
f ( glLineWidth )
f ( glLinkProgram )
f ( glPixelStorei )
f ( glPolygonOffset )
f ( glReadPixels )
f ( glReleaseShaderCompiler )
f ( glRenderbufferStorage )
f ( glSampleCoverage )
f ( glScissor )
f ( glShaderBinary )
f ( glShaderSource )
f ( glStencilFunc )
f ( glStencilFuncSeparate )
f ( glStencilMask )
f ( glStencilMaskSeparate )
f ( glStencilOp )
f ( glStencilOpSeparate )
f ( glTexImage2D )
f ( glTexParameterf )
f ( glTexParameterfv )
f ( glTexParameteri )
f ( glTexParameteriv )
f ( glTexSubImage2D )
f ( glUniform1f )
f ( glUniform1fv )
f ( glUniform1i )
f ( glUniform1iv )
f ( glUniform2f )
f ( glUniform2fv )
f ( glUniform2i )
f ( glUniform2iv )
f ( glUniform3f )
f ( glUniform3fv )
f ( glUniform3i )
f ( glUniform3iv )
f ( glUniform4f )
f ( glUniform4fv )
f ( glUniform4i )
f ( glUniform4iv )
f ( glUniformMatrix2fv )
f ( glUniformMatrix3fv )
f ( glUniformMatrix4fv )
f ( glUseProgram )
f ( glValidateProgram )
f ( glVertexAttrib1f )
f ( glVertexAttrib1fv )
f ( glVertexAttrib2f )
f ( glVertexAttrib2fv )
f ( glVertexAttrib3f )
f ( glVertexAttrib3fv )
f ( glVertexAttrib4f )
f ( glVertexAttrib4fv )
f ( glVertexAttribPointer )
f ( glViewport )
f ( wglCreateContextAttribsARB )
NULL
} ;
2015-09-14 10:36:42 +00:00
//this is a list of the functions that exist in opengles2, as well as wglCreateContextAttribsARB.
//functions not in this list *should* be stubs that just return errors, but we can't always depend on drivers for that... they shouldn't get called.
//this list is just to make it easier to test+debug android gles2 stuff using windows.
static char * gles1funcs [ ] =
{
# define f(n) #n,
/* Available only in Common profile */
f ( glAlphaFunc )
f ( glClearColor )
f ( glClearDepthf )
f ( glClipPlanef )
f ( glColor4f )
f ( glDepthRangef )
f ( glFogf )
f ( glFogfv )
f ( glFrustumf )
f ( glGetClipPlanef )
f ( glGetFloatv )
f ( glGetLightfv )
f ( glGetMaterialfv )
f ( glGetTexEnvfv )
f ( glGetTexParameterfv )
f ( glLightModelf )
f ( glLightModelfv )
f ( glLightf )
f ( glLightfv )
f ( glLineWidth )
f ( glLoadMatrixf )
f ( glMaterialf )
f ( glMaterialfv )
f ( glMultMatrixf )
f ( glMultiTexCoord4f )
f ( glNormal3f )
f ( glOrthof )
f ( glPointParameterf )
f ( glPointParameterfv )
f ( glPointSize )
f ( glPolygonOffset )
f ( glRotatef )
f ( glScalef )
f ( glTexEnvf )
f ( glTexEnvfv )
f ( glTexParameterf )
f ( glTexParameterfv )
f ( glTranslatef )
/* Available in both Common and Common-Lite profiles */
f ( glActiveTexture )
f ( glAlphaFuncx )
f ( glBindBuffer )
f ( glBindTexture )
f ( glBlendFunc )
f ( glBufferData )
f ( glBufferSubData )
f ( glClear )
f ( glClearColorx )
f ( glClearDepthx )
f ( glClearStencil )
f ( glClientActiveTexture )
f ( glClipPlanex )
f ( glColor4ub )
f ( glColor4x )
f ( glColorMask )
f ( glColorPointer )
f ( glCompressedTexImage2D )
f ( glCompressedTexSubImage2D )
f ( glCopyTexImage2D )
f ( glCopyTexSubImage2D )
f ( glCullFace )
f ( glDeleteBuffers )
f ( glDeleteTextures )
f ( glDepthFunc )
f ( glDepthMask )
f ( glDepthRangex )
f ( glDisable )
f ( glDisableClientState )
f ( glDrawArrays )
f ( glDrawElements )
f ( glEnable )
f ( glEnableClientState )
f ( glFinish )
f ( glFlush )
f ( glFogx )
f ( glFogxv )
f ( glFrontFace )
f ( glFrustumx )
f ( glGetBooleanv )
f ( glGetBufferParameteriv )
f ( glGetClipPlanex )
f ( glGenBuffers )
f ( glGenTextures )
f ( glGetError )
f ( glGetFixedv )
f ( glGetIntegerv )
f ( glGetLightxv )
f ( glGetMaterialxv )
f ( glGetPointerv )
f ( glGetString )
f ( glGetTexEnviv )
f ( glGetTexEnvxv )
f ( glGetTexParameteriv )
f ( glGetTexParameterxv )
f ( glHint )
f ( glIsBuffer )
f ( glIsEnabled )
f ( glIsTexture )
f ( glLightModelx )
f ( glLightModelxv )
f ( glLightx )
f ( glLightxv )
f ( glLineWidthx )
f ( glLoadIdentity )
f ( glLoadMatrixx )
f ( glLogicOp )
f ( glMaterialx )
f ( glMaterialxv )
f ( glMatrixMode )
f ( glMultMatrixx )
f ( glMultiTexCoord4x )
f ( glNormal3x )
f ( glNormalPointer )
f ( glOrthox )
f ( glPixelStorei )
f ( glPointParameterx )
f ( glPointParameterxv )
f ( glPointSizex )
f ( glPolygonOffsetx )
f ( glPopMatrix )
f ( glPushMatrix )
f ( glReadPixels )
f ( glRotatex )
f ( glSampleCoverage )
f ( glSampleCoveragex )
f ( glScalex )
f ( glScissor )
f ( glShadeModel )
f ( glStencilFunc )
f ( glStencilMask )
f ( glStencilOp )
f ( glTexCoordPointer )
f ( glTexEnvi )
f ( glTexEnvx )
f ( glTexEnviv )
f ( glTexEnvxv )
f ( glTexImage2D )
f ( glTexParameteri )
f ( glTexParameterx )
f ( glTexParameteriv )
f ( glTexParameterxv )
f ( glTexSubImage2D )
f ( glTranslatex )
f ( glVertexPointer )
f ( glViewport )
/*required to switch stuff around*/
f ( wglCreateContextAttribsARB )
NULL
} ;
2012-04-24 07:59:11 +00:00
# endif
2004-08-22 22:29:09 +00:00
//just GetProcAddress with a safty net.
2016-12-13 11:50:15 +00:00
static void * getglfunc ( char * name )
2004-08-22 22:29:09 +00:00
{
FARPROC proc ;
proc = qwglGetProcAddress ? qwglGetProcAddress ( name ) : NULL ;
if ( ! proc )
{
proc = GetProcAddress ( hInstGL , name ) ;
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: getglfunc: gpa %s: success %i \n " , name , ! ! proc ) ) ;
2004-08-22 22:29:09 +00:00
}
2012-04-24 07:59:11 +00:00
else
{
TRACE ( ( " dbg: getglfunc: glgpa %s: success %i \n " , name , ! ! proc ) ) ;
}
# ifdef _DEBUG
2015-09-14 10:36:42 +00:00
if ( vid_gl_context_es . ival = = 3 )
{
int i ;
for ( i = 0 ; gles1funcs [ i ] ; i + + )
{
if ( ! strcmp ( name , gles1funcs [ i ] ) )
return proc ;
}
return NULL ;
}
2014-02-07 08:38:40 +00:00
if ( vid_gl_context_es . ival = = 2 )
2012-04-24 07:59:11 +00:00
{
int i ;
for ( i = 0 ; gles2funcs [ i ] ; i + + )
{
if ( ! strcmp ( name , gles2funcs [ i ] ) )
return proc ;
}
return NULL ;
}
# endif
2004-08-22 22:29:09 +00:00
return proc ;
}
2016-12-13 11:50:15 +00:00
static void * getwglfunc ( char * name )
2004-08-22 22:29:09 +00:00
{
FARPROC proc ;
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: getwglfunc: %s: getting \n " , name ) ) ;
2010-07-11 02:22:39 +00:00
2004-08-22 22:29:09 +00:00
proc = GetProcAddress ( hInstGL , name ) ;
if ( ! proc )
{
if ( ! hInstwgl )
2004-10-07 13:13:15 +00:00
{
TRACE ( ( " dbg: getwglfunc: explicitly loading opengl32.dll \n " , name ) ) ;
2015-05-14 03:06:58 +00:00
hInstwgl = LoadLibraryA ( " opengl32.dll " ) ;
2004-10-07 13:13:15 +00:00
}
TRACE ( ( " dbg: getwglfunc: %s: wglgetting \n " , name ) ) ;
2004-08-22 22:29:09 +00:00
proc = GetProcAddress ( hInstwgl , name ) ;
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: getwglfunc: gpa %s: success %i \n " , name , ! ! proc ) ) ;
2004-08-22 22:29:09 +00:00
if ( ! proc )
Sys_Error ( " GL function %s was not found in %s \n Possibly you do not have a full enough gl implementation " , name , opengldllname ) ;
}
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: getwglfunc: glgpa %s: success %i \n " , name , ! ! proc ) ) ;
2004-08-22 22:29:09 +00:00
return proc ;
}
2016-12-13 11:50:15 +00:00
static qboolean shouldforcepixelformat ;
static int forcepixelformat ;
static int currentpixelformat ;
2006-03-15 20:11:37 +00:00
2016-12-13 11:50:15 +00:00
static qboolean GLInitialise ( char * renderer )
2004-08-22 22:29:09 +00:00
{
2011-06-16 02:03:57 +00:00
if ( ! hInstGL | | strcmp ( reqminidriver , renderer ) )
2005-04-26 16:04:12 +00:00
{
2011-10-27 16:16:29 +00:00
usingminidriver = false ;
2005-04-26 16:04:12 +00:00
if ( hInstGL )
2015-05-14 03:06:58 +00:00
Sys_CloseLibrary ( hInstGL ) ;
2011-06-16 02:03:57 +00:00
hInstGL = NULL ;
if ( hInstwgl )
2015-05-14 03:06:58 +00:00
Sys_CloseLibrary ( hInstwgl ) ;
2011-06-16 02:03:57 +00:00
hInstwgl = NULL ;
2011-05-19 13:34:07 +00:00
2011-06-16 02:03:57 +00:00
Q_strncpyz ( reqminidriver , renderer , sizeof ( reqminidriver ) ) ;
Q_strncpyz ( opengldllname , renderer , sizeof ( opengldllname ) ) ;
2005-04-26 16:04:12 +00:00
2012-02-13 04:11:11 +00:00
if ( * renderer & & stricmp ( renderer , " opengl32.dll " ) & & stricmp ( renderer , " opengl32 " ) )
2011-06-16 02:03:57 +00:00
{
2015-06-04 06:15:14 +00:00
unsigned int emode = SetErrorMode ( SEM_FAILCRITICALERRORS ) ; /*no annoying errors if they use glide*/
2011-06-16 02:03:57 +00:00
Con_DPrintf ( " Loading renderer dll \" %s \" " , renderer ) ;
2015-05-14 03:06:58 +00:00
hInstGL = Sys_LoadLibrary ( opengldllname , NULL ) ;
2015-06-04 06:15:14 +00:00
SetErrorMode ( emode ) ;
2011-06-16 02:03:57 +00:00
if ( hInstGL )
2011-10-27 16:16:29 +00:00
{
usingminidriver = true ;
2011-06-16 02:03:57 +00:00
Con_DPrintf ( " Success \n " ) ;
2011-10-27 16:16:29 +00:00
}
2011-06-16 02:03:57 +00:00
else
Con_DPrintf ( " Failed \n " ) ;
}
2005-04-26 16:04:12 +00:00
else
2011-06-16 02:03:57 +00:00
hInstGL = NULL ;
2015-09-01 04:45:15 +00:00
if ( ! hInstGL )
{ //gog has started shipping glquake using a 3dfxopengl->nglide->direct3d chain of wrappers.
//this bypasses issues with (not that) recent gl drivers giving up on limiting extension string lengths and paletted textures
//instead, we explicitly try to use the opengl32.dll from the windows system32 directory to try and avoid using the wrapper.
unsigned int emode ;
wchar_t wbuffer [ MAX_OSPATH ] ;
GetSystemDirectoryW ( wbuffer , countof ( wbuffer ) ) ;
narrowen ( opengldllname , sizeof ( opengldllname ) , wbuffer ) ;
Q_strncatz ( opengldllname , " \\ opengl32.dll " , sizeof ( opengldllname ) ) ;
Con_DPrintf ( " Loading renderer dll \" %s \" " , opengldllname ) ;
emode = SetErrorMode ( SEM_FAILCRITICALERRORS ) ;
hInstGL = Sys_LoadLibrary ( opengldllname , NULL ) ;
SetErrorMode ( emode ) ;
if ( hInstGL )
Con_DPrintf ( " Success \n " ) ;
else
Con_DPrintf ( " Failed \n " ) ;
}
2011-06-16 02:03:57 +00:00
if ( ! hInstGL )
{
unsigned int emode ;
strcpy ( opengldllname , " opengl32 " ) ;
Con_DPrintf ( " Loading renderer dll \" %s \" " , opengldllname ) ;
emode = SetErrorMode ( SEM_FAILCRITICALERRORS ) ; /*no annoying errors if they use glide*/
2015-05-14 03:06:58 +00:00
hInstGL = Sys_LoadLibrary ( opengldllname , NULL ) ;
2011-06-16 02:03:57 +00:00
SetErrorMode ( emode ) ;
if ( hInstGL )
Con_DPrintf ( " Success \n " ) ;
else
Con_DPrintf ( " Failed \n " ) ;
}
if ( ! hInstGL )
{
if ( * renderer )
Con_Printf ( " Couldn't load %s or %s \n " , renderer , opengldllname ) ;
else
Con_Printf ( " Couldn't load %s \n " , opengldllname ) ;
return false ;
}
2004-12-24 08:45:56 +00:00
}
2011-06-16 02:03:57 +00:00
else
2004-08-22 22:29:09 +00:00
{
2011-06-16 02:03:57 +00:00
Con_DPrintf ( " Reusing renderer dll %s \n " , opengldllname ) ;
2004-08-22 22:29:09 +00:00
}
2004-12-24 08:45:56 +00:00
Con_DPrintf ( " Loaded renderer dll %s \n " , opengldllname ) ;
2004-10-07 13:13:15 +00:00
2004-08-22 22:29:09 +00:00
// windows dependant
qwglCreateContext = ( void * ) getwglfunc ( " wglCreateContext " ) ;
qwglDeleteContext = ( void * ) getwglfunc ( " wglDeleteContext " ) ;
qwglGetCurrentContext = ( void * ) getwglfunc ( " wglGetCurrentContext " ) ;
qwglGetCurrentDC = ( void * ) getwglfunc ( " wglGetCurrentDC " ) ;
qwglGetProcAddress = ( void * ) getwglfunc ( " wglGetProcAddress " ) ;
qwglMakeCurrent = ( void * ) getwglfunc ( " wglMakeCurrent " ) ;
2011-10-27 16:16:29 +00:00
if ( usingminidriver )
{
2015-03-03 00:14:43 +00:00
qwglSwapLayerBuffers = NULL ;
2011-10-27 16:16:29 +00:00
qSwapBuffers = ( void * ) getglfunc ( " wglSwapBuffers " ) ;
qChoosePixelFormat = ( void * ) getglfunc ( " wglChoosePixelFormat " ) ;
qSetPixelFormat = ( void * ) getglfunc ( " wglSetPixelFormat " ) ;
qDescribePixelFormat = ( void * ) getglfunc ( " wglDescribePixelFormat " ) ;
}
else
{
2015-06-04 06:15:14 +00:00
qwglSwapLayerBuffers = NULL ; //(void *)getwglfunc("wglSwapLayerBuffers");
2011-10-27 16:16:29 +00:00
qSwapBuffers = SwapBuffers ;
qChoosePixelFormat = ChoosePixelFormat ;
qSetPixelFormat = SetPixelFormat ;
qDescribePixelFormat = DescribePixelFormat ;
}
2004-08-22 22:29:09 +00:00
2006-02-11 02:05:15 +00:00
qGetDeviceGammaRamp = ( void * ) getglfunc ( " wglGetDeviceGammaRamp3DFX " ) ;
qSetDeviceGammaRamp = ( void * ) getglfunc ( " wglSetDeviceGammaRamp3DFX " ) ;
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: GLInitialise: got wgl funcs \n " ) ) ;
2004-08-22 22:29:09 +00:00
return true ;
}
2016-12-13 11:50:15 +00:00
static void ReleaseGL ( void )
{
HGLRC hRC ;
HDC hDC = NULL ;
if ( qwglGetCurrentContext )
{
hRC = qwglGetCurrentContext ( ) ;
hDC = qwglGetCurrentDC ( ) ;
qwglMakeCurrent ( NULL , NULL ) ;
if ( hRC )
qwglDeleteContext ( hRC ) ;
}
qwglGetCurrentContext = NULL ;
if ( hDC & & dibwindow )
ReleaseDC ( dibwindow , hDC ) ;
}
# endif //USE_WGL
# ifdef VKQUAKE
static dllhandle_t * hInstVulkan = NULL ;
static qboolean Win32VK_CreateSurface ( void )
{
VkResult err ;
VkWin32SurfaceCreateInfoKHR createInfo = { VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR } ;
createInfo . flags = 0 ;
createInfo . hinstance = GetModuleHandle ( NULL ) ;
createInfo . hwnd = mainwindow ;
err = vkCreateWin32SurfaceKHR ( vk . instance , & createInfo , NULL , & vk . surface ) ;
switch ( err )
{
default :
Con_Printf ( " Unknown vulkan device creation error: %x \n " , err ) ;
return false ;
case VK_SUCCESS :
break ;
}
return true ;
}
# ifdef WTHREAD
static void Win32VK_Present ( struct vkframe * theframe )
{
// if (theframe)
2017-06-21 01:24:25 +00:00
// PostMessage(mainwindow, WM_USER_VKPRESENT, 0, (LPARAM)theframe);
2016-12-13 11:50:15 +00:00
// else
2017-06-21 01:24:25 +00:00
SendMessage ( mainwindow , WM_USER_VKPRESENT , 0 , ( LPARAM ) theframe ) ;
2016-12-13 11:50:15 +00:00
}
# else
# define Win32VK_Present NULL
# endif
static qboolean Win32VK_AttachVulkan ( rendererstate_t * info )
{ //make sure we can get a valid renderer.
2017-09-20 11:27:13 +00:00
const char * extnames [ ] = { VK_KHR_WIN32_SURFACE_EXTENSION_NAME , NULL } ;
2016-12-13 11:50:15 +00:00
# ifdef VK_NO_PROTOTYPES
hInstVulkan = NULL ;
if ( ! hInstVulkan )
hInstVulkan = * info - > subrenderer ? LoadLibrary ( info - > subrenderer ) : NULL ;
if ( ! hInstVulkan )
hInstVulkan = LoadLibrary ( " vulkan-1.dll " ) ;
if ( ! hInstVulkan )
{
Con_Printf ( " Unable to load vulkan-1.dll \n No Vulkan drivers are installed \n " ) ;
return false ;
}
vkGetInstanceProcAddr = ( PFN_vkGetInstanceProcAddr ) GetProcAddress ( hInstVulkan , " vkGetInstanceProcAddr " ) ;
# endif
2017-09-20 11:27:13 +00:00
return VK_Init ( info , extnames , Win32VK_CreateSurface , Win32VK_Present ) ;
2016-12-13 11:50:15 +00:00
}
# endif
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
# if defined(VKQUAKE) && defined(USE_WGL)
# define GLuint64 quint64_t
# define GLchar char
static PFN_vkVoidFunction ( WINAPI * qglGetVkProcAddrNV ) ( const GLchar * name ) ;
static void ( WINAPI * qglDrawVkImageNV ) ( GLuint64 vkImage , GLuint sampler , GLfloat x0 , GLfloat y0 , GLfloat x1 , GLfloat y1 , GLfloat z , GLfloat s0 , GLfloat t0 , GLfloat s1 , GLfloat t1 ) ;
static void ( WINAPI * qglWaitVkSemaphoreNV ) ( GLuint64 vkSemaphore ) ;
static void ( WINAPI * qglSignalVkSemaphoreNV ) ( GLuint64 vkSemaphore ) ;
static void ( WINAPI * qglSignalVkFenceNV ) ( GLuint64 vkFence ) ;
static PFN_vkVoidFunction VKAPI_CALL nvvkGetInstanceProcAddr ( VkInstance instance , const char * pName )
{
//nvidia do not make this easy.
PFN_vkVoidFunction fnc ;
// qwglMakeCurrent(maindc, baseRC);
fnc = qglGetVkProcAddrNV ( pName ) ;
// qwglMakeCurrent(maindc, NULL);
return fnc ;
}
static qboolean Win32NVVK_CreateSurface ( void )
{
vk . surface = VK_NULL_HANDLE ;
// vk.allowsubmissionthread = false; //must come on the main thread, because that's the one with the gl context.
//I seem to be getting crashes on vulkan's fences if I try giving ownership of the gl context to a different thread (instead of main).
return true ;
}
static void Win32NVVK_Present ( struct vkframe * theframe )
{
2017-06-21 01:24:25 +00:00
SendMessage ( mainwindow , WM_USER_NVVKPRESENT , 0 , ( LPARAM ) theframe ) ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
}
static void Win32NVVK_DoPresent ( struct vkframe * theframe )
{
VkFence fence ;
RSpeedLocals ( ) ;
if ( ! theframe )
return ; //this is used to ensure some presentation thread has woken up. we're not threading this, hopefully the gl server will do any of that that's needed.
RSpeedRemark ( ) ;
//this might be a submission thread, so make sure we're talking to the right opengl context...
// qwglMakeCurrent(maindc, baseRC);
//get the gl driver to wait for the vk driver to finish rendering the frame
2017-08-14 16:38:44 +00:00
qglWaitVkSemaphoreNV ( ( GLuint64 ) theframe - > backbuf - > presentsemaphore ) ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
//tell the gl driver to copy it over now
2017-08-14 16:38:44 +00:00
qglDrawVkImageNV ( ( GLuint64 ) theframe - > backbuf - > colour . image , ( GLuint64 ) theframe - > backbuf - > colour . sampler ,
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
0 , 0 , vid . pixelwidth , vid . pixelheight , //xywh (window coords)
0 , //z
0 , 1 , 1 , 0 ) ; //stst (remember that gl textures are meant to be upside down)
//and tell our code to expect it.
2020-06-27 19:31:55 +00:00
vk . acquirebufferidx [ vk . acquirelast % ACQUIRELIMIT ] = vk . acquirelast % vk . backbuf_count ;
fence = vk . acquirefences [ vk . acquirelast % ACQUIRELIMIT ] ;
vk . acquirelast + + ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
//and actually signal it, so our code can wake up.
2017-08-14 16:38:44 +00:00
qglSignalVkFenceNV ( ( GLuint64 ) fence ) ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
//and the gl driver has its final image and should do something with it now.
qSwapBuffers ( maindc ) ;
// qwglMakeCurrent(maindc, NULL);
RSpeedEnd ( RSPEED_PRESENT ) ;
}
static qboolean WGL_CheckExtension ( char * extname ) ;
static qboolean Win32NVVK_AttachVulkan ( rendererstate_t * info )
{ //make sure we can get a valid renderer.
if ( ! GL_CheckExtension ( " GL_NV_draw_vulkan_image " ) )
{
Con_Printf ( " GL_NV_draw_vulkan_image is not supported. Try using real vulkan instead. \n " ) ;
return false ;
}
qglGetVkProcAddrNV = getglfunc ( " glGetVkProcAddrNV " ) ;
qglDrawVkImageNV = getglfunc ( " glDrawVkImageNV " ) ;
qglWaitVkSemaphoreNV = getglfunc ( " glWaitVkSemaphoreNV " ) ;
qglSignalVkSemaphoreNV = getglfunc ( " glSignalVkSemaphoreNV " ) ;
qglSignalVkFenceNV = getglfunc ( " glSignalVkFenceNV " ) ;
vkGetInstanceProcAddr = nvvkGetInstanceProcAddr ;
// qwglMakeCurrent(maindc, NULL);
return VK_Init ( info , NULL , Win32NVVK_CreateSurface , Win32NVVK_Present ) ;
}
# endif
2011-04-30 17:21:10 +00:00
/*doesn't consider parent offsets*/
2016-12-13 11:50:15 +00:00
static RECT centerrect ( unsigned int parentleft , unsigned int parenttop , unsigned int parentwidth , unsigned int parentheight , unsigned int cwidth , unsigned int cheight )
2004-08-22 22:29:09 +00:00
{
2011-04-30 17:21:10 +00:00
RECT r ;
2014-06-12 23:08:42 +00:00
if ( modestate ! = MS_WINDOWED )
{
if ( ! vid_width . ival )
cwidth = parentwidth ;
if ( ! vid_height . ival )
cheight = parentwidth ;
}
2011-04-30 17:21:10 +00:00
if ( parentwidth < cwidth )
{
2011-10-27 16:16:29 +00:00
r . left = parentleft ;
r . right = r . left + parentwidth ;
2011-04-30 17:21:10 +00:00
}
else
{
2011-10-27 16:16:29 +00:00
r . left = parentleft + ( parentwidth - cwidth ) / 2 ;
2011-04-30 17:21:10 +00:00
r . right = r . left + cwidth ;
}
if ( parentheight < cheight )
{
2011-10-27 16:16:29 +00:00
r . top = parenttop ;
r . bottom = r . top + parentheight ;
2011-04-30 17:21:10 +00:00
}
else
{
2011-10-27 16:16:29 +00:00
r . top = parenttop + ( parentheight - cheight ) / 2 ;
2011-04-30 17:21:10 +00:00
r . bottom = r . top + cheight ;
}
return r ;
2004-08-22 22:29:09 +00:00
}
2014-09-02 02:44:43 +00:00
2016-07-12 00:40:13 +00:00
static qboolean VID_SetWindowedMode ( rendererstate_t * info )
2004-08-22 22:29:09 +00:00
//qboolean VID_SetWindowedMode (int modenum)
{
int i ;
HDC hdc ;
2013-06-24 09:04:00 +00:00
int wwidth , wheight , pleft , ptop , pwidth , pheight ;
2004-08-22 22:29:09 +00:00
2014-06-12 23:08:42 +00:00
modestate = MS_WINDOWED ;
2004-08-22 22:29:09 +00:00
hdc = GetDC ( NULL ) ;
if ( GetDeviceCaps ( hdc , RASTERCAPS ) & RC_PALETTE )
{
ReleaseDC ( NULL , hdc ) ;
Con_Printf ( " Can't run GL in non-RGB mode \n " ) ;
return false ;
}
2017-12-28 16:24:50 +00:00
vid . dpi_x = GetDeviceCaps ( hdc , LOGPIXELSX ) ;
vid . dpi_y = GetDeviceCaps ( hdc , LOGPIXELSY ) ;
2004-08-22 22:29:09 +00:00
ReleaseDC ( NULL , hdc ) ;
2014-02-09 09:25:28 +00:00
# ifndef FTE_SDL
2009-04-06 00:34:32 +00:00
if ( sys_parentwindow )
2009-04-01 22:03:56 +00:00
{
2009-04-06 00:34:32 +00:00
SetWindowLong ( sys_parentwindow , GWL_STYLE , GetWindowLong ( sys_parentwindow , GWL_STYLE ) | WS_OVERLAPPED ) ;
2009-04-01 22:03:56 +00:00
WindowStyle = WS_CHILDWINDOW | WS_OVERLAPPED ;
ExWindowStyle = 0 ;
2009-04-06 00:34:32 +00:00
2011-10-27 16:16:29 +00:00
pleft = sys_parentleft ;
ptop = sys_parenttop ;
2011-04-30 17:21:10 +00:00
pwidth = sys_parentwidth ;
pheight = sys_parentheight ;
2013-03-12 23:09:25 +00:00
2017-12-28 16:24:50 +00:00
wwidth = sys_parentwidth ;
wheight = sys_parentheight ;
2009-04-01 22:03:56 +00:00
}
else
2010-08-11 23:55:35 +00:00
# endif
2009-04-01 22:03:56 +00:00
{
WindowStyle = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_SYSMENU |
WS_MINIMIZEBOX ;
ExWindowStyle = 0 ;
2004-08-22 22:29:09 +00:00
2009-04-01 22:03:56 +00:00
WindowStyle | = WS_SIZEBOX | WS_MAXIMIZEBOX ;
2011-04-30 17:21:10 +00:00
2011-10-27 16:16:29 +00:00
pleft = 0 ;
ptop = 0 ;
2011-04-30 17:21:10 +00:00
pwidth = GetSystemMetrics ( SM_CXSCREEN ) ;
pheight = GetSystemMetrics ( SM_CYSCREEN ) ;
2017-12-28 16:24:50 +00:00
/*Assume dual monitors, and chop the width to try to put it on only one screen
" Because of app compatibility reasons these system metrics return the size of the primary monitor "
so we shouldn ' t need this . . .
*/
// if (pwidth >= pheight*2)
// pwidth /= 2;
wwidth = info - > width ;
wheight = info - > height ;
/*win8 code:
HMONITOR mod = MonitorFromRect ( & rect , MONITOR_DEFAULTTONEAREST ) ;
if ( mon ! = INVALID_HANDLE_VALUE )
GetDpiForMonitor ( mon , 0 , & vid . dpi_x , & vid . dpi_y ) ;
*/
2019-10-30 14:33:32 +00:00
// wwidth = (wwidth*vid.dpi_x)/96;
// wheight = (wheight*vid.dpi_y)/96;
2009-04-01 22:03:56 +00:00
}
2004-08-22 22:29:09 +00:00
2011-10-27 16:16:29 +00:00
WindowRect = centerrect ( pleft , ptop , pwidth , pheight , wwidth , wheight ) ;
2017-12-28 16:24:50 +00:00
if ( ! sys_parentwindow )
2018-01-03 04:40:06 +00:00
AdjustWindowRectEx ( & WindowRect , WindowStyle , FALSE , 0 ) ;
2011-04-30 17:21:10 +00:00
2004-08-22 22:29:09 +00:00
// Create the DIB window
2015-06-04 06:15:14 +00:00
if ( WinNT )
{
dibwindow = CreateWindowExW (
ExWindowStyle ,
WINDOW_CLASS_NAME_W ,
_L ( FULLENGINENAME ) ,
WindowStyle ,
WindowRect . left , WindowRect . top ,
WindowRect . right - WindowRect . left ,
WindowRect . bottom - WindowRect . top ,
sys_parentwindow ,
NULL ,
global_hInstance ,
NULL ) ;
}
else
{
dibwindow = CreateWindowExA (
ExWindowStyle ,
WINDOW_CLASS_NAME_A ,
FULLENGINENAME ,
WindowStyle ,
WindowRect . left , WindowRect . top ,
WindowRect . right - WindowRect . left ,
WindowRect . bottom - WindowRect . top ,
sys_parentwindow ,
NULL ,
global_hInstance ,
NULL ) ;
}
2004-08-22 22:29:09 +00:00
if ( ! dibwindow )
{
Con_Printf ( " Couldn't create DIB window " ) ;
return false ;
}
2017-12-28 16:24:50 +00:00
GetClientRect ( dibwindow , & WindowRect ) ;
WindowRect . right - = WindowRect . left ;
WindowRect . bottom - = WindowRect . top ;
DIBWidth = WindowRect . right ;
DIBHeight = WindowRect . bottom ;
2012-09-30 05:52:03 +00:00
SendMessage ( dibwindow , WM_SETICON , ( WPARAM ) TRUE , ( LPARAM ) hIcon ) ;
SendMessage ( dibwindow , WM_SETICON , ( WPARAM ) FALSE , ( LPARAM ) hIcon ) ;
2009-04-06 00:34:32 +00:00
if ( ! sys_parentwindow )
2009-04-01 22:03:56 +00:00
{
2009-04-06 00:34:32 +00:00
# ifdef WS_EX_LAYERED
int av ;
av = 255 * vid_wndalpha . value ;
if ( av < 70 )
av = 70 ;
if ( av < 255 )
{
2015-05-14 03:06:58 +00:00
HMODULE hm = GetModuleHandleA ( " user32.dll " ) ;
2009-04-06 00:34:32 +00:00
lpfnSetLayeredWindowAttributes pSetLayeredWindowAttributes ;
pSetLayeredWindowAttributes = ( void * ) GetProcAddress ( hm , " SetLayeredWindowAttributes " ) ;
if ( pSetLayeredWindowAttributes )
{
2011-05-19 13:34:07 +00:00
// Set WS_EX_LAYERED on this window
2009-04-06 00:34:32 +00:00
SetWindowLong ( dibwindow , GWL_EXSTYLE , GetWindowLong ( dibwindow , GWL_EXSTYLE ) | WS_EX_LAYERED ) ;
// Make this window 70% alpha
2009-07-25 11:05:06 +00:00
pSetLayeredWindowAttributes ( dibwindow , 0 , ( BYTE ) av , LWA_ALPHA ) ;
2009-04-06 00:34:32 +00:00
}
}
# endif
2009-04-01 22:03:56 +00:00
}
2011-04-30 17:21:10 +00:00
2019-10-30 14:33:32 +00:00
ShowWindow ( dibwindow , SW_SHOWNORMAL ) ;
2011-04-30 17:21:10 +00:00
SetFocus ( dibwindow ) ;
2004-08-22 22:29:09 +00:00
2006-03-15 20:11:37 +00:00
// ShowWindow (dibwindow, SW_SHOWDEFAULT);
// UpdateWindow (dibwindow);
2004-08-22 22:29:09 +00:00
// because we have set the background brush for the window to NULL
// (to avoid flickering when re-sizing the window on the desktop),
// we clear the window to black when created, otherwise it will be
// empty while Quake starts up.
hdc = GetDC ( dibwindow ) ;
PatBlt ( hdc , 0 , 0 , WindowRect . right , WindowRect . bottom , BLACKNESS ) ;
ReleaseDC ( dibwindow , hdc ) ;
if ( ( i = COM_CheckParm ( " -conwidth " ) ) ! = 0 )
2010-07-11 02:22:39 +00:00
vid . width = Q_atoi ( com_argv [ i + 1 ] ) ;
2004-08-22 22:29:09 +00:00
else
{
2010-07-11 02:22:39 +00:00
vid . width = 640 ;
2004-08-22 22:29:09 +00:00
}
2010-07-11 02:22:39 +00:00
vid . width & = 0xfff8 ; // make it a multiple of eight
2004-08-22 22:29:09 +00:00
2010-07-11 02:22:39 +00:00
if ( vid . width < 320 )
vid . width = 320 ;
2004-08-22 22:29:09 +00:00
// pick a conheight that matches with correct aspect
2010-07-11 02:22:39 +00:00
vid . height = vid . width * 3 / 4 ;
2004-08-22 22:29:09 +00:00
if ( ( i = COM_CheckParm ( " -conheight " ) ) ! = 0 )
2010-07-11 02:22:39 +00:00
vid . height = Q_atoi ( com_argv [ i + 1 ] ) ;
if ( vid . height < 200 )
vid . height = 200 ;
2004-08-22 22:29:09 +00:00
2010-07-11 02:22:39 +00:00
if ( vid . height > info - > height )
vid . height = info - > height ;
if ( vid . width > info - > width )
vid . width = info - > width ;
2004-08-22 22:29:09 +00:00
vid . numpages = 2 ;
mainwindow = dibwindow ;
vid_isfullscreen = false ;
2012-09-30 05:52:03 +00:00
CL_UpdateWindowTitle ( ) ;
2004-08-22 22:29:09 +00:00
return true ;
}
2016-07-12 00:40:13 +00:00
void GLVID_SetCaption ( const char * text )
2007-02-23 00:21:33 +00:00
{
2015-05-14 03:06:58 +00:00
wchar_t wide [ 2048 ] ;
widen ( wide , sizeof ( wide ) , text ) ;
SetWindowTextW ( mainwindow , wide ) ;
2007-02-23 00:21:33 +00:00
}
2016-07-12 00:40:13 +00:00
static qboolean VID_SetFullDIBMode ( rendererstate_t * info )
2004-08-22 22:29:09 +00:00
{
int i ;
HDC hdc ;
2013-06-24 09:04:00 +00:00
int wwidth , wheight ;
2004-08-22 22:29:09 +00:00
RECT rect ;
2015-01-21 18:18:37 +00:00
if ( info - > fullscreen ! = 2 )
2004-08-27 00:51:25 +00:00
{ //make windows change res.
2015-01-21 18:18:37 +00:00
modestate = MS_FULLDIB ;
2004-08-22 22:29:09 +00:00
gdevmode . dmFields = DM_PELSWIDTH | DM_PELSHEIGHT ;
if ( info - > bpp )
gdevmode . dmFields | = DM_BITSPERPEL ;
if ( info - > rate )
gdevmode . dmFields | = DM_DISPLAYFREQUENCY ;
2016-08-25 00:12:14 +00:00
if ( info - > bpp & & ( info - > bpp < 15 ) )
{ //low values get you a warning. otherwise only 16 and 32bit are allowed.
2015-06-04 06:15:14 +00:00
Con_Printf ( " Forcing at least 15bpp \n " ) ;
2006-04-14 01:55:12 +00:00
gdevmode . dmBitsPerPel = 16 ;
}
2016-08-25 00:12:14 +00:00
else if ( info - > bpp = = 16 )
gdevmode . dmBitsPerPel = 16 ;
else
gdevmode . dmBitsPerPel = 32 ;
2004-08-22 22:29:09 +00:00
gdevmode . dmDisplayFrequency = info - > rate ;
gdevmode . dmPelsWidth = info - > width ;
gdevmode . dmPelsHeight = info - > height ;
gdevmode . dmSize = sizeof ( gdevmode ) ;
if ( ChangeDisplaySettings ( & gdevmode , CDS_FULLSCREEN ) ! = DISP_CHANGE_SUCCESSFUL )
{
2018-04-19 17:30:39 +00:00
Con_SafePrintf ( ( gdevmode . dmFields & DM_DISPLAYFREQUENCY ) ? " Windows rejected mode %i*%i, %ibpp @%ihz \n " : " Windows rejected mode %i*%i, %ibpp \n " , ( int ) gdevmode . dmPelsWidth , ( int ) gdevmode . dmPelsHeight , ( int ) gdevmode . dmBitsPerPel , ( int ) gdevmode . dmDisplayFrequency ) ;
2004-08-22 22:29:09 +00:00
return false ;
}
}
2015-01-21 18:18:37 +00:00
else
{
modestate = MS_FULLWINDOW ;
}
2004-08-22 22:29:09 +00:00
WindowRect . top = WindowRect . left = 0 ;
WindowRect . right = info - > width ;
WindowRect . bottom = info - > height ;
DIBWidth = info - > width ;
DIBHeight = info - > height ;
WindowStyle = WS_POPUP ;
ExWindowStyle = 0 ;
rect = WindowRect ;
AdjustWindowRectEx ( & rect , WindowStyle , FALSE , 0 ) ;
wwidth = rect . right - rect . left ;
wheight = rect . bottom - rect . top ;
// Create the DIB window
2015-06-04 06:15:14 +00:00
if ( WinNT )
{
dibwindow = CreateWindowExW (
ExWindowStyle ,
WINDOW_CLASS_NAME_W ,
_L ( FULLENGINENAME ) ,
WindowStyle ,
rect . left , rect . top ,
wwidth ,
wheight ,
NULL ,
NULL ,
global_hInstance ,
NULL ) ;
}
else
{
dibwindow = CreateWindowExA (
ExWindowStyle ,
WINDOW_CLASS_NAME_A ,
FULLENGINENAME ,
WindowStyle ,
rect . left , rect . top ,
wwidth ,
wheight ,
NULL ,
NULL ,
global_hInstance ,
NULL ) ;
}
2004-08-22 22:29:09 +00:00
if ( ! dibwindow )
Sys_Error ( " Couldn't create DIB window " ) ;
2018-07-22 11:49:37 +00:00
{
BOOL fDisable = TRUE ;
DWORD qDWMWA_TRANSITIONS_FORCEDISABLED = 3 ;
HRESULT ( WINAPI * pDwmSetWindowAttribute ) ( HWND hWnd , DWORD dwAttribute , LPCVOID pvAttribute , DWORD cbAttribute ) ;
dllfunction_t dwm [ ] =
{
{ ( void * ) & pDwmSetWindowAttribute , " DwmSetWindowAttribute " } ,
{ NULL , NULL }
} ;
if ( Sys_LoadLibrary ( " dwmapi.dll " , dwm ) )
{
pDwmSetWindowAttribute ( dibwindow , qDWMWA_TRANSITIONS_FORCEDISABLED , & fDisable , sizeof ( fDisable ) ) ;
}
}
2012-09-30 05:52:03 +00:00
SendMessage ( dibwindow , WM_SETICON , ( WPARAM ) TRUE , ( LPARAM ) hIcon ) ;
SendMessage ( dibwindow , WM_SETICON , ( WPARAM ) FALSE , ( LPARAM ) hIcon ) ;
2015-01-21 18:18:37 +00:00
if ( modestate = = MS_FULLWINDOW )
2018-03-04 14:41:16 +00:00
ShowWindow ( dibwindow , SW_HIDE ) ; //SW_SHOWMAXIMIZED);
2015-01-21 18:18:37 +00:00
else
2018-03-04 14:41:16 +00:00
ShowWindow ( dibwindow , SW_HIDE ) ; //SW_SHOWDEFAULT);
2004-08-22 22:29:09 +00:00
UpdateWindow ( dibwindow ) ;
// Because we have set the background brush for the window to NULL
// (to avoid flickering when re-sizing the window on the desktop), we
// clear the window to black when created, otherwise it will be
// empty while Quake starts up.
hdc = GetDC ( dibwindow ) ;
PatBlt ( hdc , 0 , 0 , WindowRect . right , WindowRect . bottom , BLACKNESS ) ;
ReleaseDC ( dibwindow , hdc ) ;
if ( ( i = COM_CheckParm ( " -conwidth " ) ) ! = 0 )
2010-07-11 02:22:39 +00:00
vid . width = Q_atoi ( com_argv [ i + 1 ] ) ;
2004-08-22 22:29:09 +00:00
else
2010-07-11 02:22:39 +00:00
vid . width = 640 ;
2004-08-22 22:29:09 +00:00
2010-07-11 02:22:39 +00:00
vid . width & = 0xfff8 ; // make it a multiple of eight
2004-08-22 22:29:09 +00:00
2010-07-11 02:22:39 +00:00
if ( vid . width < 320 )
vid . width = 320 ;
2004-08-22 22:29:09 +00:00
// pick a conheight that matches with correct aspect
2010-07-11 02:22:39 +00:00
vid . height = vid . width * 3 / 4 ;
2004-08-22 22:29:09 +00:00
if ( ( i = COM_CheckParm ( " -conheight " ) ) ! = 0 )
2010-07-11 02:22:39 +00:00
vid . height = Q_atoi ( com_argv [ i + 1 ] ) ;
if ( vid . height < 200 )
vid . height = 200 ;
2004-08-22 22:29:09 +00:00
2010-07-11 02:22:39 +00:00
if ( vid . height > info - > height )
vid . height = info - > height ;
if ( vid . width > info - > width )
vid . width = info - > width ;
2004-08-22 22:29:09 +00:00
vid . numpages = 2 ;
// needed because we're not getting WM_MOVE messages fullscreen on NT
window_x = 0 ;
window_y = 0 ;
vid_isfullscreen = true ;
mainwindow = dibwindow ;
return true ;
}
2011-03-12 13:51:40 +00:00
extern qboolean gammaworks ;
2014-03-30 08:55:06 +00:00
static void Win_Touch_Init ( HWND wnd ) ;
2016-12-13 11:50:15 +00:00
# ifdef WTHREAD
static rendererstate_t * rs ;
static qboolean CreateMainWindow ( rendererstate_t * info , qboolean withthread ) ;
static int GLVID_WindowThread ( void * cond )
{
extern qboolean mouseshowtoggle ;
int cursor = 1 ;
MSG msg ;
HWND wnd ;
CreateMainWindow ( rs , false ) ;
wnd = mainwindow ;
Sys_ConditionSignal ( cond ) ;
while ( GetMessageW ( & msg , NULL , 0 , 0 ) )
{
// TranslateMessageW (&msg);
DispatchMessageW ( & msg ) ;
//ShowCursor is thread-local.
if ( cursor ! = mouseshowtoggle )
{
cursor = mouseshowtoggle ;
ShowCursor ( cursor ) ;
}
}
DestroyWindow ( wnd ) ;
return 0 ;
}
# endif
static qboolean CreateMainWindow ( rendererstate_t * info , qboolean withthread )
2004-08-22 22:29:09 +00:00
{
qboolean stat ;
2016-12-13 11:50:15 +00:00
# ifdef WTHREAD
2017-07-28 01:49:25 +00:00
if ( withthread & & vid_winthread . ival )
2016-12-13 11:50:15 +00:00
{
void * cond = Sys_CreateConditional ( ) ;
Sys_LockConditional ( cond ) ;
rs = info ;
windowthread = Sys_CreateThread ( " windowthread " , GLVID_WindowThread , cond , 0 , 0 ) ;
if ( ! Sys_ConditionWait ( cond ) )
Con_SafePrintf ( " Looks like the window thread isn't starting up \n " ) ;
Sys_UnlockConditional ( cond ) ;
Sys_DestroyConditional ( cond ) ;
return ! ! mainwindow ;
}
# endif
2015-06-04 06:15:14 +00:00
if ( WinNT )
{
WNDCLASSW wc ;
/* Register the frame class */
wc . style = CS_OWNDC ;
wc . lpfnWndProc = ( WNDPROC ) GLMainWndProc ;
wc . cbClsExtra = 0 ;
wc . cbWndExtra = 0 ;
wc . hInstance = global_hInstance ;
wc . hIcon = hIcon ;
wc . hCursor = hArrowCursor ;
wc . hbrBackground = NULL ;
wc . lpszMenuName = 0 ;
wc . lpszClassName = WINDOW_CLASS_NAME_W ;
if ( ! RegisterClassW ( & wc ) ) //this isn't really fatal, we'll let the CreateWindow fail instead.
2016-07-12 00:40:13 +00:00
Con_DPrintf ( " RegisterClass failed \n " ) ;
2015-06-04 06:15:14 +00:00
}
else
{
WNDCLASSA wc ;
/* Register the frame class */
wc . style = CS_OWNDC ;
wc . lpfnWndProc = ( WNDPROC ) GLMainWndProc ;
wc . cbClsExtra = 0 ;
wc . cbWndExtra = 0 ;
wc . hInstance = global_hInstance ;
wc . hIcon = hIcon ;
wc . hCursor = hArrowCursor ;
wc . hbrBackground = NULL ;
wc . lpszMenuName = 0 ;
wc . lpszClassName = WINDOW_CLASS_NAME_A ;
if ( ! RegisterClassA ( & wc ) ) //this isn't really fatal, we'll let the CreateWindow fail instead.
2016-07-12 00:40:13 +00:00
Con_DPrintf ( " RegisterClass failed \n " ) ;
2015-06-04 06:15:14 +00:00
}
2015-05-14 03:06:58 +00:00
2004-08-22 22:29:09 +00:00
if ( ! info - > fullscreen )
{
2013-10-08 14:28:11 +00:00
TRACE ( ( " dbg: GLVID_SetMode: VID_SetWindowedMode \n " ) ) ;
stat = VID_SetWindowedMode ( info ) ;
2004-08-22 22:29:09 +00:00
}
else
{
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: GLVID_SetMode: VID_SetFullDIBMode \n " ) ) ;
2004-08-22 22:29:09 +00:00
stat = VID_SetFullDIBMode ( info ) ;
}
2014-03-30 08:55:06 +00:00
VID_UpdateWindowStatus ( mainwindow ) ;
Win_Touch_Init ( mainwindow ) ;
2009-04-01 22:03:56 +00:00
2016-02-10 23:23:43 +00:00
INS_UpdateGrabs ( info - > fullscreen , vid . activeapp ) ;
2009-04-01 22:03:56 +00:00
2006-03-15 20:11:37 +00:00
return stat ;
}
2015-05-03 19:57:46 +00:00
2016-12-13 11:50:15 +00:00
static void VID_UnSetMode ( void ) ;
static int GLVID_SetMode ( rendererstate_t * info , unsigned char * palette )
2006-03-15 20:11:37 +00:00
{
int temp ;
qboolean stat ;
2011-09-16 05:56:54 +00:00
# ifndef NPFTE
2016-12-13 11:50:15 +00:00
MSG msg ;
2009-04-01 22:03:56 +00:00
# endif
2006-03-15 20:11:37 +00:00
// HDC hdc;
2020-05-14 15:50:26 +00:00
vrsetup_t setup = { sizeof ( setup ) } ;
2006-03-15 20:11:37 +00:00
TRACE ( ( " dbg: GLVID_SetMode \n " ) ) ;
// so Con_Printfs don't mess us up by forcing vid and snd updates
temp = scr_disabled_for_loading ;
scr_disabled_for_loading = true ;
CDAudio_Pause ( ) ;
2016-12-13 11:50:15 +00:00
qGetDeviceGammaRamp = ( void * ) GetDeviceGammaRamp ;
qSetDeviceGammaRamp = ( void * ) SetDeviceGammaRamp ;
2015-05-03 19:57:46 +00:00
2016-12-13 11:50:15 +00:00
switch ( platform_rendermode )
2006-03-15 20:11:37 +00:00
{
2016-12-13 11:50:15 +00:00
# ifdef USE_WGL
case MODE_WGL :
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
# ifdef VKQUAKE
case MODE_NVVULKAN :
# endif
2020-05-14 15:50:26 +00:00
setup . vrplatform = VR_WIN_WGL ;
if ( info - > vr & & ! info - > vr - > Prepare ( & setup ) )
{
info - > vr - > Shutdown ( ) ;
info - > vr = NULL ;
}
2016-12-13 11:50:15 +00:00
// Set either the fullscreen or windowed mode
qwglChoosePixelFormatARB = NULL ;
2017-07-12 08:15:27 +00:00
qwglGetPixelFormatAttribfvARB = NULL ;
2016-12-13 11:50:15 +00:00
qwglCreateContextAttribsARB = NULL ;
stat = CreateMainWindow ( info , true ) ;
2006-03-15 20:11:37 +00:00
if ( stat )
{
2016-12-13 11:50:15 +00:00
stat = VID_AttachGL ( info ) ;
if ( stat )
2006-03-15 20:11:37 +00:00
{
2016-12-13 11:50:15 +00:00
TRACE ( ( " dbg: GLVID_SetMode: attaching gl okay \n " ) ) ;
if ( CheckForcePixelFormat ( info ) )
2006-03-15 20:11:37 +00:00
{
2016-12-13 11:50:15 +00:00
HMODULE oldgl = hInstGL ;
hInstGL = NULL ; //don't close the gl library, just in case
2017-07-12 08:15:27 +00:00
VID_UnSetMode ( ) ; //SetPixelFormat may only be used once per window. which means we *MUST* destroy the window if we're using a different pixelformat.
2016-12-13 11:50:15 +00:00
hInstGL = oldgl ;
if ( CreateMainWindow ( info , true ) & & VID_AttachGL ( info ) )
{
//we have our multisample window
}
else
2006-03-15 20:11:37 +00:00
{
2016-12-13 11:50:15 +00:00
//multisample failed
//try the origional way
if ( ! CreateMainWindow ( info , true ) | | ! VID_AttachGL ( info ) )
{
Con_Printf ( " Failed to undo antialising. Giving up. \n " ) ;
return false ; //eek
}
2006-03-15 20:11:37 +00:00
}
}
}
2016-12-13 11:50:15 +00:00
else
{
TRACE ( ( " dbg: GLVID_SetMode: attaching gl failed \n " ) ) ;
return false ;
}
2006-03-15 20:11:37 +00:00
}
2018-03-04 14:41:16 +00:00
else
{
TRACE ( ( " dbg: GLVID_SetMode: unable to create window \n " ) ) ;
return false ;
}
if ( modestate = = MS_FULLWINDOW )
ShowWindow ( dibwindow , SW_SHOWMAXIMIZED ) ;
else
2020-05-14 15:50:26 +00:00
ShowWindow ( dibwindow , SW_SHOWNORMAL ) ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
2017-09-20 11:27:13 +00:00
if ( ! GL_Init ( info , getglfunc ) )
return false ;
2020-05-14 15:50:26 +00:00
setup . wgl . hdc = maindc ;
setup . wgl . hglrc = baseRC ;
if ( info - > vr & & ! info - > vr - > Init ( & setup , info ) )
{
info - > vr - > Shutdown ( ) ;
return false ;
}
vid . vr = info - > vr ;
2018-07-05 16:21:44 +00:00
if ( qwglGetPixelFormatAttribfvARB ) //just for debugging info.
{
int iAttributeNames [ ] = { WGL_RED_BITS_ARB , WGL_GREEN_BITS_ARB , WGL_BLUE_BITS_ARB , WGL_ALPHA_BITS_ARB , WGL_PIXEL_TYPE_ARB , WGL_DEPTH_BITS_ARB , WGL_STENCIL_BITS_ARB } ;
float fAttributeValues [ countof ( iAttributeNames ) ] = { 0 } ;
if ( qwglGetPixelFormatAttribfvARB ( maindc , currentpixelformat , 0 , countof ( iAttributeNames ) , iAttributeNames , fAttributeValues ) )
{
Con_DPrintf ( " Colour buffer: GL_R%gG%gB%gA%g%s \n " , fAttributeValues [ 0 ] , fAttributeValues [ 1 ] , fAttributeValues [ 2 ] , fAttributeValues [ 3 ] , fAttributeValues [ 5 ] = = WGL_TYPE_RGBA_FLOAT_ARB ? " F " : ( ( vid . flags & VID_SRGBAWARE ) ? " _SRGB " : " " ) ) ;
Con_DPrintf ( " Depth buffer: GL_DEPTH%g_STENCIL%g \n " , fAttributeValues [ 5 ] , fAttributeValues [ 6 ] ) ;
}
}
2017-07-12 08:15:27 +00:00
qSwapBuffers ( maindc ) ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
# ifdef VKQUAKE
if ( platform_rendermode = = MODE_NVVULKAN & & stat )
{
stat = Win32NVVK_AttachVulkan ( info ) ;
}
# endif
2016-12-13 11:50:15 +00:00
break ;
# endif
# ifdef USE_EGL
case MODE_EGL :
stat = CreateMainWindow ( info , true ) ;
if ( stat )
2006-03-15 20:11:37 +00:00
{
2016-12-13 11:50:15 +00:00
maindc = GetDC ( mainwindow ) ;
2018-03-25 09:36:14 +00:00
stat = EGL_Init ( info , palette , EGL_PLATFORM_WIN32 , mainwindow , maindc , ( EGLNativeWindowType ) mainwindow , ( EGLNativeDisplayType ) maindc ) ;
2016-12-13 11:50:15 +00:00
if ( stat )
2018-03-04 14:41:16 +00:00
if ( ! GL_Init ( info , & EGL_Proc ) )
2017-09-20 11:27:13 +00:00
return false ;
2016-12-13 11:50:15 +00:00
}
break ;
# endif
# ifdef VKQUAKE
case MODE_VULKAN :
stat = CreateMainWindow ( info , true ) ;
if ( stat )
{
maindc = GetDC ( mainwindow ) ;
stat = Win32VK_AttachVulkan ( info ) ;
2006-03-15 20:11:37 +00:00
}
2016-12-13 11:50:15 +00:00
break ;
# endif
default :
stat = false ;
break ;
2006-03-15 20:11:37 +00:00
}
2004-08-22 22:29:09 +00:00
2004-10-07 13:13:15 +00:00
if ( ! stat )
{
TRACE ( ( " dbg: GLVID_SetMode: VID_Set... failed \n " ) ) ;
return false ;
}
2016-12-13 11:50:15 +00:00
if ( ! qGetDeviceGammaRamp ) qGetDeviceGammaRamp = ( void * ) GetDeviceGammaRamp ;
if ( ! qSetDeviceGammaRamp ) qSetDeviceGammaRamp = ( void * ) SetDeviceGammaRamp ;
2004-08-22 22:29:09 +00:00
window_width = DIBWidth ;
window_height = DIBHeight ;
2009-04-06 00:34:32 +00:00
VID_UpdateWindowStatus ( mainwindow ) ;
2012-07-21 04:43:31 +00:00
Cvar_ForceCallback ( & vid_conautoscale ) ;
2004-08-22 22:29:09 +00:00
CDAudio_Resume ( ) ;
scr_disabled_for_loading = temp ;
// now we try to make sure we get the focus on the mode switch, because
// sometimes in some systems we don't. We grab the foreground, then
// finish setting up, pump all our messages, and sleep for a little while
// to let messages finish bouncing around the system, then we put
// ourselves at the top of the z order, then grab the foreground again,
// Who knows if it helps, but it probably doesn't hurt
SetForegroundWindow ( mainwindow ) ;
2011-09-16 05:56:54 +00:00
# ifndef NPFTE
2010-03-14 14:35:56 +00:00
/*I don't like this, but if we */
2018-03-04 14:41:16 +00:00
Sleep ( 100 ) ;
2009-04-01 22:03:56 +00:00
while ( PeekMessage ( & msg , mainwindow , 0 , 0 , PM_REMOVE ) )
2004-08-22 22:29:09 +00:00
{
2016-12-13 11:50:15 +00:00
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
2004-08-22 22:29:09 +00:00
}
Sleep ( 100 ) ;
2010-03-14 14:35:56 +00:00
# endif
2004-08-22 22:29:09 +00:00
SetWindowPos ( mainwindow , HWND_TOP , 0 , 0 , 0 , 0 ,
SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW |
SWP_NOCOPYBITS ) ;
SetForegroundWindow ( mainwindow ) ;
2018-03-04 14:41:16 +00:00
Sleep ( 100 ) ;
while ( PeekMessage ( & msg , mainwindow , 0 , 0 , PM_REMOVE ) )
{
TranslateMessage ( & msg ) ;
DispatchMessage ( & msg ) ;
}
Sleep ( 100 ) ;
2004-08-22 22:29:09 +00:00
// fix the leftover Alt from any Alt-Tab or the like that switched us away
ClearAllStates ( ) ;
2016-08-25 00:12:14 +00:00
gammaworks = FALSE ;
2005-10-18 04:42:13 +00:00
if ( vid_desktopgamma . value )
{
HDC hDC = GetDC ( GetDesktopWindow ( ) ) ;
2016-08-25 00:12:14 +00:00
if ( qGetDeviceGammaRamp ( hDC , originalgammaramps ) )
gammaworks = qSetDeviceGammaRamp ( hDC , originalgammaramps ) ;
2005-10-18 04:42:13 +00:00
ReleaseDC ( GetDesktopWindow ( ) , hDC ) ;
}
else
2016-08-25 00:12:14 +00:00
{
if ( qGetDeviceGammaRamp ( maindc , originalgammaramps ) )
gammaworks = qSetDeviceGammaRamp ( maindc , originalgammaramps ) ;
}
if ( ! gammaworks )
Con_Printf ( " Hardware gamma is not supported \n " ) ;
else
Con_DPrintf ( " Hardware gamma appears to work \n " ) ;
2004-09-20 23:25:38 +00:00
2004-08-22 22:29:09 +00:00
return true ;
}
2006-03-15 20:11:37 +00:00
void VID_UnSetMode ( void )
{
if ( mainwindow & & vid_initialized )
{
GLAppActivate ( false , false ) ;
2004-08-22 22:29:09 +00:00
2006-03-15 20:11:37 +00:00
vid_canalttab = false ;
2016-12-13 11:50:15 +00:00
switch ( platform_rendermode )
{
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
# if defined(VKQUAKE) && defined(USE_WGL)
case MODE_NVVULKAN :
qwglMakeCurrent ( maindc , baseRC ) ;
VK_Shutdown ( ) ;
ReleaseGL ( ) ;
break ;
# endif
2016-12-13 11:50:15 +00:00
# ifdef USE_WGL
case MODE_WGL :
ReleaseGL ( ) ;
break ;
# endif
# ifdef USE_EGL
case MODE_EGL :
EGL_Shutdown ( ) ;
break ;
# endif
# ifdef VKQUAKE
case MODE_VULKAN :
VK_Shutdown ( ) ;
break ;
# endif
}
2004-08-22 22:29:09 +00:00
if ( modestate = = MS_FULLDIB )
ChangeDisplaySettings ( NULL , 0 ) ;
if ( maindc & & dibwindow )
ReleaseDC ( dibwindow , maindc ) ;
2016-12-13 11:50:15 +00:00
maindc = NULL ;
2004-08-22 22:29:09 +00:00
}
if ( mainwindow )
{
dibwindow = NULL ;
2009-04-01 22:03:56 +00:00
// ShowWindow(mainwindow, SW_HIDE);
// SetWindowLongPtr(mainwindow, GWL_WNDPROC, DefWindowProc);
// PostMessage(mainwindow, WM_CLOSE, 0, 0);
2015-05-03 19:57:46 +00:00
# ifdef WTHREAD
if ( windowthread )
{
SendMessage ( mainwindow , WM_USER + 4 , 0 , 0 ) ;
2016-12-13 11:50:15 +00:00
Sys_WaitOnThread ( windowthread ) ;
2015-05-03 19:57:46 +00:00
windowthread = NULL ;
}
else
# endif
DestroyWindow ( mainwindow ) ;
2004-08-22 22:29:09 +00:00
mainwindow = NULL ;
}
2011-06-16 02:03:57 +00:00
2016-10-22 07:06:51 +00:00
if ( WinNT )
UnregisterClassW ( WINDOW_CLASS_NAME_W , global_hInstance ) ;
else
UnregisterClassA ( WINDOW_CLASS_NAME_A , global_hInstance ) ;
2011-06-16 02:03:57 +00:00
#if 0
//Logically this code should be active. However...
//1: vid_restarts are slightly slower if we don't reuse the old dll
//2: nvidia drivers crash if we shut it down+reload!
2004-08-22 22:29:09 +00:00
if ( hInstGL )
{
FreeLibrary ( hInstGL ) ;
2011-06-16 02:03:57 +00:00
hInstGL = NULL ;
2004-08-22 22:29:09 +00:00
}
2011-06-16 02:03:57 +00:00
if ( hInstwgl )
{
FreeLibrary ( hInstwgl ) ;
hInstwgl = NULL ;
}
* opengldllname = 0 ;
# endif
2018-04-27 16:40:50 +00:00
# ifdef GLQUAKE
GL_ForgetPointers ( ) ;
# endif
2004-08-22 22:29:09 +00:00
}
/*
= = = = = = = = = = = = = = = =
VID_UpdateWindowStatus
= = = = = = = = = = = = = = = =
*/
2016-12-13 11:50:15 +00:00
static void VID_UpdateWindowStatus ( HWND hWnd )
2004-08-22 22:29:09 +00:00
{
2009-04-06 00:34:32 +00:00
POINT p ;
RECT nr ;
GetClientRect ( hWnd , & nr ) ;
//if its bad then we're probably minimised
if ( nr . right < = nr . left )
return ;
if ( nr . bottom < = nr . top )
return ;
WindowRect = nr ;
p . x = 0 ;
p . y = 0 ;
ClientToScreen ( hWnd , & p ) ;
window_x = p . x ;
window_y = p . y ;
window_width = WindowRect . right - WindowRect . left ;
window_height = WindowRect . bottom - WindowRect . top ;
2004-08-22 22:29:09 +00:00
window_rect . left = window_x ;
window_rect . top = window_y ;
window_rect . right = window_x + window_width ;
window_rect . bottom = window_y + window_height ;
window_center_x = ( window_rect . left + window_rect . right ) / 2 ;
window_center_y = ( window_rect . top + window_rect . bottom ) / 2 ;
2012-10-14 09:00:49 +00:00
INS_UpdateClipCursor ( ) ;
2016-12-13 11:50:15 +00:00
switch ( platform_rendermode )
{
# ifdef VKQUAKE
2017-05-10 03:13:18 +00:00
# ifdef USE_WGL
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
case MODE_NVVULKAN :
2017-05-10 03:13:18 +00:00
# endif
2016-12-13 11:50:15 +00:00
case MODE_VULKAN :
if ( vid . pixelwidth ! = window_width | | vid . pixelheight ! = window_height )
vk . neednewswapchain = true ;
2017-07-28 01:49:25 +00:00
break ;
2016-12-13 11:50:15 +00:00
# endif
default :
vid . pixelwidth = window_width ;
vid . pixelheight = window_height ;
break ;
}
2004-08-22 22:29:09 +00:00
}
2016-12-13 11:50:15 +00:00
# ifdef USE_WGL
static qboolean WGL_CheckExtension ( char * extname )
2014-10-22 19:41:20 +00:00
{
// int i;
int len ;
const char * foo ;
cvar_t * v = Cvar_Get ( va ( " gl_ext_%s " , extname ) , " 1 " , 0 , " GL Extensions " ) ;
if ( v & & ! v - > ival )
{
Con_Printf ( " Cvar %s is 0 \n " , v - > name ) ;
return false ;
}
/* if (gl_num_extensions && qglGetStringi)
{
for ( i = 0 ; i < gl_num_extensions ; i + + )
if ( ! strcmp ( qglGetStringi ( GL_EXTENSIONS , i ) , extname ) )
{
Con_DPrintf ( " Detected GL extension %s \n " , extname ) ;
return true ;
}
}
*/
if ( ! wgl_extensions )
return false ;
//the list is space delimited. we cannot just strstr lest we find leading/trailing _FOO_.
len = strlen ( extname ) ;
for ( foo = wgl_extensions ; * foo ; )
{
if ( ! strncmp ( foo , extname , len ) & & ( foo [ len ] = = ' ' | | ! foo [ len ] ) )
return true ;
while ( * foo & & * foo ! = ' ' )
foo + + ;
if ( * foo = = ' ' )
foo + + ;
}
return false ;
}
2004-08-22 22:29:09 +00:00
//====================================
qboolean VID_AttachGL ( rendererstate_t * info )
{ //make sure we can get a valid renderer.
2018-03-04 14:41:16 +00:00
int iAttributeNames [ 2 ] ;
FLOAT fAttributeValues [ countof ( iAttributeNames ) ] ;
2004-08-22 22:29:09 +00:00
do
{
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: VID_AttachGL: GLInitialise \n " ) ) ;
2013-11-21 23:02:28 +00:00
if ( GLInitialise ( info - > subrenderer ) )
2004-08-22 22:29:09 +00:00
{
maindc = GetDC ( mainwindow ) ;
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: VID_AttachGL: bSetupPixelFormat \n " ) ) ;
2012-09-30 05:52:03 +00:00
if ( bSetupPixelFormat ( maindc , info ) )
2006-07-21 23:38:24 +00:00
break ;
2010-12-05 02:46:07 +00:00
ReleaseDC ( mainwindow , maindc ) ;
2004-08-22 22:29:09 +00:00
}
2013-11-21 23:02:28 +00:00
if ( ! * info - > subrenderer | | ! stricmp ( info - > subrenderer , " opengl32.dll " ) | | ! stricmp ( info - > subrenderer , " opengl32 " ) ) //go for windows system dir if we failed with the default. Should help to avoid the 3dfx problem.
2004-08-22 22:29:09 +00:00
{
2015-05-14 03:06:58 +00:00
wchar_t systemglw [ MAX_OSPATH + 1 ] ;
2004-08-22 22:29:09 +00:00
char systemgl [ MAX_OSPATH + 1 ] ;
2015-05-14 03:06:58 +00:00
GetSystemDirectoryW ( systemglw , countof ( systemglw ) - 1 ) ;
narrowen ( systemgl , sizeof ( systemgl ) , systemglw ) ;
Q_strncatz ( systemgl , " \\ " , sizeof ( systemgl ) ) ;
2013-11-21 23:02:28 +00:00
if ( * info - > subrenderer )
2015-05-14 03:06:58 +00:00
Q_strncatz ( systemgl , info - > subrenderer , sizeof ( systemgl ) ) ;
2005-06-04 04:20:20 +00:00
else
2015-05-14 03:06:58 +00:00
Q_strncatz ( systemgl , " opengl32.dll " , sizeof ( systemgl ) ) ;
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: VID_AttachGL: GLInitialise (system dir specific) \n " ) ) ;
2004-08-22 22:29:09 +00:00
if ( GLInitialise ( systemgl ) )
{
maindc = GetDC ( mainwindow ) ;
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: VID_AttachGL: bSetupPixelFormat \n " ) ) ;
2012-09-30 05:52:03 +00:00
if ( bSetupPixelFormat ( maindc , info ) )
2006-07-21 23:38:24 +00:00
break ;
2010-12-05 02:46:07 +00:00
ReleaseDC ( mainwindow , maindc ) ;
2004-08-22 22:29:09 +00:00
}
}
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: VID_AttachGL: failed to find a valid dll \n " ) ) ;
2004-08-22 22:29:09 +00:00
return false ;
} while ( 1 ) ;
2011-05-19 13:34:07 +00:00
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: VID_AttachGL: qwglCreateContext \n " ) ) ;
2004-08-22 22:29:09 +00:00
2016-12-13 11:50:15 +00:00
baseRC = qwglCreateContext ( maindc ) ;
2004-08-22 22:29:09 +00:00
if ( ! baseRC )
{
2007-09-23 15:28:06 +00:00
Con_SafePrintf ( CON_ERROR " Could not initialize GL (wglCreateContext failed). \n \n Make sure you in are 65535 color mode, and try running -window. \n " ) ; //green to make it show.
2004-08-22 22:29:09 +00:00
return false ;
}
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: VID_AttachGL: qwglMakeCurrent \n " ) ) ;
2016-12-13 11:50:15 +00:00
if ( ! qwglMakeCurrent ( maindc , baseRC ) )
2004-08-22 22:29:09 +00:00
{
2007-09-23 15:28:06 +00:00
Con_SafePrintf ( CON_ERROR " wglMakeCurrent failed \n " ) ; //green to make it show.
2004-08-22 22:29:09 +00:00
return false ;
}
2011-01-23 03:44:49 +00:00
2011-01-04 02:56:16 +00:00
{
2011-01-23 03:44:49 +00:00
char * ( WINAPI * wglGetExtensionsString ) ( HDC hdc ) = NULL ;
2011-01-04 02:56:16 +00:00
if ( ! wglGetExtensionsString )
wglGetExtensionsString = getglfunc ( " wglGetExtensionsString " ) ;
if ( ! wglGetExtensionsString )
wglGetExtensionsString = getglfunc ( " wglGetExtensionsStringARB " ) ;
if ( ! wglGetExtensionsString )
wglGetExtensionsString = getglfunc ( " wglGetExtensionsStringEXT " ) ;
if ( wglGetExtensionsString )
2014-10-22 19:41:20 +00:00
wgl_extensions = wglGetExtensionsString ( maindc ) ;
else
wgl_extensions = NULL ;
2011-01-04 02:56:16 +00:00
}
2011-01-23 03:44:49 +00:00
2014-10-22 19:41:20 +00:00
if ( developer . ival )
2015-01-07 13:34:05 +00:00
Con_SafePrintf ( " WGL_EXTENSIONS: %s \n " , wgl_extensions ? wgl_extensions : " NONE " ) ;
2014-10-22 19:41:20 +00:00
2009-11-04 21:16:50 +00:00
qwglCreateContextAttribsARB = getglfunc ( " wglCreateContextAttribsARB " ) ;
2019-04-17 19:57:26 +00:00
2009-11-04 21:16:50 +00:00
//attempt to promote that to opengl3.
if ( qwglCreateContextAttribsARB )
{
HGLRC opengl3 ;
2014-10-25 01:24:12 +00:00
int attribs [ 11 ] ;
2009-11-04 21:16:50 +00:00
char * mv ;
int i = 0 ;
2011-01-23 03:44:49 +00:00
char * ver ;
ver = vid_gl_context_version . string ;
2014-10-22 19:41:20 +00:00
if ( ! * ver & & vid_gl_context_es . ival & & WGL_CheckExtension ( " WGL_EXT_create_context_es2_profile " ) )
2011-01-23 03:44:49 +00:00
ver = " 2.0 " ;
2009-11-04 21:16:50 +00:00
2011-01-23 03:44:49 +00:00
mv = ver ;
2009-11-04 21:16:50 +00:00
while ( * mv )
{
if ( * mv + + = = ' . ' )
break ;
}
2011-01-23 03:44:49 +00:00
if ( * ver )
2009-11-04 21:16:50 +00:00
{
attribs [ i + + ] = WGL_CONTEXT_MAJOR_VERSION_ARB ;
2011-01-23 03:44:49 +00:00
attribs [ i + + ] = atoi ( ver ) ;
2009-11-04 21:16:50 +00:00
}
if ( * mv )
{
attribs [ i + + ] = WGL_CONTEXT_MINOR_VERSION_ARB ;
attribs [ i + + ] = atoi ( mv ) ;
}
//flags
attribs [ i + 1 ] = 0 ;
2010-09-05 10:42:23 +00:00
if ( vid_gl_context_debug . ival )
2009-11-04 21:16:50 +00:00
attribs [ i + 1 ] | = WGL_CONTEXT_DEBUG_BIT_ARB ;
2010-09-05 10:42:23 +00:00
if ( vid_gl_context_forwardcompatible . ival )
2009-11-04 21:16:50 +00:00
attribs [ i + 1 ] | = WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB ;
2014-10-22 19:41:20 +00:00
if ( vid_gl_context_robustness . ival & & WGL_CheckExtension ( " WGL_ARB_create_context_robustness " ) )
attribs [ i + 1 ] | = WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB ;
2009-11-04 21:16:50 +00:00
if ( attribs [ i + 1 ] )
{
attribs [ i ] = WGL_CONTEXT_FLAGS_ARB ;
i + = 2 ;
}
2014-10-22 19:41:20 +00:00
if ( vid_gl_context_selfreset . ival & & WGL_CheckExtension ( " WGL_ARB_create_context_robustness " ) )
{
attribs [ i + + ] = WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB ;
attribs [ i + + ] = WGL_LOSE_CONTEXT_ON_RESET_ARB ;
}
2017-06-21 01:24:25 +00:00
if ( vid_gl_context_noerror . ival & & WGL_CheckExtension ( " WGL_ARB_create_context_no_error " ) )
{
attribs [ i + + ] = WGL_CONTEXT_OPENGL_NO_ERROR_ARB ;
attribs [ i + + ] = ! vid_gl_context_robustness . ival & & ! vid_gl_context_debug . ival ;
}
2010-09-05 10:42:23 +00:00
/*only switch contexts if there's actually a point*/
2014-02-07 08:38:40 +00:00
if ( i | | ! vid_gl_context_compatibility . ival | | vid_gl_context_es . ival )
2009-11-04 21:16:50 +00:00
{
2014-10-22 19:41:20 +00:00
if ( WGL_CheckExtension ( " WGL_ARB_create_context_profile " ) )
{
attribs [ i + 1 ] = 0 ;
if ( vid_gl_context_es . ival & & ( WGL_CheckExtension ( " WGL_EXT_create_context_es_profile " ) | | WGL_CheckExtension ( " WGL_EXT_create_context_es2_profile " ) ) )
attribs [ i + 1 ] | = WGL_CONTEXT_ES2_PROFILE_BIT_EXT ;
else if ( vid_gl_context_compatibility . ival )
attribs [ i + 1 ] | = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB ;
else
attribs [ i + 1 ] | = WGL_CONTEXT_CORE_PROFILE_BIT_ARB ;
attribs [ i ] = WGL_CONTEXT_PROFILE_MASK_ARB ;
//WGL_CONTEXT_PROFILE_MASK_ARB is ignored if < 3.2 - however, nvidia do not agree and return errors
if ( atof ( ver ) > = 3.2 | | vid_gl_context_es . ival )
i + = 2 ;
}
2009-11-04 21:16:50 +00:00
2010-09-05 10:42:23 +00:00
attribs [ i ] = 0 ;
if ( ( opengl3 = qwglCreateContextAttribsARB ( maindc , NULL , attribs ) ) )
2009-11-04 21:16:50 +00:00
{
2011-05-20 04:10:46 +00:00
qwglMakeCurrent ( maindc , NULL ) ;
2010-09-05 10:42:23 +00:00
qwglDeleteContext ( baseRC ) ;
baseRC = opengl3 ;
if ( ! qwglMakeCurrent ( maindc , baseRC ) )
{
Con_SafePrintf ( CON_ERROR " wglMakeCurrent failed \n " ) ; //green to make it show.
return false ;
}
2009-11-04 21:16:50 +00:00
}
else
2010-09-05 10:42:23 +00:00
{
DWORD error = GetLastError ( ) ;
2011-01-23 03:44:49 +00:00
if ( error = = ( 0xc0070000 | ERROR_INVALID_VERSION_ARB ) )
2010-09-05 10:42:23 +00:00
Con_Printf ( " Unsupported OpenGL context version (%s). \n " , vid_gl_context_version . string ) ;
2011-01-23 03:44:49 +00:00
else if ( error = = ( 0xc0070000 | ERROR_INVALID_PROFILE_ARB ) )
2014-02-07 08:38:40 +00:00
Con_Printf ( " Unsupported OpenGL profile (%s). \n " , vid_gl_context_es . ival ? " gles " : ( vid_gl_context_compatibility . ival ? " compat " : " core " ) ) ;
2013-03-12 22:53:23 +00:00
else if ( error = = ( 0xc0070000 | ERROR_INVALID_OPERATION ) )
Con_Printf ( " wglCreateContextAttribsARB returned invalid operation. \n " ) ;
else if ( error = = ( 0xc0070000 | ERROR_DC_NOT_FOUND ) )
Con_Printf ( " wglCreateContextAttribsARB returned dc not found. \n " ) ;
else if ( error = = ( 0xc0070000 | ERROR_INVALID_PIXEL_FORMAT ) )
Con_Printf ( " wglCreateContextAttribsARB returned dc not found. \n " ) ;
else if ( error = = ( 0xc0070000 | ERROR_NO_SYSTEM_RESOURCES ) )
Con_Printf ( " wglCreateContextAttribsARB ran out of system resources. \n " ) ;
else if ( error = = ( 0xc0070000 | ERROR_INVALID_PARAMETER ) )
Con_Printf ( " wglCreateContextAttribsARB reported invalid parameter. \n " ) ;
2010-09-05 10:42:23 +00:00
else
Con_Printf ( " Unknown error creating an OpenGL (%s) Context. \n " , vid_gl_context_version . string ) ;
}
2009-11-04 21:16:50 +00:00
}
}
2017-07-12 08:15:27 +00:00
qwglChoosePixelFormatARB = getglfunc ( " wglChoosePixelFormatARB " ) ;
qwglGetPixelFormatAttribfvARB = getglfunc ( " wglGetPixelFormatAttribfvARB " ) ;
2009-11-04 21:16:50 +00:00
2012-09-30 05:52:03 +00:00
if ( info - > stereo )
{
GLboolean ster = false ;
qglGetBooleanv ( GL_STEREO , & ster ) ;
if ( ! ster )
Con_Printf ( " Unable to create stereoscopic/quad-buffered OpenGL context. Please use a different stereoscopic method. \n " ) ;
}
2004-08-22 22:29:09 +00:00
qwglSwapIntervalEXT = getglfunc ( " wglSwapIntervalEXT " ) ;
2014-02-07 08:38:40 +00:00
if ( qwglSwapIntervalEXT & & * vid_vsync . string )
2004-10-07 13:13:15 +00:00
{
TRACE ( ( " dbg: VID_AttachGL: qwglSwapIntervalEXT \n " ) ) ;
2014-02-07 08:38:40 +00:00
qwglSwapIntervalEXT ( vid_vsync . value ) ;
2004-10-07 13:13:15 +00:00
}
2018-03-04 14:41:16 +00:00
vid . flags = 0 ;
iAttributeNames [ 0 ] = WGL_PIXEL_TYPE_ARB ;
iAttributeNames [ 1 ] = WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB ;
if ( qwglGetPixelFormatAttribfvARB & & qwglGetPixelFormatAttribfvARB ( maindc , currentpixelformat , 0 , 1 , iAttributeNames + 0 , fAttributeValues + 0 ) & & fAttributeValues [ 0 ] = = WGL_TYPE_RGBA_FLOAT_ARB )
vid . flags | = VID_FP16 | VID_SRGB_FB_LINEAR ;
if ( qwglGetPixelFormatAttribfvARB & & qwglGetPixelFormatAttribfvARB ( maindc , currentpixelformat , 0 , 1 , iAttributeNames + 1 , fAttributeValues + 1 ) & & fAttributeValues [ 1 ] = = TRUE )
vid . flags | = VID_SRGB_CAPABLE ;
2004-08-22 22:29:09 +00:00
return true ;
}
2016-12-13 11:50:15 +00:00
# endif
2004-08-22 22:29:09 +00:00
2015-04-21 04:12:00 +00:00
static void QDECL VID_Wait_Override_Callback ( struct cvar_s * var , char * oldvalue )
2006-04-21 06:02:06 +00:00
{
2016-12-13 11:50:15 +00:00
switch ( platform_rendermode )
{
# ifdef USE_WGL
case MODE_WGL :
if ( qwglSwapIntervalEXT & & * vid_vsync . string )
qwglSwapIntervalEXT ( vid_vsync . value ) ;
break ;
# endif
default :
break ;
}
2006-04-21 06:02:06 +00:00
}
2016-12-13 11:50:15 +00:00
static void GLVID_Recenter_f ( void )
2009-04-06 00:34:32 +00:00
{
2011-05-19 13:34:07 +00:00
// 4 unused variables
//int nw = vid_width.value;
//int nh = vid_height.value;
//int nx = 0;
//int ny = 0;
2009-04-06 00:34:32 +00:00
2012-11-27 03:23:19 +00:00
if ( Cmd_Argc ( ) > 1 )
sys_parentleft = atoi ( Cmd_Argv ( 1 ) ) ;
if ( Cmd_Argc ( ) > 2 )
sys_parenttop = atoi ( Cmd_Argv ( 2 ) ) ;
if ( Cmd_Argc ( ) > 3 )
sys_parentwidth = atoi ( Cmd_Argv ( 3 ) ) ;
if ( Cmd_Argc ( ) > 4 )
sys_parentheight = atoi ( Cmd_Argv ( 4 ) ) ;
if ( Cmd_Argc ( ) > 5 )
{
2014-02-07 08:38:40 +00:00
HWND newparent = ( HWND ) ( DWORD_PTR ) strtoull ( Cmd_Argv ( 5 ) , NULL , 16 ) ;
2012-11-27 03:23:19 +00:00
if ( newparent ! = sys_parentwindow & & mainwindow & & modestate = = MS_WINDOWED )
SetParent ( mainwindow , sys_parentwindow ) ;
sys_parentwindow = newparent ;
}
2009-04-06 00:34:32 +00:00
if ( sys_parentwindow & & modestate = = MS_WINDOWED )
{
2013-03-12 23:09:25 +00:00
WindowRect = centerrect ( sys_parentleft , sys_parenttop , sys_parentwidth , sys_parentheight , sys_parentwidth , sys_parentheight ) ;
2011-04-30 17:21:10 +00:00
MoveWindow ( mainwindow , WindowRect . left , WindowRect . top , WindowRect . right - WindowRect . left , WindowRect . bottom - WindowRect . top , FALSE ) ;
2009-04-06 00:34:32 +00:00
2011-04-30 17:21:10 +00:00
VID_UpdateWindowStatus ( mainwindow ) ;
2012-07-21 04:43:31 +00:00
Cvar_ForceCallback ( & vid_conautoscale ) ;
2009-04-06 00:34:32 +00:00
}
}
2015-04-21 04:12:00 +00:00
static void QDECL VID_WndAlpha_Override_Callback ( struct cvar_s * var , char * oldvalue )
2009-04-06 00:34:32 +00:00
{
2014-03-30 08:55:06 +00:00
//this code tells windows to use the alpha channel of the screen, but does really nasty things with the mouse such that its unplayable.
//its not useful.
/* if (modestate==MS_WINDOWED)
{
struct qDWM_BLURBEHIND
{
DWORD dwFlags ;
BOOL fEnable ;
HRGN hRgnBlur ;
BOOL fTransitionOnMaximized ;
} bb = { 1 , true , NULL , true } ;
HRESULT ( WINAPI * pDwmEnableBlurBehindWindow ) ( HWND hWnd , const struct qDWM_BLURBEHIND * pBlurBehind ) ;
dllfunction_t dwm [ ] =
{
{ ( void * ) & pDwmEnableBlurBehindWindow , " DwmEnableBlurBehindWindow " } ,
{ NULL , NULL }
} ;
if ( Sys_LoadLibrary ( " dwmapi.dll " , dwm ) )
pDwmEnableBlurBehindWindow ( mainwindow , & bb ) ;
}
*/
2009-04-06 01:01:31 +00:00
# ifdef WS_EX_LAYERED
2014-03-30 08:55:06 +00:00
//enable whole-window fixed transparency. should work in win2k+
//note that this can destroy framerates, and they won't reset when the setting is reverted to 1.
//be prepared to do a vid_restart.
2009-04-06 00:34:32 +00:00
if ( modestate = = MS_WINDOWED )
{
int av ;
2015-05-14 03:06:58 +00:00
HMODULE hm = GetModuleHandleA ( " user32.dll " ) ;
2009-04-06 00:34:32 +00:00
lpfnSetLayeredWindowAttributes pSetLayeredWindowAttributes ;
pSetLayeredWindowAttributes = ( void * ) GetProcAddress ( hm , " SetLayeredWindowAttributes " ) ;
av = 255 * var - > value ;
if ( av < 70 )
av = 70 ;
if ( av > 255 )
av = 255 ;
if ( pSetLayeredWindowAttributes )
{
2011-05-19 13:34:07 +00:00
// Set WS_EX_LAYERED on this window
2009-04-06 00:34:32 +00:00
if ( av < 255 )
{
SetWindowLong ( mainwindow , GWL_EXSTYLE , GetWindowLong ( mainwindow , GWL_EXSTYLE ) | WS_EX_LAYERED ) ;
// Make this window 70% alpha
2009-07-25 11:05:06 +00:00
pSetLayeredWindowAttributes ( mainwindow , 0 , ( BYTE ) av , LWA_ALPHA ) ;
2009-04-06 00:34:32 +00:00
}
else
2014-03-30 08:55:06 +00:00
{
2009-04-06 00:34:32 +00:00
SetWindowLong ( mainwindow , GWL_EXSTYLE , GetWindowLong ( mainwindow , GWL_EXSTYLE ) & ~ WS_EX_LAYERED ) ;
2014-03-30 08:55:06 +00:00
pSetLayeredWindowAttributes ( mainwindow , 0 , ( BYTE ) 255 , LWA_ALPHA ) ;
}
2009-04-06 00:34:32 +00:00
}
}
# endif
}
2014-03-30 00:39:37 +00:00
void GLVID_SwapBuffers ( void )
2004-08-22 22:29:09 +00:00
{
2016-12-13 11:50:15 +00:00
switch ( platform_rendermode )
2015-03-03 00:14:43 +00:00
{
2016-12-13 11:50:15 +00:00
# ifdef USE_WGL
case MODE_WGL :
if ( qwglSwapLayerBuffers )
{
if ( ! qwglSwapLayerBuffers ( maindc , WGL_SWAP_MAIN_PLANE ) )
qwglSwapLayerBuffers = NULL ;
}
else
qSwapBuffers ( maindc ) ;
break ;
# endif
# ifdef USE_EGL
case MODE_EGL :
EGL_SwapBuffers ( ) ;
break ;
# endif
# ifdef VKQUAKE
case MODE_VULKAN :
2017-09-20 11:27:13 +00:00
# ifdef USE_WGL
case MODE_NVVULKAN :
# endif
2016-12-13 11:50:15 +00:00
//FIXME: force a buffer swap now (might be called while loading (eg: q3), where we won't get a chance to redraw for a bit)
break ;
# endif
2015-03-03 00:14:43 +00:00
}
2004-08-22 22:29:09 +00:00
// handle the mouse state when windowed if that's changed
2009-04-01 22:03:56 +00:00
2016-02-10 23:23:43 +00:00
INS_UpdateGrabs ( modestate ! = MS_WINDOWED , vid . activeapp ) ;
2004-08-22 22:29:09 +00:00
}
2016-12-13 11:50:15 +00:00
static void OblitterateOldGamma ( void )
2008-01-09 00:37:17 +00:00
{
int i ;
if ( vid_preservegamma . value )
return ;
for ( i = 0 ; i < 256 ; i + + )
{
originalgammaramps [ 0 ] [ i ] = ( i < < 8 ) + i ;
originalgammaramps [ 1 ] [ i ] = ( i < < 8 ) + i ;
originalgammaramps [ 2 ] [ i ] = ( i < < 8 ) + i ;
}
}
2016-07-28 15:57:22 +00:00
qboolean GLVID_ApplyGammaRamps ( unsigned int gammarampsize , unsigned short * ramps )
2004-08-22 22:29:09 +00:00
{
2013-05-11 14:02:55 +00:00
if ( ramps )
{
2017-08-29 02:29:06 +00:00
switch ( vid_hardwaregamma . ival )
{
case 0 : //never use hardware/glsl gamma
case 2 : //ALWAYS use glsl gamma
2018-03-04 14:41:16 +00:00
case 4 : //scene-only gamma
2013-05-11 14:02:55 +00:00
return false ;
2017-08-29 02:29:06 +00:00
default :
case 1 : //no hardware gamma when windowed
if ( modestate = = MS_WINDOWED )
return false ;
break ;
case 3 : //ALWAYS try to use hardware gamma, even when it fails...
break ;
}
2004-08-22 22:29:09 +00:00
2017-08-29 02:29:06 +00:00
if ( vid . activeapp ) //this is needed because ATI drivers don't work properly (or when task-switched out).
{ //we have hardware gamma applied - if we're doing a BF, we don't want to reset to the default gamma (yuck)
if ( vid_desktopgamma . value )
{
HDC hDC = GetDC ( GetDesktopWindow ( ) ) ;
qSetDeviceGammaRamp ( hDC , ramps ) ;
ReleaseDC ( GetDesktopWindow ( ) , hDC ) ;
}
else
{
qSetDeviceGammaRamp ( maindc , ramps ) ;
2013-05-11 14:02:55 +00:00
}
return true ;
}
return false ;
}
2017-08-29 02:29:06 +00:00
else if ( gammaworks )
2004-10-14 12:31:29 +00:00
{
2013-05-11 14:02:55 +00:00
//revert to default
if ( qSetDeviceGammaRamp )
{
OblitterateOldGamma ( ) ;
2005-10-18 04:42:13 +00:00
if ( vid_desktopgamma . value )
{
HDC hDC = GetDC ( GetDesktopWindow ( ) ) ;
2013-05-11 14:02:55 +00:00
qSetDeviceGammaRamp ( hDC , originalgammaramps ) ;
2005-10-18 04:42:13 +00:00
ReleaseDC ( GetDesktopWindow ( ) , hDC ) ;
}
else
2006-02-11 02:05:15 +00:00
{
2013-05-11 14:02:55 +00:00
qSetDeviceGammaRamp ( maindc , originalgammaramps ) ;
2006-02-11 02:05:15 +00:00
}
2004-10-14 12:31:29 +00:00
}
2013-05-11 14:02:55 +00:00
return true ;
2004-10-14 12:31:29 +00:00
}
2017-08-29 02:29:06 +00:00
return false ;
2004-08-22 22:29:09 +00:00
}
2009-11-04 21:16:50 +00:00
void GLVID_Crashed ( void )
{
if ( qSetDeviceGammaRamp & & gammaworks )
{
OblitterateOldGamma ( ) ;
qSetDeviceGammaRamp ( maindc , originalgammaramps ) ;
}
}
2004-08-22 22:29:09 +00:00
void GLVID_Shutdown ( void )
{
2006-02-11 02:05:15 +00:00
if ( qSetDeviceGammaRamp )
2005-10-18 04:42:13 +00:00
{
2008-01-09 00:37:17 +00:00
OblitterateOldGamma ( ) ;
2006-02-11 02:05:15 +00:00
if ( vid_desktopgamma . value )
{
HDC hDC = GetDC ( GetDesktopWindow ( ) ) ;
qSetDeviceGammaRamp ( hDC , originalgammaramps ) ;
ReleaseDC ( GetDesktopWindow ( ) , hDC ) ;
}
else
{
qSetDeviceGammaRamp ( maindc , originalgammaramps ) ;
}
2005-10-18 04:42:13 +00:00
}
2006-02-11 02:05:15 +00:00
qSetDeviceGammaRamp = NULL ;
qGetDeviceGammaRamp = NULL ;
2005-10-18 04:42:13 +00:00
2004-10-14 12:31:29 +00:00
gammaworks = false ;
2004-09-20 23:25:38 +00:00
2016-12-13 11:50:15 +00:00
// GLBE_Shutdown();
// Image_Shutdown();
2004-08-22 22:29:09 +00:00
VID_UnSetMode ( ) ;
}
//==========================================================================
2016-12-13 11:50:15 +00:00
# ifdef USE_WGL
static BOOL CheckForcePixelFormat ( rendererstate_t * info )
2006-03-15 20:11:37 +00:00
{
2018-03-04 14:41:16 +00:00
if ( qwglChoosePixelFormatARB & & ( info - > multisample | | info - > srgb | | info - > bpp = = 30 ) )
2006-03-15 20:11:37 +00:00
{
HDC hDC ;
int valid ;
2014-03-30 08:55:06 +00:00
float fAttribute [ ] = { 0 , 0 } ;
2006-03-15 20:11:37 +00:00
UINT numFormats ;
2017-07-12 08:15:27 +00:00
int pixelformats [ 1 ] ;
2014-03-30 08:55:06 +00:00
int iAttributes = 0 ;
int iAttribute [ 16 * 2 ] ;
2017-07-12 08:15:27 +00:00
2014-03-30 08:55:06 +00:00
iAttribute [ iAttributes + + ] = WGL_DRAW_TO_WINDOW_ARB ; iAttribute [ iAttributes + + ] = GL_TRUE ;
iAttribute [ iAttributes + + ] = WGL_SUPPORT_OPENGL_ARB ; iAttribute [ iAttributes + + ] = GL_TRUE ;
iAttribute [ iAttributes + + ] = WGL_ACCELERATION_ARB ; iAttribute [ iAttributes + + ] = WGL_FULL_ACCELERATION_ARB ;
2018-03-04 14:41:16 +00:00
2018-07-05 16:21:44 +00:00
if ( info - > srgb > = 2 & & modestate ! = MS_WINDOWED )
2018-03-04 14:41:16 +00:00
{ //half-float backbuffers!
//'as has been the case since Windows Vista, fp16 swap chains are expected to have linear color data'
//if we try using WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, then we won't actually get a pixelformat.
//we just have to assume that its a linear colour space.
//we ONLY use this fullscreen, because its totally fucked on nvidia otherwise.
//when windowed, its an scRGB image but with and srgb capable false, when fullscreen its always linear until something else takes focus...
//so if windowed or unfocused or whatever, we would need to use custom glsl to fix the gamma settings.
//additionally, a single program using floats will disable the desktop compositor, which can be a bit jarring.
iAttribute [ iAttributes + + ] = WGL_PIXEL_TYPE_ARB ; iAttribute [ iAttributes + + ] = WGL_TYPE_RGBA_FLOAT_ARB ;
iAttribute [ iAttributes + + ] = WGL_RED_BITS_ARB ; iAttribute [ iAttributes + + ] = 16 ;
iAttribute [ iAttributes + + ] = WGL_GREEN_BITS_ARB ; iAttribute [ iAttributes + + ] = 16 ;
iAttribute [ iAttributes + + ] = WGL_BLUE_BITS_ARB ; iAttribute [ iAttributes + + ] = 16 ;
}
else
{
if ( info - > srgb )
{
iAttribute [ iAttributes + + ] = WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB ; iAttribute [ iAttributes + + ] = info - > bpp < = 32 ;
}
if ( info - > bpp = = 30 )
{ //10-bit backbuffers!
// iAttribute[iAttributes++] = WGL_PIXEL_TYPE_ARB; iAttribute[iAttributes++] = WGL_TYPE_RGBA_FLOAT_ARB;
iAttribute [ iAttributes + + ] = WGL_RED_BITS_ARB ; iAttribute [ iAttributes + + ] = 10 ;
iAttribute [ iAttributes + + ] = WGL_GREEN_BITS_ARB ; iAttribute [ iAttributes + + ] = 10 ;
iAttribute [ iAttributes + + ] = WGL_BLUE_BITS_ARB ; iAttribute [ iAttributes + + ] = 10 ;
}
else
{
iAttribute [ iAttributes + + ] = WGL_COLOR_BITS_ARB ; iAttribute [ iAttributes + + ] = ( info - > bpp > 24 ) ? 24 : info - > bpp ;
}
}
// iAttribute[iAttributes++] = WGL_ALPHA_BITS_ARB; iAttribute[iAttributes++] = 2;
2020-06-12 23:29:58 +00:00
iAttribute [ iAttributes + + ] = WGL_DEPTH_BITS_ARB ; iAttribute [ iAttributes + + ] = info - > depthbits ? info - > depthbits : 16 ;
2014-03-30 08:55:06 +00:00
iAttribute [ iAttributes + + ] = WGL_STENCIL_BITS_ARB ; iAttribute [ iAttributes + + ] = 8 ;
iAttribute [ iAttributes + + ] = WGL_DOUBLE_BUFFER_ARB ; iAttribute [ iAttributes + + ] = GL_TRUE ;
iAttribute [ iAttributes + + ] = WGL_STEREO_ARB ; iAttribute [ iAttributes + + ] = info - > stereo ;
if ( info - > multisample )
{
iAttribute [ iAttributes + + ] = WGL_SAMPLE_BUFFERS_ARB ; iAttribute [ iAttributes + + ] = GL_TRUE ;
iAttribute [ iAttributes + + ] = WGL_SAMPLES_ARB , iAttribute [ iAttributes + + ] = info - > multisample ; // Check For 4x Multisampling
}
iAttribute [ iAttributes + + ] = 0 ; iAttribute [ iAttributes + + ] = 0 ;
2006-03-15 20:11:37 +00:00
TRACE ( ( " dbg: bSetupPixelFormat: attempting wglChoosePixelFormatARB (multisample 4) \n " ) ) ;
hDC = GetDC ( mainwindow ) ;
2006-03-15 20:48:48 +00:00
2017-07-12 08:15:27 +00:00
valid = qwglChoosePixelFormatARB ( hDC , iAttribute , fAttribute , countof ( pixelformats ) , pixelformats , & numFormats ) ;
2014-03-30 08:55:06 +00:00
/* while ((!valid || numFormats < 1) && iAttribute[19] > 1)
2006-03-15 20:11:37 +00:00
{ //failed, switch wgl_samples to 2
2014-03-30 08:55:06 +00:00
iAttribute [ 19 ] / = 2 ;
2006-03-15 20:48:48 +00:00
TRACE ( ( " dbg: bSetupPixelFormat: attempting wglChoosePixelFormatARB (smaller multisample) \n " ) ) ;
2014-03-30 08:55:06 +00:00
valid = qwglChoosePixelFormatARB ( hDC , iAttribute , fAttribute , 1 , & pixelformat , & numFormats ) ;
2006-03-15 20:11:37 +00:00
}
2014-03-30 08:55:06 +00:00
*/
2017-07-12 08:15:27 +00:00
#if 0
for ( iAttributes = - 1 ; iAttributes < ( int ) numFormats ; iAttributes + + )
{
int j ;
struct
{
char * name ;
int id ;
} iAttributeTable [ ] = {
{ " WGL_DRAW_TO_WINDOW " , WGL_DRAW_TO_WINDOW_ARB } ,
{ " WGL_DRAW_TO_BITMAP " , 0x2002 } ,
{ " WGL_ACCELERATION " , WGL_ACCELERATION_ARB } ,
{ " WGL_NEED_PALETTE " , 0x2004 } ,
{ " WGL_NEED_SYSTEM_PALETTE " , 0x2005 } ,
{ " WGL_SWAP_LAYER_BUFFERS " , WGL_SWAP_LAYER_BUFFERS_ARB } ,
{ " WGL_SWAP_METHOD " , 0x2007 } ,
{ " WGL_NUMBER_OVERLAYS " , 0x2008 } ,
{ " WGL_NUMBER_UNDERLAYS " , 0x2009 } ,
{ " WGL_TRANSPARENT " , 0x200A } ,
{ " WGL_TRANSPARENT_RED_VALUE " , 0x2037 } ,
{ " WGL_TRANSPARENT_GREEN_VALUE " , 0x2038 } ,
{ " WGL_TRANSPARENT_BLUE_VALUE " , 0x2039 } ,
{ " WGL_TRANSPARENT_ALPHA_VALUE " , 0x203a } ,
{ " WGL_TRANSPARENT_INDEX_VALUE " , 0x203B } ,
{ " WGL_SHARE_DEPTH " , 0x200C } ,
{ " WGL_SHARE_STENCIL " , 0x200D } ,
{ " WGL_SHARE_ACCUM " , 0x200E } ,
{ " WGL_SUPPORT_GDI " , 0x200F } ,
{ " WGL_SUPPORT_OPENGL " , WGL_SUPPORT_OPENGL_ARB } ,
{ " WGL_DOUBLE_BUFFER " , WGL_DOUBLE_BUFFER_ARB } ,
{ " WGL_STEREO " , WGL_STEREO_ARB } ,
2018-03-04 14:41:16 +00:00
{ " WGL_PIXEL_TYPE " , WGL_PIXEL_TYPE_ARB } ,
2017-07-12 08:15:27 +00:00
{ " WGL_COLOR_BITS " , WGL_COLOR_BITS_ARB } ,
{ " WGL_RED_BITS " , 0x2015 } ,
{ " WGL_RED_SHIFT " , 0x2016 } ,
{ " WGL_GREEN_BITS " , 0x2017 } ,
{ " WGL_GREEN_SHIFT " , 0x2018 } ,
{ " WGL_BLUE_BITS " , 0x2019 } ,
{ " WGL_BLUE_SHIFT " , 0x201A } ,
{ " WGL_ALPHA_BITS " , WGL_ALPHA_BITS_ARB } ,
{ " WGL_ALPHA_SHIFT " , 0x201C } ,
{ " WGL_ACCUM_BITS " , 0x201D } ,
{ " WGL_ACCUM_RED_BITS " , 0x201E } ,
{ " WGL_ACCUM_GREEN_BITS " , 0x201F } ,
{ " WGL_ACCUM_BLUE_BITS " , 0x2020 } ,
{ " WGL_ACCUM_ALPHA_BITS " , 0x2021 } ,
{ " WGL_DEPTH_BITS " , WGL_DEPTH_BITS_ARB } ,
{ " WGL_STENCIL_BITS " , WGL_STENCIL_BITS_ARB } ,
{ " WGL_AUX_BUFFERS " , 0x2024 } ,
//extra extensions
{ " WGL_SAMPLE_BUFFERS_ARB " , WGL_SAMPLE_BUFFERS_ARB } , //multisample
{ " WGL_SAMPLES_ARB " , WGL_SAMPLES_ARB } , //multisample
{ " WGL_DRAW_TO_PBUFFER_ARB " , 0x202D } , //pbuffers
{ " WGL_MAX_PBUFFER_PIXELS_ARB " , 0x202E } , //pbuffers
{ " WGL_MAX_PBUFFER_WIDTH_ARB " , 0x202F } , //pbuffers
{ " WGL_MAX_PBUFFER_HEIGHT_ARB " , 0x2030 } , //pbuffers
{ " WGL_BIND_TO_TEXTURE_RGB_ARB " , 0x2070 } ,
{ " WGL_BIND_TO_TEXTURE_RGBA_ARB " , 0x2071 } ,
{ " WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB " , WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB } ,
{ " WGL_COLORSPACE_EXT " , 0x309D } , //WGL_EXT_colorspace
//stuff my drivers don't support
// {"WGL_DEPTH_FLOAT_EXT", 0x2040},
} ;
int iAttributeNames [ countof ( iAttributeTable ) ] ;
float fAttributeValues [ countof ( iAttributeTable ) ] ;
float basevalues [ countof ( iAttributeTable ) ] ;
for ( j = 0 ; j < countof ( iAttributeTable ) ; j + + )
iAttributeNames [ j ] = iAttributeTable [ j ] . id ;
Sys_Printf ( " Pixel Format %i -------------------------- \n " , iAttributes < 0 ? currentpixelformat : pixelformats [ iAttributes ] ) ;
if ( qwglGetPixelFormatAttribfvARB ( hDC , iAttributes < 0 ? currentpixelformat : pixelformats [ iAttributes ] , 0 , countof ( iAttributeTable ) , iAttributeNames , fAttributeValues ) )
{
if ( iAttributes = = - 1 )
memcpy ( basevalues , fAttributeValues , sizeof ( basevalues ) ) ;
for ( j = 0 ; j < countof ( iAttributeTable ) ; j + + )
{
if ( iAttributes = = - 1 | | fAttributeValues [ j ] ! = basevalues [ j ] )
{
if ( iAttributeTable [ j ] . id = = 0x2007 & & fAttributeValues [ j ] = = 0x2028 )
Sys_Printf ( " %s: exchange \n " , iAttributeTable [ j ] . name ) ;
else if ( iAttributeTable [ j ] . id = = 0x2007 & & fAttributeValues [ j ] = = 0x2029 )
Sys_Printf ( " %s: copy \n " , iAttributeTable [ j ] . name ) ;
else if ( iAttributeTable [ j ] . id = = 0x309D & & fAttributeValues [ j ] = = 0x3089 )
Sys_Printf ( " %s: WGL_COLORSPACE_SRGB \n " , iAttributeTable [ j ] . name ) ;
else if ( iAttributeTable [ j ] . id = = 0x309D & & fAttributeValues [ j ] = = 0x308A )
Sys_Printf ( " %s: WGL_COLORSPACE_LINEAR \n " , iAttributeTable [ j ] . name ) ;
2018-03-04 14:41:16 +00:00
else if ( iAttributeTable [ j ] . id = = WGL_PIXEL_TYPE_ARB & & fAttributeValues [ j ] = = WGL_TYPE_RGBA_FLOAT_ARB )
Sys_Printf ( " %s: WGL_TYPE_RGBA_FLOAT_ARB \n " , iAttributeTable [ j ] . name ) ;
else if ( iAttributeTable [ j ] . id = = WGL_PIXEL_TYPE_ARB & & fAttributeValues [ j ] = = 0x20A8 )
Sys_Printf ( " %s: WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT \n " , iAttributeTable [ j ] . name ) ;
else if ( iAttributeTable [ j ] . id = = 0x202E | | iAttributeTable [ j ] . id = = WGL_PIXEL_TYPE_ARB )
2017-07-12 08:15:27 +00:00
Sys_Printf ( " %s: %#x \n " , iAttributeTable [ j ] . name , ( int ) fAttributeValues [ j ] ) ;
else
Sys_Printf ( " %s: %g \n " , iAttributeTable [ j ] . name , fAttributeValues [ j ] ) ;
}
}
}
}
# endif
2006-03-15 20:11:37 +00:00
ReleaseDC ( mainwindow , hDC ) ;
2017-07-12 08:15:27 +00:00
if ( valid & & numFormats > 0 & & pixelformats [ 0 ] ! = currentpixelformat )
2006-03-15 20:11:37 +00:00
{
shouldforcepixelformat = true ;
2017-07-12 08:15:27 +00:00
forcepixelformat = pixelformats [ 0 ] ;
2006-03-15 20:11:37 +00:00
return true ;
}
}
return false ;
}
2004-08-22 22:29:09 +00:00
2016-12-13 11:50:15 +00:00
static BYTE IntensityFromShifted ( unsigned int index , unsigned int shift , unsigned int bits )
2006-07-21 23:38:24 +00:00
{
unsigned int val ;
val = ( index > > shift ) & ( ( 1 < < bits ) - 1 ) ;
switch ( bits )
{
case 1 :
val = val ? 0xFF : 0 ;
break ;
case 2 :
val | = val < < 2 ;
val | = val < < 4 ;
break ;
case 3 :
val = val < < ( 8 - bits ) ;
val | = val > > 3 ;
break ;
case 4 :
case 5 :
case 6 :
case 7 :
val = val < < ( 8 - bits ) ;
val | = val > > bits ;
break ;
case 8 :
break ;
default :
return 0 ;
}
return val ;
}
2016-12-13 11:50:15 +00:00
static void FixPaletteInDescriptor ( HDC hDC , PIXELFORMATDESCRIPTOR * pfd )
2006-07-21 23:38:24 +00:00
{
LOGPALETTE * ppal ;
HPALETTE hpal ;
int idx , clrs ;
if ( pfd - > dwFlags & PFD_NEED_PALETTE )
{
clrs = 1 < < pfd - > cColorBits ;
ppal = Z_Malloc ( sizeof ( LOGPALETTE ) + sizeof ( PALETTEENTRY ) * clrs ) ;
ppal - > palVersion = 0x300 ;
ppal - > palNumEntries = clrs ;
for ( idx = 0 ; idx < clrs ; idx + + )
{
ppal - > palPalEntry [ idx ] . peRed = IntensityFromShifted ( idx , pfd - > cRedShift , pfd - > cRedBits ) ;
ppal - > palPalEntry [ idx ] . peGreen = IntensityFromShifted ( idx , pfd - > cGreenShift , pfd - > cGreenBits ) ;
ppal - > palPalEntry [ idx ] . peBlue = IntensityFromShifted ( idx , pfd - > cBlueShift , pfd - > cBlueBits ) ;
ppal - > palPalEntry [ idx ] . peFlags = 0 ;
}
hpal = CreatePalette ( ppal ) ;
SelectPalette ( hDC , hpal , FALSE ) ;
RealizePalette ( hDC ) ;
Z_Free ( ppal ) ;
}
}
2016-12-13 11:50:15 +00:00
static BOOL bSetupPixelFormat ( HDC hDC , rendererstate_t * info )
2004-08-22 22:29:09 +00:00
{
2016-12-13 11:50:15 +00:00
PIXELFORMATDESCRIPTOR pfd = {
2004-08-22 22:29:09 +00:00
sizeof ( PIXELFORMATDESCRIPTOR ) , // size of this pfd
1 , // version number
PFD_DRAW_TO_WINDOW // support window
| PFD_SUPPORT_OPENGL // support OpenGL
2014-02-07 08:38:40 +00:00
| PFD_DOUBLEBUFFER , // double buffered
2004-08-22 22:29:09 +00:00
PFD_TYPE_RGBA , // RGBA type
24 , // 24-bit color depth
0 , 0 , 0 , 0 , 0 , 0 , // color bits ignored
0 , // no alpha buffer
0 , // shift bit ignored
0 , // no accumulation buffer
0 , 0 , 0 , 0 , // accum bits ignored
2009-11-04 21:16:50 +00:00
# ifndef RTLIGHTS
2018-03-04 14:41:16 +00:00
24 , // 24-bit z-buffer
2009-11-04 21:16:50 +00:00
0 , // 0 stencil, don't need it unless we're using rtlights
# else
24 , // 24-bit z-buffer
2004-08-22 22:29:09 +00:00
8 , // stencil buffer
2009-11-04 21:16:50 +00:00
# endif
2004-08-22 22:29:09 +00:00
0 , // no auxiliary buffer
PFD_MAIN_PLANE , // main layer
0 , // reserved
0 , 0 , 0 // layer masks ignored
2016-12-13 11:50:15 +00:00
} ;
2006-03-15 20:11:37 +00:00
2004-10-07 13:13:15 +00:00
TRACE ( ( " dbg: bSetupPixelFormat: ChoosePixelFormat \n " ) ) ;
2004-08-22 22:29:09 +00:00
2012-09-30 05:52:03 +00:00
if ( info - > stereo )
pfd . dwFlags | = PFD_STEREO ;
if ( info - > bpp = = 15 | | info - > bpp = = 16 )
pfd . cColorBits = 16 ;
2018-03-04 14:41:16 +00:00
if ( shouldforcepixelformat & & qwglChoosePixelFormatARB & &
qDescribePixelFormat ( hDC , forcepixelformat , sizeof ( pfd ) , & pfd ) & &
qSetPixelFormat ( hDC , forcepixelformat , & pfd ) ) //the extra && is paranoia
2004-10-07 13:13:15 +00:00
{
2006-03-15 20:11:37 +00:00
shouldforcepixelformat = false ;
2015-03-03 00:14:43 +00:00
currentpixelformat = forcepixelformat ;
2006-03-15 20:11:37 +00:00
}
2018-03-04 14:41:16 +00:00
else if ( ( currentpixelformat = qChoosePixelFormat ( hDC , & pfd ) ) & & qDescribePixelFormat ( hDC , currentpixelformat , sizeof ( pfd ) , & pfd ) & & qSetPixelFormat ( hDC , currentpixelformat , & pfd ) )
; //we got our desired pixel format, or close enough
2006-03-15 20:11:37 +00:00
else
{
pfd . cStencilBits = 0 ;
2018-03-04 14:41:16 +00:00
if ( ( currentpixelformat = qChoosePixelFormat ( hDC , & pfd ) ) & & qDescribePixelFormat ( hDC , currentpixelformat , sizeof ( pfd ) , & pfd ) & & qSetPixelFormat ( hDC , currentpixelformat , & pfd ) )
;
else
2006-03-15 20:11:37 +00:00
{
2018-03-04 14:41:16 +00:00
Con_Printf ( " Unable to find suitable pixel format: %i \n " , ( int ) GetLastError ( ) ) ;
2006-03-15 20:11:37 +00:00
return FALSE ;
}
}
2018-03-04 14:41:16 +00:00
shouldforcepixelformat = false ;
2004-08-22 22:29:09 +00:00
2012-11-27 03:23:19 +00:00
if ( ( pfd . dwFlags & PFD_GENERIC_FORMAT ) & & ! ( pfd . dwFlags & PFD_GENERIC_ACCELERATED ) )
{
Con_Printf ( CON_WARNING " WARNING: software-rendered opengl context \n Please install appropriate graphics drivers, or try d3d rendering instead \n " ) ;
}
2014-02-07 08:38:40 +00:00
else if ( pfd . dwFlags & PFD_SWAP_COPY )
Con_Printf ( CON_WARNING " WARNING: buffer swaps will use copy operations \n " ) ;
2012-11-27 03:23:19 +00:00
2006-07-21 23:38:24 +00:00
FixPaletteInDescriptor ( hDC , & pfd ) ;
2016-12-13 11:50:15 +00:00
return TRUE ;
2004-08-22 22:29:09 +00:00
}
2016-12-13 11:50:15 +00:00
# endif
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
MAIN WINDOW
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
/*
= = = = = = = = = = = = = = = =
ClearAllStates
= = = = = = = = = = = = = = = =
*/
2016-12-13 11:50:15 +00:00
static void ClearAllStates ( void )
2004-08-22 22:29:09 +00:00
{
2018-12-20 00:57:15 +00:00
IN_KeyEvent ( 0 , false , - 1 , 0 ) ; //-1 means to clear all keys.
2004-08-22 22:29:09 +00:00
Key_ClearStates ( ) ;
2012-10-14 09:00:49 +00:00
INS_ClearStates ( ) ;
2004-08-22 22:29:09 +00:00
}
2016-12-13 11:50:15 +00:00
static qboolean GLAppActivate ( BOOL fActive , BOOL minimize )
2004-08-22 22:29:09 +00:00
/****************************************************************************
*
* Function : AppActivate
* Parameters : fActive - True if app is activating
*
* Description : If the application is activating , then swap the system
* into SYSPAL_NOSTATIC mode so that our palettes will display
* correctly .
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
{
static BOOL sound_active ;
2018-03-04 14:41:16 +00:00
// Con_Printf("GLAppActivate: %i %i\n", fActive, minimize);
2016-02-10 23:23:43 +00:00
if ( vid . activeapp = = fActive & & Minimized = = minimize )
2005-12-06 02:19:22 +00:00
return false ; //so windows doesn't crash us over and over again.
2016-02-10 23:23:43 +00:00
vid . activeapp = fActive ; // && (foregroundwindow==mainwindow);
2004-08-22 22:29:09 +00:00
Minimized = minimize ;
// enable/disable sound on focus gain/loss
2016-02-10 23:23:43 +00:00
if ( ! vid . activeapp & & sound_active )
2004-08-22 22:29:09 +00:00
{
S_BlockSound ( ) ;
sound_active = false ;
}
2016-02-10 23:23:43 +00:00
else if ( vid . activeapp & & ! sound_active )
2004-08-22 22:29:09 +00:00
{
S_UnblockSound ( ) ;
sound_active = true ;
}
2016-02-10 23:23:43 +00:00
INS_UpdateGrabs ( modestate ! = MS_WINDOWED , vid . activeapp ) ;
2009-04-01 22:03:56 +00:00
2004-08-22 22:29:09 +00:00
if ( fActive )
{
2015-01-21 18:18:37 +00:00
if ( modestate = = MS_FULLDIB )
2004-08-22 22:29:09 +00:00
{
2013-05-11 14:02:55 +00:00
if ( vid_canalttab & & vid_wassuspended )
{
2004-08-22 22:29:09 +00:00
vid_wassuspended = false ;
ChangeDisplaySettings ( & gdevmode , CDS_FULLSCREEN ) ;
ShowWindow ( mainwindow , SW_SHOWNORMAL ) ;
// Fix for alt-tab bug in NVidia drivers
MoveWindow ( mainwindow , 0 , 0 , gdevmode . dmPelsWidth , gdevmode . dmPelsHeight , false ) ;
}
}
2015-01-21 18:18:37 +00:00
else if ( modestate = = MS_FULLWINDOW )
{
ShowWindow ( mainwindow , SW_SHOWMAXIMIZED ) ;
UpdateWindow ( mainwindow ) ;
}
2004-10-01 02:19:17 +00:00
2013-03-12 23:16:20 +00:00
gammapending = 0.5 ; //delayed gamma force
Cvar_ForceCallback ( & v_gamma ) ; //so the delay isn't so blatent when you have decent graphics drivers that don't break things.
2004-08-22 22:29:09 +00:00
}
if ( ! fActive )
{
2015-01-21 18:18:37 +00:00
if ( modestate = = MS_FULLDIB )
2004-08-22 22:29:09 +00:00
{
2013-07-13 12:14:32 +00:00
if ( vid_canalttab )
{
2004-08-22 22:29:09 +00:00
ChangeDisplaySettings ( NULL , 0 ) ;
vid_wassuspended = true ;
}
}
2004-10-01 02:19:17 +00:00
2013-05-11 14:02:55 +00:00
Cvar_ForceCallback ( & v_gamma ) ; //wham bam thanks.
2004-08-22 22:29:09 +00:00
}
2005-11-26 21:13:45 +00:00
2005-12-06 02:19:22 +00:00
return true ;
2004-08-22 22:29:09 +00:00
}
2014-03-30 08:55:06 +00:00
# ifndef TWF_WANTPALM
typedef struct _TOUCHINPUT {
LONG x ;
LONG y ;
HANDLE hSource ;
DWORD dwID ;
DWORD dwFlags ;
DWORD dwMask ;
DWORD dwTime ;
ULONG_PTR dwExtraInfo ;
DWORD cxContact ;
DWORD cyContact ;
} TOUCHINPUT , * PTOUCHINPUT ;
DECLARE_HANDLE ( HTOUCHINPUT ) ;
# define WM_TOUCH 0x0240
# define TOUCHINPUTMASKF_CONTACTAREA 0x0004
# define TOUCHEVENTF_DOWN 0x0002
# define TOUCHEVENTF_UP 0x0004
# define TWF_WANTPALM 0x00000002
# endif
static BOOL ( WINAPI * pRegisterTouchWindow ) ( HWND hWnd , ULONG ulFlags ) ;
static BOOL ( WINAPI * pGetTouchInputInfo ) ( HTOUCHINPUT hTouchInput , UINT cInputs , PTOUCHINPUT pInputs , int cbSize ) ;
static BOOL ( WINAPI * pCloseTouchInputHandle ) ( HTOUCHINPUT hTouchInput ) ;
static void Win_Touch_Init ( HWND wnd )
{
HMODULE lib ;
2015-05-14 03:06:58 +00:00
lib = LoadLibraryA ( " user32.dll " ) ;
2014-03-30 08:55:06 +00:00
pRegisterTouchWindow = ( void * ) GetProcAddress ( lib , " RegisterTouchWindow " ) ;
pGetTouchInputInfo = ( void * ) GetProcAddress ( lib , " GetTouchInputInfo " ) ;
pCloseTouchInputHandle = ( void * ) GetProcAddress ( lib , " CloseTouchInputHandle " ) ;
if ( pRegisterTouchWindow & & pGetTouchInputInfo & & pCloseTouchInputHandle )
pRegisterTouchWindow ( wnd , TWF_WANTPALM ) ;
}
static void Win_Touch_Event ( int points , HTOUCHINPUT ti )
{
float sz ;
int i ;
TOUCHINPUT * inputs = malloc ( points * sizeof ( * inputs ) ) , * input ;
if ( inputs )
{
if ( pGetTouchInputInfo ( ti , points , inputs , sizeof ( * inputs ) ) )
{
for ( i = 0 , input = inputs ; i < points ; i + + , input + + )
{
int id = input - > dwID + 1 ; //googling implies the id is generally a low 0-based index. I can't test this. the +1 ensures that mouselook is not broken by someone trying to use a touchscreen at the same time.
if ( input - > dwMask & TOUCHINPUTMASKF_CONTACTAREA )
sz = sqrt ( ( input - > cxContact * input - > cxContact + input - > cyContact * input - > cyContact ) / 10000.0 ) ;
else
sz = 0 ;
//the web seems to imply that the ids should be low values, <16 or so. hurrah.
//movement *then* buttons. this should ensure that the cursor is positioned correctly.
IN_MouseMove ( id , true , input - > x / 100.0f , input - > y / 100.0f , 0 , sz ) ;
if ( input - > dwFlags & TOUCHEVENTF_DOWN )
IN_KeyEvent ( id , true , K_MOUSE1 , 0 ) ;
if ( input - > dwFlags & TOUCHEVENTF_UP )
IN_KeyEvent ( id , false , K_MOUSE1 , 0 ) ;
}
}
free ( inputs ) ;
}
pCloseTouchInputHandle ( ti ) ;
}
2015-05-03 19:57:46 +00:00
# ifdef WTHREAD
2016-12-13 11:50:15 +00:00
//runs on the main/render thread, forwarded from the worker thread.
//these events are the ones that would cause race conditions, but need to be able to cope with a little bit of a delay (and shouldn't need to trigger other window messages, as that would cause other races).
2015-05-03 19:57:46 +00:00
void MainThreadWndProc ( void * ctx , void * data , size_t msg , size_t ex )
{
switch ( msg )
{
case WM_COPYDATA :
Host_RunFile ( data , ex , NULL ) ;
Z_Free ( data ) ;
break ;
2016-07-12 00:40:13 +00:00
case WM_CLOSE :
Cbuf_AddText ( " \n quit \n " , RESTRICT_LOCAL ) ;
break ;
2015-05-03 19:57:46 +00:00
case WM_SIZE :
case WM_MOVE :
2018-03-04 14:41:16 +00:00
Cvar_ForceCallback ( & vid_conautoscale ) ;
2015-05-03 19:57:46 +00:00
break ;
case WM_KILLFOCUS :
2018-03-04 14:41:16 +00:00
GLAppActivate ( FALSE , Minimized ) ;
ClearAllStates ( ) ;
2015-05-03 19:57:46 +00:00
break ;
case WM_SETFOCUS :
2018-03-04 14:41:16 +00:00
if ( ! GLAppActivate ( TRUE , Minimized ) )
2015-05-03 19:57:46 +00:00
break ;
2018-03-04 14:41:16 +00:00
ClearAllStates ( ) ;
2015-05-03 19:57:46 +00:00
break ;
2017-02-21 20:22:07 +00:00
# ifdef HAVE_CDPLAYER
2017-07-28 01:49:25 +00:00
case MM_MCINOTIFY :
CDAudio_MessageHandler ( mainwindow , msg , ( WPARAM ) ctx , ( LPARAM ) data ) ;
break ;
2017-02-21 20:22:07 +00:00
# endif
2015-05-03 19:57:46 +00:00
}
}
# endif
2014-03-30 08:55:06 +00:00
2015-05-03 19:57:46 +00:00
/* main window procedure
due to moving the main window over to a different thread , we gain access to input timestamps ( as well as video refreshes when dragging etc )
however , we have to tread carefully . the main / render thread will be running the whole time , and may trigger messages that we need to respond to _now_ .
this means that the main and window thread cannot be allowed to contest any mutexes where anything but memory is touched before its unlocked .
( or in other words , we can ' t have the main thread near - perma - lock any mutexes that can be locked - to - sync here )
*/
2016-12-13 11:50:15 +00:00
static LONG WINAPI GLMainWndProc (
2014-09-02 02:44:43 +00:00
HWND hWnd ,
UINT uMsg ,
WPARAM wParam ,
LPARAM lParam )
2004-08-22 22:29:09 +00:00
{
2014-09-02 02:44:43 +00:00
LONG lRet = 1 ;
2013-06-24 09:04:00 +00:00
// int fActive, fMinimized;
int temp ;
2004-08-22 22:29:09 +00:00
extern unsigned int uiWheelMessage ;
if ( uMsg = = uiWheelMessage )
uMsg = WM_MOUSEWHEEL ;
2014-09-02 02:44:43 +00:00
switch ( uMsg )
{
2013-05-03 04:28:08 +00:00
case WM_COPYDATA :
{
COPYDATASTRUCT * cds = ( COPYDATASTRUCT * ) lParam ;
2015-05-03 19:57:46 +00:00
# ifdef WTHREAD
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , MainThreadWndProc , NULL , memcpy ( Z_Malloc ( cds - > cbData ) , cds - > lpData , cds - > cbData ) , uMsg , cds - > cbData ) ;
2015-05-03 19:57:46 +00:00
# else
2013-06-23 02:17:02 +00:00
Host_RunFile ( cds - > lpData , cds - > cbData , NULL ) ;
2015-05-03 19:57:46 +00:00
# endif
2015-04-21 04:12:00 +00:00
lRet = 1 ;
2013-05-03 04:28:08 +00:00
}
break ;
2004-08-22 22:29:09 +00:00
case WM_KILLFOCUS :
2015-05-03 19:57:46 +00:00
# ifdef WTHREAD
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , MainThreadWndProc , NULL , NULL , uMsg , 0 ) ;
2015-05-03 19:57:46 +00:00
# else
GLAppActivate ( FALSE , Minimized ) ; //FIXME: thread
ClearAllStates ( ) ; //FIXME: thread
# endif
2018-07-22 11:49:37 +00:00
if ( modestate ! = MS_WINDOWED )
2018-03-04 14:41:16 +00:00
ShowWindow ( mainwindow , SW_SHOWMINNOACTIVE ) ;
2009-04-01 22:03:56 +00:00
break ;
case WM_SETFOCUS :
2015-05-03 19:57:46 +00:00
# ifdef WTHREAD
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , MainThreadWndProc , NULL , NULL , uMsg , 0 ) ;
2015-05-03 19:57:46 +00:00
# else
if ( ! GLAppActivate ( TRUE , Minimized ) ) //FIXME: thread
2009-04-01 22:03:56 +00:00
break ;
2015-05-03 19:57:46 +00:00
ClearAllStates ( ) ; //FIXME: thread
# endif
2004-08-22 22:29:09 +00:00
break ;
2014-03-30 08:55:06 +00:00
case WM_TOUCH :
Win_Touch_Event ( LOWORD ( wParam ) , ( HTOUCHINPUT ) lParam ) ;
return 0 ; //return 0 if we handled it.
2004-08-22 22:29:09 +00:00
case WM_CREATE :
break ;
case WM_MOVE :
2009-04-06 00:34:32 +00:00
VID_UpdateWindowStatus ( hWnd ) ;
2015-05-03 19:57:46 +00:00
# ifdef WTHREAD
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , MainThreadWndProc , NULL , NULL , uMsg , 0 ) ;
2015-05-03 19:57:46 +00:00
# else
2012-07-21 04:43:31 +00:00
Cvar_ForceCallback ( & vid_conautoscale ) ;
2015-05-03 19:57:46 +00:00
# endif
2004-08-22 22:29:09 +00:00
break ;
case WM_KEYDOWN :
case WM_SYSKEYDOWN :
if ( ! vid_initializing )
2015-01-21 18:18:37 +00:00
INS_TranslateKeyEvent ( wParam , lParam , true , 0 , false ) ;
2009-07-05 18:45:53 +00:00
break ;
// case WM_UNICHAR:
case WM_DEADCHAR :
case WM_SYSDEADCHAR :
case WM_CHAR :
case WM_SYSCHAR :
// if (!vid_initializing)
2012-10-14 09:00:49 +00:00
// INS_TranslateKeyEvent(wParam, lParam, true);
2004-08-22 22:29:09 +00:00
break ;
2004-11-13 17:31:04 +00:00
2004-08-22 22:29:09 +00:00
case WM_KEYUP :
case WM_SYSKEYUP :
if ( ! vid_initializing )
2015-01-21 18:18:37 +00:00
INS_TranslateKeyEvent ( wParam , lParam , false , 0 , false ) ;
2004-08-22 22:29:09 +00:00
break ;
2017-06-21 01:24:25 +00:00
case WM_APPCOMMAND :
2018-04-06 17:21:15 +00:00
if ( ! INS_AppCommand ( lParam ) )
lRet = DefWindowProc ( hWnd , uMsg , wParam , lParam ) ; //otherwise it won't get handled by background apps, like media players.
2017-06-21 01:24:25 +00:00
break ;
2015-04-14 23:12:17 +00:00
case WM_MOUSEACTIVATE :
lRet = MA_ACTIVATEANDEAT ;
break ;
2004-08-22 22:29:09 +00:00
// this is complicated because Win32 seems to pack multiple mouse events into
// one update sometimes, so we always check all states and look for events
case WM_LBUTTONDOWN :
case WM_LBUTTONUP :
case WM_RBUTTONDOWN :
case WM_RBUTTONUP :
case WM_MBUTTONDOWN :
case WM_MBUTTONUP :
case WM_MOUSEMOVE :
case WM_XBUTTONDOWN :
case WM_XBUTTONUP :
temp = 0 ;
if ( wParam & MK_LBUTTON )
2009-04-01 22:03:56 +00:00
{
2004-08-22 22:29:09 +00:00
temp | = 1 ;
2012-11-27 03:23:19 +00:00
if ( sys_parentwindow & & modestate = = MS_WINDOWED )
SetFocus ( hWnd ) ;
2009-04-01 22:03:56 +00:00
}
2004-08-22 22:29:09 +00:00
if ( wParam & MK_RBUTTON )
temp | = 2 ;
if ( wParam & MK_MBUTTON )
temp | = 4 ;
if ( wParam & MK_XBUTTON1 )
temp | = 8 ;
if ( wParam & MK_XBUTTON2 )
temp | = 16 ;
2005-06-18 22:30:57 +00:00
if ( wParam & MK_XBUTTON3 )
temp | = 32 ;
if ( wParam & MK_XBUTTON4 )
temp | = 64 ;
if ( wParam & MK_XBUTTON5 )
temp | = 128 ;
if ( wParam & MK_XBUTTON6 )
temp | = 256 ;
if ( wParam & MK_XBUTTON7 )
temp | = 512 ;
2004-08-22 22:29:09 +00:00
if ( ! vid_initializing )
2015-05-03 19:57:46 +00:00
INS_MouseEvent ( temp ) ; //FIXME: thread (halflife)
2004-08-22 22:29:09 +00:00
break ;
// JACK: This is the mouse wheel with the Intellimouse
// Its delta is either positive or neg, and we generate the proper
// Event.
2011-05-19 13:34:07 +00:00
case WM_MOUSEWHEEL :
2004-08-22 22:29:09 +00:00
if ( ! vid_initializing )
2004-09-13 04:16:52 +00:00
{
2014-10-05 20:04:11 +00:00
if ( ( short ) HIWORD ( wParam & 0xffffffff ) > 0 )
2004-09-13 04:16:52 +00:00
{
2015-05-03 19:57:46 +00:00
IN_KeyEvent ( 0 , true , K_MWHEELUP , 0 ) ;
IN_KeyEvent ( 0 , false , K_MWHEELUP , 0 ) ;
2004-09-13 04:16:52 +00:00
}
else
{
2015-05-03 19:57:46 +00:00
IN_KeyEvent ( 0 , true , K_MWHEELDOWN , 0 ) ;
IN_KeyEvent ( 0 , false , K_MWHEELDOWN , 0 ) ;
2004-08-22 22:29:09 +00:00
}
2004-09-13 04:16:52 +00:00
}
2004-08-22 22:29:09 +00:00
break ;
2005-06-29 21:20:34 +00:00
case WM_INPUT :
// raw input handling
2010-08-23 04:53:20 +00:00
if ( ! vid_initializing )
2015-04-21 04:12:00 +00:00
{
2012-10-14 09:00:49 +00:00
INS_RawInput_Read ( ( HANDLE ) lParam ) ;
2015-04-21 04:12:00 +00:00
lRet = 0 ;
}
2005-06-29 21:20:34 +00:00
break ;
2017-08-14 16:38:44 +00:00
case WM_DEVICECHANGE :
COM_AddWork ( WG_MAIN , INS_DeviceChanged , NULL , NULL , uMsg , 0 ) ;
lRet = TRUE ;
break ;
2005-06-29 21:20:34 +00:00
2016-12-13 11:50:15 +00:00
# ifdef VKQUAKE
2017-06-21 01:24:25 +00:00
case WM_USER_VKPRESENT :
2016-12-13 11:50:15 +00:00
VK_DoPresent ( ( struct vkframe * ) lParam ) ;
break ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
# endif
# if defined(VKQUAKE) && defined(USE_WGL)
2017-06-21 01:24:25 +00:00
case WM_USER_NVVKPRESENT :
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
Win32NVVK_DoPresent ( ( struct vkframe * ) lParam ) ;
break ;
2016-12-13 11:50:15 +00:00
# endif
2017-06-21 01:24:25 +00:00
case WM_USER_VIDSHUTDOWN :
2015-05-03 19:57:46 +00:00
PostQuitMessage ( 0 ) ;
break ;
2017-06-21 01:24:25 +00:00
case WM_USER_SPEECHTOTEXT :
2017-02-21 20:22:07 +00:00
# ifdef HAVE_SPEECHTOTEXT
2012-08-04 01:35:52 +00:00
STT_Event ( ) ;
2012-08-04 11:28:39 +00:00
# endif
2012-08-04 01:35:52 +00:00
break ;
2011-03-31 02:32:32 +00:00
case WM_GETMINMAXINFO :
{
RECT windowrect ;
RECT clientrect ;
MINMAXINFO * mmi = ( MINMAXINFO * ) lParam ;
GetWindowRect ( hWnd , & windowrect ) ;
GetClientRect ( hWnd , & clientrect ) ;
mmi - > ptMinTrackSize . x = 320 + ( ( windowrect . right - windowrect . left ) - ( clientrect . right - clientrect . left ) ) ;
mmi - > ptMinTrackSize . y = 200 + ( ( windowrect . bottom - windowrect . top ) - ( clientrect . bottom - clientrect . top ) ) ;
}
return 0 ;
2014-09-02 02:44:43 +00:00
case WM_SIZE :
2013-07-13 12:14:32 +00:00
vid . isminimized = ( wParam = = SIZE_MINIMIZED ) ;
2004-08-22 22:29:09 +00:00
if ( ! vid_initializing )
{
2009-04-06 00:34:32 +00:00
VID_UpdateWindowStatus ( hWnd ) ;
2015-05-03 19:57:46 +00:00
# ifdef WTHREAD
2016-02-15 06:01:17 +00:00
COM_AddWork ( WG_MAIN , MainThreadWndProc , NULL , NULL , uMsg , 0 ) ;
2015-05-03 19:57:46 +00:00
# else
2012-07-21 04:43:31 +00:00
Cvar_ForceCallback ( & vid_conautoscale ) ;
2015-05-03 19:57:46 +00:00
# endif
2004-08-22 22:29:09 +00:00
}
2014-09-02 02:44:43 +00:00
break ;
2004-08-22 22:29:09 +00:00
2014-09-02 02:44:43 +00:00
case WM_CLOSE :
2004-08-22 22:29:09 +00:00
if ( ! vid_initializing )
2016-07-12 00:40:13 +00:00
{
if ( wantquit )
2004-08-22 22:29:09 +00:00
{
2016-07-12 00:40:13 +00:00
//urr, this would be the second time that they've told us to quit.
//assume the main thread has deadlocked
if ( MessageBoxW ( hWnd , L " Terminate process? " , L " Confirm Exit " ,
MB_YESNO | MB_SETFOREGROUND | MB_ICONEXCLAMATION | MB_DEFBUTTON2 ) = = IDYES )
{
//abrupt process termination is never nice, but sometimes drivers suck.
//or qc code runs away, or ...
exit ( 1 ) ;
}
}
else if ( MessageBoxW ( hWnd , L " Are you sure you want to quit? " , L " Confirm Exit " ,
MB_YESNO | MB_SETFOREGROUND | MB_ICONQUESTION | MB_DEFBUTTON2 ) = = IDYES )
{
# ifdef WTHREAD
COM_AddWork ( WG_MAIN , MainThreadWndProc , NULL , NULL , uMsg , 0 ) ;
# else
2011-10-27 16:16:29 +00:00
Cbuf_AddText ( " \n quit \n " , RESTRICT_LOCAL ) ;
2016-07-12 00:40:13 +00:00
# endif
2015-02-07 22:34:22 +00:00
wantquit = true ;
2004-08-22 22:29:09 +00:00
}
2016-07-12 00:40:13 +00:00
}
2014-09-02 02:44:43 +00:00
break ;
2004-08-22 22:29:09 +00:00
2015-05-03 19:57:46 +00:00
case WM_ERASEBKGND :
lRet = TRUE ;
break ;
/*
2004-08-22 22:29:09 +00:00
case WM_ACTIVATE :
2013-06-24 09:04:00 +00:00
// fActive = LOWORD(wParam);
// fMinimized = (BOOL) HIWORD(wParam);
2012-07-05 19:42:36 +00:00
// if (!GLAppActivate(!(fActive == WA_INACTIVE), fMinimized))
2005-12-06 02:19:22 +00:00
break ; //so, urm, tell me microsoft, what changed?
2004-08-22 22:29:09 +00:00
if ( modestate = = MS_FULLDIB )
2015-05-03 19:57:46 +00:00
ShowWindow ( hWnd , SW_SHOWNORMAL ) ;
2004-08-22 22:29:09 +00:00
2015-05-03 19:57:46 +00:00
# ifdef WTHREAD
# else
2004-08-22 22:29:09 +00:00
// fix the leftover Alt from any Alt-Tab or the like that switched us away
2015-05-03 19:57:46 +00:00
ClearAllStates ( ) ; //FIXME: thread
2011-10-27 16:16:29 +00:00
2015-05-03 19:57:46 +00:00
Cvar_ForceCallback ( & vid_conautoscale ) ; //FIXME: thread
# endif
2004-08-22 22:29:09 +00:00
break ;
2015-05-03 19:57:46 +00:00
*/
2014-09-02 02:44:43 +00:00
case WM_DESTROY :
break ;
case WM_SETCURSOR :
//only use a custom cursor if the cursor is inside the client area
switch ( lParam & 0xffff )
{
case 0 :
break ;
case HTCLIENT :
if ( hCustomCursor ) //custom cursor enabled
SetCursor ( hCustomCursor ) ;
else //fallback on an arrow cursor, just so we have something visible at startup or so
SetCursor ( hArrowCursor ) ;
lRet = TRUE ;
break ;
default :
2015-05-14 03:06:58 +00:00
lRet = DefWindowProcW ( hWnd , uMsg , wParam , lParam ) ;
2014-09-02 02:44:43 +00:00
break ;
}
break ;
2004-08-22 22:29:09 +00:00
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
case WM_DROPFILES :
{
HDROP p = ( HDROP ) wParam ;
wchar_t fnamew [ MAX_PATH ] ;
char fname [ MAX_PATH ] ;
vfsfile_t * f ;
int i , count = DragQueryFile ( p , ~ 0 , NULL , 0 ) ;
for ( i = 0 ; i < count ; i + + )
{
if ( WinNT )
{
DragQueryFileW ( p , i , fnamew , countof ( fnamew ) ) ;
narrowen ( fname , sizeof ( fname ) , fnamew ) ;
}
else
DragQueryFileA ( p , i , fname , countof ( fname ) ) ;
f = FS_OpenVFS ( fname , " rb " , FS_SYSTEM ) ;
if ( f )
Host_RunFile ( fname , strlen ( fname ) , f ) ;
}
DragFinish ( p ) ;
return 0 ; //An application should return zero if it processes this message.
}
break ;
2017-02-21 20:22:07 +00:00
# ifdef HAVE_CDPLAYER
2004-08-22 22:29:09 +00:00
case MM_MCINOTIFY :
2017-02-21 20:22:07 +00:00
# ifdef WTHREAD
2017-07-28 01:49:25 +00:00
COM_AddWork ( WG_MAIN , MainThreadWndProc , ( void * ) wParam , ( void * ) lParam , uMsg , 0 ) ;
2017-02-21 20:22:07 +00:00
lRet = 0 ;
# else
2015-05-03 19:57:46 +00:00
lRet = CDAudio_MessageHandler ( hWnd , uMsg , wParam , lParam ) ; //FIXME: thread
2017-02-21 20:22:07 +00:00
# endif
2004-08-22 22:29:09 +00:00
break ;
2015-05-03 19:57:46 +00:00
# endif
2011-05-19 13:34:07 +00:00
2014-09-02 02:44:43 +00:00
default :
/* pass all unhandled messages to DefWindowProc */
2015-06-04 06:15:14 +00:00
if ( WinNT )
lRet = DefWindowProcW ( hWnd , uMsg , wParam , lParam ) ;
else
lRet = DefWindowProcA ( hWnd , uMsg , wParam , lParam ) ;
2014-09-02 02:44:43 +00:00
break ;
}
2004-08-22 22:29:09 +00:00
2014-09-02 02:44:43 +00:00
/* return 1 if handled message, 0 if not */
return lRet ;
2004-08-22 22:29:09 +00:00
}
2016-12-13 11:50:15 +00:00
/*
2011-05-19 13:34:07 +00:00
void VID_Init8bitPalette ( void )
2004-08-22 22:29:09 +00:00
{
2010-01-18 02:10:55 +00:00
# ifdef GL_USE8BITTEX
# ifdef GL_EXT_paletted_texture
# define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
2004-08-22 22:29:09 +00:00
// Check for 8bit Extensions and initialize them.
int i ;
char thePalette [ 256 * 3 ] ;
char * oldPalette , * newPalette ;
2005-01-07 03:16:44 +00:00
qglColorTableEXT = ( void * ) qwglGetProcAddress ( " glColorTableEXT " ) ;
2010-07-11 02:22:39 +00:00
if ( ! qglColorTableEXT | | ! GL_CheckExtension ( " GL_EXT_shared_texture_palette " ) | | COM_CheckParm ( " -no8bit " ) )
2004-08-22 22:29:09 +00:00
return ;
Con_SafePrintf ( " 8-bit GL extensions enabled. \n " ) ;
2010-07-11 02:22:39 +00:00
qglEnable ( GL_SHARED_TEXTURE_PALETTE_EXT ) ;
2004-08-22 22:29:09 +00:00
oldPalette = ( char * ) d_8to24rgbtable ; //d_8to24table3dfx;
newPalette = thePalette ;
2009-11-04 21:16:50 +00:00
for ( i = 0 ; i < 256 ; i + + )
{
2004-08-22 22:29:09 +00:00
* newPalette + + = * oldPalette + + ;
* newPalette + + = * oldPalette + + ;
* newPalette + + = * oldPalette + + ;
oldPalette + + ;
}
2005-01-07 03:16:44 +00:00
qglColorTableEXT ( GL_SHARED_TEXTURE_PALETTE_EXT , GL_RGB , 256 , GL_RGB , GL_UNSIGNED_BYTE ,
2004-08-22 22:29:09 +00:00
( void * ) thePalette ) ;
is8bit = TRUE ;
2010-01-18 02:10:55 +00:00
# endif
# endif
2004-08-22 22:29:09 +00:00
}
2016-12-13 11:50:15 +00:00
*/
2004-08-22 22:29:09 +00:00
void GLVID_DeInit ( void )
{
GLVID_Shutdown ( ) ;
2016-02-10 23:23:43 +00:00
vid . activeapp = false ;
2004-08-22 22:29:09 +00:00
2014-02-07 08:38:40 +00:00
Cvar_Unhook ( & vid_vsync ) ;
2009-04-06 00:34:32 +00:00
Cvar_Unhook ( & vid_wndalpha ) ;
2011-04-30 17:21:10 +00:00
Cmd_RemoveCommand ( " vid_recenter " ) ;
2004-08-22 22:29:09 +00:00
}
2011-04-30 17:21:10 +00:00
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = = = = =
VID_Init
= = = = = = = = = = = = = = = = = = =
*/
2016-12-13 11:50:15 +00:00
qboolean Win32VID_Init ( rendererstate_t * info , unsigned char * palette , int mode )
2004-08-22 22:29:09 +00:00
{
2015-01-07 13:34:05 +00:00
extern int isPlugin ;
2004-08-22 22:29:09 +00:00
// qbyte *ptmp;
DEVMODE devmode ;
2016-12-13 11:50:15 +00:00
platform_rendermode = mode ;
2004-08-22 22:29:09 +00:00
memset ( & devmode , 0 , sizeof ( devmode ) ) ;
2012-09-30 05:52:03 +00:00
hIcon = LoadIcon ( global_hInstance , MAKEINTRESOURCE ( IDI_ICON1 ) ) ;
2014-09-02 02:44:43 +00:00
hArrowCursor = LoadCursor ( NULL , IDC_ARROW ) ;
rf - > VID_CreateCursor = WIN_CreateCursor ;
rf - > VID_DestroyCursor = WIN_DestroyCursor ;
rf - > VID_SetCursor = WIN_SetCursor ;
2012-09-30 05:52:03 +00:00
2004-08-22 22:29:09 +00:00
vid_initialized = false ;
vid_initializing = true ;
if ( ! GLVID_SetMode ( info , palette ) )
{
VID_UnSetMode ( ) ;
return false ;
}
// Check for 3DFX Extensions and initialize them.
2016-12-13 11:50:15 +00:00
//VID_Init8bitPalette();
2004-08-22 22:29:09 +00:00
vid_canalttab = true ;
2014-02-07 08:38:40 +00:00
Cvar_Hook ( & vid_vsync , VID_Wait_Override_Callback ) ;
2009-04-06 00:34:32 +00:00
Cvar_Hook ( & vid_wndalpha , VID_WndAlpha_Override_Callback ) ;
2006-04-21 06:02:06 +00:00
2012-05-09 15:30:53 +00:00
Cmd_AddCommand ( " vid_recenter " , GLVID_Recenter_f ) ;
2011-04-30 17:21:10 +00:00
2015-01-07 13:34:05 +00:00
if ( isPlugin > = 2 )
{
2016-07-12 00:40:13 +00:00
fprintf ( stdout , " refocuswindow % " PRIxPTR " \n " , ( quintptr_t ) mainwindow ) ;
2015-01-07 13:34:05 +00:00
fflush ( stdout ) ;
}
2004-08-22 22:29:09 +00:00
vid_initialized = true ;
vid_initializing = false ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
WIN_WindowCreated ( mainwindow ) ;
2004-08-22 22:29:09 +00:00
return true ;
}
2016-12-13 11:50:15 +00:00
# ifdef USE_WGL
qboolean GLVID_Init ( rendererstate_t * info , unsigned char * palette )
{
return Win32VID_Init ( info , palette , MODE_WGL ) ;
}
# endif //USE_WGL
# ifdef USE_EGL
static qboolean EGLVID_Init ( rendererstate_t * info , unsigned char * palette )
{
if ( ! EGL_LoadLibrary ( info - > subrenderer ) )
return false ;
return Win32VID_Init ( info , palette , MODE_EGL ) ;
}
# include "shader.h"
# include "gl_draw.h"
rendererinfo_t eglrendererinfo =
{
" EGL(win32) " ,
{
" egl "
} ,
QR_OPENGL ,
GLDraw_Init ,
GLDraw_DeInit ,
GL_UpdateFiltering ,
GL_LoadTextureMips ,
GL_DestroyTexture ,
GLR_Init ,
GLR_DeInit ,
GLR_RenderView ,
EGLVID_Init ,
GLVID_DeInit ,
GLVID_SwapBuffers ,
GLVID_ApplyGammaRamps ,
NULL ,
NULL ,
NULL ,
GLVID_SetCaption , //setcaption
GLVID_GetRGBInfo ,
GLSCR_UpdateScreen ,
GLBE_SelectMode ,
GLBE_DrawMesh_List ,
GLBE_DrawMesh_Single ,
GLBE_SubmitBatch ,
GLBE_GetTempBatch ,
GLBE_DrawWorld ,
GLBE_Init ,
GLBE_GenBrushModelVBO ,
GLBE_ClearVBO ,
GLBE_UploadAllLightmaps ,
GLBE_SelectEntity ,
GLBE_SelectDLight ,
GLBE_Scissor ,
GLBE_LightCullModel ,
GLBE_VBO_Begin ,
GLBE_VBO_Data ,
GLBE_VBO_Finish ,
GLBE_VBO_Destroy ,
GLBE_RenderToTextureUpdate2d ,
" "
} ;
# endif //USE_EGL
# ifdef VKQUAKE
static qboolean VKVID_Init ( rendererstate_t * info , unsigned char * palette )
{
return Win32VID_Init ( info , palette , MODE_VULKAN ) ;
}
rendererinfo_t vkrendererinfo =
{
" Vulkan " ,
{
" vk " ,
" Vulkan "
} ,
QR_VULKAN ,
VK_Draw_Init ,
VK_Draw_Shutdown ,
VK_UpdateFiltering ,
VK_LoadTextureMips ,
VK_DestroyTexture ,
VK_R_Init ,
VK_R_DeInit ,
VK_R_RenderView ,
VKVID_Init ,
GLVID_DeInit ,
GLVID_SwapBuffers ,
GLVID_ApplyGammaRamps ,
WIN_CreateCursor ,
WIN_SetCursor ,
WIN_DestroyCursor ,
GLVID_SetCaption ,
VKVID_GetRGBInfo ,
VK_SCR_UpdateScreen ,
VKBE_SelectMode ,
VKBE_DrawMesh_List ,
VKBE_DrawMesh_Single ,
VKBE_SubmitBatch ,
VKBE_GetTempBatch ,
VKBE_DrawWorld ,
VKBE_Init ,
VKBE_GenBrushModelVBO ,
VKBE_ClearVBO ,
VKBE_UploadAllLightmaps ,
VKBE_SelectEntity ,
VKBE_SelectDLight ,
VKBE_Scissor ,
VKBE_LightCullModel ,
VKBE_VBO_Begin ,
VKBE_VBO_Data ,
VKBE_VBO_Finish ,
VKBE_VBO_Destroy ,
VKBE_RenderToTextureUpdate2d ,
" no more "
} ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
2017-05-10 03:13:18 +00:00
# ifdef USE_WGL
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
static qboolean NVVKVID_Init ( rendererstate_t * info , unsigned char * palette )
{
return Win32VID_Init ( info , palette , MODE_NVVULKAN ) ;
}
rendererinfo_t nvvkrendererinfo =
{
2018-04-19 17:30:39 +00:00
" Vulkan via OpenGL (GL_NV_draw_vulkan_image) " ,
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
{
" nvvk " ,
2018-04-19 17:30:39 +00:00
" GL_NV_draw_vulkan_image " ,
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
} ,
QR_VULKAN ,
VK_Draw_Init ,
VK_Draw_Shutdown ,
VK_UpdateFiltering ,
VK_LoadTextureMips ,
VK_DestroyTexture ,
VK_R_Init ,
VK_R_DeInit ,
VK_R_RenderView ,
NVVKVID_Init ,
GLVID_DeInit ,
GLVID_SwapBuffers ,
GLVID_ApplyGammaRamps ,
WIN_CreateCursor ,
WIN_SetCursor ,
WIN_DestroyCursor ,
GLVID_SetCaption ,
VKVID_GetRGBInfo ,
VK_SCR_UpdateScreen ,
VKBE_SelectMode ,
VKBE_DrawMesh_List ,
VKBE_DrawMesh_Single ,
VKBE_SubmitBatch ,
VKBE_GetTempBatch ,
VKBE_DrawWorld ,
VKBE_Init ,
VKBE_GenBrushModelVBO ,
VKBE_ClearVBO ,
VKBE_UploadAllLightmaps ,
VKBE_SelectEntity ,
VKBE_SelectDLight ,
VKBE_Scissor ,
VKBE_LightCullModel ,
VKBE_VBO_Begin ,
VKBE_VBO_Data ,
VKBE_VBO_Finish ,
VKBE_VBO_Destroy ,
VKBE_RenderToTextureUpdate2d ,
" no more "
} ;
2016-12-13 11:50:15 +00:00
# endif
2017-05-10 03:13:18 +00:00
# endif
2016-12-13 11:50:15 +00:00
2004-12-15 19:53:30 +00:00
# endif