Munging with viewport stuff. Nasty.

This commit is contained in:
Ben Vanik 2015-01-02 00:27:05 -08:00
parent be05ab6ffe
commit 1c068a601d
1 changed files with 9 additions and 9 deletions

View File

@ -77,21 +77,21 @@ bool GL4Shader::PrepareVertexShader(
" // w is not 1/W0. Common case.\n" " // w is not 1/W0. Common case.\n"
" w = 1.0 / w;\n" " w = 1.0 / w;\n"
" }\n" " }\n"
" if (state.vtx_fmt.x == 0.0) {\n" " if (state.vtx_fmt.x != 0.0) {\n"
" // Need to multiply by 1/W0.\n" " // Need to multiply by 1/W0.\n"
" pos.xy /= w;\n" " pos.xy *= w;\n"
" }\n" " }\n"
" if (state.vtx_fmt.z == 0.0) {\n" " if (state.vtx_fmt.z != 0.0) {\n"
" // Need to multiply by 1/W0.\n" " // Need to multiply by 1/W0.\n"
" pos.z /= w;\n" " pos.z *= w;\n"
" }\n" " }\n"
" pos.w = 1.0;\n" " pos.w = w;\n"
" // Perform clipping, lest we get weird geometry.\n" " // Perform clipping, lest we get weird geometry.\n"
// TODO(benvanik): is this right? dxclip mode may change this? // TODO(benvanik): is this right? dxclip mode may change this?
" if (pos.z < gl_DepthRange.near || pos.z > gl_DepthRange.far) {\n" //" if (pos.z < gl_DepthRange.near || pos.z > gl_DepthRange.far) {\n"
" // Clipped! w=0 will kill it in the hardware persp divide.\n" //" // Clipped! w=0 will kill it in the hardware persp divide.\n"
" pos.w = 0.0;\n" //" pos.w = 0.0;\n"
" }\n" //" }\n"
" // NDC transform.\n" " // NDC transform.\n"
" pos.x = pos.x * state.viewport_scale.x + \n" " pos.x = pos.x * state.viewport_scale.x + \n"
" state.viewport_offset.x;\n" " state.viewport_offset.x;\n"