Clip high z vertices

Fixes Soul Calibur intro bogus triangles
This commit is contained in:
Flyinghead 2018-12-06 20:46:23 +01:00
parent 064531df95
commit 9fe13e20e8
2 changed files with 11 additions and 15 deletions

View File

@ -47,14 +47,13 @@ void main() \n\
vtx_offs1 = in_offs1; \n\
vtx_uv1 = in_uv1; \n\
vec4 vpos=in_pos; \n\
if (vpos.z < 0.0) { \n\
if (vpos.z < 0.0 || vpos.z > 3.4e37) \n\
{ \n\
gl_Position = vec4(0.0, 0.0, 1.0, 1.0 / vpos.z); \n\
return; \n\
} \n\
if (isinf(vpos.z)) \n\
vpos.w = 1.18e-38; \n\
else \n\
vpos.w = extra_depth_scale / vpos.z; \n\
\n\
vpos.w = extra_depth_scale / vpos.z; \n\
vpos.z = vpos.w; \n\
vpos.xy=vpos.xy*scale.xy-scale.zw; \n\
vpos.xy*=vpos.w; \n\

View File

@ -118,18 +118,15 @@ void main() \n\
vtx_base=in_base; \n\
vtx_offs=in_offs; \n\
vtx_uv=in_uv; \n\
vec4 vpos=in_pos; \n\
#if TARGET_GL == GL3 \n\
if (isinf(vpos.z)) \n\
vpos.w = 1.18e-38; \n\
else \n\
#endif \n\
vpos.w = extra_depth_scale / vpos.z; \n\
#if TARGET_GL != GLES2 \n\
if (vpos.w < 0.0) { \n\
gl_Position = vec4(0.0, 0.0, 0.0, vpos.w); \n\
highp vec4 vpos = in_pos; \n\
if (vpos.z < 0.0 || vpos.z > 3.4e37) \n\
{ \n\
gl_Position = vec4(0.0, 0.0, 1.0, 1.0 / vpos.z); \n\
return; \n\
} \n\
\n\
vpos.w = extra_depth_scale / vpos.z; \n\
#if TARGET_GL != GLES2 \n\
vpos.z = vpos.w; \n\
#else \n\
vpos.z=depth_scale.x+depth_scale.y*vpos.w; \n\