mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Unify Execute_LoadClut
This commit is contained in:
parent
c7f8f4c5ca
commit
967018b7f8
@ -56,7 +56,9 @@ public:
|
||||
// Flush is normally non-virtual but here's a virtual way to call it, used by the shared spline code, which is expensive anyway.
|
||||
// Not really sure if these wrappers are worth it...
|
||||
virtual void DispatchFlush() = 0;
|
||||
// Same for SubmitPrim
|
||||
|
||||
// This would seem to be unnecessary now, but is still required for splines/beziers to work in the software backend since SubmitPrim
|
||||
// is different. Should probably refactor that.
|
||||
virtual void DispatchSubmitPrim(void *verts, void *inds, GEPrimitiveType prim, int vertexCount, u32 vertType, int *bytesRead) = 0;
|
||||
|
||||
bool TestBoundingBox(void* control_points, int vertexCount, u32 vertType, int *bytesRead);
|
||||
|
@ -66,19 +66,6 @@
|
||||
#include "Core/HLE/sceKernelInterrupt.h"
|
||||
#include "Core/HLE/sceGe.h"
|
||||
|
||||
struct D3D11CommandTableEntry {
|
||||
uint8_t cmd;
|
||||
uint8_t flags;
|
||||
uint64_t dirty;
|
||||
GPU_D3D11::CmdFunc func;
|
||||
};
|
||||
|
||||
// This table gets crunched into a faster form by init.
|
||||
static const D3D11CommandTableEntry commandTable[] = {
|
||||
// Changes that trigger data copies. Only flushing on change for LOADCLUT must be a bit of a hack...
|
||||
{ GE_CMD_LOADCLUT, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPU_D3D11::Execute_LoadClut },
|
||||
};
|
||||
|
||||
GPU_D3D11::CommandInfo GPU_D3D11::cmdInfo_[256]{};
|
||||
|
||||
GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
@ -134,20 +121,6 @@ GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(commandTable); i++) {
|
||||
const u8 cmd = commandTable[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)commandTable[i].flags | (commandTable[i].dirty << 8);
|
||||
cmdInfo_[cmd].func = commandTable[i].func;
|
||||
if ((cmdInfo_[cmd].flags & (FLAG_EXECUTE | FLAG_EXECUTEONCHANGE)) && !cmdInfo_[cmd].func) {
|
||||
Crash();
|
||||
}
|
||||
}
|
||||
|
||||
// Find commands missing from the table.
|
||||
for (int i = 0; i < 0xEF; i++) {
|
||||
if (dupeCheck.find((u8)i) == dupeCheck.end()) {
|
||||
@ -425,12 +398,6 @@ void GPU_D3D11::ExecuteOp(u32 op, u32 diff) {
|
||||
}
|
||||
}
|
||||
|
||||
void GPU_D3D11::Execute_LoadClut(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_TEXTURE_PARAMS);
|
||||
textureCache_->LoadClut(gstate.getClutAddress(), gstate.getClutLoadBytes());
|
||||
// This could be used to "dirty" textures with clut.
|
||||
}
|
||||
|
||||
void GPU_D3D11::GetStats(char *buffer, size_t bufsize) {
|
||||
float vertexAverageCycles = gpuStats.numVertsSubmitted > 0 ? (float)gpuStats.vertexGPUCycles / (float)gpuStats.numVertsSubmitted : 0.0f;
|
||||
snprintf(buffer, bufsize - 1,
|
||||
|
@ -64,8 +64,6 @@ public:
|
||||
GPU_D3D11::CmdFunc func;
|
||||
};
|
||||
|
||||
void Execute_LoadClut(u32 op, u32 diff);
|
||||
|
||||
// Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend.
|
||||
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override;
|
||||
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override;
|
||||
|
@ -50,19 +50,6 @@
|
||||
|
||||
namespace DX9 {
|
||||
|
||||
struct D3D9CommandTableEntry {
|
||||
uint8_t cmd;
|
||||
uint8_t flags;
|
||||
uint64_t dirty;
|
||||
GPU_DX9::CmdFunc func;
|
||||
};
|
||||
|
||||
// This table gets crunched into a faster form by init.
|
||||
static const D3D9CommandTableEntry commandTable[] = {
|
||||
// Changes that trigger data copies. Only flushing on change for LOADCLUT must be a bit of a hack...
|
||||
{ GE_CMD_LOADCLUT, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPU_DX9::Execute_LoadClut },
|
||||
};
|
||||
|
||||
GPU_DX9::CommandInfo GPU_DX9::cmdInfo_[256];
|
||||
|
||||
GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
@ -116,19 +103,6 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(commandTable); i++) {
|
||||
const u8 cmd = commandTable[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)commandTable[i].flags | (commandTable[i].dirty << 8);
|
||||
cmdInfo_[cmd].func = commandTable[i].func;
|
||||
if ((cmdInfo_[cmd].flags & (FLAG_EXECUTE | FLAG_EXECUTEONCHANGE)) && !cmdInfo_[cmd].func) {
|
||||
Crash();
|
||||
}
|
||||
}
|
||||
// Find commands missing from the table.
|
||||
for (int i = 0; i < 0xEF; i++) {
|
||||
if (dupeCheck.find((u8)i) == dupeCheck.end()) {
|
||||
|
@ -65,8 +65,6 @@ public:
|
||||
GPU_DX9::CmdFunc func;
|
||||
};
|
||||
|
||||
void Execute_LoadClut(u32 op, u32 diff);
|
||||
|
||||
// Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend.
|
||||
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override;
|
||||
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override;
|
||||
|
@ -51,20 +51,6 @@
|
||||
#include "Windows/GPU/WindowsGLContext.h"
|
||||
#endif
|
||||
|
||||
struct GLESCommandTableEntry {
|
||||
uint8_t cmd;
|
||||
uint8_t flags;
|
||||
uint64_t dirty;
|
||||
GPU_GLES::CmdFunc func;
|
||||
};
|
||||
|
||||
// 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 GLESCommandTableEntry commandTable[] = {
|
||||
// Changes that trigger data copies. Only flushing on change for LOADCLUT must be a bit of a hack...
|
||||
{ GE_CMD_LOADCLUT, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPU_GLES::Execute_LoadClut },
|
||||
};
|
||||
|
||||
GPU_GLES::CommandInfo GPU_GLES::cmdInfo_[256];
|
||||
|
||||
GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
@ -120,19 +106,6 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(commandTable); i++) {
|
||||
const u8 cmd = commandTable[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)commandTable[i].flags | (commandTable[i].dirty << 8);
|
||||
cmdInfo_[cmd].func = commandTable[i].func;
|
||||
if ((cmdInfo_[cmd].flags & (FLAG_EXECUTE | FLAG_EXECUTEONCHANGE)) && !cmdInfo_[cmd].func) {
|
||||
Crash();
|
||||
}
|
||||
}
|
||||
// Find commands missing from the table.
|
||||
for (int i = 0; i < 0xEF; i++) {
|
||||
if (dupeCheck.find((u8)i) == dupeCheck.end()) {
|
||||
@ -615,11 +588,6 @@ void GPU_GLES::ExecuteOp(u32 op, u32 diff) {
|
||||
}
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_LoadClut(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_TEXTURE_PARAMS);
|
||||
textureCache_->LoadClut(gstate.getClutAddress(), gstate.getClutLoadBytes());
|
||||
}
|
||||
|
||||
void GPU_GLES::GetStats(char *buffer, size_t bufsize) {
|
||||
float vertexAverageCycles = gpuStats.numVertsSubmitted > 0 ? (float)gpuStats.vertexGPUCycles / (float)gpuStats.numVertsSubmitted : 0.0f;
|
||||
snprintf(buffer, bufsize - 1,
|
||||
|
@ -69,9 +69,6 @@ public:
|
||||
GPU_GLES::CmdFunc func;
|
||||
};
|
||||
|
||||
void Execute_Prim(u32 op, u32 diff);
|
||||
void Execute_LoadClut(u32 op, u32 diff);
|
||||
|
||||
// Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend.
|
||||
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override;
|
||||
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override;
|
||||
|
@ -49,6 +49,8 @@ const CommonCommandTableEntry commonCommandTable[] = {
|
||||
// Changing the vertex type requires us to flush.
|
||||
{ GE_CMD_VERTEXTYPE, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_VertexType },
|
||||
|
||||
{ GE_CMD_LOADCLUT, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPUCommon::Execute_LoadClut },
|
||||
|
||||
// These two are actually processed in CMD_END. Not sure if FLAG_FLUSHBEFORE matters.
|
||||
{ GE_CMD_SIGNAL, FLAG_FLUSHBEFORE },
|
||||
{ GE_CMD_FINISH, FLAG_FLUSHBEFORE },
|
||||
@ -1354,6 +1356,11 @@ void GPUCommon::Execute_VertexType(u32 op, u32 diff) {
|
||||
}
|
||||
}
|
||||
|
||||
void GPUCommon::Execute_LoadClut(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_TEXTURE_PARAMS);
|
||||
textureCache_->LoadClut(gstate.getClutAddress(), gstate.getClutLoadBytes());
|
||||
}
|
||||
|
||||
void GPUCommon::Execute_VertexTypeSkinning(u32 op, u32 diff) {
|
||||
// Don't flush when weight count changes, unless morph is enabled.
|
||||
if ((diff & ~GE_VTYPE_WEIGHTCOUNT_MASK) || (op & GE_VTYPE_MORPHCOUNT_MASK) != 0) {
|
||||
|
@ -135,6 +135,8 @@ public:
|
||||
void Execute_BoundingBox(u32 op, u32 diff);
|
||||
void Execute_BlockTransferStart(u32 op, u32 diff);
|
||||
|
||||
void Execute_LoadClut(u32 op, u32 diff);
|
||||
|
||||
void Execute_TexSize0(u32 op, u32 diff);
|
||||
void Execute_TexLevel(u32 op, u32 diff);
|
||||
|
||||
|
@ -46,21 +46,8 @@
|
||||
#include "Core/HLE/sceKernelInterrupt.h"
|
||||
#include "Core/HLE/sceGe.h"
|
||||
|
||||
struct VulkanCommandTableEntry {
|
||||
uint8_t cmd;
|
||||
uint8_t flags;
|
||||
uint64_t dirty;
|
||||
GPU_Vulkan::CmdFunc func;
|
||||
};
|
||||
|
||||
GPU_Vulkan::CommandInfo GPU_Vulkan::cmdInfo_[256];
|
||||
|
||||
// This table gets crunched into a faster form by init.
|
||||
static const VulkanCommandTableEntry commandTable[] = {
|
||||
// Changes that trigger data copies. Only flushing on change for LOADCLUT must be a bit of a hack...
|
||||
{ GE_CMD_LOADCLUT, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPU_Vulkan::Execute_LoadClut },
|
||||
};
|
||||
|
||||
GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
: GPUCommon(gfxCtx, draw),
|
||||
vulkan_((VulkanContext *)gfxCtx->GetAPIContext()),
|
||||
@ -118,20 +105,6 @@ GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
Crash();
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(commandTable); i++) {
|
||||
const u8 cmd = commandTable[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)commandTable[i].flags | (commandTable[i].dirty << 8);
|
||||
cmdInfo_[cmd].func = commandTable[i].func;
|
||||
if ((cmdInfo_[cmd].flags & (FLAG_EXECUTE | FLAG_EXECUTEONCHANGE)) && !cmdInfo_[cmd].func) {
|
||||
Crash();
|
||||
}
|
||||
}
|
||||
// Find commands missing from the table.
|
||||
for (int i = 0; i < 0xEF; i++) {
|
||||
if (dupeCheck.find((u8)i) == dupeCheck.end()) {
|
||||
@ -510,11 +483,6 @@ void GPU_Vulkan::ExecuteOp(u32 op, u32 diff) {
|
||||
}
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_LoadClut(u32 op, u32 diff) {
|
||||
gstate_c.Dirty(DIRTY_TEXTURE_PARAMS);
|
||||
textureCache_->LoadClut(gstate.getClutAddress(), gstate.getClutLoadBytes());
|
||||
}
|
||||
|
||||
void GPU_Vulkan::InitDeviceObjects() {
|
||||
ILOG("GPU_Vulkan::InitDeviceObjects");
|
||||
// Initialize framedata
|
||||
|
@ -67,8 +67,6 @@ public:
|
||||
uint64_t flags;
|
||||
GPU_Vulkan::CmdFunc func;
|
||||
};
|
||||
|
||||
void Execute_LoadClut(u32 op, u32 diff);
|
||||
|
||||
// Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend.
|
||||
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override;
|
||||
|
Loading…
Reference in New Issue
Block a user