From 9ec5ee94b4a8786dd21f723446a32f2ff13b5f07 Mon Sep 17 00:00:00 2001 From: Rodolfo Osvaldo Bogado Date: Sat, 23 Jan 2010 12:56:07 +0000 Subject: [PATCH] this was a hard fix to found: if a degenerated primitive is passed to the VertexManager treat it as a compatible primitive, for example if a 5 vertex quad is passed treat it as a triangle fan. as crazy at this seems it fix the sun glare in ZWW, please test an d let me know if it make a difference in other games git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4931 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugins/Plugin_VideoDX9/Src/VertexManager.cpp | 14 +++++++------- .../Plugins/Plugin_VideoOGL/Src/VertexManager.cpp | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index 3dc5570c0d..825d9b463d 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -101,13 +101,13 @@ void AddIndices(int _primitive, int _numVertices) { switch (_primitive) { - case GX_DRAW_QUADS: IndexGenerator::AddQuads(_numVertices); return; - case GX_DRAW_TRIANGLES: IndexGenerator::AddList(_numVertices); return; - case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(_numVertices); return; - case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(_numVertices); return; - case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(_numVertices); return; - case GX_DRAW_LINES: IndexGenerator::AddLineList(_numVertices); return; - case GX_DRAW_POINTS: IndexGenerator::AddPoints(_numVertices); return; + case GX_DRAW_QUADS: if ((_numVertices % 4) == 0 ) {IndexGenerator::AddQuads(_numVertices);} else {IndexGenerator::AddFan(_numVertices);} break; + case GX_DRAW_TRIANGLES: if ((_numVertices % 3) == 0 ) {IndexGenerator::AddList(_numVertices);} else {IndexGenerator::AddStrip(_numVertices);} break; + case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(_numVertices); break; + case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(_numVertices); break; + case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(_numVertices); break; + case GX_DRAW_LINES: if ((_numVertices % 2) == 0 ) {IndexGenerator::AddLineList(_numVertices);} else {IndexGenerator::AddLineStrip(_numVertices);} break; + case GX_DRAW_POINTS: IndexGenerator::AddPoints(_numVertices); break; } } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index 479a93b392..b303c0be3e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -110,12 +110,12 @@ void AddIndices(int primitive, int numVertices) { switch (primitive) { - case GX_DRAW_TRIANGLES: IndexGenerator::AddList(numVertices); break; - case GX_DRAW_QUADS: IndexGenerator::AddQuads(numVertices); break; + case GX_DRAW_QUADS: if ((numVertices % 4) == 0 ) {IndexGenerator::AddQuads(numVertices);} else {IndexGenerator::AddFan(numVertices);} break; + case GX_DRAW_TRIANGLES: if ((numVertices % 3) == 0 ) {IndexGenerator::AddList(numVertices);} else {IndexGenerator::AddStrip(numVertices);} break; case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(numVertices); break; case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(numVertices); break; case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(numVertices); break; - case GX_DRAW_LINES: IndexGenerator::AddLineList(numVertices); break; + case GX_DRAW_LINES: if ((numVertices % 2) == 0 ) {IndexGenerator::AddLineList(numVertices);} else {IndexGenerator::AddLineStrip(numVertices);} break; case GX_DRAW_POINTS: IndexGenerator::AddPoints(numVertices); break; } }