mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Setup a global GPU command table, and start moving stuff into it.
This commit is contained in:
parent
e78d85f386
commit
3f795799c9
@ -66,47 +66,18 @@
|
||||
#include "Core/HLE/sceKernelInterrupt.h"
|
||||
#include "Core/HLE/sceGe.h"
|
||||
|
||||
enum {
|
||||
FLAG_FLUSHBEFORE = 1,
|
||||
FLAG_FLUSHBEFOREONCHANGE = 2,
|
||||
FLAG_EXECUTE = 4, // needs to actually be executed. unused for now.
|
||||
FLAG_EXECUTEONCHANGE = 8,
|
||||
FLAG_READS_PC = 16,
|
||||
FLAG_WRITES_PC = 32,
|
||||
FLAG_DIRTYONCHANGE = 64, // NOTE: Either this or FLAG_EXECUTE*, not both!
|
||||
};
|
||||
|
||||
struct CommandTableEntry {
|
||||
struct D3D11CommandTableEntry {
|
||||
uint8_t cmd;
|
||||
uint8_t flags;
|
||||
uint64_t dirty;
|
||||
GPU_D3D11::CmdFunc func;
|
||||
};
|
||||
|
||||
static const CommandTableEntry commandTable[] = {
|
||||
// Changes that dirty the framebuffer
|
||||
{ GE_CMD_FRAMEBUFPTR, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{ GE_CMD_FRAMEBUFWIDTH, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{ GE_CMD_FRAMEBUFPIXFORMAT, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{ GE_CMD_ZBUFPTR, FLAG_FLUSHBEFOREONCHANGE },
|
||||
{ GE_CMD_ZBUFWIDTH, FLAG_FLUSHBEFOREONCHANGE },
|
||||
|
||||
// Changes that dirty uniforms
|
||||
{ GE_CMD_FOGCOLOR, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOLOR },
|
||||
{ GE_CMD_FOG1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOEF },
|
||||
{ GE_CMD_FOG2, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOEF },
|
||||
|
||||
static const D3D11CommandTableEntry commandTable[] = {
|
||||
// Should these maybe flush?
|
||||
{ GE_CMD_MINZ, FLAG_FLUSHBEFOREONCHANGE, DIRTY_DEPTHRANGE },
|
||||
{ GE_CMD_MAXZ, FLAG_FLUSHBEFOREONCHANGE, DIRTY_DEPTHRANGE },
|
||||
|
||||
// Changes that dirty texture scaling.
|
||||
{ GE_CMD_TEXMAPMODE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_UVSCALEOFFSET },
|
||||
{ GE_CMD_TEXSCALEU, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexScaleU },
|
||||
{ GE_CMD_TEXSCALEV, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexScaleV },
|
||||
{ GE_CMD_TEXOFFSETU, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexOffsetU },
|
||||
{ GE_CMD_TEXOFFSETV, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexOffsetV },
|
||||
|
||||
// Changes that dirty the current texture.
|
||||
{ GE_CMD_TEXSIZE0, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPU_D3D11::Execute_TexSize0 },
|
||||
{ GE_CMD_TEXSIZE1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_TEXTURE_PARAMS },
|
||||
@ -367,47 +338,9 @@ static const CommandTableEntry commandTable[] = {
|
||||
{ GE_CMD_TGENMATRIXDATA, FLAG_EXECUTE, 0, &GPUCommon::Execute_TgenMtxData },
|
||||
{ GE_CMD_BONEMATRIXNUMBER, FLAG_EXECUTE | FLAG_READS_PC | FLAG_WRITES_PC, 0, &GPUCommon::Execute_BoneMtxNum },
|
||||
{ GE_CMD_BONEMATRIXDATA, FLAG_EXECUTE, 0, &GPUCommon::Execute_BoneMtxData },
|
||||
|
||||
// Vertex Screen/Texture/Color
|
||||
{ GE_CMD_VSCX, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VSCY, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VSCZ, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VTCS, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VTCT, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VTCQ, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VCV, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VAP, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VFC, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VSCV, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
|
||||
// "Missing" commands (gaps in the sequence)
|
||||
{ GE_CMD_UNKNOWN_03, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_0D, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_11, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_29, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_34, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_35, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_39, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_4E, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_4F, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_52, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_59, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_5A, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_B6, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_B7, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_D1, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_ED, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_EF, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FA, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FB, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FC, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FD, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FE, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
// Appears to be debugging related or something? Hit a lot in GoW.
|
||||
{ GE_CMD_UNKNOWN_FF, 0 },
|
||||
};
|
||||
|
||||
GPU_D3D11::CommandInfo GPU_D3D11::cmdInfo_[256];
|
||||
GPU_D3D11::CommandInfo GPU_D3D11::cmdInfo_[256]{};
|
||||
|
||||
GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
: GPUCommon(gfxCtx, draw), drawEngine_(draw,
|
||||
@ -444,9 +377,24 @@ GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
ERROR_LOG(G3D, "gstate has drifted out of sync!");
|
||||
}
|
||||
|
||||
// Sanity check cmdInfo_ table - no dupes please
|
||||
std::set<u8> dupeCheck;
|
||||
memset(cmdInfo_, 0, sizeof(cmdInfo_));
|
||||
|
||||
// Import both the global and local command tables, and check for dupes
|
||||
std::set<u8> dupeCheck;
|
||||
for (size_t i = 0; i < commonCommandTableSize; i++) {
|
||||
const u8 cmd = commonCommandTable[i].cmd;
|
||||
if (dupeCheck.find(cmd) != dupeCheck.end()) {
|
||||
ERROR_LOG(G3D, "Command table Dupe: %02x (%i)", (int)cmd, (int)cmd);
|
||||
} else {
|
||||
dupeCheck.insert(cmd);
|
||||
}
|
||||
cmdInfo_[cmd].flags |= (uint64_t)commonCommandTable[i].flags | (commonCommandTable[i].dirty << 8);
|
||||
cmdInfo_[cmd].func = commonCommandTable[i].func;
|
||||
if ((cmdInfo_[cmd].flags & (FLAG_EXECUTE | FLAG_EXECUTEONCHANGE)) && !cmdInfo_[cmd].func) {
|
||||
Crash();
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(commandTable); i++) {
|
||||
const u8 cmd = commandTable[i].cmd;
|
||||
if (dupeCheck.find(cmd) != dupeCheck.end()) {
|
||||
@ -460,6 +408,7 @@ GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
Crash();
|
||||
}
|
||||
}
|
||||
|
||||
// Find commands missing from the table.
|
||||
for (int i = 0; i < 0xEF; i++) {
|
||||
if (dupeCheck.find((u8)i) == dupeCheck.end()) {
|
||||
|
@ -50,47 +50,18 @@
|
||||
|
||||
namespace DX9 {
|
||||
|
||||
enum {
|
||||
FLAG_FLUSHBEFORE = 1,
|
||||
FLAG_FLUSHBEFOREONCHANGE = 2,
|
||||
FLAG_EXECUTE = 4, // needs to actually be executed. unused for now.
|
||||
FLAG_EXECUTEONCHANGE = 8,
|
||||
FLAG_READS_PC = 16,
|
||||
FLAG_WRITES_PC = 32,
|
||||
FLAG_DIRTYONCHANGE = 64, // NOTE: Either this or FLAG_EXECUTE*, not both!
|
||||
};
|
||||
|
||||
struct CommandTableEntry {
|
||||
struct D3D9CommandTableEntry {
|
||||
uint8_t cmd;
|
||||
uint8_t flags;
|
||||
uint64_t dirty;
|
||||
GPU_DX9::CmdFunc func;
|
||||
};
|
||||
|
||||
static const CommandTableEntry commandTable[] = {
|
||||
// Changes that dirty the framebuffer
|
||||
{ GE_CMD_FRAMEBUFPTR, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{ GE_CMD_FRAMEBUFWIDTH, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{ GE_CMD_FRAMEBUFPIXFORMAT, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{GE_CMD_ZBUFPTR, FLAG_FLUSHBEFOREONCHANGE},
|
||||
{GE_CMD_ZBUFWIDTH, FLAG_FLUSHBEFOREONCHANGE},
|
||||
|
||||
// Changes that dirty uniforms
|
||||
{GE_CMD_FOGCOLOR, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOLOR},
|
||||
{GE_CMD_FOG1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOEF},
|
||||
{GE_CMD_FOG2, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOEF},
|
||||
|
||||
static const D3D9CommandTableEntry commandTable[] = {
|
||||
// Should these maybe flush?
|
||||
{GE_CMD_MINZ, FLAG_FLUSHBEFOREONCHANGE, DIRTY_DEPTHRANGE},
|
||||
{GE_CMD_MAXZ, FLAG_FLUSHBEFOREONCHANGE, DIRTY_DEPTHRANGE},
|
||||
|
||||
// Changes that dirty texture scaling.
|
||||
{ GE_CMD_TEXMAPMODE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_UVSCALEOFFSET },
|
||||
{ GE_CMD_TEXSCALEU, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexScaleU },
|
||||
{ GE_CMD_TEXSCALEV, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexScaleV },
|
||||
{ GE_CMD_TEXOFFSETU, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexOffsetU },
|
||||
{ GE_CMD_TEXOFFSETV, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexOffsetV },
|
||||
|
||||
// Changes that dirty the current texture.
|
||||
{ GE_CMD_TEXSIZE0, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPU_DX9::Execute_TexSize0 },
|
||||
{ GE_CMD_TEXSIZE1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_TEXTURE_PARAMS },
|
||||
@ -351,44 +322,6 @@ static const CommandTableEntry commandTable[] = {
|
||||
{GE_CMD_TGENMATRIXDATA, FLAG_EXECUTE, 0, &GPUCommon::Execute_TgenMtxData},
|
||||
{GE_CMD_BONEMATRIXNUMBER, FLAG_EXECUTE | FLAG_READS_PC | FLAG_WRITES_PC, 0, &GPUCommon::Execute_BoneMtxNum},
|
||||
{GE_CMD_BONEMATRIXDATA, FLAG_EXECUTE, 0, &GPUCommon::Execute_BoneMtxData},
|
||||
|
||||
// Vertex Screen/Texture/Color
|
||||
{ GE_CMD_VSCX, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{ GE_CMD_VSCY, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{ GE_CMD_VSCZ, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{ GE_CMD_VTCS, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{ GE_CMD_VTCT, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{ GE_CMD_VTCQ, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{ GE_CMD_VCV, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{ GE_CMD_VAP, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{ GE_CMD_VFC, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{ GE_CMD_VSCV, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
|
||||
// "Missing" commands (gaps in the sequence)
|
||||
{GE_CMD_UNKNOWN_03, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_0D, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_11, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_29, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_34, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_35, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_39, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_4E, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_4F, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_52, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_59, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_5A, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_B6, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_B7, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_D1, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_ED, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_EF, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_FA, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_FB, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_FC, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_FD, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_FE, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
// Appears to be debugging related or something? Hit a lot in GoW.
|
||||
{ GE_CMD_UNKNOWN_FF, 0 },
|
||||
};
|
||||
|
||||
GPU_DX9::CommandInfo GPU_DX9::cmdInfo_[256];
|
||||
@ -426,9 +359,24 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
ERROR_LOG(G3D, "gstate has drifted out of sync!");
|
||||
}
|
||||
|
||||
// Sanity check cmdInfo_ table - no dupes please
|
||||
std::set<u8> dupeCheck;
|
||||
memset(cmdInfo_, 0, sizeof(cmdInfo_));
|
||||
|
||||
// Import both the global and local command tables, and check for dupes
|
||||
std::set<u8> dupeCheck;
|
||||
for (size_t i = 0; i < commonCommandTableSize; i++) {
|
||||
const u8 cmd = commonCommandTable[i].cmd;
|
||||
if (dupeCheck.find(cmd) != dupeCheck.end()) {
|
||||
ERROR_LOG(G3D, "Command table Dupe: %02x (%i)", (int)cmd, (int)cmd);
|
||||
} else {
|
||||
dupeCheck.insert(cmd);
|
||||
}
|
||||
cmdInfo_[cmd].flags |= (uint64_t)commonCommandTable[i].flags | (commonCommandTable[i].dirty << 8);
|
||||
cmdInfo_[cmd].func = commonCommandTable[i].func;
|
||||
if ((cmdInfo_[cmd].flags & (FLAG_EXECUTE | FLAG_EXECUTEONCHANGE)) && !cmdInfo_[cmd].func) {
|
||||
Crash();
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(commandTable); i++) {
|
||||
const u8 cmd = commandTable[i].cmd;
|
||||
if (dupeCheck.find(cmd) != dupeCheck.end()) {
|
||||
|
@ -52,17 +52,7 @@
|
||||
#include "Windows/GPU/WindowsGLContext.h"
|
||||
#endif
|
||||
|
||||
enum {
|
||||
FLAG_FLUSHBEFORE = 1,
|
||||
FLAG_FLUSHBEFOREONCHANGE = 2,
|
||||
FLAG_EXECUTE = 4, // needs to actually be executed. unused for now.
|
||||
FLAG_EXECUTEONCHANGE = 8,
|
||||
FLAG_READS_PC = 16,
|
||||
FLAG_WRITES_PC = 32,
|
||||
// No flag for dirtying needed - if the dirty flag is non zero, it's "on change".
|
||||
};
|
||||
|
||||
struct CommandTableEntry {
|
||||
struct GLESCommandTableEntry {
|
||||
uint8_t cmd;
|
||||
uint8_t flags;
|
||||
uint64_t dirty;
|
||||
@ -71,29 +61,11 @@ struct CommandTableEntry {
|
||||
|
||||
// This table gets crunched into a faster form by init.
|
||||
// TODO: Share this table between the backends. Will have to make another indirection for the function pointers though..
|
||||
static const CommandTableEntry commandTable[] = {
|
||||
// Changes that dirty the framebuffer
|
||||
{GE_CMD_FRAMEBUFPTR, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS},
|
||||
{GE_CMD_FRAMEBUFWIDTH, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS},
|
||||
{GE_CMD_FRAMEBUFPIXFORMAT, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS},
|
||||
{GE_CMD_ZBUFPTR, FLAG_FLUSHBEFOREONCHANGE},
|
||||
{GE_CMD_ZBUFWIDTH, FLAG_FLUSHBEFOREONCHANGE},
|
||||
|
||||
// Changes that dirty uniforms
|
||||
{GE_CMD_FOGCOLOR, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOLOR},
|
||||
{GE_CMD_FOG1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOEF},
|
||||
{GE_CMD_FOG2, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOEF},
|
||||
|
||||
static const GLESCommandTableEntry commandTable[] = {
|
||||
// Should these maybe flush?
|
||||
{GE_CMD_MINZ, FLAG_FLUSHBEFOREONCHANGE, DIRTY_DEPTHRANGE},
|
||||
{GE_CMD_MAXZ, FLAG_FLUSHBEFOREONCHANGE, DIRTY_DEPTHRANGE},
|
||||
|
||||
{GE_CMD_TEXMAPMODE, FLAG_FLUSHBEFOREONCHANGE, 0},
|
||||
{GE_CMD_TEXSCALEU, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexScaleU},
|
||||
{GE_CMD_TEXSCALEV, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexScaleV},
|
||||
{GE_CMD_TEXOFFSETU, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexOffsetU},
|
||||
{GE_CMD_TEXOFFSETV, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexOffsetV},
|
||||
|
||||
// Changes that dirty the current texture.
|
||||
{GE_CMD_TEXSIZE0, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, DIRTY_UVSCALEOFFSET, &GPU_GLES::Execute_TexSize0},
|
||||
{GE_CMD_TEXSIZE1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_TEXTURE_PARAMS},
|
||||
@ -352,44 +324,6 @@ static const CommandTableEntry commandTable[] = {
|
||||
{GE_CMD_TGENMATRIXDATA, FLAG_EXECUTE, 0, &GPUCommon::Execute_TgenMtxData},
|
||||
{GE_CMD_BONEMATRIXNUMBER, FLAG_EXECUTE | FLAG_READS_PC | FLAG_WRITES_PC, 0, &GPUCommon::Execute_BoneMtxNum},
|
||||
{GE_CMD_BONEMATRIXDATA, FLAG_EXECUTE, 0, &GPUCommon::Execute_BoneMtxData},
|
||||
|
||||
// Vertex Screen/Texture/Color
|
||||
{GE_CMD_VSCX, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_VSCY, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_VSCZ, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_VTCS, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_VTCT, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_VTCQ, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_VCV, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_VAP, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_VFC, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_VSCV, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
|
||||
// "Missing" commands (gaps in the sequence)
|
||||
{GE_CMD_UNKNOWN_03, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_0D, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_11, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_29, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_34, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_35, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_39, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_4E, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_4F, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_52, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_59, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_5A, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_B6, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_B7, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_D1, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_ED, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_EF, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_FA, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_FB, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_FC, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_FD, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
{GE_CMD_UNKNOWN_FE, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown},
|
||||
// Appears to be debugging related or something? Hit a lot in GoW.
|
||||
{GE_CMD_UNKNOWN_FF, 0},
|
||||
};
|
||||
|
||||
GPU_GLES::CommandInfo GPU_GLES::cmdInfo_[256];
|
||||
@ -427,9 +361,24 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
ERROR_LOG(G3D, "gstate has drifted out of sync!");
|
||||
}
|
||||
|
||||
// Sanity check cmdInfo_ table - no dupes please
|
||||
std::set<u8> dupeCheck;
|
||||
memset(cmdInfo_, 0, sizeof(cmdInfo_));
|
||||
|
||||
// Import both the global and local command tables, and check for dupes
|
||||
std::set<u8> dupeCheck;
|
||||
for (size_t i = 0; i < commonCommandTableSize; i++) {
|
||||
const u8 cmd = commonCommandTable[i].cmd;
|
||||
if (dupeCheck.find(cmd) != dupeCheck.end()) {
|
||||
ERROR_LOG(G3D, "Command table Dupe: %02x (%i)", (int)cmd, (int)cmd);
|
||||
} else {
|
||||
dupeCheck.insert(cmd);
|
||||
}
|
||||
cmdInfo_[cmd].flags |= (uint64_t)commonCommandTable[i].flags | (commonCommandTable[i].dirty << 8);
|
||||
cmdInfo_[cmd].func = commonCommandTable[i].func;
|
||||
if ((cmdInfo_[cmd].flags & (FLAG_EXECUTE | FLAG_EXECUTEONCHANGE)) && !cmdInfo_[cmd].func) {
|
||||
Crash();
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(commandTable); i++) {
|
||||
const u8 cmd = commandTable[i].cmd;
|
||||
if (dupeCheck.find(cmd) != dupeCheck.end()) {
|
||||
|
@ -26,6 +26,65 @@
|
||||
#include "GPU/Common/TextureCacheCommon.h"
|
||||
#include "GPU/Common/DrawEngineCommon.h"
|
||||
|
||||
const CommonCommandTableEntry commonCommandTable[] = {
|
||||
// Changes that dirty the framebuffer
|
||||
{ GE_CMD_FRAMEBUFPTR, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{ GE_CMD_FRAMEBUFWIDTH, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{ GE_CMD_FRAMEBUFPIXFORMAT, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{ GE_CMD_ZBUFPTR, FLAG_FLUSHBEFOREONCHANGE },
|
||||
{ GE_CMD_ZBUFWIDTH, FLAG_FLUSHBEFOREONCHANGE },
|
||||
|
||||
// Changes that dirty uniforms
|
||||
{ GE_CMD_FOGCOLOR, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOLOR },
|
||||
{ GE_CMD_FOG1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOEF },
|
||||
{ GE_CMD_FOG2, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOEF },
|
||||
|
||||
{ GE_CMD_TEXMAPMODE, FLAG_FLUSHBEFOREONCHANGE, 0 },
|
||||
{ GE_CMD_TEXSCALEU, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexScaleU },
|
||||
{ GE_CMD_TEXSCALEV, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexScaleV },
|
||||
{ GE_CMD_TEXOFFSETU, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexOffsetU },
|
||||
{ GE_CMD_TEXOFFSETV, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexOffsetV },
|
||||
|
||||
// Vertex Screen/Texture/Color
|
||||
{ GE_CMD_VSCX, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VSCY, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VSCZ, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VTCS, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VTCT, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VTCQ, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VCV, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VAP, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VFC, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VSCV, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
|
||||
// "Missing" commands (gaps in the sequence)
|
||||
{ GE_CMD_UNKNOWN_03, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_0D, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_11, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_29, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_34, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_35, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_39, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_4E, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_4F, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_52, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_59, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_5A, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_B6, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_B7, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_D1, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_ED, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_EF, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FA, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FB, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FC, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FD, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FE, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
// Appears to be debugging related or something? Hit a lot in GoW.
|
||||
{ GE_CMD_UNKNOWN_FF, 0 },
|
||||
};
|
||||
size_t commonCommandTableSize = ARRAY_SIZE(commonCommandTable);
|
||||
|
||||
void GPUCommon::Flush() {
|
||||
drawEngineCommon_->DispatchFlush();
|
||||
}
|
||||
|
@ -30,6 +30,16 @@ enum DrawType {
|
||||
DRAW_BEZIER,
|
||||
};
|
||||
|
||||
enum {
|
||||
FLAG_FLUSHBEFORE = 1,
|
||||
FLAG_FLUSHBEFOREONCHANGE = 2,
|
||||
FLAG_EXECUTE = 4, // needs to actually be executed. unused for now.
|
||||
FLAG_EXECUTEONCHANGE = 8,
|
||||
FLAG_READS_PC = 16,
|
||||
FLAG_WRITES_PC = 32,
|
||||
FLAG_DIRTYONCHANGE = 64, // NOTE: Either this or FLAG_EXECUTE*, not both!
|
||||
};
|
||||
|
||||
class GPUCommon : public GPUThreadEventQueue, public GPUDebugInterface {
|
||||
public:
|
||||
GPUCommon(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
|
||||
@ -206,6 +216,8 @@ public:
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
typedef void (GPUCommon::*CmdFunc)(u32 op, u32 diff);
|
||||
|
||||
protected:
|
||||
void SetDrawType(DrawType type) {
|
||||
if (type != lastDraw_) {
|
||||
@ -348,3 +360,13 @@ private:
|
||||
double timeSteppingStarted_;
|
||||
double timeSpentStepping_;
|
||||
};
|
||||
|
||||
struct CommonCommandTableEntry {
|
||||
uint8_t cmd;
|
||||
uint8_t flags;
|
||||
uint64_t dirty;
|
||||
GPUCommon::CmdFunc func;
|
||||
};
|
||||
|
||||
extern const CommonCommandTableEntry commonCommandTable[];
|
||||
extern size_t commonCommandTableSize;
|
||||
|
@ -46,17 +46,7 @@
|
||||
#include "Core/HLE/sceKernelInterrupt.h"
|
||||
#include "Core/HLE/sceGe.h"
|
||||
|
||||
enum {
|
||||
FLAG_FLUSHBEFORE = 1,
|
||||
FLAG_FLUSHBEFOREONCHANGE = 2,
|
||||
FLAG_EXECUTE = 4, // needs to actually be executed. unused for now.
|
||||
FLAG_EXECUTEONCHANGE = 8,
|
||||
FLAG_READS_PC = 16,
|
||||
FLAG_WRITES_PC = 32,
|
||||
FLAG_DIRTYONCHANGE = 64, // NOTE: Either this or FLAG_EXECUTE*, not both!
|
||||
};
|
||||
|
||||
struct CommandTableEntry {
|
||||
struct VulkanCommandTableEntry {
|
||||
uint8_t cmd;
|
||||
uint8_t flags;
|
||||
uint64_t dirty;
|
||||
@ -67,30 +57,11 @@ GPU_Vulkan::CommandInfo GPU_Vulkan::cmdInfo_[256];
|
||||
|
||||
// This table gets crunched into a faster form by init.
|
||||
// TODO: Share this table between the backends. Will have to make another indirection for the function pointers though..
|
||||
static const CommandTableEntry commandTable[] = {
|
||||
// Changes that dirty the framebuffer
|
||||
{ GE_CMD_FRAMEBUFPTR, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{ GE_CMD_FRAMEBUFWIDTH, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{ GE_CMD_FRAMEBUFPIXFORMAT, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FRAMEBUF | DIRTY_TEXTURE_PARAMS },
|
||||
{ GE_CMD_ZBUFPTR, FLAG_FLUSHBEFOREONCHANGE },
|
||||
{ GE_CMD_ZBUFWIDTH, FLAG_FLUSHBEFOREONCHANGE },
|
||||
|
||||
// Changes that dirty uniforms
|
||||
{ GE_CMD_FOGCOLOR, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOLOR },
|
||||
{ GE_CMD_FOG1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOEF },
|
||||
{ GE_CMD_FOG2, FLAG_FLUSHBEFOREONCHANGE, DIRTY_FOGCOEF },
|
||||
|
||||
static const VulkanCommandTableEntry commandTable[] = {
|
||||
// Should these maybe flush?
|
||||
{ GE_CMD_MINZ, FLAG_FLUSHBEFOREONCHANGE, DIRTY_DEPTHRANGE },
|
||||
{ GE_CMD_MAXZ, FLAG_FLUSHBEFOREONCHANGE, DIRTY_DEPTHRANGE },
|
||||
|
||||
// Changes that dirty texture scaling.
|
||||
{ GE_CMD_TEXMAPMODE, FLAG_FLUSHBEFOREONCHANGE, DIRTY_UVSCALEOFFSET },
|
||||
{ GE_CMD_TEXSCALEU, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexScaleU },
|
||||
{ GE_CMD_TEXSCALEV, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexScaleV },
|
||||
{ GE_CMD_TEXOFFSETU, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexOffsetU },
|
||||
{ GE_CMD_TEXOFFSETV, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_TexOffsetV },
|
||||
|
||||
// Changes that dirty the current texture.
|
||||
{ GE_CMD_TEXSIZE0, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPU_Vulkan::Execute_TexSize0 },
|
||||
{ GE_CMD_TEXSIZE1, FLAG_FLUSHBEFOREONCHANGE, DIRTY_TEXTURE_PARAMS },
|
||||
@ -349,44 +320,6 @@ static const CommandTableEntry commandTable[] = {
|
||||
{ GE_CMD_TGENMATRIXDATA, FLAG_EXECUTE, 0, &GPUCommon::Execute_TgenMtxData },
|
||||
{ GE_CMD_BONEMATRIXNUMBER, FLAG_EXECUTE | FLAG_READS_PC | FLAG_WRITES_PC, 0, &GPU_Vulkan::Execute_BoneMtxNum },
|
||||
{ GE_CMD_BONEMATRIXDATA, FLAG_EXECUTE, 0, &GPU_Vulkan::Execute_BoneMtxData },
|
||||
|
||||
// Vertex Screen/Texture/Color
|
||||
{ GE_CMD_VSCX, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VSCY, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VSCZ, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VTCS, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VTCT, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VTCQ, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VCV, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VAP, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VFC, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_VSCV, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
|
||||
// "Missing" commands (gaps in the sequence)
|
||||
{ GE_CMD_UNKNOWN_03, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_0D, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_11, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_29, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_34, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_35, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_39, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_4E, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_4F, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_52, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_59, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_5A, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_B6, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_B7, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_D1, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_ED, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_EF, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FA, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FB, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FC, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FD, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
{ GE_CMD_UNKNOWN_FE, FLAG_EXECUTE, 0, &GPUCommon::Execute_Unknown },
|
||||
// Appears to be debugging related or something? Hit a lot in GoW.
|
||||
{ GE_CMD_UNKNOWN_FF, 0 },
|
||||
};
|
||||
|
||||
GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
@ -423,9 +356,24 @@ GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
ERROR_LOG(G3D, "gstate has drifted out of sync!");
|
||||
}
|
||||
|
||||
// Sanity check cmdInfo_ table - no dupes please
|
||||
std::set<u8> dupeCheck;
|
||||
memset(cmdInfo_, 0, sizeof(cmdInfo_));
|
||||
|
||||
// Import both the global and local command tables, and check for dupes
|
||||
std::set<u8> dupeCheck;
|
||||
for (size_t i = 0; i < commonCommandTableSize; i++) {
|
||||
const u8 cmd = commonCommandTable[i].cmd;
|
||||
if (dupeCheck.find(cmd) != dupeCheck.end()) {
|
||||
ERROR_LOG(G3D, "Command table Dupe: %02x (%i)", (int)cmd, (int)cmd);
|
||||
} else {
|
||||
dupeCheck.insert(cmd);
|
||||
}
|
||||
cmdInfo_[cmd].flags |= (uint64_t)commonCommandTable[i].flags | (commonCommandTable[i].dirty << 8);
|
||||
cmdInfo_[cmd].func = commonCommandTable[i].func;
|
||||
if ((cmdInfo_[cmd].flags & (FLAG_EXECUTE | FLAG_EXECUTEONCHANGE)) && !cmdInfo_[cmd].func) {
|
||||
Crash();
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(commandTable); i++) {
|
||||
const u8 cmd = commandTable[i].cmd;
|
||||
if (dupeCheck.find(cmd) != dupeCheck.end()) {
|
||||
|
Loading…
Reference in New Issue
Block a user