From 39d439fc48ef44d0a28113a10cb796cd8989f944 Mon Sep 17 00:00:00 2001 From: magumagu Date: Thu, 8 May 2014 16:53:18 -0700 Subject: Opcode decoding: handle missing opcodes 0x88 etc. Hardware testing shows that they do the same thing as the 0x80 family of opcodes: they draw quads. --- Source/Core/VideoCommon/IndexGenerator.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'Source/Core/VideoCommon/IndexGenerator.cpp') diff --git a/Source/Core/VideoCommon/IndexGenerator.cpp b/Source/Core/VideoCommon/IndexGenerator.cpp index 949ee342b1..f9838a1daa 100644 --- a/Source/Core/VideoCommon/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/IndexGenerator.cpp @@ -6,6 +6,7 @@ #include "Common/Common.h" #include "VideoCommon/IndexGenerator.h" +#include "VideoCommon/OpcodeDecoding.h" #include "VideoCommon/VideoConfig.h" //Init @@ -21,22 +22,23 @@ 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; + primitive_table[GX_DRAW_QUADS] = IndexGenerator::AddQuads; + primitive_table[GX_DRAW_QUADS_2] = IndexGenerator::AddQuads; + primitive_table[GX_DRAW_TRIANGLES] = IndexGenerator::AddList; + primitive_table[GX_DRAW_TRIANGLE_STRIP] = IndexGenerator::AddStrip; + primitive_table[GX_DRAW_TRIANGLE_FAN] = 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[GX_DRAW_QUADS] = IndexGenerator::AddQuads; + primitive_table[GX_DRAW_QUADS_2] = IndexGenerator::AddQuads; + primitive_table[GX_DRAW_TRIANGLES] = IndexGenerator::AddList; + primitive_table[GX_DRAW_TRIANGLE_STRIP] = IndexGenerator::AddStrip; + primitive_table[GX_DRAW_TRIANGLE_FAN] = IndexGenerator::AddFan; } - primitive_table[1] = nullptr; - primitive_table[5] = &IndexGenerator::AddLineList; - primitive_table[6] = &IndexGenerator::AddLineStrip; - primitive_table[7] = &IndexGenerator::AddPoints; + primitive_table[GX_DRAW_LINES] = &IndexGenerator::AddLineList; + primitive_table[GX_DRAW_LINE_STRIP] = &IndexGenerator::AddLineStrip; + primitive_table[GX_DRAW_POINTS] = &IndexGenerator::AddPoints; } void IndexGenerator::Start(u16* Indexptr) -- cgit v1.2.3 From 9b82d720705c8e6fd34c336a92dde5a8b10471b9 Mon Sep 17 00:00:00 2001 From: magumagu Date: Sat, 17 May 2014 11:55:32 -0700 Subject: 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/VideoCommon/IndexGenerator.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/IndexGenerator.cpp') 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) { -- cgit v1.2.3