Skip to content
Permalink
Browse files

Merge pull request #8286 from stenzek/efb-savestate-fixes

FramebufferManager: Fix restoring of EFB depth buffer / upside-down in OpenGL
  • Loading branch information...
stenzek committed Aug 4, 2019
2 parents 4ccb4ef + d6460e0 commit c829351c90f8f9833a0a311c7982603c0c1339c9
@@ -472,6 +472,7 @@ bool FramebufferManager::CompileReadbackPipelines()
if (!restore_shader)
return false;

config.depth_state = RenderState::GetAlwaysWriteDepthState();
config.framebuffer_state = GetEFBFramebufferState();
config.framebuffer_state.per_sample_shading = false;
config.vertex_shader = g_shader_cache->GetScreenQuadVertexShader();
@@ -651,14 +651,11 @@ std::string GenerateEFBRestorePixelShader()
EmitPixelMainDeclaration(ss, 1, 0, "float4",
GetAPIType() == APIType::D3D ? "out float depth : SV_Depth, " : "");
ss << "{\n";
ss << " float3 coords = float3(v_tex0.x, "
<< (g_ActiveConfig.backend_info.bUsesLowerLeftOrigin ? "1.0 - " : "")
<< "v_tex0.y, v_tex0.z);\n";
ss << " ocol0 = ";
EmitSampleTexture(ss, 0, "coords");
EmitSampleTexture(ss, 0, "v_tex0");
ss << ";\n";
ss << " " << (GetAPIType() == APIType::D3D ? "depth" : "gl_FragDepth") << " = ";
EmitSampleTexture(ss, 1, "coords");
EmitSampleTexture(ss, 1, "v_tex0");
ss << ".r;\n";
ss << "}\n";
return ss.str();

0 comments on commit c829351

Please sign in to comment.
You can’t perform that action at this time.