From 6c571ccfc57b55d12436f62119c225fd63243bd6 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Mon, 29 Jun 2015 17:12:47 -0700 Subject: [PATCH] Change rect lists to tri lists instead of strips. Progress on #304. --- src/xenia/gpu/gl4/command_processor.cc | 31 +++++++++++++++++++++----- src/xenia/gpu/gl4/draw_batcher.cc | 2 +- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index ddeaec901..c6177d18e 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -305,7 +305,7 @@ bool CommandProcessor::SetupGL() { std::string rect_list_shader = geometry_header + "layout(triangles) in;\n" - "layout(triangle_strip, max_vertices = 4) out;\n" + "layout(triangle_strip, max_vertices = 6) out;\n" "void main() {\n" // Most games use the left-aligned form. " bool left_aligned = gl_in[0].gl_Position.x == \n" @@ -328,6 +328,15 @@ bool CommandProcessor::SetupGL() { " gl_PointSize = gl_in[2].gl_PointSize;\n" " out_vtx = in_vtx[2];\n" " EmitVertex();\n" + " EndPrimitive();\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 = gl_in[1].gl_Position;\n" + " gl_PointSize = gl_in[1].gl_PointSize;\n" + " out_vtx = in_vtx[1];\n" + " EmitVertex();\n" " gl_Position = \n" " (gl_in[1].gl_Position + gl_in[2].gl_Position) - \n" " gl_in[0].gl_Position;\n" @@ -337,6 +346,7 @@ bool CommandProcessor::SetupGL() { " in_vtx[2].o[i];\n" " }\n" " EmitVertex();\n" + " EndPrimitive();\n" " } else {\n" // 0 ------ 1 // | - | @@ -351,6 +361,19 @@ bool CommandProcessor::SetupGL() { " 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" + " EndPrimitive();\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[2].gl_Position;\n" + " gl_PointSize = gl_in[2].gl_PointSize;\n" + " out_vtx = in_vtx[2];\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" @@ -359,12 +382,8 @@ bool CommandProcessor::SetupGL() { " in_vtx[2].o[i];\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" - " EndPrimitive();\n" "}\n"; std::string quad_list_shader = geometry_header + diff --git a/src/xenia/gpu/gl4/draw_batcher.cc b/src/xenia/gpu/gl4/draw_batcher.cc index 240ee9d1e..93e7693dc 100644 --- a/src/xenia/gpu/gl4/draw_batcher.cc +++ b/src/xenia/gpu/gl4/draw_batcher.cc @@ -302,7 +302,7 @@ bool DrawBatcher::Flush(FlushMode mode) { prim_type = GL_TRIANGLE_FAN; break; case PrimitiveType::kRectangleList: - prim_type = GL_TRIANGLE_STRIP; + prim_type = GL_TRIANGLES; // Rect lists aren't culled. There may be other things they skip too. // assert_true((register_file_->values[XE_GPU_REG_PA_SU_SC_MODE_CNTL].u32 // &