Commit Graph

147 Commits

Author SHA1 Message Date
Eric Wasylishen 91196a618f Disable GLSL alias model renderer on Win32+ATI/AMD until szo's bug with models drawing black can be fixed.
Replace GLAlias_SupportsShaders() with gl_glsl_alias_able variable.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1171 af15c1b1-3010-417e-b628-4374ebc0bcbd
2015-02-20 00:24:05 +00:00
Eric Wasylishen 4c4ef48fcd gl_vidsdl.c: Experimental support for SDL2's new SDL_WINDOW_FULLSCREEN_DESKTOP mode.
When cvar vid_desktopfullscreen is set to 1, fullscreen mode ignores vid_width/vid_height and uses the desktop resolution. SDL docs recommend using this, it's supposed to offer better OS integration.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1164 af15c1b1-3010-417e-b628-4374ebc0bcbd
2015-02-07 00:05:06 +00:00
Eric Wasylishen 1311398e80 New gamma correction implementation using glsl. Enabled by default on OpenGL2. Disable with -noglslgamma.
Avoids general bugginess of hardware gamma, doesn't affect the whole screen in windowed mode like HW gamma. Should fix http://sourceforge.net/p/quakespasm/bugs/5/

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1157 af15c1b1-3010-417e-b628-4374ebc0bcbd
2015-01-26 20:18:45 +00:00
Eric Wasylishen 1a5c428100 VID_Restart: delete all GL textures before calling VID_SetMode. SDL2 reuses the gl context when changing modes, so the TexMgr_ReloadImages call after the mode change was leaking textures.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1156 af15c1b1-3010-417e-b628-4374ebc0bcbd
2015-01-26 20:18:39 +00:00
Eric Wasylishen 112c8b68b8 Alias model rendering fast-path using OpenGL 2.
In GL_MakeAliasModelDisplayLists, after saving the standerd triangle strips and fans onto the hunk, if the system is GL2 capable, we also save a second version of the mdl on the hunk designed to be loaded into a VBO (GL_MakeAliasModelDisplayLists_VBO). In R_NewMap, and on video mode changes, we call GLMesh_LoadVertexBuffers which loops over all precached mdl's and loads the data into a pair of VBO's (vertices and vertex indices).

Finally, in R_DrawAliasModel, assuming no rendering options are disabling the fast-path (r_drawflat 1, r_lightmap 1, or r_fullbright 1 would disable it), we call GL_DrawAliasFrame_GLSL, which sets up all of the bindings and draws the (possibly lerped) mdl in one glDrawElements call.

Special thanks to MH for some of the code from RMQEngine and the general concept.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1151 af15c1b1-3010-417e-b628-4374ebc0bcbd
2015-01-20 18:59:15 +00:00
Ozkan Sezer 6b57f04f57 make sure we have more than one CPUs before enabling multi-threaded OpenGL
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1139 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-11-03 09:20:23 +00:00
Eric Wasylishen 2870be2bee GL_Init: on OS X, enable multi-threaded OpenGL mode.
This moves some of the OpenGL implementation to a background thread, and makes draw calls block for a shorter amount of time. AFAIK, this is the default mode on most other OS'es, not sure why you have to explicitly ask for it on OS X.

N.B. the kCGLCEMPEngine constant is available on 10.4+ so I don't bother checking the OS X version.
More info: https://developer.apple.com/library/mac/technotes/tn2085/_index.html

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1137 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-11-02 23:01:20 +00:00
Ozkan Sezer ed0eeb149f sync a few minor stuff with uhexen2 svn
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1132 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-30 18:00:06 +00:00
Sander van Dijk bc30c6278c sdl: Make our error checking for SDL_Init(SubSystem) consistent with the SDL wiki/test programs.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1126 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-18 16:33:01 +00:00
Eric Wasylishen 1b6abd0e04 in_sdl.c, key.c: Fixes agreed on with Sander:
1. Remove Key_IgnoreTextInput(), and simple always send a Char_Event when
we receive TEXTINPUT (SDL2) or the unicode field of a KEYDOWN event is
filled (SDL1.).
2. Remove handling of K_KP_* in the menu/console, since they cannot be
relied on to not also send text (see issue described above). The handling
of K_KP_ENTER can stay, since we do know that it never sends text.
3. Remove the interpretation hack for the numpad, since it will no longer
be needed (and doesn't currently work for SDL2 anyway); if a numpad key
generates text we will handle it (because of "1"), if not then it will
simply be if ignored (because of "2”).

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1110 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-14 03:30:44 +00:00
Ozkan Sezer 5678106819 fix sdl2-msvc build
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1103 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-12 11:20:34 +00:00
Ozkan Sezer 039fdaad6f minor whitespace adjustments
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1101 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-11 19:11:40 +00:00
Sander van Dijk f6d44a3a10 Fix SDL2 fallback when no FSAA is available.
On my old laptop, when running "./quakespasm -fsaa 2", quakespasm would error out with a "Couldn't create window" message. Our "no FSAA available" fallback was applied at OpenGL context creation time, but according to the SDL2 wiki FSAA settings should be done before creation of the window (see https://wiki.libsdl.org/SDL_GLattr#multisample). Moved it there.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1084 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-05 17:06:35 +00:00
Eric Wasylishen 749ed362e7 gl_vidsdl.c: for OpenGL versions below 1.5, assume "-novbo" (attempting to avoid old, broken VBO implementations).
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1080 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-03 18:31:58 +00:00
Sander van Dijk 1ab2cbde9b input: Support for "plain" numpad keys in the menu/console (still todo: numpad translation).
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1078 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-10-02 19:21:52 +00:00
Ozkan Sezer b9032b7815 copyright years, general tidy-up, remove unused d_ifacea.h.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1059 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-22 08:55:46 +00:00
Ozkan Sezer c80fbd9629 allow KP_ENTER to function as K_ENTER in menus, console, etc., after r1042.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1058 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-22 06:21:06 +00:00
Ozkan Sezer f040037e64 add code for USE_GAMMA_RAMPS case for SDL2 builds. (still off by default.)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1053 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-21 14:00:56 +00:00
Ozkan Sezer 84e79ad4a2 cleanup USE_GAMMA_RAMPS and USE_SDL2 stuff
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1051 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-21 11:01:02 +00:00
Sander van Dijk 4aedfee2af gl_vidsdl.c: Correct some swap interval related messages.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1050 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-21 07:52:22 +00:00
Eric Wasylishen 90b26fc215 r_world: Add a new R_DrawTextureChains_Multitexture_VBO function. Draws lightmapped surfaces with fulbrights in one pass, using the VBO. Requires 3 TMUs, GL_COMBINE_EXT, and GL_ADD.
R_DrawTextureChains_Multitexture: revert to the way it was before VBO support was added.
gl_texmgr: expose GL_SelectTexture. make the implementation less convoluted and support 3 TMUs.
gl_vidsdl: check GL_MAX_TEXTURE_UNITS
r_brush: only create VBOs if 3 TMUs available

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1035 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-20 01:08:13 +00:00
Ozkan Sezer ad2905b5e4 bumped version to 0.90.0
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1033 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-16 09:05:36 +00:00
Sander van Dijk a5e4a93cf0 gl_vidsdl.c: Minor VID_Toggle() fast path optimization.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1026 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-13 01:48:24 +00:00
Eric Wasylishen e0680cb6d3 Load world and brush models into a VBO, and draw it in batches in R_DrawTextureChains_Multitexture. Uses the same immediate mode code as before if VBOs are not available, or if "-novbo" used at the command line. I only touched R_DrawTextureChains_Multitexture because it's usually the main bottleneck aside from alias model rendering.
This seems to help fps a fair bit on maps with a lot of world polys like jam2_tronyn. Tried on a few computers with intel and nvidia gpus, windows, mac os, linux, and there's always at least some fps improvement. Best case was 70fps -> 96fps on jam2_tronyn, on OS X + nvidia 650gt.

Interested to hear how this works for amd gpu's, just do a timedemo with and without "-novbo".

Only downside is I had to disable the fast path in Vid_Toggle_f() because at least with SDL1, the vbo no longer works after a toggle. So as a result, fullscreen toggles with alt-enter are slightly slower.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1018 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-11 04:55:16 +00:00
Eric Wasylishen 24f4a2dab4 SDL2 support, if USE_SDL2 defined.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@987 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-05 19:34:43 +00:00
Ozkan Sezer b8fc8caa0f dropped support for GL_SGIS_multitexture
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@984 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-30 08:00:34 +00:00
Eric Wasylishen b9d280f10b Revert r981 "Simple use of vertex arrays in R_DrawTextureChains_Multitexture."
It caused a dramatic slowdown on my machine on windows (50% slower)

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@983 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-30 06:30:49 +00:00
Eric Wasylishen bdca64b93b Silence warning about vid_fsaa requiring restart when parsing config.cfg at startup. Add missing newline to warning message.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@982 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-30 03:22:36 +00:00
Eric Wasylishen 745fa7ecce Simple use of vertex arrays in R_DrawTextureChains_Multitexture.
The glBegin(GL_POLYGON), for() loop with GL_MTexCoord2fFunc()/glVertex3fv() calls, and glEnd () per polygon is replaced by a memcpy() and a glDrawArrays() call per poly.

My guess is this only saves function call overhead, but it gives a decent ~20% speedup (36 -> 42fps) on my machine on orl’s map.

Note: glDrawArrays() is in OpenGL 1.1, but the glClientActiveTextureARB function is part of the GL_ARB_multitexture extension but not GL_SGIS_multitexture. Instead of splitting into two code paths, I just dropped support for GL_SGIS_multitexture.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@981 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-30 03:22:26 +00:00
Eric Wasylishen fb31319099 new fsaa support patch. commandline flag is -fsaa, cvar is vid_fsaa. cvar is only read in VID_Init, changing it prints a message that the new value will only be used upon restart
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@966 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-12 19:39:20 +00:00
Eric Wasylishen 7cca17afaa revert r962 and r963 (first attempt at multisampling)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@965 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-12 19:25:14 +00:00
Eric Wasylishen 5f7e61ecd4 cleanup fsaa patch, from szo. removes sdl version checks because qs requires sdl >= 1.2.10
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@963 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-11 08:08:15 +00:00
Eric Wasylishen 503db92edb fsaa support, borrowing from uhexen2. cvar is vid_multisample, cmdline arg is -fsaa (inconsistent..)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@962 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-11 06:58:42 +00:00
Ozkan Sezer 90c6f024f6 request 24-bit depth buffer / z-buffer. patch from Eric Wasylishen.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@935 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-07-15 07:03:56 +00:00
Ozkan Sezer 75338a37a1 support for GL_ARB_texture_non_power_of_two, patch from Eric Wasylishen.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@931 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-07-11 06:56:09 +00:00
Ozkan Sezer e27c101a08 gl_vidsdl.c: small gamma update.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@863 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-07-25 09:41:28 +00:00
Ozkan Sezer 50ed45c9b1 gl_vidsdl.c: use SDL_SetGamma() instead of SDL's GammaRamps api.
see: http://hg.libsdl.org/SDL/rev/3665bc284271
http://bugzilla.libsdl.org/show_bug.cgi?id=1979


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@861 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-07-24 07:00:44 +00:00
Sander van Dijk d3676574df gl_vidsdl.c: minor cleanup (lets not hijack the SDL_ prefix)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@840 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-03-03 15:01:14 +00:00
Sander van Dijk bd5b2ae556 gl_vidsdl.c: some video menu code readability tweaking
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@839 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-03-03 13:43:11 +00:00
Sander van Dijk 1c59d663ad gl_vidsdl.c: be bit more lenient (and safer) regarding bpp
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@836 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-03-02 18:10:19 +00:00
Sander van Dijk e2ea2d2360 gl_vidsdl.c: fix a minor inconsistency in VID_Toggle
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@835 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-03-02 16:35:48 +00:00
Sander van Dijk 78900118f3 gl_vidsdl.c: make the intel hack feedback a bit more informative
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@834 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-03-02 15:32:27 +00:00
Sander van Dijk f02120cc7f gl_vidsdl.c: remove the PowerVR stuff, as it seems to be outdated
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@833 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-03-02 13:46:59 +00:00
Sander van Dijk d245a15fe2 oops
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@832 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-03-02 13:13:47 +00:00
Sander van Dijk f26daa58c2 Simplify the Intel video hack, make the PowerVR hack do the same
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@831 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-03-02 13:10:02 +00:00
Sander van Dijk 3d7a0fd66a revert r612, fix VID_Test blackscreen properly
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@826 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-03-02 09:34:18 +00:00
Ozkan Sezer 47b044893e putenv () may conform to different standards, therefore keep the vid_center[]
static char array in VID_Init ().

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@822 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-02-24 17:15:04 +00:00
Sander van Dijk a6b83f69ce gl_vidsdl.c: make bpp default to current bpp
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@821 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-02-24 16:28:28 +00:00
Sander van Dijk 7ae0a9e7f2 gl_vidsdl.c: fix an initialization oops
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@820 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-02-24 13:46:19 +00:00
Sander van Dijk 8dfabe4e7f gl_vidsdl.c, vid.h: cleanup some modestate related stuff (requires a clean build)
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@819 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-02-24 13:42:23 +00:00