summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Canete <use.less01@gmail.com>2012-11-20 03:34:16 +0000
committerTim Angus <tim@ngus.net>2013-01-12 21:24:50 +0000
commit94a474b4437b8ed749ab171b6d0a813cdee0bbde (patch)
tree194ea37f44fd280c13042a4d98dccf75e0a19b4d /src
parent582f9820eb140fccfacd43333199838898ebad2a (diff)
Make software overbright optional (cvar r_softOverbright) and reduce the number of FBOs and FBO blits when able.
Diffstat (limited to 'src')
-rw-r--r--src/rend2/tr_backend.c178
-rw-r--r--src/rend2/tr_cmds.c32
-rw-r--r--src/rend2/tr_fbo.c18
-rw-r--r--src/rend2/tr_image.c12
-rw-r--r--src/rend2/tr_init.c5
-rw-r--r--src/rend2/tr_local.h2
-rw-r--r--src/rend2/tr_postprocess.c34
7 files changed, 120 insertions, 161 deletions
diff --git a/src/rend2/tr_backend.c b/src/rend2/tr_backend.c
index 0c3321e9..55457a51 100644
--- a/src/rend2/tr_backend.c
+++ b/src/rend2/tr_backend.c
@@ -485,7 +485,7 @@ void RB_BeginDrawingView (void) {
// drawing more world check is in case of double renders, such as skyportals
if (backEnd.viewParms.targetFbo == NULL)
{
- if (backEnd.framePostProcessed && (backEnd.refdef.rdflags & RDF_NOWORLDMODEL))
+ if (!tr.renderFbo || (backEnd.framePostProcessed && (backEnd.refdef.rdflags & RDF_NOWORLDMODEL)))
{
FBO_Bind(tr.screenScratchFbo);
}
@@ -959,7 +959,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
// FIXME: HUGE hack
if (glRefConfig.framebufferObject)
{
- if (backEnd.framePostProcessed)
+ if (!tr.renderFbo || backEnd.framePostProcessed)
{
FBO_Bind(tr.screenScratchFbo);
}
@@ -1108,7 +1108,7 @@ const void *RB_StretchPic ( const void *data ) {
// FIXME: HUGE hack
if (glRefConfig.framebufferObject)
{
- if (backEnd.framePostProcessed)
+ if (!tr.renderFbo || backEnd.framePostProcessed)
{
FBO_Bind(tr.screenScratchFbo);
}
@@ -1223,58 +1223,22 @@ const void *RB_DrawSurfs( const void *data ) {
qglColorMask(!backEnd.colorMask[0], !backEnd.colorMask[1], !backEnd.colorMask[2], !backEnd.colorMask[3]);
backEnd.depthFill = qfalse;
- // If we're using multisampling, resolve the depth first
if (tr.msaaResolveFbo)
{
+ // If we're using multisampling, resolve the depth first
FBO_FastBlit(tr.renderFbo, NULL, tr.msaaResolveFbo, NULL, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
}
+ else if (tr.renderFbo == NULL)
+ {
+ // If we're rendering directly to the screen, copy the depth to a texture
+ GL_BindToTMU(tr.renderDepthImage, 0);
+ qglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 0, 0, glConfig.vidWidth, glConfig.vidHeight, 0);
+ }
if (r_ssao->integer)
- {
- vec2_t srcTexScale;
- vec4_t color;
- vec4_t quadVerts[4];
- vec2_t texCoords[4];
- vec2_t invTexRes;
-
- matrix_t idmatrix;
-
- srcTexScale[0] = srcTexScale[1] = 1.0f;
- color[0] = color[1] = color[2] = color[3] = 1.0f;
-
- FBO_Bind(tr.hdrDepthFbo);
-
- qglViewport(0, 0, tr.hdrDepthFbo->width, tr.hdrDepthFbo->height);
- qglScissor(0, 0, tr.hdrDepthFbo->width, tr.hdrDepthFbo->height);
-
- Matrix16Identity(idmatrix);
-
- VectorSet4(quadVerts[0], -1, 1, 0, 1);
- VectorSet4(quadVerts[1], 1, 1, 0, 1);
- VectorSet4(quadVerts[2], 1, -1, 0, 1);
- VectorSet4(quadVerts[3], -1, -1, 0, 1);
-
- texCoords[0][0] = 0; texCoords[0][1] = 1;
- texCoords[1][0] = 1; texCoords[1][1] = 1;
- texCoords[2][0] = 1; texCoords[2][1] = 0;
- texCoords[3][0] = 0; texCoords[3][1] = 0;
-
- invTexRes[0] = 0.0f;
- invTexRes[1] = 0.0f;
-
- GL_State( GLS_DEPTHTEST_DISABLE );
-
- GLSL_BindProgram(&tr.textureColorShader);
-
- GL_BindToTMU(tr.renderDepthImage, TB_COLORMAP);
-
- GLSL_SetUniformMatrix16(&tr.textureColorShader, TEXTURECOLOR_UNIFORM_MODELVIEWPROJECTIONMATRIX, idmatrix);
- GLSL_SetUniformVec4(&tr.textureColorShader, TEXTURECOLOR_UNIFORM_COLOR, color);
- GLSL_SetUniformVec2(&tr.textureColorShader, TEXTURECOLOR_UNIFORM_INVTEXRES, invTexRes);
- GLSL_SetUniformVec2(&tr.textureColorShader, TEXTURECOLOR_UNIFORM_AUTOEXPOSUREMINMAX, tr.refdef.autoExposureMinMax);
- GLSL_SetUniformVec3(&tr.textureColorShader, TEXTURECOLOR_UNIFORM_TONEMINAVGMAXLINEAR, tr.refdef.toneMinAvgMaxLinear);
-
- RB_InstantQuad2(quadVerts, texCoords); //, color, shaderProgram, invTexRes);
+ {
+ // need the depth in a texture we can do GL_LINEAR sampling on, so copy it to an HDR image
+ FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, tr.hdrDepthFbo, NULL, NULL, NULL, 0);
}
if (backEnd.viewParms.flags & VPF_USESUNLIGHT)
@@ -1584,7 +1548,7 @@ const void *RB_ClearDepth(const void *data)
if (glRefConfig.framebufferObject)
{
- if (backEnd.framePostProcessed)
+ if (!tr.renderFbo || backEnd.framePostProcessed)
{
FBO_Bind(tr.screenScratchFbo);
}
@@ -1599,7 +1563,7 @@ const void *RB_ClearDepth(const void *data)
// if we're doing MSAA, clear the depth texture for the resolve buffer
if (tr.msaaResolveFbo)
{
- FBO_Bind(tr.screenScratchFbo);
+ FBO_Bind(tr.msaaResolveFbo);
qglClear(GL_DEPTH_BUFFER_BIT);
}
@@ -1648,47 +1612,38 @@ const void *RB_SwapBuffers( const void *data ) {
if (glRefConfig.framebufferObject)
{
- // copy final image to screen
- vec4_t color;
-
- if (backEnd.framePostProcessed)
- {
- // frame was postprocessed into screen fbo, copy from there
- }
- else if (!glRefConfig.framebuffer_srgb)
+ if (!backEnd.framePostProcessed)
{
- // Copy render to screenscratch, possibly resolving MSAA
- FBO_FastBlit(tr.renderFbo, NULL, tr.screenScratchFbo, NULL, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ if (tr.msaaResolveFbo && r_hdr->integer)
+ {
+ // Resolving an RGB16F MSAA FBO to the screen messes with the brightness, so resolve to an RGB16F FBO first
+ FBO_FastBlit(tr.renderFbo, NULL, tr.msaaResolveFbo, NULL, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ FBO_FastBlit(tr.msaaResolveFbo, NULL, tr.screenScratchFbo, NULL, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ }
+ else if (tr.renderFbo)
+ {
+ FBO_FastBlit(tr.renderFbo, NULL, tr.screenScratchFbo, NULL, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ }
}
- else
+
+ if (tr.screenScratchFbo)
{
- FBO_t *srcFbo = tr.renderFbo;
+ vec4_t color;
- if (tr.msaaResolveFbo)
- {
- // Resolve the MSAA before copying
- FBO_FastBlit(srcFbo, NULL, tr.msaaResolveFbo, NULL, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ color[0] =
+ color[1] =
+ color[2] = pow(2, tr.overbrightBits); //exp2(tr.overbrightBits);
+ color[3] = 1.0f;
- srcFbo = tr.msaaResolveFbo;
- }
+ // turn off colormask when copying final image
+ if (backEnd.colorMask[0] || backEnd.colorMask[1] || backEnd.colorMask[2] || backEnd.colorMask[3])
+ qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+
+ FBO_Blit(tr.screenScratchFbo, NULL, NULL, NULL, NULL, NULL, color, 0);
- // need to copy from resolve to screenscratch to fix gamma
- FBO_Blit(srcFbo, NULL, NULL, tr.screenScratchFbo, NULL, NULL, NULL, 0);
+ if (backEnd.colorMask[0] || backEnd.colorMask[1] || backEnd.colorMask[2] || backEnd.colorMask[3])
+ qglColorMask(!backEnd.colorMask[0], !backEnd.colorMask[1], !backEnd.colorMask[2], !backEnd.colorMask[3]);
}
-
- color[0] =
- color[1] =
- color[2] = pow(2, tr.overbrightBits); //exp2(tr.overbrightBits);
- color[3] = 1.0f;
-
- // turn off colormask when copying final image
- if (backEnd.colorMask[0] || backEnd.colorMask[1] || backEnd.colorMask[2] || backEnd.colorMask[3])
- qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-
- FBO_Blit(tr.screenScratchFbo, NULL, NULL, NULL, NULL, NULL, color, 0);
-
- if (backEnd.colorMask[0] || backEnd.colorMask[1] || backEnd.colorMask[2] || backEnd.colorMask[3])
- qglColorMask(!backEnd.colorMask[0], !backEnd.colorMask[1], !backEnd.colorMask[2], !backEnd.colorMask[3]);
}
if ( !glState.finishCalled ) {
@@ -1750,11 +1705,9 @@ const void *RB_PostProcess(const void *data)
FBO_t *srcFbo;
qboolean autoExposure;
- if (!glRefConfig.framebufferObject)
+ if (!glRefConfig.framebufferObject || !r_postProcess->integer)
{
// do nothing
- backEnd.framePostProcessed = qtrue;
-
return (const void *)(cmd + 1);
}
@@ -1766,36 +1719,37 @@ const void *RB_PostProcess(const void *data)
srcFbo = tr.msaaResolveFbo;
}
- if (r_postProcess->integer && r_ssao->integer)
+ if (r_ssao->integer)
{
- vec4i_t dstBox;
- VectorSet4(dstBox, 0, 0, srcFbo->width, srcFbo->height);
- FBO_BlitFromTexture(tr.screenSsaoImage, NULL, NULL, srcFbo, dstBox, NULL, NULL, GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);
+ FBO_BlitFromTexture(tr.screenSsaoImage, NULL, NULL, srcFbo, NULL, NULL, NULL, GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);
}
- if (r_postProcess->integer && (r_toneMap->integer || r_forceToneMap->integer))
- {
- autoExposure = r_autoExposure->integer || r_forceAutoExposure;
- RB_ToneMap(srcFbo, autoExposure);
- }
- else if (!glRefConfig.framebuffer_srgb && r_cameraExposure->value == 0.0f)
- {
- FBO_FastBlit(srcFbo, NULL, tr.screenScratchFbo, NULL, GL_COLOR_BUFFER_BIT, GL_NEAREST);
- }
- else
+ if (srcFbo)
{
- vec4_t color;
+ if (r_hdr->integer && (r_toneMap->integer || r_forceToneMap->integer))
+ {
+ autoExposure = r_autoExposure->integer || r_forceAutoExposure->integer;
+ RB_ToneMap(srcFbo, autoExposure);
+ }
+ else if (!glRefConfig.framebuffer_srgb && r_cameraExposure->value == 0.0f)
+ {
+ FBO_FastBlit(srcFbo, NULL, tr.screenScratchFbo, NULL, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ }
+ else
+ {
+ vec4_t color;
- color[0] =
- color[1] =
- color[2] = pow(2, r_cameraExposure->value); //exp2(r_cameraExposure->value);
- color[3] = 1.0f;
+ color[0] =
+ color[1] =
+ color[2] = pow(2, r_cameraExposure->value); //exp2(r_cameraExposure->value);
+ color[3] = 1.0f;
- FBO_Blit(srcFbo, NULL, NULL, tr.screenScratchFbo, NULL, NULL, color, 0);
+ FBO_Blit(srcFbo, NULL, NULL, tr.screenScratchFbo, NULL, NULL, color, 0);
+ }
}
#ifdef REACTION
- if (r_postProcess->integer && glRefConfig.framebufferObject)
+ if (1)
{
RB_GodRays();
@@ -1820,16 +1774,16 @@ const void *RB_PostProcess(const void *data)
if (0)
{
vec4i_t dstBox;
- VectorSet4(dstBox, 256, tr.screenScratchFbo->height - 256, 256, 256);
+ VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.renderDepthImage, NULL, NULL, tr.screenScratchFbo, dstBox, NULL, NULL, 0);
- VectorSet4(dstBox, 512, tr.screenScratchFbo->height - 256, 256, 256);
+ VectorSet4(dstBox, 512, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.screenShadowImage, NULL, NULL, tr.screenScratchFbo, dstBox, NULL, NULL, 0);
}
if (0)
{
vec4i_t dstBox;
- VectorSet4(dstBox, 256, tr.screenScratchFbo->height - 256, 256, 256);
+ VectorSet4(dstBox, 256, glConfig.vidHeight - 256, 256, 256);
FBO_BlitFromTexture(tr.renderImage, NULL, NULL, tr.screenScratchFbo, dstBox, NULL, NULL, 0);
}
diff --git a/src/rend2/tr_cmds.c b/src/rend2/tr_cmds.c
index 9945da3f..2f67d221 100644
--- a/src/rend2/tr_cmds.c
+++ b/src/rend2/tr_cmds.c
@@ -502,29 +502,21 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) {
if (glRefConfig.framebufferObject)
{
// clear all framebuffers
- // FIXME: must be a better way to do this
- int i;
-
- for (i = 0; i < 3; i++)
+ if (tr.msaaResolveFbo)
{
- if (i == 1 && !tr.msaaResolveFbo)
- continue;
-
- switch(i)
- {
- case 0:
- FBO_Bind(tr.renderFbo);
- break;
-
- case 1:
- FBO_Bind(tr.msaaResolveFbo);
- break;
+ FBO_Bind(tr.msaaResolveFbo);
+ qglClear(GL_COLOR_BUFFER_BIT);
+ }
- case 2:
- FBO_Bind(tr.screenScratchFbo);
- break;
- }
+ if (tr.renderFbo)
+ {
+ FBO_Bind(tr.renderFbo);
+ qglClear(GL_COLOR_BUFFER_BIT);
+ }
+ if (tr.screenScratchFbo)
+ {
+ FBO_Bind(tr.screenScratchFbo);
qglClear(GL_COLOR_BUFFER_BIT);
}
diff --git a/src/rend2/tr_fbo.c b/src/rend2/tr_fbo.c
index 04f9ff26..0e84d944 100644
--- a/src/rend2/tr_fbo.c
+++ b/src/rend2/tr_fbo.c
@@ -309,7 +309,7 @@ FBO_Bind
*/
void FBO_Bind(FBO_t * fbo)
{
- if (fbo && glState.currentFBO == fbo)
+ if (glState.currentFBO == fbo)
return;
if (r_logFile->integer)
@@ -405,6 +405,8 @@ void FBO_Init(void)
ri.Cvar_SetValue("r_ext_framebuffer_multisample", (float)multisample);
}
+ // only create a render FBO if we need to resolve MSAA or do HDR
+ // otherwise just render straight to the screen (tr.renderFbo = NULL)
if (multisample && glRefConfig.framebufferMultisample)
{
tr.renderFbo = FBO_Create("_render", tr.renderDepthImage->width, tr.renderDepthImage->height);
@@ -427,7 +429,7 @@ void FBO_Init(void)
R_CheckFBO(tr.msaaResolveFbo);
}
- else
+ else if (r_hdr->integer)
{
tr.renderFbo = FBO_Create("_render", tr.renderDepthImage->width, tr.renderDepthImage->height);
FBO_Bind(tr.renderFbo);
@@ -443,10 +445,13 @@ void FBO_Init(void)
// clear render buffer
// this fixes the corrupt screen bug with r_hdr 1 on older hardware
- FBO_Bind(tr.renderFbo);
- qglClearColor( 1, 0, 0.5, 1 );
- qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
- FBO_Bind(NULL);
+ if (tr.renderFbo)
+ {
+ FBO_Bind(tr.renderFbo);
+ qglClearColor( 1, 0, 0.5, 1 );
+ qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+ FBO_Bind(NULL);
+ }
#ifdef REACTION
{
@@ -525,6 +530,7 @@ void FBO_Init(void)
R_CheckFBO(tr.targetLevelsFbo);
}
+ if (r_softOverbright->integer)
{
//tr.screenScratchFbo = FBO_Create("_screenscratch", width, height);
tr.screenScratchFbo = FBO_Create("_screenscratch", tr.screenScratchImage->width, tr.screenScratchImage->height);
diff --git a/src/rend2/tr_image.c b/src/rend2/tr_image.c
index eaf133b4..c00bfbbc 100644
--- a/src/rend2/tr_image.c
+++ b/src/rend2/tr_image.c
@@ -2943,6 +2943,7 @@ void R_CreateBuiltinImages( void ) {
tr.godRaysImage = R_CreateImage("*godRays", NULL, width, height, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, GL_RGBA8);
#endif
+ if (r_softOverbright->integer)
{
int format;
@@ -3033,14 +3034,14 @@ void R_SetColorMappings( void ) {
tr.overbrightBits = 0; // need hardware gamma for overbright
}
- // never overbright in windowed mode
- if ( 0 /* !glConfig.isFullscreen */ )
+ // never overbright in windowed mode without soft overbright
+ if ( !glConfig.isFullscreen && !r_softOverbright->integer )
{
tr.overbrightBits = 0;
}
// never overbright with tonemapping
- if ( r_toneMap->integer )
+ if ( r_toneMap->integer && r_hdr->integer )
{
tr.overbrightBits = 0;
}
@@ -3077,8 +3078,11 @@ void R_SetColorMappings( void ) {
shift = tr.overbrightBits;
- if (glRefConfig.framebufferObject)
+ // no shift with soft overbright
+ if (r_softOverbright->integer)
+ {
shift = 0;
+ }
for ( i = 0; i < 256; i++ ) {
if ( g == 1 ) {
diff --git a/src/rend2/tr_init.c b/src/rend2/tr_init.c
index 0f14c081..7b384106 100644
--- a/src/rend2/tr_init.c
+++ b/src/rend2/tr_init.c
@@ -107,6 +107,9 @@ cvar_t *r_mergeMultidraws;
cvar_t *r_mergeLeafSurfaces;
cvar_t *r_cameraExposure;
+
+cvar_t *r_softOverbright;
+
cvar_t *r_hdr;
cvar_t *r_postProcess;
@@ -1149,6 +1152,8 @@ void R_Register( void )
r_greyscale = ri.Cvar_Get("r_greyscale", "0", CVAR_ARCHIVE | CVAR_LATCH);
ri.Cvar_CheckRange(r_greyscale, 0, 1, qfalse);
+ r_softOverbright = ri.Cvar_Get( "r_softOverbright", "1", CVAR_ARCHIVE | CVAR_LATCH );
+
r_hdr = ri.Cvar_Get( "r_hdr", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_postProcess = ri.Cvar_Get( "r_postProcess", "1", CVAR_ARCHIVE );
diff --git a/src/rend2/tr_local.h b/src/rend2/tr_local.h
index 84829dc6..77b11f90 100644
--- a/src/rend2/tr_local.h
+++ b/src/rend2/tr_local.h
@@ -2092,6 +2092,8 @@ extern cvar_t *r_anaglyphMode;
extern cvar_t *r_mergeMultidraws;
extern cvar_t *r_mergeLeafSurfaces;
+extern cvar_t *r_softOverbright;
+
extern cvar_t *r_hdr;
extern cvar_t *r_postProcess;
diff --git a/src/rend2/tr_postprocess.c b/src/rend2/tr_postprocess.c
index 0cb162b3..73fa7175 100644
--- a/src/rend2/tr_postprocess.c
+++ b/src/rend2/tr_postprocess.c
@@ -112,14 +112,16 @@ void RB_BokehBlur(float blur)
if (blur > 0.0f)
{
// create a quarter texture
- FBO_Blit(tr.screenScratchFbo, NULL, NULL, tr.quarterFbo[0], NULL, NULL, NULL, 0);
+ //FBO_Blit(NULL, NULL, NULL, tr.quarterFbo[0], NULL, NULL, NULL, 0);
+ FBO_FastBlit(tr.screenScratchFbo, NULL, tr.quarterFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
}
#ifndef HQ_BLUR
if (blur > 1.0f)
{
// create a 1/16th texture
- FBO_Blit(tr.quarterFbo[0], NULL, NULL, tr.textureScratchFbo[0], NULL, NULL, NULL, 0);
+ //FBO_Blit(tr.quarterFbo[0], NULL, NULL, tr.textureScratchFbo[0], NULL, NULL, NULL, 0);
+ FBO_FastBlit(tr.quarterFbo[0], NULL, tr.textureScratchFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
}
#endif
@@ -340,16 +342,15 @@ void RB_GodRays(void)
VectorSet4(color, mul, mul, mul, 1);
// first, downsample the framebuffer
- VectorSet4(srcBox, 0, 0, tr.godRaysFbo->width, tr.godRaysFbo->height);
- VectorSet4(dstBox, 0, 0, tr.quarterFbo[0]->width, tr.quarterFbo[0]->height);
- FBO_Blit(tr.godRaysFbo, srcBox, texScale, tr.quarterFbo[0], dstBox, &tr.textureColorShader, color, 0);
-
if (colorize)
{
- VectorSet4(srcBox, 0, 0, tr.screenScratchFbo->width, tr.screenScratchFbo->height);
- FBO_Blit(tr.screenScratchFbo, srcBox, texScale, tr.quarterFbo[0], dstBox, &tr.textureColorShader, color,
- GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);
- }
+ FBO_FastBlit(tr.screenScratchFbo, NULL, tr.quarterFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
+ FBO_Blit(tr.godRaysFbo, NULL, NULL, tr.quarterFbo[0], NULL, NULL, color, GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_ZERO);
+ }
+ else
+ {
+ FBO_FastBlit(tr.godRaysFbo, NULL, tr.quarterFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
+ }
}
// radial blur passes, ping-ponging between the two quarter-size buffers
@@ -375,7 +376,7 @@ void RB_GodRays(void)
VectorSet4(color, mul, mul, mul, 1);
VectorSet4(srcBox, 0, 0, tr.quarterFbo[0]->width, tr.quarterFbo[0]->height);
- VectorSet4(dstBox, 0, 0, tr.screenScratchFbo->width, tr.screenScratchFbo->height);
+ VectorSet4(dstBox, 0, 0, glConfig.vidWidth, glConfig.vidHeight);
FBO_Blit(tr.quarterFbo[0], srcBox, texScale, tr.screenScratchFbo, dstBox, &tr.textureColorShader, color, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE);
}
}
@@ -462,13 +463,8 @@ void RB_GaussianBlur(float blur)
VectorSet4(color, 1, 1, 1, 1);
// first, downsample the framebuffer
- VectorSet4(srcBox, 0, 0, tr.screenScratchFbo->width, tr.screenScratchFbo->height);
- VectorSet4(dstBox, 0, 0, tr.quarterFbo[0]->width, tr.quarterFbo[0]->height);
- FBO_Blit(tr.screenScratchFbo, srcBox, texScale, tr.quarterFbo[0], dstBox, &tr.textureColorShader, color, 0);
-
- VectorSet4(srcBox, 0, 0, tr.quarterFbo[0]->width, tr.quarterFbo[0]->height);
- VectorSet4(dstBox, 0, 0, tr.textureScratchFbo[0]->width, tr.textureScratchFbo[0]->height);
- FBO_Blit(tr.quarterFbo[0], srcBox, texScale, tr.textureScratchFbo[0], dstBox, &tr.textureColorShader, color, 0);
+ FBO_FastBlit(tr.screenScratchFbo, NULL, tr.quarterFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
+ FBO_FastBlit(tr.quarterFbo[0], NULL, tr.textureScratchFbo[0], NULL, GL_COLOR_BUFFER_BIT, GL_LINEAR);
// set the alpha channel
VectorSet4(srcBox, 0, 0, tr.whiteImage->width, tr.whiteImage->height);
@@ -483,7 +479,7 @@ void RB_GaussianBlur(float blur)
// finally, merge back to framebuffer
VectorSet4(srcBox, 0, 0, tr.textureScratchFbo[0]->width, tr.textureScratchFbo[0]->height);
- VectorSet4(dstBox, 0, 0, tr.screenScratchFbo->width, tr.screenScratchFbo->height);
+ VectorSet4(dstBox, 0, 0, glConfig.vidWidth, glConfig.vidHeight);
color[3] = factor;
FBO_Blit(tr.textureScratchFbo[0], srcBox, texScale, tr.screenScratchFbo, dstBox, &tr.textureColorShader, color, GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
}