Change rect lists to tri lists instead of strips.

Progress on #304.
This commit is contained in:
Ben Vanik 2015-06-29 17:12:47 -07:00
parent 6c0f1fc15d
commit 6c571ccfc5
2 changed files with 26 additions and 7 deletions

View File

@ -305,7 +305,7 @@ bool CommandProcessor::SetupGL() {
std::string rect_list_shader = std::string rect_list_shader =
geometry_header + geometry_header +
"layout(triangles) in;\n" "layout(triangles) in;\n"
"layout(triangle_strip, max_vertices = 4) out;\n" "layout(triangle_strip, max_vertices = 6) out;\n"
"void main() {\n" "void main() {\n"
// Most games use the left-aligned form. // Most games use the left-aligned form.
" bool left_aligned = gl_in[0].gl_Position.x == \n" " 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" " gl_PointSize = gl_in[2].gl_PointSize;\n"
" out_vtx = in_vtx[2];\n" " out_vtx = in_vtx[2];\n"
" EmitVertex();\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_Position = \n"
" (gl_in[1].gl_Position + gl_in[2].gl_Position) - \n" " (gl_in[1].gl_Position + gl_in[2].gl_Position) - \n"
" gl_in[0].gl_Position;\n" " gl_in[0].gl_Position;\n"
@ -337,6 +346,7 @@ bool CommandProcessor::SetupGL() {
" in_vtx[2].o[i];\n" " in_vtx[2].o[i];\n"
" }\n" " }\n"
" EmitVertex();\n" " EmitVertex();\n"
" EndPrimitive();\n"
" } else {\n" " } else {\n"
// 0 ------ 1 // 0 ------ 1
// | - | // | - |
@ -351,6 +361,19 @@ bool CommandProcessor::SetupGL() {
" gl_PointSize = gl_in[1].gl_PointSize;\n" " gl_PointSize = gl_in[1].gl_PointSize;\n"
" out_vtx = in_vtx[1];\n" " out_vtx = in_vtx[1];\n"
" EmitVertex();\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_Position = gl_in[0].gl_Position + (gl_in[2].gl_Position - \n"
" gl_in[1].gl_Position);\n" " gl_in[1].gl_Position);\n"
" gl_PointSize = gl_in[2].gl_PointSize;\n" " gl_PointSize = gl_in[2].gl_PointSize;\n"
@ -359,12 +382,8 @@ bool CommandProcessor::SetupGL() {
" in_vtx[2].o[i];\n" " in_vtx[2].o[i];\n"
" }\n" " }\n"
" EmitVertex();\n" " EmitVertex();\n"
" gl_Position = gl_in[2].gl_Position;\n" " EndPrimitive();\n"
" gl_PointSize = gl_in[2].gl_PointSize;\n"
" out_vtx = in_vtx[2];\n"
" EmitVertex();\n"
" }\n" " }\n"
" EndPrimitive();\n"
"}\n"; "}\n";
std::string quad_list_shader = std::string quad_list_shader =
geometry_header + geometry_header +

View File

@ -302,7 +302,7 @@ bool DrawBatcher::Flush(FlushMode mode) {
prim_type = GL_TRIANGLE_FAN; prim_type = GL_TRIANGLE_FAN;
break; break;
case PrimitiveType::kRectangleList: 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. // 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 // assert_true((register_file_->values[XE_GPU_REG_PA_SU_SC_MODE_CNTL].u32
// & // &