mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-19 16:31:20 +00:00
Allow individual cmd funcs to be called.
Rather than a single one, ExecuteOpInternal(). This allows less "huge switch" code organization, and will (once separated) also improve speed.
This commit is contained in:
parent
b2f12daba9
commit
e06c135be4
@ -55,6 +55,7 @@ enum {
|
|||||||
struct CommandTableEntry {
|
struct CommandTableEntry {
|
||||||
u8 cmd;
|
u8 cmd;
|
||||||
u8 flags;
|
u8 flags;
|
||||||
|
GLES_GPU::CmdFunc func;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const CommandTableEntry commandTable[] = {
|
static const CommandTableEntry commandTable[] = {
|
||||||
@ -382,6 +383,8 @@ static const CommandTableEntry commandTable[] = {
|
|||||||
{GE_CMD_UNKNOWN_FF, FLAG_EXECUTE},
|
{GE_CMD_UNKNOWN_FF, FLAG_EXECUTE},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GLES_GPU::CmdFunc GLES_GPU::cmdFuncs_[256];
|
||||||
|
|
||||||
|
|
||||||
GLES_GPU::GLES_GPU()
|
GLES_GPU::GLES_GPU()
|
||||||
: resized_(false) {
|
: resized_(false) {
|
||||||
@ -422,6 +425,10 @@ GLES_GPU::GLES_GPU()
|
|||||||
dupeCheck.insert(cmd);
|
dupeCheck.insert(cmd);
|
||||||
}
|
}
|
||||||
commandFlags_[cmd] |= commandTable[i].flags;
|
commandFlags_[cmd] |= commandTable[i].flags;
|
||||||
|
cmdFuncs_[cmd] = commandTable[i].func;
|
||||||
|
if (!cmdFuncs_[cmd]) {
|
||||||
|
cmdFuncs_[cmd] = &GLES_GPU::ExecuteOpInternal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Find commands missing from the table.
|
// Find commands missing from the table.
|
||||||
for (int i = 0; i < 0xEF; i++) {
|
for (int i = 0; i < 0xEF; i++) {
|
||||||
@ -628,7 +635,7 @@ void GLES_GPU::FastRunLoop(DisplayList &list) {
|
|||||||
}
|
}
|
||||||
gstate.cmdmem[cmd] = op; // TODO: no need to write if diff==0...
|
gstate.cmdmem[cmd] = op; // TODO: no need to write if diff==0...
|
||||||
if ((cmdFlags & FLAG_EXECUTE) || (diff && (cmdFlags & FLAG_EXECUTEONCHANGE))) {
|
if ((cmdFlags & FLAG_EXECUTE) || (diff && (cmdFlags & FLAG_EXECUTEONCHANGE))) {
|
||||||
ExecuteOpInternal(op, diff);
|
(this->*cmdFuncs_[cmd])(op, diff);
|
||||||
}
|
}
|
||||||
list.pc += 4;
|
list.pc += 4;
|
||||||
}
|
}
|
||||||
@ -675,7 +682,7 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
|
|||||||
const u8 cmd = op >> 24;
|
const u8 cmd = op >> 24;
|
||||||
const u8 cmdFlags = commandFlags_[cmd];
|
const u8 cmdFlags = commandFlags_[cmd];
|
||||||
if ((cmdFlags & FLAG_EXECUTE) || (diff && (cmdFlags & FLAG_EXECUTEONCHANGE))) {
|
if ((cmdFlags & FLAG_EXECUTE) || (diff && (cmdFlags & FLAG_EXECUTEONCHANGE))) {
|
||||||
ExecuteOpInternal(op, diff);
|
(this->*cmdFuncs_[cmd])(op, diff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +74,8 @@ public:
|
|||||||
|
|
||||||
virtual bool DescribeCodePtr(const u8 *ptr, std::string &name);
|
virtual bool DescribeCodePtr(const u8 *ptr, std::string &name);
|
||||||
|
|
||||||
|
typedef void (GLES_GPU::*CmdFunc)(u32 op, u32 diff);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void FastRunLoop(DisplayList &list);
|
virtual void FastRunLoop(DisplayList &list);
|
||||||
virtual void ProcessEvent(GPUEvent ev);
|
virtual void ProcessEvent(GPUEvent ev);
|
||||||
@ -92,6 +94,8 @@ private:
|
|||||||
void CopyDisplayToOutputInternal();
|
void CopyDisplayToOutputInternal();
|
||||||
void InvalidateCacheInternal(u32 addr, int size, GPUInvalidationType type);
|
void InvalidateCacheInternal(u32 addr, int size, GPUInvalidationType type);
|
||||||
|
|
||||||
|
static CmdFunc cmdFuncs_[256];
|
||||||
|
|
||||||
FramebufferManager framebufferManager_;
|
FramebufferManager framebufferManager_;
|
||||||
TextureCache textureCache_;
|
TextureCache textureCache_;
|
||||||
TransformDrawEngine transformDraw_;
|
TransformDrawEngine transformDraw_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user