summaryrefslogtreecommitdiff
path: root/src/rend2/tr_postprocess.c
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/rend2/tr_postprocess.c
parent582f9820eb140fccfacd43333199838898ebad2a (diff)
Make software overbright optional (cvar r_softOverbright) and reduce the number of FBOs and FBO blits when able.
Diffstat (limited to 'src/rend2/tr_postprocess.c')
-rw-r--r--src/rend2/tr_postprocess.c34
1 files changed, 15 insertions, 19 deletions
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);
}