From 4bc65be2b3ab8cb41d2595b7e640e768de56d623 Mon Sep 17 00:00:00 2001 From: eihrul Date: Tue, 25 Dec 2012 01:26:12 +0000 Subject: [PATCH] allow framebuffer objects to be used where non-power of two textures are not required git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11868 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=769127c03a39beebd771ab3b6e662327cd167548 --- gl_rmain.c | 8 ++++---- vid_sdl.c | 7 ------- vid_shared.c | 16 +--------------- vid_wgl.c | 7 ------- 4 files changed, 5 insertions(+), 33 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index 6d9147a7..88ca6263 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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; diff --git a/vid_sdl.c b/vid_sdl.c index aed184b1..0aba7111 100644 --- 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"); diff --git a/vid_shared.c b/vid_shared.c index 7d8485c3..f5987e78 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -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; diff --git a/vid_wgl.c b/vid_wgl.c index cb74dea9..ffa66589 100644 --- 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; -- 2.39.2