IOQ3 commit 2338

This commit is contained in:
Richard Allen 2012-12-12 19:46:52 +00:00
parent d76a457c9c
commit b53b8a0c3b
7 changed files with 43 additions and 36 deletions

View file

@ -815,7 +815,8 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
}
#endif
FBO_Bind(fbo);
if (glRefConfig.framebufferObject)
FBO_Bind(fbo);
// go back to the world modelview matrix
@ -1193,12 +1194,12 @@ const void *RB_DrawSurfs( const void *data ) {
// clear the z buffer, set the modelview, etc
RB_BeginDrawingView ();
if ((backEnd.viewParms.flags & VPF_DEPTHCLAMP) && glRefConfig.depthClamp)
if (glRefConfig.framebufferObject && (backEnd.viewParms.flags & VPF_DEPTHCLAMP) && glRefConfig.depthClamp)
{
qglEnable(GL_DEPTH_CLAMP);
}
if (!(backEnd.refdef.rdflags & RDF_NOWORLDMODEL) && (r_depthPrepass->integer || (backEnd.viewParms.flags & VPF_DEPTHSHADOW)))
if (glRefConfig.framebufferObject && !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL) && (r_depthPrepass->integer || (backEnd.viewParms.flags & VPF_DEPTHSHADOW)))
{
FBO_t *oldFbo = glState.currentFBO;
@ -1416,7 +1417,7 @@ const void *RB_DrawSurfs( const void *data ) {
SetViewportAndScissor();
}
if ((backEnd.viewParms.flags & VPF_DEPTHCLAMP) && glRefConfig.depthClamp)
if (glRefConfig.framebufferObject && (backEnd.viewParms.flags & VPF_DEPTHCLAMP) && glRefConfig.depthClamp)
{
qglDisable(GL_DEPTH_CLAMP);
}
@ -1435,8 +1436,8 @@ const void *RB_DrawSurfs( const void *data ) {
RB_RenderFlares();
}
if (glRefConfig.framebufferObject)
FBO_Bind(NULL);
//if (glRefConfig.framebufferObject)
//FBO_Bind(NULL);
return (const void *)(cmd + 1);
}
@ -1453,6 +1454,9 @@ const void *RB_DrawBuffer( const void *data ) {
cmd = (const drawBufferCommand_t *)data;
if (glRefConfig.framebufferObject)
FBO_Bind(NULL);
qglDrawBuffer( cmd->buffer );
// clear screen for debugging
@ -1564,14 +1568,18 @@ const void *RB_ClearDepth(const void *data)
if (r_showImages->integer)
RB_ShowImages();
if (backEnd.framePostProcessed && (backEnd.refdef.rdflags & RDF_NOWORLDMODEL))
if (glRefConfig.framebufferObject)
{
FBO_Bind(tr.screenScratchFbo);
}
else
{
FBO_Bind(tr.renderFbo);
if (backEnd.framePostProcessed && (backEnd.refdef.rdflags & RDF_NOWORLDMODEL))
{
FBO_Bind(tr.screenScratchFbo);
}
else
{
FBO_Bind(tr.renderFbo);
}
}
qglClear(GL_DEPTH_BUFFER_BIT);
// if we're doing MSAA, clear the depth texture for the resolve buffer

View file

@ -498,12 +498,7 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) {
backEnd.colorMask[2] = GL_FALSE;
backEnd.colorMask[3] = GL_FALSE;
qglClearColor(0.0f, 0.0f, 0.0f, 1.0f);
qglDrawBuffer(GL_FRONT);
qglClear(GL_COLOR_BUFFER_BIT);
qglDrawBuffer(GL_BACK);
qglClear(GL_COLOR_BUFFER_BIT);
if (glRefConfig.framebufferObject)
{
// clear all framebuffers
@ -530,15 +525,17 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) {
break;
}
qglDrawBuffer(GL_FRONT);
qglClear(GL_COLOR_BUFFER_BIT);
qglDrawBuffer(GL_BACK);
qglClear(GL_COLOR_BUFFER_BIT);
}
FBO_Bind(NULL);
}
qglDrawBuffer(GL_FRONT);
qglClear(GL_COLOR_BUFFER_BIT);
qglDrawBuffer(GL_BACK);
qglClear(GL_COLOR_BUFFER_BIT);
r_anaglyphMode->modified = qfalse;
}

View file

@ -795,7 +795,7 @@ void FBO_FastBlit(FBO_t *src, vec4i_t srcBox, FBO_t *dst, vec4i_t dstBox, int bu
}
// get to a neutral state first
FBO_Bind(NULL);
//FBO_Bind(NULL);
srcFb = src ? src->frameBuffer : 0;
dstFb = dst ? dst->frameBuffer : 0;

View file

@ -2919,6 +2919,7 @@ void R_CreateBuiltinImages( void ) {
R_CreateDlightImage();
R_CreateFogImage();
if (glRefConfig.framebufferObject)
{
int width, height, hdrFormat;
@ -3001,17 +3002,16 @@ void R_CreateBuiltinImages( void ) {
tr.screenSsaoImage = R_CreateImage("*screenSsao", NULL, width / 2, height / 2, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, GL_RGBA8);
tr.hdrDepthImage = R_CreateImage("*hdrDepth", NULL, width, height, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, GL_INTENSITY32F_ARB);
}
}
for( x = 0; x < MAX_DRAWN_PSHADOWS; x++)
{
tr.pshadowMaps[x] = R_CreateImage(va("*shadowmap%i", x), NULL, PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, GL_RGBA8);
}
for( x = 0; x < MAX_DRAWN_PSHADOWS; x++)
{
tr.pshadowMaps[x] = R_CreateImage(va("*shadowmap%i", x), NULL, PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, GL_RGBA8);
}
//tr.sunShadowImage = R_CreateImage("*sunshadowmap", NULL, SUNSHADOW_MAP_SIZE, SUNSHADOW_MAP_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, GL_RGBA8);
for ( x = 0; x < 3; x++)
{
tr.sunShadowDepthImage[x] = R_CreateImage(va("*sunshadowdepth%i", x), NULL, r_shadowMapSize->integer, r_shadowMapSize->integer, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, GL_DEPTH_COMPONENT24_ARB);
for ( x = 0; x < 3; x++)
{
tr.sunShadowDepthImage[x] = R_CreateImage(va("*sunshadowdepth%i", x), NULL, r_shadowMapSize->integer, r_shadowMapSize->integer, IMGTYPE_COLORALPHA, IMGFLAG_NO_COMPRESSION | IMGFLAG_CLAMPTOEDGE, GL_DEPTH_COMPONENT24_ARB);
}
}
}

View file

@ -1411,7 +1411,8 @@ void R_Init( void ) {
R_InitImages();
FBO_Init();
if (glRefConfig.framebufferObject)
FBO_Init();
GLSL_InitGPUShaders();
@ -1463,7 +1464,8 @@ void RE_Shutdown( qboolean destroyWindow ) {
R_SyncRenderThread();
R_ShutdownCommandBuffers();
R_ShutDownQueries();
FBO_Shutdown();
if (glRefConfig.framebufferObject)
FBO_Shutdown();
R_DeleteTextures();
R_ShutdownVBOs();
GLSL_ShutdownGPUShaders();

View file

@ -476,13 +476,13 @@ void RE_RenderScene( const refdef_t *fd ) {
}
/* playing with more shadows */
if(!( fd->rdflags & RDF_NOWORLDMODEL ) && r_shadows->integer == 4)
if(glRefConfig.framebufferObject && !( fd->rdflags & RDF_NOWORLDMODEL ) && r_shadows->integer == 4)
{
R_RenderPshadowMaps(fd);
}
// playing with even more shadows
if(!( fd->rdflags & RDF_NOWORLDMODEL ) && (r_forceSun->integer || tr.sunShadows))
if(glRefConfig.framebufferObject && !( fd->rdflags & RDF_NOWORLDMODEL ) && (r_forceSun->integer || tr.sunShadows))
{
R_RenderSunShadowMaps(fd, 0);
R_RenderSunShadowMaps(fd, 1);

View file

@ -1713,7 +1713,7 @@ void RB_StageIteratorGeneric( void )
//
// pshadows!
//
if ( tess.pshadowBits && tess.shader->sort <= SS_OPAQUE
if (glRefConfig.framebufferObject && tess.pshadowBits && tess.shader->sort <= SS_OPAQUE
&& !(tess.shader->surfaceFlags & (SURF_NODLIGHT | SURF_SKY) ) ) {
ProjectPshadowVBOGLSL();
}