allow framebuffer objects to be used where non-power of two textures are not required
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 25 Dec 2012 01:26:12 +0000 (01:26 +0000)
committereihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 25 Dec 2012 01:26:12 +0000 (01:26 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11868 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
vid_sdl.c
vid_shared.c
vid_wgl.c

index 6d9147a..88ca626 100644 (file)
@@ -5510,7 +5510,7 @@ static void R_Water_StartFrame(void)
        int i;
        int waterwidth, waterheight, texturewidth, textureheight, camerawidth, cameraheight;
        r_waterstate_waterplane_t *p;
-       qboolean usewaterfbo = (r_viewfbo.integer >= 1 || r_water_fbo.integer >= 1) && vid.support.ext_framebuffer_object && vid.samples < 2;
+       qboolean usewaterfbo = (r_viewfbo.integer >= 1 || r_water_fbo.integer >= 1) && vid.support.ext_framebuffer_object && vid.support.arb_texture_non_power_of_two && vid.samples < 2;
 
        if (vid.width > (int)vid.maxtexturesize_2d || vid.height > (int)vid.maxtexturesize_2d)
                return;
@@ -5724,7 +5724,7 @@ static void R_Water_ProcessPlanes(int fbo, rtexture_t *depthtexture, rtexture_t
        int planeindex, qualityreduction = 0, old_r_dynamic = 0, old_r_shadows = 0, old_r_worldrtlight = 0, old_r_dlight = 0, old_r_particles = 0, old_r_decals = 0;
        r_waterstate_waterplane_t *p;
        vec3_t visorigin;
-       qboolean usewaterfbo = (r_viewfbo.integer >= 1 || r_water_fbo.integer >= 1) && vid.support.ext_framebuffer_object && vid.samples < 2;
+       qboolean usewaterfbo = (r_viewfbo.integer >= 1 || r_water_fbo.integer >= 1) && vid.support.ext_framebuffer_object && vid.support.arb_texture_non_power_of_two && vid.samples < 2;
        char vabuf[1024];
 
        originalview = r_refdef.view;
@@ -5996,14 +5996,14 @@ static void R_Bloom_StartFrame(void)
        int i;
        int bloomtexturewidth, bloomtextureheight, screentexturewidth, screentextureheight;
        int viewwidth, viewheight;
-       qboolean useviewfbo = r_viewfbo.integer >= 1 && vid.support.ext_framebuffer_object && vid.samples < 2;
+       qboolean useviewfbo = r_viewfbo.integer >= 1 && vid.support.ext_framebuffer_object && vid.support.arb_texture_non_power_of_two && vid.samples < 2;
        textype_t textype = TEXTYPE_COLORBUFFER;
 
        switch (vid.renderpath)
        {
        case RENDERPATH_GL20:
                r_fb.usedepthtextures = r_usedepthtextures.integer != 0;
-               if (vid.support.ext_framebuffer_object)
+               if (vid.support.ext_framebuffer_object && vid.support.arb_texture_non_power_of_two)
                {
                        if (r_viewfbo.integer == 2) textype = TEXTYPE_COLORBUFFER16F;
                        if (r_viewfbo.integer == 3) textype = TEXTYPE_COLORBUFFER32F;
index aed184b..0aba711 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -1558,13 +1558,6 @@ void GLES_Init(void)
        vid.support.ext_draw_range_elements = true;
        vid.support.ext_framebuffer_object = false;//true;
 
-       // FIXME remove this workaround once FBO + npot texture mapping is fixed
-       if(!vid.support.arb_texture_non_power_of_two)
-       {
-               vid.support.arb_framebuffer_object = false;
-               vid.support.ext_framebuffer_object = false;
-       }
-
        vid.support.ext_packed_depth_stencil = false;
        vid.support.ext_stencil_two_side = false;
        vid.support.ext_texture_3d = SDL_GL_ExtensionSupported("GL_OES_texture_3D");
index 7d8485c..f5987e7 100644 (file)
@@ -1039,13 +1039,6 @@ void VID_CheckExtensions(void)
        else
                vid.support.ext_framebuffer_object = GL_CheckExtension("GL_EXT_framebuffer_object", extfbofuncs, "-nofbo", false);
 
-       // FIXME remove this workaround once FBO + npot texture mapping is fixed
-       if(!vid.support.arb_texture_non_power_of_two)
-       {
-               vid.support.arb_framebuffer_object = false;
-               vid.support.ext_framebuffer_object = false;
-       }
-
        vid.support.ext_packed_depth_stencil = GL_CheckExtension("GL_EXT_packed_depth_stencil", NULL, "-nopackeddepthstencil", false);
        vid.support.ext_stencil_two_side = GL_CheckExtension("GL_EXT_stencil_two_side", stenciltwosidefuncs, "-nostenciltwoside", false);
        vid.support.ext_texture_3d = GL_CheckExtension("GL_EXT_texture3D", texture3dextfuncs, "-notexture3d", false);
@@ -1824,7 +1817,7 @@ static int VID_Mode(int fullscreen, int width, int height, int bpp, float refres
                        (vid_sRGB_fallback.integer >= 3) // force fallback
                        ||
                        (vid_sRGB_fallback.integer >= 2 && // fallback if framebuffer is 8bit
-                               !(r_viewfbo.integer >= 2 && vid.support.ext_framebuffer_object && vid.samples < 2))
+                               !(r_viewfbo.integer >= 2 && vid.support.ext_framebuffer_object && vid.support.arb_texture_non_power_of_two && vid.samples < 2))
                )
                        vid.sRGB2D = vid.sRGB3D = false;
 
@@ -2051,13 +2044,6 @@ void VID_Soft_SharedSetup(void)
        vid.support.ext_draw_range_elements = true;
        vid.support.ext_framebuffer_object = true;
 
-       // FIXME remove this workaround once FBO + npot texture mapping is fixed
-       if(!vid.support.arb_texture_non_power_of_two)
-       {
-               vid.support.arb_framebuffer_object = false;
-               vid.support.ext_framebuffer_object = false;
-       }
-
        vid.support.ext_texture_3d = true;
        //vid.support.ext_texture_compression_s3tc = true;
        vid.support.ext_texture_filter_anisotropic = true;
index cb74dea..ffa6658 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -1509,13 +1509,6 @@ qboolean VID_InitModeDX(viddef_mode_t *mode, int version)
        vid.support.ext_draw_range_elements = true;
        vid.support.ext_framebuffer_object = true;
 
-       // FIXME remove this workaround once FBO + npot texture mapping is fixed
-       if(!vid.support.arb_texture_non_power_of_two)
-       {
-               vid.support.arb_framebuffer_object = false;
-               vid.support.ext_framebuffer_object = false;
-       }
-
        vid.support.ext_texture_3d = true;
        vid.support.ext_texture_compression_s3tc = true;
        vid.support.ext_texture_filter_anisotropic = true;