Skip to content

Commit

Permalink
vk/gl: Preserve clamped z precision to some extent
Browse files Browse the repository at this point in the history
- Use edges of depth range to map clamped stuff

Disable range compression on regular draws vs extended range draws
- Some applications require full 0-1 usage without compromises.
-- TODO: This leaves the extended range z values to fight with regular draws in the .99 - 1.0 range
  • Loading branch information
kd-11 committed Jan 22, 2018
1 parent f908daf commit 743928b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rpcs3/Emu/RSX/Common/GLSLCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,11 @@ namespace glsl
OS << "{\n";
OS << " float d = pos.z / pos.w;\n";
OS << " if (d < 0.f && d >= near_plane)\n";
OS << " d = 0.f;\n";
OS << " d = 0.f;\n"; //force clamp negative values
OS << " else if (d > 1.f && d <= far_plane)\n";
OS << " d = 1.f;\n";
OS << " d = min(1., 0.99 + (0.01 * (pos.z - near_plane) / (far_plane - near_plane)));\n";
OS << " else\n";
OS << " return pos;\n";
OS << " return pos; //d = (0.99 * d);\n"; //range compression for normal values is disabled until a solution to ops comparing z is found
OS << "\n";
OS << " pos.z = d * pos.w;\n";
OS << " return pos;\n";
Expand Down

0 comments on commit 743928b

Please sign in to comment.