summaryrefslogtreecommitdiff
path: root/src/renderergl2
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderergl2')
-rw-r--r--src/renderergl2/tr_fbo.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/renderergl2/tr_fbo.c b/src/renderergl2/tr_fbo.c
index 80d59f62..d013748e 100644
--- a/src/renderergl2/tr_fbo.c
+++ b/src/renderergl2/tr_fbo.c
@@ -310,7 +310,7 @@ void FBO_Init(void)
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
- if (r_shadowBlur->integer)
+ if (tr.screenScratchImage)
{
tr.screenScratchFbo = FBO_Create("screenScratch", tr.screenScratchImage->width, tr.screenScratchImage->height);
FBO_AttachImage(tr.screenScratchFbo, tr.screenScratchImage, GL_COLOR_ATTACHMENT0_EXT, 0);
@@ -318,7 +318,7 @@ void FBO_Init(void)
R_CheckFBO(tr.screenScratchFbo);
}
- if (r_drawSunRays->integer)
+ if (tr.sunRaysImage)
{
tr.sunRaysFbo = FBO_Create("_sunRays", tr.renderDepthImage->width, tr.renderDepthImage->height);
FBO_AttachImage(tr.sunRaysFbo, tr.sunRaysImage, GL_COLOR_ATTACHMENT0_EXT, 0);
@@ -340,7 +340,7 @@ void FBO_Init(void)
if (tr.sunShadowDepthImage[0])
{
- for ( i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
tr.sunShadowFbo[i] = FBO_Create("_sunshadowmap", tr.sunShadowDepthImage[i]->width, tr.sunShadowDepthImage[i]->height);
// FIXME: this next line wastes 16mb with 4x1024x1024 sun shadow maps, skip if OpenGL 4.3+ or ARB_framebuffer_no_attachments
@@ -349,44 +349,58 @@ void FBO_Init(void)
FBO_AttachImage(tr.sunShadowFbo[i], tr.sunShadowDepthImage[i], GL_DEPTH_ATTACHMENT_EXT, 0);
R_CheckFBO(tr.sunShadowFbo[i]);
}
+ }
+ if (tr.screenShadowImage)
+ {
tr.screenShadowFbo = FBO_Create("_screenshadow", tr.screenShadowImage->width, tr.screenShadowImage->height);
FBO_AttachImage(tr.screenShadowFbo, tr.screenShadowImage, GL_COLOR_ATTACHMENT0_EXT, 0);
R_CheckFBO(tr.screenShadowFbo);
}
- for (i = 0; i < 2; i++)
+ if (tr.textureScratchImage[0])
{
- tr.textureScratchFbo[i] = FBO_Create(va("_texturescratch%d", i), tr.textureScratchImage[i]->width, tr.textureScratchImage[i]->height);
- FBO_AttachImage(tr.textureScratchFbo[i], tr.textureScratchImage[i], GL_COLOR_ATTACHMENT0_EXT, 0);
- R_CheckFBO(tr.textureScratchFbo[i]);
+ for (i = 0; i < 2; i++)
+ {
+ tr.textureScratchFbo[i] = FBO_Create(va("_texturescratch%d", i), tr.textureScratchImage[i]->width, tr.textureScratchImage[i]->height);
+ FBO_AttachImage(tr.textureScratchFbo[i], tr.textureScratchImage[i], GL_COLOR_ATTACHMENT0_EXT, 0);
+ R_CheckFBO(tr.textureScratchFbo[i]);
+ }
}
+ if (tr.calcLevelsImage)
{
tr.calcLevelsFbo = FBO_Create("_calclevels", tr.calcLevelsImage->width, tr.calcLevelsImage->height);
FBO_AttachImage(tr.calcLevelsFbo, tr.calcLevelsImage, GL_COLOR_ATTACHMENT0_EXT, 0);
R_CheckFBO(tr.calcLevelsFbo);
}
+ if (tr.targetLevelsImage)
{
tr.targetLevelsFbo = FBO_Create("_targetlevels", tr.targetLevelsImage->width, tr.targetLevelsImage->height);
FBO_AttachImage(tr.targetLevelsFbo, tr.targetLevelsImage, GL_COLOR_ATTACHMENT0_EXT, 0);
R_CheckFBO(tr.targetLevelsFbo);
}
- for (i = 0; i < 2; i++)
+ if (tr.quarterImage[0])
{
- tr.quarterFbo[i] = FBO_Create(va("_quarter%d", i), tr.quarterImage[i]->width, tr.quarterImage[i]->height);
- FBO_AttachImage(tr.quarterFbo[i], tr.quarterImage[i], GL_COLOR_ATTACHMENT0_EXT, 0);
- R_CheckFBO(tr.quarterFbo[i]);
+ for (i = 0; i < 2; i++)
+ {
+ tr.quarterFbo[i] = FBO_Create(va("_quarter%d", i), tr.quarterImage[i]->width, tr.quarterImage[i]->height);
+ FBO_AttachImage(tr.quarterFbo[i], tr.quarterImage[i], GL_COLOR_ATTACHMENT0_EXT, 0);
+ R_CheckFBO(tr.quarterFbo[i]);
+ }
}
- if (r_ssao->integer)
+ if (tr.hdrDepthImage)
{
tr.hdrDepthFbo = FBO_Create("_hdrDepth", tr.hdrDepthImage->width, tr.hdrDepthImage->height);
FBO_AttachImage(tr.hdrDepthFbo, tr.hdrDepthImage, GL_COLOR_ATTACHMENT0_EXT, 0);
R_CheckFBO(tr.hdrDepthFbo);
+ }
+ if (tr.screenSsaoImage)
+ {
tr.screenSsaoFbo = FBO_Create("_screenssao", tr.screenSsaoImage->width, tr.screenSsaoImage->height);
FBO_AttachImage(tr.screenSsaoFbo, tr.screenSsaoImage, GL_COLOR_ATTACHMENT0_EXT, 0);
R_CheckFBO(tr.screenSsaoFbo);