mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 00:41:26 +12:00
rsx: Handle rare rounding issue where position.w is very close to zero
This commit is contained in:
parent
f5415fb4ac
commit
14a64e2529
1 changed files with 2 additions and 2 deletions
|
@ -616,7 +616,7 @@ namespace glsl
|
||||||
// Forward mapping eqn is d' = d * (f - n) + n, where d' is the stored Z value (this) and d is the normalized API value.
|
// Forward mapping eqn is d' = d * (f - n) + n, where d' is the stored Z value (this) and d is the normalized API value.
|
||||||
"vec4 apply_zclip_xform(const in vec4 pos, const in float near_plane, const in float far_plane)\n"
|
"vec4 apply_zclip_xform(const in vec4 pos, const in float near_plane, const in float far_plane)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" if (far_plane != 0.0)\n"
|
" if (far_plane != 0.0 && pos.w != 0.0)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" double z_range = (far_plane > near_plane)? (far_plane - near_plane) : far_plane;\n"
|
" double z_range = (far_plane > near_plane)? (far_plane - near_plane) : far_plane;\n"
|
||||||
" double inv_range = rcp_precise(z_range);\n"
|
" double inv_range = rcp_precise(z_range);\n"
|
||||||
|
@ -646,7 +646,7 @@ namespace glsl
|
||||||
" // Compress Z and store towards highest end of the range\n"
|
" // Compress Z and store towards highest end of the range\n"
|
||||||
" d = min(1., 0.99 + (0.01 * (pos.z - near_plane) / (far_plane - near_plane)));\n"
|
" d = min(1., 0.99 + (0.01 * (pos.z - near_plane) / (far_plane - near_plane)));\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" else\n"
|
" else\n" // This catch-call also handles w=0 since d=inf
|
||||||
" {\n"
|
" {\n"
|
||||||
" return pos;\n"
|
" return pos;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue