converted all code using gl_support_* variables to use vid.support.*
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 8 Dec 2009 04:42:15 +0000 (04:42 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 8 Dec 2009 04:42:15 +0000 (04:42 +0000)
instead
a few other cleanups

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9564 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
gl_backend.c
gl_rmain.c
gl_textures.c
glquake.h
menu.c
model_brush.c
model_shared.c
r_shadow.c
vid_shared.c

index 50ff644..0590e76 100644 (file)
@@ -1719,7 +1719,7 @@ static void SCR_SetLoadingScreenTexture(void)
 
        SCR_ClearLoadingScreenTexture();
 
-       if (gl_support_arb_texture_non_power_of_two)
+       if (vid.support.arb_texture_non_power_of_two)
        {
                w = vid.width; h = vid.height;
                loadingscreentexture_w = loadingscreentexture_h = 1;
@@ -2073,13 +2073,13 @@ void CL_UpdateScreen(void)
                Cvar_Set ("fov","170");
 
        // validate r_textureunits cvar
-       if (r_textureunits.integer > gl_textureunits)
-               Cvar_SetValueQuick(&r_textureunits, gl_textureunits);
+       if (r_textureunits.integer > (int)vid.texunits)
+               Cvar_SetValueQuick(&r_textureunits, vid.texunits);
        if (r_textureunits.integer < 1)
                Cvar_SetValueQuick(&r_textureunits, 1);
 
        // validate gl_combine cvar
-       if (gl_combine.integer && !gl_combine_extension)
+       if (gl_combine.integer && !vid.support.arb_texture_env_combine)
                Cvar_SetValueQuick(&gl_combine, 0);
 
        // intermission is always full screen
index 86b88dc..9d1be9e 100644 (file)
@@ -228,7 +228,7 @@ static void gl_backend_start(void)
                Con_DPrintf("GL_MAX_ELEMENTS_VERTICES = %i\nGL_MAX_ELEMENTS_INDICES = %i\n", gl_maxdrawrangeelementsvertices, gl_maxdrawrangeelementsindices);
        }
 
-       if (gl_support_fragment_shader)
+       if (vid.support.arb_fragment_shader)
        {
                Con_DPrintf("GLSL shader support detected: texture units = %i texenv, %i image, %i array\n", vid.texunits, vid.teximageunits, vid.texarrayunits);
                vid.teximageunits = bound(1, vid.teximageunits, MAX_TEXTUREUNITS);
@@ -681,15 +681,15 @@ void GL_SetupTextureState(void)
        {
                GL_ActiveTexture(i);
                qglBindTexture(GL_TEXTURE_2D, 0);CHECKGLERROR
-               if (gl_texture3d)
+               if (vid.support.ext_texture_3d)
                {
                        qglBindTexture(GL_TEXTURE_3D, 0);CHECKGLERROR
                }
-               if (gl_texturecubemap)
+               if (vid.support.arb_texture_cube_map)
                {
                        qglBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0);CHECKGLERROR
                }
-               if (gl_texturerectangle)
+               if (vid.support.arb_texture_rectangle)
                {
                        qglBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);CHECKGLERROR
                }
@@ -707,15 +707,15 @@ void GL_SetupTextureState(void)
        {
                GL_ActiveTexture(i);
                qglDisable(GL_TEXTURE_2D);CHECKGLERROR
-               if (gl_texture3d)
+               if (vid.support.ext_texture_3d)
                {
                        qglDisable(GL_TEXTURE_3D);CHECKGLERROR
                }
-               if (gl_texturecubemap)
+               if (vid.support.arb_texture_cube_map)
                {
                        qglDisable(GL_TEXTURE_CUBE_MAP_ARB);CHECKGLERROR
                }
-               if (gl_texturerectangle)
+               if (vid.support.arb_texture_rectangle)
                {
                        qglDisable(GL_TEXTURE_RECTANGLE_ARB);CHECKGLERROR
                }
@@ -783,13 +783,13 @@ void GL_Backend_ResetState(void)
        qglDepthMask(gl_state.depthmask);CHECKGLERROR
        qglPolygonOffset(gl_state.polygonoffset[0], gl_state.polygonoffset[1]);
 
-       if (gl_support_arb_vertex_buffer_object)
+       if (vid.support.arb_vertex_buffer_object)
        {
                qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
                qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
        }
 
-       if (gl_support_ext_framebuffer_object)
+       if (vid.support.ext_framebuffer_object)
        {
                qglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
                qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
@@ -1023,7 +1023,7 @@ void GL_LockArrays(int first, int count)
                        qglUnlockArraysEXT();
                        CHECKGLERROR
                }
-               if (count && gl_supportslockarrays && gl_lockarrays.integer)
+               if (count && vid.support.ext_compiled_vertex_array && gl_lockarrays.integer)
                {
                        gl_state.lockrange_first = first;
                        gl_state.lockrange_count = count;
@@ -1431,15 +1431,15 @@ void R_Mesh_Finish(void)
        {
                GL_ActiveTexture(i);
                qglBindTexture(GL_TEXTURE_2D, 0);CHECKGLERROR
-               if (gl_texture3d)
+               if (vid.support.ext_texture_3d)
                {
                        qglBindTexture(GL_TEXTURE_3D, 0);CHECKGLERROR
                }
-               if (gl_texturecubemap)
+               if (vid.support.arb_texture_cube_map)
                {
                        qglBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0);CHECKGLERROR
                }
-               if (gl_texturerectangle)
+               if (vid.support.arb_texture_rectangle)
                {
                        qglBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);CHECKGLERROR
                }
@@ -1453,15 +1453,15 @@ void R_Mesh_Finish(void)
        {
                GL_ActiveTexture(vid.texunits - 1 - i);
                qglDisable(GL_TEXTURE_2D);CHECKGLERROR
-               if (gl_texture3d)
+               if (vid.support.ext_texture_3d)
                {
                        qglDisable(GL_TEXTURE_3D);CHECKGLERROR
                }
-               if (gl_texturecubemap)
+               if (vid.support.arb_texture_cube_map)
                {
                        qglDisable(GL_TEXTURE_CUBE_MAP_ARB);CHECKGLERROR
                }
-               if (gl_texturerectangle)
+               if (vid.support.arb_texture_rectangle)
                {
                        qglDisable(GL_TEXTURE_RECTANGLE_ARB);CHECKGLERROR
                }
index e507002..4edc0c5 100644 (file)
@@ -2041,7 +2041,7 @@ void R_SetupShader_SetPermutation(unsigned int mode, unsigned int permutation)
 
 void R_SetupGenericShader(qboolean usetexture)
 {
-       if (gl_support_fragment_shader)
+       if (vid.support.arb_fragment_shader)
        {
                if (r_glsl.integer && r_glsl_usegeneric.integer)
                        R_SetupShader_SetPermutation(SHADERMODE_GENERIC, usetexture ? SHADERPERMUTATION_DIFFUSE : 0);
@@ -2055,7 +2055,7 @@ void R_SetupGenericShader(qboolean usetexture)
 
 void R_SetupGenericTwoTextureShader(int texturemode)
 {
-       if (gl_support_fragment_shader)
+       if (vid.support.arb_fragment_shader)
        {
                if (r_glsl.integer && r_glsl_usegeneric.integer)
                        R_SetupShader_SetPermutation(SHADERMODE_GENERIC, SHADERPERMUTATION_DIFFUSE | SHADERPERMUTATION_SPECULAR | (r_shadow_glossexact.integer ? SHADERPERMUTATION_EXACTSPECULARMATH : 0) | (texturemode == GL_MODULATE ? SHADERPERMUTATION_COLORMAPPING : (texturemode == GL_ADD ? SHADERPERMUTATION_GLOW : (texturemode == GL_DECAL ? SHADERPERMUTATION_VERTEXTEXTUREBLEND : 0))));
@@ -2075,7 +2075,7 @@ void R_SetupGenericTwoTextureShader(int texturemode)
 
 void R_SetupDepthOrShadowShader(void)
 {
-       if (gl_support_fragment_shader)
+       if (vid.support.arb_fragment_shader)
        {
                if (r_glsl.integer && r_glsl_usegeneric.integer)
                        R_SetupShader_SetPermutation(SHADERMODE_DEPTH_OR_SHADOW, 0);
@@ -2089,7 +2089,7 @@ void R_SetupDepthOrShadowShader(void)
 
 void R_SetupShowDepthShader(void)
 {
-       if (gl_support_fragment_shader)
+       if (vid.support.arb_fragment_shader)
        {
                if (r_glsl.integer && r_glsl_usegeneric.integer)
                        R_SetupShader_SetPermutation(SHADERMODE_SHOWDEPTH, 0);
@@ -2951,7 +2951,7 @@ void R_Main_ResizeViewCache(void)
 
 void gl_main_start(void)
 {
-       r_loadnormalmap = r_loadgloss = gl_dot3arb || gl_support_fragment_shader;
+       r_loadnormalmap = r_loadgloss = vid.support.arb_texture_env_dot3 || vid.support.arb_fragment_shader;
        r_loadfog = true;
 
        r_numqueries = 0;
@@ -2969,7 +2969,7 @@ void gl_main_start(void)
        r_main_texturepool = R_AllocTexturePool();
        R_BuildBlankTextures();
        R_BuildNoTexture();
-       if (gl_texturecubemap)
+       if (vid.support.arb_texture_cube_map)
        {
                R_BuildWhiteCube();
                R_BuildNormalizationCube();
@@ -3579,7 +3579,7 @@ static qboolean R_CanSeeBox(int numsamples, vec_t enlarge, vec3_t eye, vec3_t en
        vec3_t start;
        vec3_t end;
        dp_model_t *model = r_refdef.scene.worldmodel;
-       
+
        if (!model || !model->brush.TraceLineOfSight)
                return true;
 
@@ -4024,9 +4024,9 @@ static void R_Water_StartFrame(void)
 
        // calculate desired texture sizes
        // can't use water if the card does not support the texture size
-       if (!r_water.integer || !r_glsl.integer || !gl_support_fragment_shader || waterwidth > gl_max_texture_size || waterheight > gl_max_texture_size || r_showsurfaces.integer)
+       if (!r_water.integer || !r_glsl.integer || !vid.support.arb_fragment_shader || waterwidth > (int)vid.maxtexturesize_2d || waterheight > (int)vid.maxtexturesize_2d || r_showsurfaces.integer)
                texturewidth = textureheight = waterwidth = waterheight = 0;
-       else if (gl_support_arb_texture_non_power_of_two)
+       else if (vid.support.arb_texture_non_power_of_two)
        {
                texturewidth = waterwidth;
                textureheight = waterheight;
@@ -4255,11 +4255,11 @@ void R_Bloom_StartFrame(void)
        r_bloomstate.bloomwidth = bound(1, r_bloom_resolution.integer, vid.height);
        r_bloomstate.bloomheight = r_bloomstate.bloomwidth * vid.height / vid.width;
        r_bloomstate.bloomheight = bound(1, r_bloomstate.bloomheight, vid.height);
-       r_bloomstate.bloomwidth = bound(1, r_bloomstate.bloomwidth, gl_max_texture_size);
-       r_bloomstate.bloomheight = bound(1, r_bloomstate.bloomheight, gl_max_texture_size);
+       r_bloomstate.bloomwidth = bound(1, r_bloomstate.bloomwidth, (int)vid.maxtexturesize_2d);
+       r_bloomstate.bloomheight = bound(1, r_bloomstate.bloomheight, (int)vid.maxtexturesize_2d);
 
        // calculate desired texture sizes
-       if (gl_support_arb_texture_non_power_of_two)
+       if (vid.support.arb_texture_non_power_of_two)
        {
                screentexturewidth = r_refdef.view.width;
                screentextureheight = r_refdef.view.height;
@@ -4274,7 +4274,7 @@ void R_Bloom_StartFrame(void)
                for (bloomtextureheight  = 1;bloomtextureheight  < r_bloomstate.bloomheight;bloomtextureheight  *= 2);
        }
 
-       if ((r_hdr.integer || r_bloom.integer || (!R_Stereo_Active() && (r_motionblur.value > 0 || r_damageblur.value > 0))) && ((r_bloom_resolution.integer < 4 || r_bloom_blur.value < 1 || r_bloom_blur.value >= 512) || r_refdef.view.width > gl_max_texture_size || r_refdef.view.height > gl_max_texture_size))
+       if ((r_hdr.integer || r_bloom.integer || (!R_Stereo_Active() && (r_motionblur.value > 0 || r_damageblur.value > 0))) && ((r_bloom_resolution.integer < 4 || r_bloom_blur.value < 1 || r_bloom_blur.value >= 512) || r_refdef.view.width > (int)vid.maxtexturesize_2d || r_refdef.view.height > (int)vid.maxtexturesize_2d))
        {
                Cvar_SetValueQuick(&r_hdr, 0);
                Cvar_SetValueQuick(&r_bloom, 0);
@@ -4469,7 +4469,7 @@ void R_Bloom_MakeTexture(void)
 
        // apply subtract last
        // (just like it would be in a GLSL shader)
-       if (r_bloom_colorsubtract.value > 0 && gl_support_ext_blend_subtract)
+       if (r_bloom_colorsubtract.value > 0 && vid.support.ext_blend_subtract)
        {
                GL_BlendFunc(GL_ONE, GL_ZERO);
                R_Mesh_TexBind(0, R_GetTexture(r_bloomstate.texture_bloom));
@@ -4609,7 +4609,7 @@ static void R_BlendView(void)
                r_refdef.stats.bloom_copypixels += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
        }
 
-       if (r_glsl.integer && gl_support_fragment_shader && (r_bloomstate.texture_screen || r_bloomstate.texture_bloom))
+       if (r_glsl.integer && vid.support.arb_fragment_shader && (r_bloomstate.texture_screen || r_bloomstate.texture_bloom))
        {
                unsigned int permutation =
                          (r_bloomstate.texture_bloom ? SHADERPERMUTATION_BLOOM : 0)
@@ -4994,7 +4994,7 @@ void R_RenderView(void)
        r_refdef.view.clear = true;
 
        // this produces a bloom texture to be used in R_BlendView() later
-       if (r_hdr.integer)
+       if (r_hdr.integer && r_bloomstate.bloomwidth)
                R_HDR_RenderBloomTexture();
 
        r_refdef.view.showdebug = true;
@@ -7898,7 +7898,7 @@ static void R_DrawWorldTextureSurfaceList(int texturenumsurfaces, const msurface
        RSurf_SetupDepthAndCulling();
        if (r_showsurfaces.integer == 3)
                R_DrawTextureSurfaceList_ShowSurfaces3(texturenumsurfaces, texturesurfacelist, writedepth);
-       else if (r_glsl.integer && gl_support_fragment_shader)
+       else if (r_glsl.integer && vid.support.arb_fragment_shader)
                R_DrawTextureSurfaceList_GL20(texturenumsurfaces, texturesurfacelist, writedepth);
        else if (gl_combine.integer && r_textureunits.integer >= 2)
                R_DrawTextureSurfaceList_GL13(texturenumsurfaces, texturesurfacelist, writedepth);
@@ -7913,7 +7913,7 @@ static void R_DrawModelTextureSurfaceList(int texturenumsurfaces, const msurface
        RSurf_SetupDepthAndCulling();
        if (r_showsurfaces.integer == 3)
                R_DrawTextureSurfaceList_ShowSurfaces3(texturenumsurfaces, texturesurfacelist, writedepth);
-       else if (r_glsl.integer && gl_support_fragment_shader)
+       else if (r_glsl.integer && vid.support.arb_fragment_shader)
                R_DrawTextureSurfaceList_GL20(texturenumsurfaces, texturesurfacelist, writedepth);
        else if (gl_combine.integer && r_textureunits.integer >= 2)
                R_DrawTextureSurfaceList_GL13(texturenumsurfaces, texturesurfacelist, writedepth);
@@ -7938,7 +7938,7 @@ static void R_DrawSurface_TransparentCallback(const entity_render_t *ent, const
        else if (r_showsurfaces.integer && r_showsurfaces.integer != 3)
                RSurf_ActiveModelEntity(ent, false, false);
        else
-               RSurf_ActiveModelEntity(ent, true, r_glsl.integer && gl_support_fragment_shader);
+               RSurf_ActiveModelEntity(ent, true, r_glsl.integer && vid.support.arb_fragment_shader);
 
        for (i = 0;i < numsurfaces;i = j)
        {
@@ -9105,8 +9105,10 @@ void R_DrawModelSurfaces(entity_render_t *ent, qboolean skysurfaces, qboolean wr
                RSurf_ActiveWorldEntity();
        else if (r_showsurfaces.integer && r_showsurfaces.integer != 3)
                RSurf_ActiveModelEntity(ent, false, false);
+       else if (depthonly)
+               RSurf_ActiveModelEntity(ent, false, false);
        else
-               RSurf_ActiveModelEntity(ent, true, r_glsl.integer && gl_support_fragment_shader && !depthonly);
+               RSurf_ActiveModelEntity(ent, true, r_glsl.integer && vid.support.arb_fragment_shader);
 
        surfaces = model->data_surfaces;
        update = model->brushq1.lightmapupdateflags;
index 4e86d25..d437365 100644 (file)
@@ -122,7 +122,7 @@ typedef struct gltexture_s
        // palette if the texture is TEXTYPE_PALETTE
        const unsigned int *palette;
        // actual stored texture size after gl_picmip and gl_max_size are applied
-       // (power of 2 if gl_support_arb_texture_non_power_of_two is not supported)
+       // (power of 2 if vid.support.arb_texture_non_power_of_two is not supported)
        int tilewidth, tileheight, tiledepth;
        // 1 or 6 depending on texturetype
        int sides;
@@ -156,7 +156,7 @@ static int texturebuffersize = 0;
 
 static textypeinfo_t *R_GetTexTypeInfo(textype_t textype, int flags)
 {
-       if ((flags & TEXF_COMPRESS) && gl_texturecompression.integer >= 1 && gl_support_texture_compression)
+       if ((flags & TEXF_COMPRESS) && gl_texturecompression.integer >= 1 && vid.support.arb_texture_compression)
        {
                if (flags & TEXF_ALPHA)
                {
@@ -413,20 +413,20 @@ static void GL_Texture_CalcImageSize(int texturetype, int flags, int inwidth, in
 {
        int picmip = 0, maxsize = 0, width2 = 1, height2 = 1, depth2 = 1;
 
-       if (gl_max_size.integer > gl_max_texture_size)
-               Cvar_SetValue("gl_max_size", gl_max_texture_size);
+       if (gl_max_size.integer > (int)vid.maxtexturesize_2d)
+               Cvar_SetValue("gl_max_size", vid.maxtexturesize_2d);
 
        switch (texturetype)
        {
        default:
        case GLTEXTURETYPE_2D:
-               maxsize = gl_max_texture_size;
+               maxsize = vid.maxtexturesize_2d;
                break;
        case GLTEXTURETYPE_3D:
-               maxsize = gl_max_3d_texture_size;
+               maxsize = vid.maxtexturesize_3d;
                break;
        case GLTEXTURETYPE_CUBEMAP:
-               maxsize = gl_max_cube_map_texture_size;
+               maxsize = vid.maxtexturesize_cubemap;
                break;
        }
 
@@ -438,7 +438,7 @@ static void GL_Texture_CalcImageSize(int texturetype, int flags, int inwidth, in
 
        if (outwidth)
        {
-               if (gl_support_arb_texture_non_power_of_two)
+               if (vid.support.arb_texture_non_power_of_two)
                        width2 = min(inwidth >> picmip, maxsize);
                else
                {
@@ -449,7 +449,7 @@ static void GL_Texture_CalcImageSize(int texturetype, int flags, int inwidth, in
        }
        if (outheight)
        {
-               if (gl_support_arb_texture_non_power_of_two)
+               if (vid.support.arb_texture_non_power_of_two)
                        height2 = min(inheight >> picmip, maxsize);
                else
                {
@@ -460,7 +460,7 @@ static void GL_Texture_CalcImageSize(int texturetype, int flags, int inwidth, in
        }
        if (outdepth)
        {
-               if (gl_support_arb_texture_non_power_of_two)
+               if (vid.support.arb_texture_non_power_of_two)
                        depth2 = min(indepth >> picmip, maxsize);
                else
                {
@@ -638,7 +638,7 @@ void R_Textures_Frame (void)
                gltexturepool_t *pool;
                GLint oldbindtexnum;
 
-               old_aniso = bound(1, gl_texture_anisotropy.integer, gl_max_anisotropy);
+               old_aniso = bound(1, gl_texture_anisotropy.integer, (int)vid.max_anisotropy);
 
                Cvar_SetValueQuick(&gl_texture_anisotropy, old_aniso);
 
@@ -681,13 +681,13 @@ void R_MakeResizeBufferBigger(int size)
 static void GL_SetupTextureParameters(int flags, textype_t textype, int texturetype)
 {
        int textureenum = gltexturetypeenums[texturetype];
-       int wrapmode = ((flags & TEXF_CLAMP) && gl_support_clamptoedge) ? GL_CLAMP_TO_EDGE : GL_REPEAT;
+       int wrapmode = (flags & TEXF_CLAMP) ? GL_CLAMP_TO_EDGE : GL_REPEAT;
 
        CHECKGLERROR
 
-       if (gl_support_anisotropy && (flags & TEXF_MIPMAP))
+       if (vid.support.ext_texture_filter_anisotropic && (flags & TEXF_MIPMAP))
        {
-               int aniso = bound(1, gl_texture_anisotropy.integer, gl_max_anisotropy);
+               int aniso = bound(1, gl_texture_anisotropy.integer, (int)vid.max_anisotropy);
                if (gl_texture_anisotropy.integer != aniso)
                        Cvar_SetValueQuick(&gl_texture_anisotropy, aniso);
                qglTexParameteri(textureenum, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso);CHECKGLERROR
@@ -746,7 +746,7 @@ static void GL_SetupTextureParameters(int flags, textype_t textype, int texturet
 
        if (textype == TEXTYPE_SHADOWMAP)
        {
-               if (gl_support_arb_shadow)
+               if (vid.support.arb_shadow)
                {
                        if (flags & TEXF_COMPARE)
                        {
@@ -778,7 +778,7 @@ static void R_Upload(gltexture_t *glt, const unsigned char *data, int fragx, int
        qglBindTexture(gltexturetypeenums[glt->texturetype], glt->texnum);CHECKGLERROR
 
        // these are rounded up versions of the size to do better resampling
-       if (gl_support_arb_texture_non_power_of_two || glt->texturetype == GLTEXTURETYPE_RECTANGLE)
+       if (vid.support.arb_texture_non_power_of_two || glt->texturetype == GLTEXTURETYPE_RECTANGLE)
        {
                width = glt->inputwidth;
                height = glt->inputheight;
@@ -846,7 +846,7 @@ static void R_Upload(gltexture_t *glt, const unsigned char *data, int fragx, int
                        }
                }
                mip = 0;
-               if (gl_support_texture_compression)
+               if (vid.support.arb_texture_compression)
                {
                        if (gl_texturecompression.integer >= 2)
                                qglHint(GL_TEXTURE_COMPRESSION_HINT_ARB, GL_NICEST);
@@ -961,17 +961,17 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden
        if (cls.state == ca_dedicated)
                return NULL;
 
-       if (texturetype == GLTEXTURETYPE_RECTANGLE && !gl_texturerectangle)
+       if (texturetype == GLTEXTURETYPE_RECTANGLE && !vid.support.arb_texture_rectangle)
        {
                Con_Printf ("R_LoadTexture: rectangle texture not supported by driver\n");
                return NULL;
        }
-       if (texturetype == GLTEXTURETYPE_CUBEMAP && !gl_texturecubemap)
+       if (texturetype == GLTEXTURETYPE_CUBEMAP && !vid.support.arb_texture_cube_map)
        {
                Con_Printf ("R_LoadTexture: cubemap texture not supported by driver\n");
                return NULL;
        }
-       if (texturetype == GLTEXTURETYPE_3D && !gl_texture3d)
+       if (texturetype == GLTEXTURETYPE_3D && !vid.support.ext_texture_3d)
        {
                Con_Printf ("R_LoadTexture: 3d texture not supported by driver\n");
                return NULL;
index 1a56be0..cbe7406 100644 (file)
--- a/glquake.h
+++ b/glquake.h
@@ -264,8 +264,6 @@ typedef ptrdiff_t GLsizeiptrARB;
 #endif
 
 //GL_EXT_texture_filter_anisotropic
-extern int gl_support_anisotropy;
-extern int gl_max_anisotropy;
 #ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT
 #define GL_TEXTURE_MAX_ANISOTROPY_EXT       0x84FE
 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT   0x84FF
@@ -281,17 +279,13 @@ extern int gl_max_anisotropy;
 #endif
 
 // GL_ARB_shadow
-extern int gl_support_arb_shadow;
 #ifndef GL_TEXTURE_COMPARE_MODE_ARB
 #define GL_TEXTURE_COMPARE_MODE_ARB       0x884C
 #define GL_TEXTURE_COMPARE_FUNC_ARB       0x884D
 #define GL_COMPARE_R_TO_TEXTURE_ARB       0x884E
 #endif
 
-extern int gl_max_texture_size;
-
 // GL_ARB_multitexture
-extern int gl_textureunits;
 extern void (GLAPIENTRY *qglMultiTexCoord1f) (GLenum, GLfloat);
 extern void (GLAPIENTRY *qglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
 extern void (GLAPIENTRY *qglMultiTexCoord3f) (GLenum, GLfloat, GLfloat, GLfloat);
@@ -337,12 +331,10 @@ extern void (GLAPIENTRY *qglClientActiveTexture) (GLenum);
 #endif
 
 // GL_EXT_compiled_vertex_array
-extern int gl_supportslockarrays;
 extern void (GLAPIENTRY *qglLockArraysEXT) (GLint first, GLint count);
 extern void (GLAPIENTRY *qglUnlockArraysEXT) (void);
 
 // GL_ARB_texture_env_combine
-extern int gl_combine_extension;
 #ifndef GL_COMBINE_ARB
 #define GL_COMBINE_ARB                                 0x8570
 #define GL_COMBINE_RGB_ARB                             0x8571
@@ -376,8 +368,6 @@ extern int gl_combine_extension;
 #endif
 
 
-extern int gl_texture3d;
-extern int gl_max_3d_texture_size;
 #ifndef GL_TEXTURE_3D
 #define GL_PACK_SKIP_IMAGES                    0x806B
 #define GL_PACK_IMAGE_HEIGHT                   0x806C
@@ -394,8 +384,6 @@ extern void (GLAPIENTRY *qglTexSubImage3D)(GLenum target, GLint level, GLint xof
 extern void (GLAPIENTRY *qglCopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
 #endif
 
-extern int gl_texturecubemap;
-extern int gl_max_cube_map_texture_size;
 #ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
 #define GL_NORMAL_MAP_ARB                          0x8511
 #define GL_REFLECTION_MAP_ARB              0x8512
@@ -411,8 +399,6 @@ extern int gl_max_cube_map_texture_size;
 #define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB               0x851C
 #endif
 
-extern int gl_texturerectangle;
-extern int gl_max_rectangle_texture_size;
 #ifndef GL_TEXTURE_RECTANGLE_ARB
 #define GL_TEXTURE_RECTANGLE_ARB            0x84F5
 #define GL_TEXTURE_BINDING_RECTANGLE_ARB    0x84F6
@@ -422,7 +408,6 @@ extern int gl_max_rectangle_texture_size;
 #define GL_SAMPLER_2D_RECT_SHADOW_ARB       0x8B64
 #endif
 
-extern int gl_depthtexture;
 #ifndef GL_DEPTH_COMPONENT16_ARB
 #define GL_DEPTH_COMPONENT16_ARB       0x81A5
 #define GL_DEPTH_COMPONENT24_ARB       0x81A6
@@ -432,7 +417,6 @@ extern int gl_depthtexture;
 #endif
 
 
-extern int gl_dot3arb;
 #ifndef GL_DOT3_RGB_ARB
 #define GL_DOT3_RGB_ARB                                0x86AE
 #define GL_DOT3_RGBA_ARB                               0x86AF
@@ -453,13 +437,11 @@ extern int gl_dot3ext;
 #endif
 
 // GL_SGIS_texture_edge_clamp or GL_EXT_texture_edge_clamp
-extern int gl_support_clamptoedge;
 #ifndef GL_CLAMP_TO_EDGE
 #define GL_CLAMP_TO_EDGE 0x812F
 #endif
 
 //GL_ATI_separate_stencil
-extern int gl_support_separatestencil;
 #ifndef GL_STENCIL_BACK_FUNC
 #define GL_STENCIL_BACK_FUNC              0x8800
 #define GL_STENCIL_BACK_FAIL              0x8801
@@ -473,10 +455,8 @@ extern void (GLAPIENTRY *qglStencilFuncSeparate)(GLenum, GLenum, GLint, GLuint);
 #define GL_STENCIL_TEST_TWO_SIDE_EXT      0x8910
 #define GL_ACTIVE_STENCIL_FACE_EXT        0x8911
 extern void (GLAPIENTRY *qglActiveStencilFaceEXT)(GLenum);
-extern int gl_support_stenciltwoside;
 
 //GL_EXT_blend_minmax
-extern int gl_support_ext_blend_minmax;
 #ifndef GL_FUNC_ADD_EXT
 #define GL_FUNC_ADD_EXT                   0x8006 // also supplied by GL_EXT_blend_subtract
 #define GL_MIN_EXT                        0x8007
@@ -486,7 +466,6 @@ extern void (GLAPIENTRY *qglBlendEquationEXT)(GLenum); // also supplied by GL_EX
 #endif
 
 //GL_EXT_blend_subtract
-extern int gl_support_ext_blend_subtract;
 #ifndef GL_FUNC_SUBTRACT_EXT
 #define GL_FUNC_SUBTRACT_EXT              0x800A
 #define GL_FUNC_REVERSE_SUBTRACT_EXT      0x800B
@@ -494,10 +473,8 @@ extern void (GLAPIENTRY *qglBlendEquationEXT)(GLenum); // also supplied by GL_EX
 #endif
 
 //GL_ARB_texture_non_power_of_two
-extern int gl_support_arb_texture_non_power_of_two;
 
 //GL_ARB_vertex_buffer_object
-extern int gl_support_arb_vertex_buffer_object;
 #ifndef GL_ARRAY_BUFFER_ARB
 #define GL_ARRAY_BUFFER_ARB               0x8892
 #define GL_ELEMENT_ARRAY_BUFFER_ARB       0x8893
@@ -541,7 +518,6 @@ extern void (GLAPIENTRY *qglBufferDataARB) (GLenum target, GLsizeiptrARB size, c
 extern void (GLAPIENTRY *qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
 
 //GL_EXT_framebuffer_object
-extern int gl_support_ext_framebuffer_object;
 #ifndef GL_FRAMEBUFFER_EXT
 #define GL_FRAMEBUFFER_EXT                                   0x8D40
 #define GL_RENDERBUFFER_EXT                                  0x8D41
@@ -728,7 +704,6 @@ extern void (GLAPIENTRY *qglLineWidth)(GLfloat width);
 extern void (GLAPIENTRY *qglPointSize)(GLfloat size);
 
 // GL_ARB_shader_objects
-extern int gl_support_shader_objects;
 #ifndef GL_PROGRAM_OBJECT_ARB
 // 1-byte character string
 typedef char GLcharARB;
@@ -815,7 +790,6 @@ extern void (GLAPIENTRY *qglPolygonStipple)(const GLubyte *mask);
 #endif
 
 // GL_ARB_vertex_shader
-extern int gl_support_vertex_shader;
 //extern void (GLAPIENTRY *qglVertexAttrib1fARB)(GLuint index, GLfloat v0);
 //extern void (GLAPIENTRY *qglVertexAttrib1sARB)(GLuint index, GLshort v0);
 //extern void (GLAPIENTRY *qglVertexAttrib1dARB)(GLuint index, GLdouble v0);
@@ -892,7 +866,6 @@ extern GLint (GLAPIENTRY *qglGetAttribLocationARB)(GLhandleARB programObj, const
 #endif
 
 // GL_ARB_fragment_shader
-extern int gl_support_fragment_shader;
 #ifndef GL_FRAGMENT_SHADER_ARB
 #define GL_FRAGMENT_SHADER_ARB                                         0x8B30
 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB         0x8B49
@@ -902,13 +875,11 @@ extern int gl_support_fragment_shader;
 #endif
 
 // GL_ARB_shading_language_100
-extern int gl_support_shading_language_100;
 #ifndef GL_SHADING_LANGUAGE_VERSION_ARB
 #define GL_SHADING_LANGUAGE_VERSION_ARB                                0x8B8C
 #endif
 
 // GL_ARB_texture_compression
-extern int gl_support_texture_compression;
 extern void (GLAPIENTRY *qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
 extern void (GLAPIENTRY *qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border,  GLsizei imageSize, const void *data);
 //extern void (GLAPIENTRY *qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
@@ -931,7 +902,6 @@ extern void (GLAPIENTRY *qglGetCompressedTexImageARB)(GLenum target, GLint lod,
 #endif
 
 // GL_ARB_occlusion_query
-extern int gl_support_arb_occlusion_query;
 extern void (GLAPIENTRY *qglGenQueriesARB)(GLsizei n, GLuint *ids);
 extern void (GLAPIENTRY *qglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
 extern GLboolean (GLAPIENTRY *qglIsQueryARB)(GLuint qid);
@@ -955,10 +925,8 @@ extern void (GLAPIENTRY *qglGetQueryObjectuivARB)(GLuint qid, GLenum pname, GLui
 #define GL_BGRA                                        0x80E1
 
 //GL_AMD_texture_texture4
-extern int gl_support_amd_texture_texture4;
 
 //GL_ARB_texture_gather
-extern int gl_support_arb_texture_gather;
 
 #define DEBUGGL
 
diff --git a/menu.c b/menu.c
index ddea465..0625265 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -2922,15 +2922,15 @@ static void M_Video_Draw (void)
        M_DrawCheckbox(220, video_cursor_table[t], vid_vsync.integer);
        t++;
 
-       M_ItemPrint(16, video_cursor_table[t], "    Anisotropic Filter", gl_support_anisotropy);
-       M_DrawSlider(220, video_cursor_table[t], gl_texture_anisotropy.integer, 1, gl_max_anisotropy);
+       M_ItemPrint(16, video_cursor_table[t], "    Anisotropic Filter", vid.support.ext_texture_filter_anisotropic);
+       M_DrawSlider(220, video_cursor_table[t], gl_texture_anisotropy.integer, 1, vid.max_anisotropy);
        t++;
 
        M_ItemPrint(16, video_cursor_table[t], "       Texture Quality", true);
        M_DrawSlider(220, video_cursor_table[t], gl_picmip.value, 3, 0);
        t++;
 
-       M_ItemPrint(16, video_cursor_table[t], "   Texture Compression", gl_support_texture_compression);
+       M_ItemPrint(16, video_cursor_table[t], "   Texture Compression", vid.support.arb_texture_compression);
        M_DrawCheckbox(220, video_cursor_table[t], gl_texturecompression.integer);
        t++;
 
@@ -2978,7 +2978,7 @@ static void M_Menu_Video_AdjustSliders (int dir)
        else if (video_cursor == t++)
                Cvar_SetValueQuick (&vid_vsync, !vid_vsync.integer);
        else if (video_cursor == t++)
-               Cvar_SetValueQuick (&gl_texture_anisotropy, bound(1, gl_texture_anisotropy.value * (dir < 0 ? 0.5 : 2.0), gl_max_anisotropy));
+               Cvar_SetValueQuick (&gl_texture_anisotropy, bound(1, gl_texture_anisotropy.value * (dir < 0 ? 0.5 : 2.0), vid.max_anisotropy));
        else if (video_cursor == t++)
                Cvar_SetValueQuick (&gl_picmip, bound(0, gl_picmip.value - dir, 3));
        else if (video_cursor == t++)
index c9c41cf..5ca6925 100644 (file)
@@ -4639,7 +4639,7 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l, lump_t *faceslump)
                ;
        // i is now 0 for 128, 1 for 256, etc
 
-       for (power = 1;power + i <= mod_q3bsp_lightmapmergepower.integer && (size << power) <= gl_max_texture_size && (1 << (power * 2)) < 4 * (count >> (loadmodel->brushq3.deluxemapping ? 1 : 0)); power++)
+       for (power = 1;power + i <= mod_q3bsp_lightmapmergepower.integer && (size << power) <= (int)vid.maxtexturesize_2d && (1 << (power * 2)) < 4 * (count >> (loadmodel->brushq3.deluxemapping ? 1 : 0)); power++)
                loadmodel->brushq3.num_lightmapmergepower = power;
 
        loadmodel->brushq3.num_lightmapmerge = 1 << loadmodel->brushq3.num_lightmapmergepower;
index 6a0d502..040b1ba 100644 (file)
@@ -1146,7 +1146,7 @@ shadowmesh_t *Mod_ShadowMesh_Begin(mempool_t *mempool, int maxverts, int maxtria
 
 static void Mod_ShadowMesh_CreateVBOs(shadowmesh_t *mesh)
 {
-       if (!gl_support_arb_vertex_buffer_object)
+       if (!vid.support.arb_vertex_buffer_object)
                return;
 
        // element buffer is easy because it's just one array
@@ -2492,7 +2492,7 @@ static void Mod_BuildVBOs(void)
                }
        }
 
-       if (!gl_support_arb_vertex_buffer_object)
+       if (!vid.support.arb_vertex_buffer_object)
                return;
 
        // element buffer is easy because it's just one array
@@ -3563,7 +3563,7 @@ static void Mod_GenerateLightmaps_CreateLightmaps(dp_model_t *model)
                model->texturepool = R_AllocTexturePool();
        lm_basescalepixels = 1.0f / max(0.0001f, mod_generatelightmaps_unitspersample.value);
        lm_borderpixels = mod_generatelightmaps_borderpixels.integer;
-       lm_texturesize = bound(lm_borderpixels*2+1, 64, gl_max_texture_size);
+       lm_texturesize = bound(lm_borderpixels*2+1, 64, (int)vid.maxtexturesize_2d);
        lm_maxpixels = lm_texturesize-(lm_borderpixels*2+1);
        Mod_AllocLightmap_Init(&lmstate, lm_texturesize, lm_texturesize);
        lightmapnumber = 0;
@@ -3607,7 +3607,7 @@ static void Mod_GenerateLightmaps_CreateLightmaps(dp_model_t *model)
                                break;
                        // if we haven't maxed out the lightmap size yet, we retry the
                        // entire surface batch...
-                       if (lm_texturesize * 2 <= min(mod_generatelightmaps_texturesize.integer, gl_max_texture_size))
+                       if (lm_texturesize * 2 <= min(mod_generatelightmaps_texturesize.integer, (int)vid.maxtexturesize_2d))
                        {
                                lm_texturesize *= 2;
                                surfaceindex = -1;
index bb86919..41e3d95 100644 (file)
@@ -380,31 +380,31 @@ void R_Shadow_SetShadowMode(void)
        r_shadow_shadowmapsampler = false;
        r_shadow_shadowmappcf = 0;
        r_shadow_shadowmode = R_SHADOW_SHADOWMODE_STENCIL;
-       if(r_shadow_shadowmapping.integer && r_glsl.integer && gl_support_fragment_shader && gl_support_ext_framebuffer_object)
+       if(r_shadow_shadowmapping.integer && r_glsl.integer && vid.support.arb_fragment_shader && vid.support.ext_framebuffer_object)
        {
                if(r_shadow_shadowmapfilterquality < 0)
                {
                        if(strstr(gl_vendor, "NVIDIA")) 
                        {
-                               r_shadow_shadowmapsampler = gl_support_arb_shadow;
+                               r_shadow_shadowmapsampler = vid.support.arb_shadow;
                                r_shadow_shadowmappcf = 1;
                        }
-                       else if(gl_support_amd_texture_texture4 || gl_support_arb_texture_gather) 
+                       else if(vid.support.amd_texture_texture4 || vid.support.arb_texture_gather) 
                                r_shadow_shadowmappcf = 1;
                        else if(strstr(gl_vendor, "ATI")) 
                                r_shadow_shadowmappcf = 1;
                        else 
-                               r_shadow_shadowmapsampler = gl_support_arb_shadow;
+                               r_shadow_shadowmapsampler = vid.support.arb_shadow;
                }
                else 
                {
                        switch (r_shadow_shadowmapfilterquality)
                        {
                        case 1:
-                               r_shadow_shadowmapsampler = gl_support_arb_shadow;
+                               r_shadow_shadowmapsampler = vid.support.arb_shadow;
                                break;
                        case 2:
-                               r_shadow_shadowmapsampler = gl_support_arb_shadow;
+                               r_shadow_shadowmapsampler = vid.support.arb_shadow;
                                r_shadow_shadowmappcf = 1;
                                break;
                        case 3:
@@ -427,9 +427,9 @@ void R_Shadow_SetShadowMode(void)
             r_shadow_shadowmode = R_SHADOW_SHADOWMODE_SHADOWMAPCUBESIDE;
             break;
         default:
-                       if((gl_support_amd_texture_texture4 || gl_support_arb_texture_gather) && r_shadow_shadowmappcf && !r_shadow_shadowmapsampler)
+                       if((vid.support.amd_texture_texture4 || vid.support.arb_texture_gather) && r_shadow_shadowmappcf && !r_shadow_shadowmapsampler)
                                r_shadow_shadowmode = R_SHADOW_SHADOWMODE_SHADOWMAP2D;
-                       else if(gl_texturerectangle) 
+                       else if(vid.support.arb_texture_rectangle) 
                                r_shadow_shadowmode = R_SHADOW_SHADOWMODE_SHADOWMAPRECTANGLE;
                        else
                                r_shadow_shadowmode = R_SHADOW_SHADOWMODE_SHADOWMAP2D;
@@ -1722,7 +1722,7 @@ static void R_Shadow_MakeTextures(void)
                        data[y*ATTEN2DSIZE+x] = R_Shadow_MakeTextures_SamplePoint(((x + 0.5f) * (2.0f / ATTEN2DSIZE) - 1.0f) * (1.0f / 0.9375), ((y + 0.5f) * (2.0f / ATTEN2DSIZE) - 1.0f) * (1.0f / 0.9375), 0);
        r_shadow_attenuation2dtexture = R_LoadTexture2D(r_shadow_texturepool, "attenuation2d", ATTEN2DSIZE, ATTEN2DSIZE, (unsigned char *)data, TEXTYPE_BGRA, TEXF_PRECACHE | TEXF_CLAMP | TEXF_ALPHA | TEXF_FORCELINEAR, NULL);
        // 3D sphere texture
-       if (r_shadow_texture3d.integer && gl_texture3d)
+       if (r_shadow_texture3d.integer && vid.support.ext_texture_3d)
        {
                for (z = 0;z < ATTEN3DSIZE;z++)
                        for (y = 0;y < ATTEN3DSIZE;y++)
@@ -1849,11 +1849,11 @@ static void R_Shadow_MakeTextures(void)
 
 void R_Shadow_ValidateCvars(void)
 {
-       if (r_shadow_texture3d.integer && !gl_texture3d)
+       if (r_shadow_texture3d.integer && !vid.support.ext_texture_3d)
                Cvar_SetValueQuick(&r_shadow_texture3d, 0);
-       if (gl_ext_separatestencil.integer && !gl_support_separatestencil)
+       if (gl_ext_separatestencil.integer && !vid.support.ati_separate_stencil)
                Cvar_SetValueQuick(&gl_ext_separatestencil, 0);
-       if (gl_ext_stenciltwoside.integer && !gl_support_stenciltwoside)
+       if (gl_ext_stenciltwoside.integer && !vid.support.ext_stencil_two_side)
                Cvar_SetValueQuick(&gl_ext_stenciltwoside, 0);
 }
 
@@ -1900,9 +1900,9 @@ void R_Shadow_RenderMode_Begin(void)
                r_shadow_shadowingrendermode_zfail = R_SHADOW_RENDERMODE_ZFAIL_STENCIL;
        }
 
-       if (r_glsl.integer && gl_support_fragment_shader)
+       if (r_glsl.integer && vid.support.arb_fragment_shader)
                r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_GLSL;
-       else if (gl_dot3arb && gl_texturecubemap && r_shadow_dot3.integer && vid.stencil)
+       else if (vid.support.arb_texture_env_dot3 && vid.support.arb_texture_cube_map && r_shadow_dot3.integer && vid.stencil)
                r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_DOT3;
        else
                r_shadow_lightingrendermode = R_SHADOW_RENDERMODE_LIGHT_VERTEX;
@@ -1930,7 +1930,7 @@ void R_Shadow_RenderMode_Reset(void)
        {
                qglDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);CHECKGLERROR
        }
-       if (gl_support_ext_framebuffer_object)
+       if (vid.support.ext_framebuffer_object)
        {
                qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);CHECKGLERROR
        }
@@ -2070,7 +2070,7 @@ void R_Shadow_RenderMode_ShadowMap(int side, qboolean clear, int size)
                if (!r_shadow_shadowmap2dtexture)
                {
 #if 1
-                       int w = maxsize*2, h = gl_support_arb_texture_non_power_of_two ? maxsize*3 : maxsize*4;
+                       int w = maxsize*2, h = vid.support.arb_texture_non_power_of_two ? maxsize*3 : maxsize*4;
                        r_shadow_shadowmap2dtexture = R_LoadTextureShadowMap2D(r_shadow_texturepool, "shadowmap", w, h, r_shadow_shadowmapdepthbits, r_shadow_shadowmapsampler);
                        qglGenFramebuffersEXT(1, &r_shadow_fbo2d);CHECKGLERROR
                        qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, r_shadow_fbo2d);CHECKGLERROR
@@ -3454,7 +3454,7 @@ void R_Shadow_RenderLighting(int firstvertex, int numvertices, int firsttriangle
        }
        if ((ambientscale + diffusescale) * VectorLength2(lightcolorbase) + specularscale * VectorLength2(lightcolorbase) < (1.0f / 1048576.0f))
                return;
-       negated = (lightcolorbase[0] + lightcolorbase[1] + lightcolorbase[2] < 0) && gl_support_ext_blend_subtract;
+       negated = (lightcolorbase[0] + lightcolorbase[1] + lightcolorbase[2] < 0) && vid.support.ext_blend_subtract;
        if(negated)
        {
                VectorNegate(lightcolorbase, lightcolorbase);
@@ -4241,7 +4241,7 @@ void R_DrawRTLight(rtlight_t *rtlight, qboolean visible)
        }
 
        // return if there's nothing at all to light
-       if (!numlightentities && !numsurfaces)
+       if (numsurfaces + numlightentities + numlightentities_noselfshadow == 0)
                return;
 
        // don't let sound skip if going slow
@@ -4397,10 +4397,15 @@ void R_DrawRTLight(rtlight_t *rtlight, qboolean visible)
                // so that they won't receive lighting
                GL_Scissor(r_shadow_lightscissor[0], r_shadow_lightscissor[1], r_shadow_lightscissor[2], r_shadow_lightscissor[3]);
                R_Shadow_ClearStencil();
-               if (numsurfaces)
-                       R_Shadow_DrawWorldShadow_ShadowVolume(numsurfaces, surfacelist, shadowtrispvs);
-               for (i = 0;i < numshadowentities;i++)
-                       R_Shadow_DrawEntityShadow(shadowentities[i]);
+
+               if (numsurfaces + numshadowentities)
+               {
+                       if (numsurfaces)
+                               R_Shadow_DrawWorldShadow_ShadowVolume(numsurfaces, surfacelist, shadowtrispvs);
+                       for (i = 0;i < numshadowentities;i++)
+                               R_Shadow_DrawEntityShadow(shadowentities[i]);
+               }
+
                if (numlightentities_noselfshadow)
                {
                        // draw lighting in the unmasked areas
@@ -4416,9 +4421,9 @@ void R_DrawRTLight(rtlight_t *rtlight, qboolean visible)
                                for (i = 0;i < numlightentities_noselfshadow;i++)
                                        R_Shadow_DrawEntityLight(lightentities[lightentities_noselfshadow - i]);
                        }
+                       for (i = 0;i < numshadowentities_noselfshadow;i++)
+                               R_Shadow_DrawEntityShadow(shadowentities[shadowentities_noselfshadow - i]);
                }
-               for (i = 0;i < numshadowentities_noselfshadow;i++)
-                       R_Shadow_DrawEntityShadow(shadowentities[shadowentities_noselfshadow - i]);
 
                if (numsurfaces + numlightentities)
                {
@@ -4432,17 +4437,14 @@ void R_DrawRTLight(rtlight_t *rtlight, qboolean visible)
        }
        else
        {
-               if (numsurfaces + numlightentities)
-               {
-                       // draw lighting in the unmasked areas
-                       R_Shadow_RenderMode_Lighting(false, false, false);
-                       if (numsurfaces)
-                               R_Shadow_DrawWorldLight(numsurfaces, surfacelist, lighttrispvs);
-                       for (i = 0;i < numlightentities;i++)
-                               R_Shadow_DrawEntityLight(lightentities[i]);
-                       for (i = 0;i < numlightentities_noselfshadow;i++)
-                               R_Shadow_DrawEntityLight(lightentities[lightentities_noselfshadow - i]);
-               }
+               // draw lighting in the unmasked areas
+               R_Shadow_RenderMode_Lighting(false, false, false);
+               if (numsurfaces)
+                       R_Shadow_DrawWorldLight(numsurfaces, surfacelist, lighttrispvs);
+               for (i = 0;i < numlightentities;i++)
+                       R_Shadow_DrawEntityLight(lightentities[i]);
+               for (i = 0;i < numlightentities_noselfshadow;i++)
+                       R_Shadow_DrawEntityLight(lightentities[lightentities_noselfshadow - i]);
        }
 }
 
@@ -4457,7 +4459,7 @@ void R_ShadowVolumeLighting(qboolean visible)
        float f;
 
        if (r_shadow_shadowmapmaxsize != bound(1, r_shadow_shadowmapping_maxsize.integer, gl_max_size.integer / 4) ||
-               (r_shadow_shadowmode != R_SHADOW_SHADOWMODE_STENCIL) != (r_shadow_shadowmapping.integer && r_glsl.integer && gl_support_fragment_shader && gl_support_ext_framebuffer_object) || 
+               (r_shadow_shadowmode != R_SHADOW_SHADOWMODE_STENCIL) != (r_shadow_shadowmapping.integer && r_glsl.integer && vid.support.arb_fragment_shader && vid.support.ext_framebuffer_object) || 
                r_shadow_shadowmapvsdct != (r_shadow_shadowmapping_vsdct.integer != 0) || 
                r_shadow_shadowmaptexturetype != r_shadow_shadowmapping_texturetype.integer ||
                r_shadow_shadowmapfilterquality != r_shadow_shadowmapping_filterquality.integer || 
@@ -4702,7 +4704,7 @@ void R_DrawCorona(rtlight_t *rtlight, float cscale, float scale)
        if (VectorLength(color) > (1.0f / 256.0f))
        {
                float vertex3f[12];
-               qboolean negated = (color[0] + color[1] + color[2] < 0) && gl_support_ext_blend_subtract;
+               qboolean negated = (color[0] + color[1] + color[2] < 0) && vid.support.ext_blend_subtract;
                if(negated)
                {
                        VectorNegate(color, color);
@@ -4737,7 +4739,7 @@ void R_DrawCoronas(void)
        // use GL_ARB_occlusion_query if available
        // otherwise use raytraces
        r_numqueries = 0;
-       usequery = gl_support_arb_occlusion_query && r_coronas_occlusionquery.integer;
+       usequery = vid.support.arb_occlusion_query && r_coronas_occlusionquery.integer;
        if (usequery)
        {
                GL_ColorMask(0,0,0,0);
index 6b8501b..d3884ea 100644 (file)
@@ -16,65 +16,6 @@ qboolean in_client_mouse = true;
 float in_mouse_x, in_mouse_y;
 float in_windowmouse_x, in_windowmouse_y;
 
-// value of GL_MAX_TEXTURE_<various>_SIZE
-int gl_max_texture_size = 0;
-int gl_max_3d_texture_size = 0;
-int gl_max_cube_map_texture_size = 0;
-int gl_max_rectangle_texture_size = 0;
-// GL_ARB_multitexture
-int gl_textureunits = 1;
-// GL_ARB_texture_env_combine or GL_EXT_texture_env_combine
-int gl_combine_extension = false;
-// GL_EXT_compiled_vertex_array
-int gl_supportslockarrays = false;
-// 3D textures available
-int gl_texture3d = false;
-// GL_ARB_texture_cubemap
-int gl_texturecubemap = false;
-// GL_ARB_texture_rectangle
-int gl_texturerectangle = false;
-// GL_ARB_texture_non_power_of_two
-int gl_support_arb_texture_non_power_of_two = false;
-// GL_ARB_texture_env_dot3
-int gl_dot3arb = false;
-// GL_ARB_depth_texture
-int gl_depthtexture = false;
-// GL_ARB_shadow
-int gl_support_arb_shadow = false;
-// GL_SGIS_texture_edge_clamp
-int gl_support_clamptoedge = false;
-// GL_EXT_texture_filter_anisotropic
-int gl_support_anisotropy = false;
-int gl_max_anisotropy = 1;
-// OpenGL2.0 core glStencilOpSeparate, or GL_ATI_separate_stencil
-int gl_support_separatestencil = false;
-// GL_EXT_stencil_two_side
-int gl_support_stenciltwoside = false;
-// GL_EXT_blend_minmax
-int gl_support_ext_blend_minmax = false;
-// GL_EXT_blend_subtract
-int gl_support_ext_blend_subtract = false;
-// GL_ARB_shader_objects
-int gl_support_shader_objects = false;
-// GL_ARB_shading_language_100
-int gl_support_shading_language_100 = false;
-// GL_ARB_vertex_shader
-int gl_support_vertex_shader = false;
-// GL_ARB_fragment_shader
-int gl_support_fragment_shader = false;
-//GL_ARB_vertex_buffer_object
-int gl_support_arb_vertex_buffer_object = false;
-//GL_EXT_framebuffer_object
-int gl_support_ext_framebuffer_object = false;
-//GL_ARB_texture_compression
-int gl_support_texture_compression = false;
-//GL_ARB_occlusion_query
-int gl_support_arb_occlusion_query = false;
-//GL_AMD_texture_texture4
-int gl_support_amd_texture_texture4 = false;
-//GL_ARB_texture_gather
-int gl_support_arb_texture_gather = false;
-
 // LordHavoc: if window is hidden, don't update screen
 qboolean vid_hidden = true;
 // LordHavoc: if window is not the active window, don't hog as much CPU time,
@@ -973,38 +914,6 @@ void VID_CheckExtensions(void)
                vid.renderpath = RENDERPATH_GL11;
        }
 
-       gl_max_texture_size = vid.maxtexturesize_2d;
-       gl_max_3d_texture_size = vid.maxtexturesize_3d;
-       gl_max_cube_map_texture_size = vid.maxtexturesize_cubemap;
-       gl_textureunits = vid.texunits;
-       gl_max_anisotropy = vid.max_anisotropy;
-
-       gl_combine_extension = vid.support.arb_texture_env_combine;
-       gl_supportslockarrays = vid.support.ext_compiled_vertex_array;
-       gl_texture3d = vid.support.ext_texture_3d;
-       gl_texturecubemap = vid.support.arb_texture_cube_map;
-       gl_texturerectangle = vid.support.arb_texture_rectangle;
-       gl_support_arb_texture_non_power_of_two = vid.support.arb_texture_non_power_of_two;
-       gl_dot3arb = vid.support.arb_texture_env_dot3;
-       gl_depthtexture = vid.support.arb_depth_texture;
-       gl_support_arb_shadow = vid.support.arb_shadow;
-       gl_support_clamptoedge = vid.support.ext_texture_edge_clamp;
-       gl_support_anisotropy = vid.support.ext_texture_filter_anisotropic;
-       gl_support_separatestencil = vid.support.ati_separate_stencil;
-       gl_support_stenciltwoside = vid.support.ext_stencil_two_side;
-       gl_support_ext_blend_minmax = vid.support.ext_blend_minmax;
-       gl_support_ext_blend_subtract = vid.support.ext_blend_subtract;
-       gl_support_shader_objects = vid.support.arb_shader_objects;
-       gl_support_shading_language_100 = vid.support.arb_shading_language_100;
-       gl_support_vertex_shader = vid.support.arb_vertex_shader;
-       gl_support_fragment_shader = vid.support.arb_fragment_shader;
-       gl_support_arb_vertex_buffer_object = vid.support.arb_vertex_buffer_object;
-       gl_support_ext_framebuffer_object = vid.support.ext_framebuffer_object;
-       gl_support_texture_compression = vid.support.arb_texture_compression;
-       gl_support_arb_occlusion_query = vid.support.arb_occlusion_query;
-       gl_support_amd_texture_texture4 = vid.support.amd_texture_texture4;
-       gl_support_arb_texture_gather = vid.support.arb_texture_gather;
-
        // VorteX: set other info (maybe place them in VID_InitMode?)
        Cvar_SetQuick(&gl_info_vendor, gl_vendor);
        Cvar_SetQuick(&gl_info_renderer, gl_renderer);