From 564bf8a089f6dbd3ac767b5c78eb52fe3ca558d8 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Mon, 30 May 2016 19:39:52 +0200 Subject: [PATCH] gsdx ogl: terminator 3 supports sampling from the depth --- plugins/GSdx/res/glsl/tfx_fs.glsl | 6 ++++++ plugins/GSdx/res/glsl_source.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/plugins/GSdx/res/glsl/tfx_fs.glsl b/plugins/GSdx/res/glsl/tfx_fs.glsl index 59a9c4a648..6a25b1498c 100644 --- a/plugins/GSdx/res/glsl/tfx_fs.glsl +++ b/plugins/GSdx/res/glsl/tfx_fs.glsl @@ -347,10 +347,16 @@ vec4 fetch_rgb() vec4 fetch_gXbY() { +#if PS_DEPTH_FMT == 1 || PS_DEPTH_FMT == 2 + int depth = fetch_raw_depth(); + int bg = (depth >> (8 + ChannelShuffle.w)) & 0xFF; + return vec4(bg); +#else ivec4 rt = ivec4(fetch_raw_color() * 255.0f); int green = (rt.g >> ChannelShuffle.w) & ChannelShuffle.z; int blue = (rt.b << ChannelShuffle.y) & ChannelShuffle.x; return vec4(green | blue); +#endif } ////////////////////////////////////////////////////////////////////// diff --git a/plugins/GSdx/res/glsl_source.h b/plugins/GSdx/res/glsl_source.h index c9404a166f..e16224da7e 100644 --- a/plugins/GSdx/res/glsl_source.h +++ b/plugins/GSdx/res/glsl_source.h @@ -1192,10 +1192,16 @@ static const char* const tfx_fs_all_glsl = "\n" "vec4 fetch_gXbY()\n" "{\n" + "#if PS_DEPTH_FMT == 1 || PS_DEPTH_FMT == 2\n" + " int depth = fetch_raw_depth();\n" + " int bg = (depth >> (8 + ChannelShuffle.w)) & 0xFF;\n" + " return vec4(bg);\n" + "#else\n" " ivec4 rt = ivec4(fetch_raw_color() * 255.0f);\n" " int green = (rt.g >> ChannelShuffle.w) & ChannelShuffle.z;\n" " int blue = (rt.b << ChannelShuffle.y) & ChannelShuffle.x;\n" " return vec4(green | blue);\n" + "#endif\n" "}\n" "\n" "//////////////////////////////////////////////////////////////////////\n"