GPU: Unify command table (cmdInfo_)

This commit is contained in:
Henrik Rydgård committed 2018-02-26 11:44:02 +01:00
1 parent a8a34fef9c
commit 8cef1f0f8d
10 files changed
+35 -139

No files matched your search

-27
View File
@@ -66,8 +66,6 @@
#include "Core/HLE/sceKernelInterrupt.h"
#include "Core/HLE/sceGe.h"
GPU_D3D11::CommandInfo GPU_D3D11::cmdInfo_[256]{};
GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
: GPUCommon(gfxCtx, draw), drawEngine_(draw,
(ID3D11Device *)draw->GetNativeObject(Draw::NativeObject::DEVICE),
@@ -103,31 +101,6 @@ GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
ERROR_LOG(G3D, "gstate has drifted out of sync!");
}
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();
}
}
// Find commands missing from the table.
for (int i = 0; i < 0xEF; i++) {
if (dupeCheck.find((u8)i) == dupeCheck.end()) {
ERROR_LOG(G3D, "Command missing from table: %02x (%i)", i, i);
}
}
// No need to flush before the tex scale/offset commands if we are baking
// the tex scale/offset into the vertices anyway.
UpdateCmdInfo();
-8
View File
@@ -58,12 +58,6 @@ public:
fullInfo = reportingFullInfo_;
}
typedef void (GPU_D3D11::*CmdFunc)(u32 op, u32 diff);
struct CommandInfo {
uint64_t flags;
GPU_D3D11::CmdFunc func;
};
// 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;
@@ -98,8 +92,6 @@ private:
DrawEngineD3D11 drawEngine_;
ShaderManagerD3D11 *shaderManagerD3D11_;
static CommandInfo cmdInfo_[256];
int lastVsync_;
int vertexCost_ = 0;
-27
View File
@@ -50,8 +50,6 @@
namespace DX9 {
GPU_DX9::CommandInfo GPU_DX9::cmdInfo_[256];
GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
: GPUCommon(gfxCtx, draw),
depalShaderCache_(draw),
@@ -85,31 +83,6 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
ERROR_LOG(G3D, "gstate has drifted out of sync!");
}
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();
}
}
// Find commands missing from the table.
for (int i = 0; i < 0xEF; i++) {
if (dupeCheck.find((u8)i) == dupeCheck.end()) {
ERROR_LOG(G3D, "Command missing from table: %02x (%i)", i, i);
}
}
// No need to flush before the tex scale/offset commands if we are baking
// the tex scale/offset into the vertices anyway.
UpdateCmdInfo();
-8
View File
@@ -59,12 +59,6 @@ public:
fullInfo = reportingFullInfo_;
}
typedef void (GPU_DX9::*CmdFunc)(u32 op, u32 diff);
struct CommandInfo {
uint64_t flags;
GPU_DX9::CmdFunc func;
};
// 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;
@@ -98,8 +92,6 @@ private:
DrawEngineDX9 drawEngine_;
ShaderManagerDX9 *shaderManagerDX9_;
static CommandInfo cmdInfo_[256];
int lastVsync_;
int vertexCost_ = 0;
-27
View File
@@ -51,8 +51,6 @@
#include "Windows/GPU/WindowsGLContext.h"
#endif
GPU_GLES::CommandInfo GPU_GLES::cmdInfo_[256];
GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
: GPUCommon(gfxCtx, draw), drawEngine_(draw), fragmentTestCache_(draw), depalShaderCache_(draw) {
UpdateVsyncInterval(true);
@@ -88,31 +86,6 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
ERROR_LOG(G3D, "gstate has drifted out of sync!");
}
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();
}
}
// Find commands missing from the table.
for (int i = 0; i < 0xEF; i++) {
if (dupeCheck.find((u8)i) == dupeCheck.end()) {
ERROR_LOG(G3D, "Command missing from table: %02x (%i)", i, i);
}
}
// No need to flush before the tex scale/offset commands if we are baking
// the tex scale/offset into the vertices anyway.
-8
View File
@@ -63,12 +63,6 @@ public:
fullInfo = reportingFullInfo_;
}
typedef void (GPU_GLES::*CmdFunc)(u32 op, u32 diff);
struct CommandInfo {
uint64_t flags;
GPU_GLES::CmdFunc func;
};
// 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;
@@ -95,8 +89,6 @@ private:
inline void UpdateVsyncInterval(bool force);
void UpdateCmdInfo();
static CommandInfo cmdInfo_[256];
FramebufferManagerGLES *framebufferManagerGL_;
TextureCacheGLES *textureCacheGL_;
DepalShaderCacheGLES depalShaderCache_;
+27
View File
@@ -352,6 +352,9 @@ const CommonCommandTableEntry commonCommandTable[] = {
};
size_t commonCommandTableSize = ARRAY_SIZE(commonCommandTable);
// TODO: Make class member?
GPUCommon::CommandInfo GPUCommon::cmdInfo_[256];
void GPUCommon::Flush() {
drawEngineCommon_->DispatchFlush();
}
@@ -375,6 +378,30 @@ GPUCommon::GPUCommon(GraphicsContext *gfxCtx, Draw::DrawContext *draw) :
gstate.Reset();
gstate_c.Reset();
gpuStats.Reset();
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();
}
}
// Find commands missing from the table.
for (int i = 0; i < 0xEF; i++) {
if (dupeCheck.find((u8)i) == dupeCheck.end()) {
ERROR_LOG(G3D, "Command missing from table: %02x (%i)", i, i);
}
}
}
GPUCommon::~GPUCommon() {
+8
View File
@@ -295,6 +295,14 @@ protected:
GraphicsContext *gfxCtx_;
Draw::DrawContext *draw_;
typedef void (GPUCommon::*CmdFunc)(u32 op, u32 diff);
struct CommandInfo {
uint64_t flags;
GPUCommon::CmdFunc func;
};
static CommandInfo cmdInfo_[256];
typedef std::list<int> DisplayListQueue;
int nextListID;
-26
View File
@@ -46,8 +46,6 @@
#include "Core/HLE/sceKernelInterrupt.h"
#include "Core/HLE/sceGe.h"
GPU_Vulkan::CommandInfo GPU_Vulkan::cmdInfo_[256];
GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
: GPUCommon(gfxCtx, draw),
vulkan_((VulkanContext *)gfxCtx->GetAPIContext()),
@@ -88,30 +86,6 @@ GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
ERROR_LOG(G3D, "gstate has drifted out of sync!");
}
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();
}
}
// Find commands missing from the table.
for (int i = 0; i < 0xEF; i++) {
if (dupeCheck.find((u8)i) == dupeCheck.end()) {
ERROR_LOG(G3D, "Command missing from table: %02x (%i)", i, i);
}
}
UpdateCmdInfo();
BuildReportingInfo();
-8
View File
@@ -62,12 +62,6 @@ public:
fullInfo = reportingFullInfo_;
}
typedef void (GPU_Vulkan::*CmdFunc)(u32 op, u32 diff);
struct CommandInfo {
uint64_t flags;
GPU_Vulkan::CmdFunc func;
};
// 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;
@@ -95,8 +89,6 @@ private:
void InitDeviceObjects();
void DestroyDeviceObjects();
static CommandInfo cmdInfo_[256];
VulkanContext *vulkan_;
FramebufferManagerVulkan *framebufferManagerVulkan_;
TextureCacheVulkan *textureCacheVulkan_;