From 9b82d720705c8e6fd34c336a92dde5a8b10471b9 Mon Sep 17 00:00:00 2001 From: magumagu Date: Sat, 17 May 2014 11:55:32 -0700 Subject: [PATCH] Video backends: warn on usage of GL_DRAW_QUADS_2. It's not normally used, so if it shows up, it could indicate a CPU emulation bug. --- Source/Core/VideoBackends/Software/SetupUnit.cpp | 3 +++ Source/Core/VideoCommon/IndexGenerator.cpp | 10 ++++++++-- Source/Core/VideoCommon/IndexGenerator.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoBackends/Software/SetupUnit.cpp b/Source/Core/VideoBackends/Software/SetupUnit.cpp index da62490c50..171350db60 100644 --- a/Source/Core/VideoBackends/Software/SetupUnit.cpp +++ b/Source/Core/VideoBackends/Software/SetupUnit.cpp @@ -25,7 +25,10 @@ void SetupUnit::SetupVertex() switch (m_PrimType) { case GX_DRAW_QUADS: + SetupQuad(); + break; case GX_DRAW_QUADS_2: + WARN_LOG(VIDEO, "Non-standard primitive drawing command GL_DRAW_QUADS_2"); SetupQuad(); break; case GX_DRAW_TRIANGLES: diff --git a/Source/Core/VideoCommon/IndexGenerator.cpp b/Source/Core/VideoCommon/IndexGenerator.cpp index f9838a1daa..1e713185a5 100644 --- a/Source/Core/VideoCommon/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/IndexGenerator.cpp @@ -23,7 +23,7 @@ void IndexGenerator::Init() if (g_Config.backend_info.bSupportsPrimitiveRestart) { primitive_table[GX_DRAW_QUADS] = IndexGenerator::AddQuads; - primitive_table[GX_DRAW_QUADS_2] = IndexGenerator::AddQuads; + primitive_table[GX_DRAW_QUADS_2] = IndexGenerator::AddQuads_nonstandard; primitive_table[GX_DRAW_TRIANGLES] = IndexGenerator::AddList; primitive_table[GX_DRAW_TRIANGLE_STRIP] = IndexGenerator::AddStrip; primitive_table[GX_DRAW_TRIANGLE_FAN] = IndexGenerator::AddFan; @@ -31,7 +31,7 @@ void IndexGenerator::Init() else { primitive_table[GX_DRAW_QUADS] = IndexGenerator::AddQuads; - primitive_table[GX_DRAW_QUADS_2] = IndexGenerator::AddQuads; + primitive_table[GX_DRAW_QUADS_2] = IndexGenerator::AddQuads_nonstandard; primitive_table[GX_DRAW_TRIANGLES] = IndexGenerator::AddList; primitive_table[GX_DRAW_TRIANGLE_STRIP] = IndexGenerator::AddStrip; primitive_table[GX_DRAW_TRIANGLE_FAN] = IndexGenerator::AddFan; @@ -198,6 +198,12 @@ template u16* IndexGenerator::AddQuads(u16 *Iptr, u32 numVerts, u32 in return Iptr; } +template u16* IndexGenerator::AddQuads_nonstandard(u16 *Iptr, u32 numVerts, u32 index) +{ + WARN_LOG(VIDEO, "Non-standard primitive drawing command GL_DRAW_QUADS_2"); + return AddQuads(Iptr, numVerts, index); +} + // Lines u16* IndexGenerator::AddLineList(u16 *Iptr, u32 numVerts, u32 index) { diff --git a/Source/Core/VideoCommon/IndexGenerator.h b/Source/Core/VideoCommon/IndexGenerator.h index e5d09c8d96..c15ef75829 100644 --- a/Source/Core/VideoCommon/IndexGenerator.h +++ b/Source/Core/VideoCommon/IndexGenerator.h @@ -31,6 +31,7 @@ private: template static u16* AddStrip(u16 *Iptr, u32 numVerts, u32 index); template static u16* AddFan(u16 *Iptr, u32 numVerts, u32 index); template static u16* AddQuads(u16 *Iptr, u32 numVerts, u32 index); + template static u16* AddQuads_nonstandard(u16 *Iptr, u32 numVerts, u32 index); // Lines static u16* AddLineList(u16 *Iptr, u32 numVerts, u32 index);