From c4e3b0fe62d336222690a2d76d370e7dd2a493c1 Mon Sep 17 00:00:00 2001 From: espes Date: Fri, 30 May 2014 00:01:06 +1000 Subject: [PATCH] probably a more correct way to handle vsh output --- hw/xbox/nv2a_vsh.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/xbox/nv2a_vsh.c b/hw/xbox/nv2a_vsh.c index eb51097bfc..32a965aaa3 100644 --- a/hw/xbox/nv2a_vsh.c +++ b/hw/xbox/nv2a_vsh.c @@ -778,11 +778,18 @@ QString* vsh_translate(uint16_t version, * but they're not necessarily present... */ - " /* Un-screenspace transform */\n" + " /* Un-screenspace transform */\n" "oPos.x = (oPos.x - viewportOffset.x) / viewportScale.x;\n" "oPos.y = (oPos.y - viewportOffset.y) / viewportScale.y;\n" "oPos.z = (oPos.z - 0.5 * (clipRange.x + clipRange.y)) / (0.5 * (clipRange.y - clipRange.x));\n" - "oPos.w = sign(oPos.w);\n" + + "if (oPos.w <= 0.0) {\n" + /* undo the perspective divide in the case where the point would be + * clipped so opengl can clip it correctly */ + " oPos.xyz *= oPos.w;\n" + "} else {\n" + " oPos.w = 1.0;\n" + "}\n" " /* Set outputs */\n" " gl_Position = oPos;\n"