From ca8554e7d1d7c77b3c2a9ed8a7fb12de7096c67b Mon Sep 17 00:00:00 2001 From: degasus Date: Fri, 29 Mar 2013 14:27:33 +0100 Subject: first try of primitive restart index generator Convert all quads+triangles into trangle_strip and uses primitive restart to split them. Speed up triangle_strip, but slows down all others primitive formats. Only implemented in ogl. --- Source/Core/VideoCommon/Src/IndexGenerator.cpp | 46 +++++++++++++++++++------- 1 file changed, 34 insertions(+), 12 deletions(-) (limited to 'Source/Core/VideoCommon/Src/IndexGenerator.cpp') diff --git a/Source/Core/VideoCommon/Src/IndexGenerator.cpp b/Source/Core/VideoCommon/Src/IndexGenerator.cpp index aa1a971687..05097b7c9a 100644 --- a/Source/Core/VideoCommon/Src/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/Src/IndexGenerator.cpp @@ -18,6 +18,7 @@ #include #include "Common.h" +#include "VideoConfig.h" #include "IndexGenerator.h" /* @@ -90,7 +91,9 @@ __forceinline void IndexGenerator::WriteTriangle(u32 index1, u32 index2, u32 ind *Tptr++ = index1; *Tptr++ = index2; *Tptr++ = index3; - + if(g_Config.backend_info.bSupportsPrimitiveRestart) + *Tptr++ = 65535; + ++numT; } @@ -105,15 +108,25 @@ void IndexGenerator::AddList(u32 const numVerts) void IndexGenerator::AddStrip(u32 const numVerts) { - bool wind = false; - for (u32 i = 2; i < numVerts; ++i) - { - WriteTriangle( - index + i - 2, - index + i - !wind, - index + i - wind); - - wind ^= true; + if(g_Config.backend_info.bSupportsPrimitiveRestart) { + for (u32 i = 0; i < numVerts; ++i) + { + *Tptr++ = index + i; + } + *Tptr++ = 65535; + numT += numVerts - 2; + + } else { + bool wind = false; + for (u32 i = 2; i < numVerts; ++i) + { + WriteTriangle( + index + i - 2, + index + i - !wind, + index + i - wind); + + wind ^= true; + } } } @@ -130,8 +143,17 @@ void IndexGenerator::AddQuads(u32 numVerts) auto const numQuads = numVerts / 4; for (u32 i = 0; i != numQuads; ++i) { - WriteTriangle(index + i * 4, index + i * 4 + 1, index + i * 4 + 2); - WriteTriangle(index + i * 4, index + i * 4 + 2, index + i * 4 + 3); + if(g_Config.backend_info.bSupportsPrimitiveRestart) { + *Tptr++ = index + i * 4 + 0; + *Tptr++ = index + i * 4 + 1; + *Tptr++ = index + i * 4 + 3; + *Tptr++ = index + i * 4 + 2; + *Tptr++ = 65535; + numT += 2; + } else { + WriteTriangle(index + i * 4, index + i * 4 + 1, index + i * 4 + 2); + WriteTriangle(index + i * 4, index + i * 4 + 2, index + i * 4 + 3); + } } } -- cgit v1.2.3 From 80b56ddd170b12db30e636c0d5014afe20ebb784 Mon Sep 17 00:00:00 2001 From: degasus Date: Mon, 8 Apr 2013 17:22:16 +0200 Subject: convert triangle_fan to triangle_strip --- Source/Core/VideoCommon/Src/IndexGenerator.cpp | 71 +++++++++++++++++++++----- 1 file changed, 59 insertions(+), 12 deletions(-) (limited to 'Source/Core/VideoCommon/Src/IndexGenerator.cpp') diff --git a/Source/Core/VideoCommon/Src/IndexGenerator.cpp b/Source/Core/VideoCommon/Src/IndexGenerator.cpp index 05097b7c9a..edc6e90309 100644 --- a/Source/Core/VideoCommon/Src/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/Src/IndexGenerator.cpp @@ -21,15 +21,6 @@ #include "VideoConfig.h" #include "IndexGenerator.h" -/* -* -QUAD simulator - -0 1 4 5 -3 2 7 6 -012023 147172 ... -*/ - //Init u16 *IndexGenerator::Tptr; u16 *IndexGenerator::BASETptr; @@ -130,24 +121,80 @@ void IndexGenerator::AddStrip(u32 const numVerts) } } +/** + * FAN simulator: + * + * 2---3 + * / \ / \ + * 1---0---4 + * + * would generate this triangles: + * 012, 023, 034 + * + * rotated (for better striping): + * 120, 302, 034 + * + * as odd ones have to winded, following strip is fine: + * 12034 + * + * so we use 6 indices for 3 triangles + */ + void IndexGenerator::AddFan(u32 numVerts) { - for (u32 i = 2; i < numVerts; ++i) + ERROR_LOG(VIDEO, "addfan: %d vertices", numVerts); + u32 i = 2; + + if(g_Config.backend_info.bSupportsPrimitiveRestart) { + for(; i<=numVerts-3; i+=3) { + *Tptr++ = index + i - 1; + *Tptr++ = index + i + 0; + *Tptr++ = index; + *Tptr++ = index + i + 1; + *Tptr++ = index + i + 2; + *Tptr++ = 65535; + numT += 3; + } + + for(; i<=numVerts-2; i+=2) { + *Tptr++ = index + i - 1; + *Tptr++ = index + i + 0; + *Tptr++ = index; + *Tptr++ = index + i + 1; + *Tptr++ = 65535; + numT += 2; + } + } + + for (; i < numVerts; ++i) { WriteTriangle(index, index + i - 1, index + i); } } +/* + * QUAD simulator + * + * 0---1 4---5 + * |\ | |\ | + * | \ | | \ | + * | \| | \| + * 3---2 7---6 + * + * 012,023, 456,467 ... + * or 120,302, 564,746 + * or as strip: 1203, 5647 + */ void IndexGenerator::AddQuads(u32 numVerts) { auto const numQuads = numVerts / 4; for (u32 i = 0; i != numQuads; ++i) { if(g_Config.backend_info.bSupportsPrimitiveRestart) { - *Tptr++ = index + i * 4 + 0; *Tptr++ = index + i * 4 + 1; - *Tptr++ = index + i * 4 + 3; *Tptr++ = index + i * 4 + 2; + *Tptr++ = index + i * 4 + 0; + *Tptr++ = index + i * 4 + 3; *Tptr++ = 65535; numT += 2; } else { -- cgit v1.2.3 From 4dca133745129295965b245d2a07e2c82da70066 Mon Sep 17 00:00:00 2001 From: degasus Date: Mon, 8 Apr 2013 17:58:23 +0200 Subject: small cleanups --- Source/Core/VideoCommon/Src/IndexGenerator.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Source/Core/VideoCommon/Src/IndexGenerator.cpp') diff --git a/Source/Core/VideoCommon/Src/IndexGenerator.cpp b/Source/Core/VideoCommon/Src/IndexGenerator.cpp index edc6e90309..0c5c2fb91e 100644 --- a/Source/Core/VideoCommon/Src/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/Src/IndexGenerator.cpp @@ -33,6 +33,8 @@ u32 IndexGenerator::numL; u32 IndexGenerator::numP; u32 IndexGenerator::index; +static const u16 s_primitive_restart = -1; + void IndexGenerator::Start(u16* Triangleptr, u16* Lineptr, u16* Pointptr) { Tptr = Triangleptr; @@ -83,7 +85,7 @@ __forceinline void IndexGenerator::WriteTriangle(u32 index1, u32 index2, u32 ind *Tptr++ = index2; *Tptr++ = index3; if(g_Config.backend_info.bSupportsPrimitiveRestart) - *Tptr++ = 65535; + *Tptr++ = s_primitive_restart; ++numT; } @@ -104,7 +106,7 @@ void IndexGenerator::AddStrip(u32 const numVerts) { *Tptr++ = index + i; } - *Tptr++ = 65535; + *Tptr++ = s_primitive_restart; numT += numVerts - 2; } else { @@ -142,7 +144,6 @@ void IndexGenerator::AddStrip(u32 const numVerts) void IndexGenerator::AddFan(u32 numVerts) { - ERROR_LOG(VIDEO, "addfan: %d vertices", numVerts); u32 i = 2; if(g_Config.backend_info.bSupportsPrimitiveRestart) { @@ -152,7 +153,7 @@ void IndexGenerator::AddFan(u32 numVerts) *Tptr++ = index; *Tptr++ = index + i + 1; *Tptr++ = index + i + 2; - *Tptr++ = 65535; + *Tptr++ = s_primitive_restart; numT += 3; } @@ -161,7 +162,7 @@ void IndexGenerator::AddFan(u32 numVerts) *Tptr++ = index + i + 0; *Tptr++ = index; *Tptr++ = index + i + 1; - *Tptr++ = 65535; + *Tptr++ = s_primitive_restart; numT += 2; } } @@ -195,7 +196,7 @@ void IndexGenerator::AddQuads(u32 numVerts) *Tptr++ = index + i * 4 + 2; *Tptr++ = index + i * 4 + 0; *Tptr++ = index + i * 4 + 3; - *Tptr++ = 65535; + *Tptr++ = s_primitive_restart; numT += 2; } else { WriteTriangle(index + i * 4, index + i * 4 + 1, index + i * 4 + 2); @@ -216,6 +217,8 @@ void IndexGenerator::AddLineList(u32 numVerts) } } +// shouldn't be used as strips as LineLists are much more common +// so converting them to lists void IndexGenerator::AddLineStrip(u32 numVerts) { for (u32 i = 1; i < numVerts; ++i) @@ -239,6 +242,6 @@ void IndexGenerator::AddPoints(u32 numVerts) u32 IndexGenerator::GetRemainingIndices() { - u32 max_index = 65535; + u32 max_index = 65534; // -1 is reserved for primitive restart (ogl + dx11) return max_index - index; } -- cgit v1.2.3 From b0108631f6ef98719f9df3fb5924766b0798f236 Mon Sep 17 00:00:00 2001 From: degasus Date: Mon, 8 Apr 2013 19:39:43 +0200 Subject: use templates for primitive restart --- Source/Core/VideoCommon/Src/IndexGenerator.cpp | 75 +++++++++++++------------- 1 file changed, 38 insertions(+), 37 deletions(-) (limited to 'Source/Core/VideoCommon/Src/IndexGenerator.cpp') diff --git a/Source/Core/VideoCommon/Src/IndexGenerator.cpp b/Source/Core/VideoCommon/Src/IndexGenerator.cpp index 0c5c2fb91e..53a3e4a351 100644 --- a/Source/Core/VideoCommon/Src/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/Src/IndexGenerator.cpp @@ -35,6 +35,30 @@ u32 IndexGenerator::index; static const u16 s_primitive_restart = -1; +static void (*primitive_table[8])(u32); + +void IndexGenerator::Init() +{ + if(g_Config.backend_info.bSupportsPrimitiveRestart) + { + primitive_table[0] = IndexGenerator::AddQuads; + primitive_table[2] = IndexGenerator::AddList; + primitive_table[3] = IndexGenerator::AddStrip; + primitive_table[4] = IndexGenerator::AddFan; + } + else + { + primitive_table[0] = IndexGenerator::AddQuads; + primitive_table[2] = IndexGenerator::AddList; + primitive_table[3] = IndexGenerator::AddStrip; + primitive_table[4] = IndexGenerator::AddFan; + } + primitive_table[1] = NULL; + primitive_table[5] = &IndexGenerator::AddLineList; + primitive_table[6] = &IndexGenerator::AddLineStrip; + primitive_table[7] = &IndexGenerator::AddPoints; +} + void IndexGenerator::Start(u16* Triangleptr, u16* Lineptr, u16* Pointptr) { Tptr = Triangleptr; @@ -51,57 +75,34 @@ void IndexGenerator::Start(u16* Triangleptr, u16* Lineptr, u16* Pointptr) void IndexGenerator::AddIndices(int primitive, u32 numVerts) { - //switch (primitive) - //{ - //case GX_DRAW_QUADS: IndexGenerator::AddQuads(numVerts); break; - //case GX_DRAW_TRIANGLES: IndexGenerator::AddList(numVerts); break; - //case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(numVerts); break; - //case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(numVerts); break; - //case GX_DRAW_LINES: IndexGenerator::AddLineList(numVerts); break; - //case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(numVerts); break; - //case GX_DRAW_POINTS: IndexGenerator::AddPoints(numVerts); break; - //} - - static void (*const primitive_table[])(u32) = - { - IndexGenerator::AddQuads, - NULL, - IndexGenerator::AddList, - IndexGenerator::AddStrip, - IndexGenerator::AddFan, - IndexGenerator::AddLineList, - IndexGenerator::AddLineStrip, - IndexGenerator::AddPoints, - }; - primitive_table[primitive](numVerts); index += numVerts; } // Triangles -__forceinline void IndexGenerator::WriteTriangle(u32 index1, u32 index2, u32 index3) +template __forceinline void IndexGenerator::WriteTriangle(u32 index1, u32 index2, u32 index3) { *Tptr++ = index1; *Tptr++ = index2; *Tptr++ = index3; - if(g_Config.backend_info.bSupportsPrimitiveRestart) + if(pr) *Tptr++ = s_primitive_restart; ++numT; } -void IndexGenerator::AddList(u32 const numVerts) +template void IndexGenerator::AddList(u32 const numVerts) { auto const numTris = numVerts / 3; for (u32 i = 0; i != numTris; ++i) { - WriteTriangle(index + i * 3, index + i * 3 + 1, index + i * 3 + 2); + WriteTriangle(index + i * 3, index + i * 3 + 1, index + i * 3 + 2); } } -void IndexGenerator::AddStrip(u32 const numVerts) +template void IndexGenerator::AddStrip(u32 const numVerts) { - if(g_Config.backend_info.bSupportsPrimitiveRestart) { + if(pr) { for (u32 i = 0; i < numVerts; ++i) { *Tptr++ = index + i; @@ -113,7 +114,7 @@ void IndexGenerator::AddStrip(u32 const numVerts) bool wind = false; for (u32 i = 2; i < numVerts; ++i) { - WriteTriangle( + WriteTriangle( index + i - 2, index + i - !wind, index + i - wind); @@ -142,11 +143,11 @@ void IndexGenerator::AddStrip(u32 const numVerts) * so we use 6 indices for 3 triangles */ -void IndexGenerator::AddFan(u32 numVerts) +template void IndexGenerator::AddFan(u32 numVerts) { u32 i = 2; - if(g_Config.backend_info.bSupportsPrimitiveRestart) { + if(pr) { for(; i<=numVerts-3; i+=3) { *Tptr++ = index + i - 1; *Tptr++ = index + i + 0; @@ -169,7 +170,7 @@ void IndexGenerator::AddFan(u32 numVerts) for (; i < numVerts; ++i) { - WriteTriangle(index, index + i - 1, index + i); + WriteTriangle(index, index + i - 1, index + i); } } @@ -186,12 +187,12 @@ void IndexGenerator::AddFan(u32 numVerts) * or 120,302, 564,746 * or as strip: 1203, 5647 */ -void IndexGenerator::AddQuads(u32 numVerts) +template void IndexGenerator::AddQuads(u32 numVerts) { auto const numQuads = numVerts / 4; for (u32 i = 0; i != numQuads; ++i) { - if(g_Config.backend_info.bSupportsPrimitiveRestart) { + if(pr) { *Tptr++ = index + i * 4 + 1; *Tptr++ = index + i * 4 + 2; *Tptr++ = index + i * 4 + 0; @@ -199,8 +200,8 @@ void IndexGenerator::AddQuads(u32 numVerts) *Tptr++ = s_primitive_restart; numT += 2; } else { - WriteTriangle(index + i * 4, index + i * 4 + 1, index + i * 4 + 2); - WriteTriangle(index + i * 4, index + i * 4 + 2, index + i * 4 + 3); + WriteTriangle(index + i * 4, index + i * 4 + 1, index + i * 4 + 2); + WriteTriangle(index + i * 4, index + i * 4 + 2, index + i * 4 + 3); } } } -- cgit v1.2.3 From a6412f7bd4f09ce299638afbfd0a6b085e681902 Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 10 Apr 2013 12:36:59 +0200 Subject: render a triangle for a 3 vertice quad fix issue 6214 --- Source/Core/VideoCommon/Src/IndexGenerator.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Source/Core/VideoCommon/Src/IndexGenerator.cpp') diff --git a/Source/Core/VideoCommon/Src/IndexGenerator.cpp b/Source/Core/VideoCommon/Src/IndexGenerator.cpp index 53a3e4a351..5f95f30884 100644 --- a/Source/Core/VideoCommon/Src/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/Src/IndexGenerator.cpp @@ -98,6 +98,9 @@ template void IndexGenerator::AddList(u32 const numVerts) { WriteTriangle(index + i * 3, index + i * 3 + 1, index + i * 3 + 2); } + u32 remainingVerts = numVerts - numTris*3; + if(remainingVerts) + ERROR_LOG(VIDEO, "AddList: unknown count of vertices found"); } template void IndexGenerator::AddStrip(u32 const numVerts) @@ -186,6 +189,10 @@ template void IndexGenerator::AddFan(u32 numVerts) * 012,023, 456,467 ... * or 120,302, 564,746 * or as strip: 1203, 5647 + * + * Warning: + * A simple triangle have to be rendered for three vertices. + * SMS do this for sun rays */ template void IndexGenerator::AddQuads(u32 numVerts) { @@ -204,6 +211,14 @@ template void IndexGenerator::AddQuads(u32 numVerts) WriteTriangle(index + i * 4, index + i * 4 + 2, index + i * 4 + 3); } } + // three vertices remaining, so render a triangle + u32 remainingVerts = numVerts - numQuads*4; + if(remainingVerts == 3) + { + WriteTriangle(index+numVerts-3, index+numVerts-2, index+numVerts-1); + } + else if(remainingVerts) + ERROR_LOG(VIDEO, "AddQuads: unknown count of vertices found"); } // Lines @@ -216,6 +231,10 @@ void IndexGenerator::AddLineList(u32 numVerts) *Lptr++ = index + i * 2 + 1; ++numL; } + u32 remainingVerts = numVerts - numLines*2; + if(remainingVerts) + ERROR_LOG(VIDEO, "AddLineList: unknown count of vertices found"); + } // shouldn't be used as strips as LineLists are much more common -- cgit v1.2.3 From 1aa10b579a017257e74d4c26d2aab36944c55949 Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 10 Apr 2013 12:45:44 +0200 Subject: fix triangle_fan size calculation wasn't updated for the new primitive restart implementation --- Source/Core/VideoCommon/Src/IndexGenerator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/Src/IndexGenerator.cpp') diff --git a/Source/Core/VideoCommon/Src/IndexGenerator.cpp b/Source/Core/VideoCommon/Src/IndexGenerator.cpp index 5f95f30884..28c62193c2 100644 --- a/Source/Core/VideoCommon/Src/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/Src/IndexGenerator.cpp @@ -191,8 +191,8 @@ template void IndexGenerator::AddFan(u32 numVerts) * or as strip: 1203, 5647 * * Warning: - * A simple triangle have to be rendered for three vertices. - * SMS do this for sun rays + * A simple triangle has to be rendered for three vertices. + * ZWW do this for sun rays */ template void IndexGenerator::AddQuads(u32 numVerts) { -- cgit v1.2.3 From bab9963b00953d60bdd6fabe265d5daa45a27661 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 17 Apr 2013 23:09:55 -0400 Subject: New license header introduced for DiscIO, AudioCommon, InputCommon, VideoCommon, and Common projects. --- Source/Core/VideoCommon/Src/IndexGenerator.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'Source/Core/VideoCommon/Src/IndexGenerator.cpp') diff --git a/Source/Core/VideoCommon/Src/IndexGenerator.cpp b/Source/Core/VideoCommon/Src/IndexGenerator.cpp index 28c62193c2..d2948a10ed 100644 --- a/Source/Core/VideoCommon/Src/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/Src/IndexGenerator.cpp @@ -1,19 +1,6 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. #include -- cgit v1.2.3 From 8da425b008b46ef90d649e55c6c0d4a0bc2b556b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 24 Apr 2013 09:21:54 -0400 Subject: Formatting cleanup for VideoCommon. Block braces on new lines. Also killed off trailing whitespace and dangling elses. Spaced some things out to make them more readable (only in places where it looked like a bit of a clusterfuck). --- Source/Core/VideoCommon/Src/IndexGenerator.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'Source/Core/VideoCommon/Src/IndexGenerator.cpp') diff --git a/Source/Core/VideoCommon/Src/IndexGenerator.cpp b/Source/Core/VideoCommon/Src/IndexGenerator.cpp index d2948a10ed..15b2311f89 100644 --- a/Source/Core/VideoCommon/Src/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/Src/IndexGenerator.cpp @@ -92,7 +92,8 @@ template void IndexGenerator::AddList(u32 const numVerts) template void IndexGenerator::AddStrip(u32 const numVerts) { - if(pr) { + if(pr) + { for (u32 i = 0; i < numVerts; ++i) { *Tptr++ = index + i; @@ -100,7 +101,9 @@ template void IndexGenerator::AddStrip(u32 const numVerts) *Tptr++ = s_primitive_restart; numT += numVerts - 2; - } else { + } + else + { bool wind = false; for (u32 i = 2; i < numVerts; ++i) { @@ -137,8 +140,10 @@ template void IndexGenerator::AddFan(u32 numVerts) { u32 i = 2; - if(pr) { - for(; i<=numVerts-3; i+=3) { + if(pr) + { + for(; i<=numVerts-3; i+=3) + { *Tptr++ = index + i - 1; *Tptr++ = index + i + 0; *Tptr++ = index; @@ -148,7 +153,8 @@ template void IndexGenerator::AddFan(u32 numVerts) numT += 3; } - for(; i<=numVerts-2; i+=2) { + for(; i<=numVerts-2; i+=2) + { *Tptr++ = index + i - 1; *Tptr++ = index + i + 0; *Tptr++ = index; @@ -186,18 +192,22 @@ template void IndexGenerator::AddQuads(u32 numVerts) auto const numQuads = numVerts / 4; for (u32 i = 0; i != numQuads; ++i) { - if(pr) { + if(pr) + { *Tptr++ = index + i * 4 + 1; *Tptr++ = index + i * 4 + 2; *Tptr++ = index + i * 4 + 0; *Tptr++ = index + i * 4 + 3; *Tptr++ = s_primitive_restart; numT += 2; - } else { + } + else + { WriteTriangle(index + i * 4, index + i * 4 + 1, index + i * 4 + 2); WriteTriangle(index + i * 4, index + i * 4 + 2, index + i * 4 + 3); } } + // three vertices remaining, so render a triangle u32 remainingVerts = numVerts - numQuads*4; if(remainingVerts == 3) @@ -205,7 +215,9 @@ template void IndexGenerator::AddQuads(u32 numVerts) WriteTriangle(index+numVerts-3, index+numVerts-2, index+numVerts-1); } else if(remainingVerts) + { ERROR_LOG(VIDEO, "AddQuads: unknown count of vertices found"); + } } // Lines -- cgit v1.2.3