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
1 changed files with 196 additions and 177 deletions

View File

@ -878,6 +878,7 @@ RB_DrawSurfs
*/
const void *RB_DrawSurfs( const void *data ) {
const drawSurfsCommand_t *cmd;
qboolean isShadowView;
// finish any 2D drawing if needed
if ( tess.numIndexes ) {
@ -889,6 +890,8 @@ const void *RB_DrawSurfs( const void *data ) {
backEnd.refdef = cmd->refdef;
backEnd.viewParms = cmd->viewParms;
isShadowView = !!(backEnd.viewParms.flags & VPF_DEPTHSHADOW);
// clear the z buffer, set the modelview, etc
RB_BeginDrawingView ();
@ -897,7 +900,7 @@ const void *RB_DrawSurfs( const void *data ) {
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;
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]);
backEnd.depthFill = qfalse;
if (!isShadowView)
{
if (tr.msaaResolveFbo)
{
// If we're using multisampling, resolve the depth first
@ -969,7 +974,7 @@ const void *RB_DrawSurfs( const void *data ) {
VectorSet4(quadVerts[2], box[2], box[1], 0, 1);
VectorSet4(quadVerts[3], box[0], box[1], 0, 1);
GL_State( GLS_DEPTHTEST_DISABLE );
GL_State(GLS_DEPTHTEST_DISABLE);
GLSL_BindProgram(&tr.shadowmaskShader);
@ -1110,6 +1115,7 @@ const void *RB_DrawSurfs( const void *data ) {
RB_InstantQuad2(quadVerts, texCoords); //, color, shaderProgram, invTexRes);
}
}
// reset viewport and scissor
FBO_Bind(oldFbo);
@ -1121,7 +1127,7 @@ const void *RB_DrawSurfs( const void *data ) {
qglDisable(GL_DEPTH_CLAMP);
}
if (!(backEnd.viewParms.flags & VPF_DEPTHSHADOW))
if (!isShadowView)
{
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);
}
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)
{
ivec4_t dstBox;