diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index b2b578b48..dfb7f55aa 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -233,26 +233,56 @@ bool CommandProcessor::SetupGL() { "layout(triangles) in;\n" "layout(triangle_strip, max_vertices = 4) out;\n" "void main() {\n" - " gl_Position = gl_in[0].gl_Position;\n" - " gl_PointSize = gl_in[0].gl_PointSize;\n" - " out_vtx = in_vtx[0];\n" - " EmitVertex();\n" - " gl_Position = gl_in[1].gl_Position;\n" - " gl_PointSize = gl_in[1].gl_PointSize;\n" - " out_vtx = in_vtx[1];\n" - " EmitVertex();\n" - " gl_Position = gl_in[0].gl_Position + \n" - " (gl_in[2].gl_Position - gl_in[1].gl_Position);\n" - " gl_PointSize = gl_in[2].gl_PointSize + \n" - " (gl_in[1].gl_PointSize - gl_in[0].gl_PointSize);\n" - " for (int j = 0; j < 16; ++j) {\n" - " out_vtx.o[j] = in_vtx[0].o[j] + (in_vtx[2].o[j] - in_vtx[1].o[j]);\n" + // Most games use the left-aligned form. + " bool left_aligned = gl_in[0].gl_Position.x == gl_in[2].gl_Position.x;\n" + " if (left_aligned) {\n" + // 0 ------ 1 + // | - | + // | // | + // | - | + // 2 ----- [3] + " gl_Position = gl_in[0].gl_Position;\n" + " gl_PointSize = gl_in[0].gl_PointSize;\n" + " out_vtx = in_vtx[0];\n" + " EmitVertex();\n" + " gl_Position = gl_in[1].gl_Position;\n" + " gl_PointSize = gl_in[1].gl_PointSize;\n" + " out_vtx = in_vtx[1];\n" + " EmitVertex();\n" + " gl_Position = gl_in[2].gl_Position;\n" + " gl_PointSize = gl_in[2].gl_PointSize;\n" + " out_vtx = in_vtx[2];\n" + " EmitVertex();\n" + " gl_Position = \n" + " (gl_in[1].gl_Position + gl_in[2].gl_Position) - \n" + " gl_in[0].gl_Position;\n" + " gl_PointSize = gl_in[2].gl_PointSize;\n" + " out_vtx = in_vtx[2];\n" + " EmitVertex();\n" + " } else {\n" + // 0 ------ 1 + // | - | + // | \\ | + // | - | + // [3] ----- 2 + " gl_Position = gl_in[0].gl_Position;\n" + " gl_PointSize = gl_in[0].gl_PointSize;\n" + " out_vtx = in_vtx[0];\n" + " EmitVertex();\n" + " gl_Position = gl_in[1].gl_Position;\n" + " gl_PointSize = gl_in[1].gl_PointSize;\n" + " out_vtx = in_vtx[1];\n" + " EmitVertex();\n" + " gl_Position = gl_in[0].gl_Position + (gl_in[2].gl_Position - \n" + " gl_in[1].gl_Position);\n" + " gl_PointSize = gl_in[2].gl_PointSize;\n" + " out_vtx = in_vtx[2];\n" + " EmitVertex();\n" + " gl_Position = gl_in[2].gl_Position;\n" + " gl_PointSize = gl_in[2].gl_PointSize;\n" + " out_vtx = in_vtx[2];\n" + " EmitVertex();\n" " }\n" - " EmitVertex();\n" - " gl_Position = gl_in[2].gl_Position;\n" - " gl_PointSize = gl_in[2].gl_PointSize;\n" - " out_vtx = in_vtx[2];\n" - " EmitVertex();\n" " EndPrimitive();\n" "}\n"; std::string quad_list_shader =