Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/engine/renderer/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ void BindShaderGeneric3D( Material* material ) {
gl_genericShaderMaterial->SetUniform_ModelMatrix( backEnd.orientation.transformMatrix );
gl_genericShaderMaterial->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[glState.stackIndex] );

gl_genericShaderMaterial->SetUniform_DepthMapBindless( GL_BindToTMU( 1, tr.currentDepthImage ) );
gl_genericShaderMaterial->SetUniform_DepthMapBindless( GL_BindToTMU( 1, tr.readableDepthImage ) );

// u_DeformGen
gl_genericShaderMaterial->SetUniform_Time( backEnd.refdef.floatTime - backEnd.currentEntity->e.shaderTime );
Expand Down Expand Up @@ -1076,7 +1076,7 @@ void BindShaderLiquid( Material* material ) {
gl_liquidShaderMaterial->SetUniform_ModelViewProjectionMatrix( glState.modelViewProjectionMatrix[glState.stackIndex] );

// depth texture
gl_liquidShaderMaterial->SetUniform_DepthMapBindless( GL_BindToTMU( 2, tr.currentDepthImage ) );
gl_liquidShaderMaterial->SetUniform_DepthMapBindless( GL_BindToTMU( 2, tr.readableDepthImage ) );

// bind u_PortalMap
gl_liquidShaderMaterial->SetUniform_PortalMapBindless( GL_BindToTMU( 1, tr.portalRenderImage ) );
Expand Down
18 changes: 15 additions & 3 deletions src/engine/renderer/tr_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ void RB_RenderGlobalFog()

// bind u_DepthMap
gl_fogGlobalShader->SetUniform_DepthMapBindless(
GL_BindToTMU( 1, tr.currentDepthImage )
GL_BindToTMU( 1, tr.readableDepthImage )
);

Tess_InstantScreenSpaceQuad();
Expand Down Expand Up @@ -1511,7 +1511,7 @@ void RB_RenderMotionBlur()
gl_motionblurShader->SetUniform_blurVec(tr.refdef.blurVec);

gl_motionblurShader->SetUniform_DepthMapBindless(
GL_BindToTMU( 1, tr.currentDepthImage )
GL_BindToTMU( 1, tr.readableDepthImage )
);

Tess_InstantScreenSpaceQuad();
Expand Down Expand Up @@ -1567,7 +1567,7 @@ void RB_RenderSSAO()
gl_ssaoShader->SetUniform_UnprojectionParams( unprojectionParams );

gl_ssaoShader->SetUniform_DepthMapBindless(
GL_BindToTMU( 0, tr.currentDepthImage )
GL_BindToTMU( 0, tr.readableDepthImage )
);

Tess_InstantScreenSpaceQuad();
Expand Down Expand Up @@ -2674,6 +2674,18 @@ static void RB_RenderView( bool depthPass )
return;
}

if ( glConfig.usingReadonlyDepth )
{
FBO_t *currentDrawFBO = glState.currentFBO;
R_BindFBO( GL_READ_FRAMEBUFFER, currentDrawFBO );
R_BindFBO( GL_DRAW_FRAMEBUFFER, tr.readonlyDepthFBO );
int x0 = backEnd.viewParms.viewportX, x1 = x0 + backEnd.viewParms.viewportWidth;
int y0 = backEnd.viewParms.viewportY, y1 = y0 + backEnd.viewParms.viewportHeight;
// We don't need stencil but maybe it could be faster to copy the entire texture verbatim? Needs testing
GL_fboShim.glBlitFramebuffer( x0, y0, x1, y1, x0, y0, x1, y1, GL_DEPTH_BUFFER_BIT /* | GL_STENCIL_BUFFER_BIT */, GL_NEAREST );
R_BindFBO( currentDrawFBO );
}

if( tr.refdef.blurVec[0] != 0.0f ||
tr.refdef.blurVec[1] != 0.0f ||
tr.refdef.blurVec[2] != 0.0f )
Expand Down
Loading