Skip to content

Commit

Permalink
gsdx ogl: terminator 3 supports sampling from the depth
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory38 committed May 30, 2016
1 parent 43a1c48 commit 564bf8a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/GSdx/res/glsl/tfx_fs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

//////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 6 additions & 0 deletions plugins/GSdx/res/glsl_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 564bf8a

Please sign in to comment.