summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/FramebufferShaderGen.cpp
diff options
context:
space:
mode:
authorConnor McLaughlin <stenzek@gmail.com>2019-07-25 13:50:57 +1000
committerGitHub <noreply@github.com>2019-07-25 13:50:57 +1000
commitac9912bad3ad35b1ef27151ba724a3424c110acc (patch)
tree3f6873682f9c6f2570ed0123be82475cc62873d4 /Source/Core/VideoCommon/FramebufferShaderGen.cpp
parentd82e0e0761aa8cf08048aed64011f0edf5d967a8 (diff)
parent2d4d61e967baa460fa45abd4fd6bccfb12fe3cac (diff)
Merge pull request #6321 from stenzek/efb-savestates
Support saving EFB and texture cache in save states
Diffstat (limited to 'Source/Core/VideoCommon/FramebufferShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/FramebufferShaderGen.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/FramebufferShaderGen.cpp b/Source/Core/VideoCommon/FramebufferShaderGen.cpp
index 5789c0a0d2..00ff753d92 100644
--- a/Source/Core/VideoCommon/FramebufferShaderGen.cpp
+++ b/Source/Core/VideoCommon/FramebufferShaderGen.cpp
@@ -644,4 +644,24 @@ std::string GenerateTextureReinterpretShader(TextureFormat from_format, TextureF
return ss.str();
}
+std::string GenerateEFBRestorePixelShader()
+{
+ std::stringstream ss;
+ EmitSamplerDeclarations(ss, 0, 2, false);
+ 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");
+ ss << ";\n";
+ ss << " " << (GetAPIType() == APIType::D3D ? "depth" : "gl_FragDepth") << " = ";
+ EmitSampleTexture(ss, 1, "coords");
+ ss << ".r;\n";
+ ss << "}\n";
+ return ss.str();
+}
+
} // namespace FramebufferShaderGen