OpenGL2: Don't do MSAA resolve/shadow mask/SSAO on shadow views.

This commit is contained in:
SmileTheory 2017-07-14 15:42:41 -07:00
parent a4c09236b1
commit 6a77f4e363

View file

@ -878,6 +878,7 @@ RB_DrawSurfs
*/ */
const void *RB_DrawSurfs( const void *data ) { const void *RB_DrawSurfs( const void *data ) {
const drawSurfsCommand_t *cmd; const drawSurfsCommand_t *cmd;
qboolean isShadowView;
// finish any 2D drawing if needed // finish any 2D drawing if needed
if ( tess.numIndexes ) { if ( tess.numIndexes ) {
@ -889,6 +890,8 @@ const void *RB_DrawSurfs( const void *data ) {
backEnd.refdef = cmd->refdef; backEnd.refdef = cmd->refdef;
backEnd.viewParms = cmd->viewParms; backEnd.viewParms = cmd->viewParms;
isShadowView = !!(backEnd.viewParms.flags & VPF_DEPTHSHADOW);
// clear the z buffer, set the modelview, etc // clear the z buffer, set the modelview, etc
RB_BeginDrawingView (); RB_BeginDrawingView ();
@ -897,7 +900,7 @@ const void *RB_DrawSurfs( const void *data ) {
qglEnable(GL_DEPTH_CLAMP); qglEnable(GL_DEPTH_CLAMP);
} }
if (glRefConfig.framebufferObject && !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL) && (r_depthPrepass->integer || (backEnd.viewParms.flags & VPF_DEPTHSHADOW))) if (glRefConfig.framebufferObject && !(backEnd.refdef.rdflags & RDF_NOWORLDMODEL) && (r_depthPrepass->integer || isShadowView))
{ {
FBO_t *oldFbo = glState.currentFBO; FBO_t *oldFbo = glState.currentFBO;
vec4_t viewInfo; vec4_t viewInfo;
@ -910,6 +913,8 @@ const void *RB_DrawSurfs( const void *data ) {
qglColorMask(!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]);
backEnd.depthFill = qfalse; backEnd.depthFill = qfalse;
if (!isShadowView)
{
if (tr.msaaResolveFbo) if (tr.msaaResolveFbo)
{ {
// If we're using multisampling, resolve the depth first // If we're using multisampling, resolve the depth first
@ -1110,6 +1115,7 @@ const void *RB_DrawSurfs( const void *data ) {
RB_InstantQuad2(quadVerts, texCoords); //, color, shaderProgram, invTexRes); RB_InstantQuad2(quadVerts, texCoords); //, color, shaderProgram, invTexRes);
} }
}
// reset viewport and scissor // reset viewport and scissor
FBO_Bind(oldFbo); FBO_Bind(oldFbo);
@ -1121,7 +1127,7 @@ const void *RB_DrawSurfs( const void *data ) {
qglDisable(GL_DEPTH_CLAMP); qglDisable(GL_DEPTH_CLAMP);
} }
if (!(backEnd.viewParms.flags & VPF_DEPTHSHADOW)) if (!isShadowView)
{ {
RB_RenderDrawSurfList( cmd->drawSurfs, cmd->numDrawSurfs ); RB_RenderDrawSurfList( cmd->drawSurfs, cmd->numDrawSurfs );
@ -1608,6 +1614,19 @@ const void *RB_PostProcess(const void *data)
FBO_BlitFromTexture(tr.sunShadowDepthImage[3], NULL, NULL, NULL, dstBox, NULL, NULL, 0); FBO_BlitFromTexture(tr.sunShadowDepthImage[3], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
} }
if (0 && r_shadows->integer == 4)
{
ivec4_t dstBox;
VectorSet4(dstBox, 0, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[0], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 128, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[1], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 256, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[2], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
VectorSet4(dstBox, 384, glConfig.vidHeight - 128, 128, 128);
FBO_BlitFromTexture(tr.pshadowMaps[3], NULL, NULL, NULL, dstBox, NULL, NULL, 0);
}
if (0) if (0)
{ {
ivec4_t dstBox; ivec4_t dstBox;