From 5cea38e405f676ca2285f9c5ae92d59fca08bd60 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 28 Apr 2013 17:49:17 -0700 Subject: [PATCH] Reporting: catch information about the GPU. --- Core/Reporting.cpp | 10 ++++++++-- GPU/GLES/DisplayListInterpreter.cpp | 23 +++++++++++++++++++++++ GPU/GLES/DisplayListInterpreter.h | 4 ++++ GPU/GPUInterface.h | 2 ++ GPU/Null/NullGpu.h | 1 + 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 3a5b57469b..ac6f8929ea 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -20,6 +20,8 @@ #include "Common/StdThread.h" #include "Core/Config.h" #include "Core/System.h" +#include "GPU/GPUInterface.h" +#include "GPU/GPUState.h" #include "net/http_client.h" #include "net/resolve.h" @@ -150,12 +152,16 @@ namespace Reporting const int PARAM_BUFFER_SIZE = 4096; char temp[PARAM_BUFFER_SIZE]; + std::string gpuInfo; + gpu->GetReportingInfo(gpuInfo); + // TODO: Need to escape these values, add more. - snprintf(temp, PARAM_BUFFER_SIZE - 1, "version=%s&game=%s_%s&game_title=%s", + snprintf(temp, PARAM_BUFFER_SIZE - 1, "version=%s&game=%s_%s&game_title=%s&gpu=%s", PPSSPP_GIT_VERSION, g_paramSFO.GetValueString("DISC_ID").c_str(), g_paramSFO.GetValueString("DISC_VERSION").c_str(), - g_paramSFO.GetValueString("TITLE").c_str()); + g_paramSFO.GetValueString("TITLE").c_str(), + gpuInfo.c_str()); std::string data; switch (payload.type) diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index 293c8ab020..fede4b18d9 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -194,6 +194,8 @@ GLES_GPU::GLES_GPU() flushBeforeCommand_[flushBeforeCommandList[i]] = 1; } flushBeforeCommand_[1] = 0; + + BuildReportingInfo(); } GLES_GPU::~GLES_GPU() { @@ -203,6 +205,27 @@ GLES_GPU::~GLES_GPU() { delete [] flushBeforeCommand_; } +// Let's avoid passing nulls into snprintf(). +static const char *GetGLStringAlways(GLenum name) { + const GLubyte *value = glGetString(name); + if (!value) + return "?"; + return (const char *)value; +} + +// Needs to be called on GPU thread, not reporting thread. +void GLES_GPU::BuildReportingInfo() { + const char *glVendor = GetGLStringAlways(GL_VENDOR); + const char *glRenderer = GetGLStringAlways(GL_RENDERER); + const char *glVersion = GetGLStringAlways(GL_VERSION); + const char *glSlVersion = GetGLStringAlways(GL_SHADING_LANGUAGE_VERSION); + const char *glExtensions = GetGLStringAlways(GL_EXTENSIONS); + + char temp[2048]; + snprintf(temp, sizeof(temp), "%s (%s %s), %s (extensions: %s)", glVersion, glVendor, glRenderer, glSlVersion, glExtensions); + reportingInfo_ = temp; +} + void GLES_GPU::DeviceLost() { // Simply drop all caches and textures. // FBO:s appear to survive? Or no? diff --git a/GPU/GLES/DisplayListInterpreter.h b/GPU/GLES/DisplayListInterpreter.h index 3d528dd8e9..a604e715d2 100644 --- a/GPU/GLES/DisplayListInterpreter.h +++ b/GPU/GLES/DisplayListInterpreter.h @@ -60,6 +60,7 @@ public: } virtual bool FramebufferDirty(); + virtual void GetReportingInfo(std::string &info) { info = reportingInfo_; } std::vector GetFramebufferList(); protected: @@ -69,6 +70,7 @@ private: void DoBlockTransfer(); void ApplyDrawState(int prim); void CheckFlushOp(u32 op, u32 diff); + void BuildReportingInfo(); // Applies states for debugging if enabled. void BeginDebugDraw(); @@ -81,4 +83,6 @@ private: u8 *flushBeforeCommand_; bool resized_; + + std::string reportingInfo_; }; diff --git a/GPU/GPUInterface.h b/GPU/GPUInterface.h index 8f46f06863..4e4bf5beca 100644 --- a/GPU/GPUInterface.h +++ b/GPU/GPUInterface.h @@ -21,6 +21,7 @@ #include "GPUState.h" #include "Core/HLE/sceKernelThread.h" #include +#include class PointerWrap; @@ -186,6 +187,7 @@ public: // Debugging virtual void DumpNextFrame() = 0; + virtual void GetReportingInfo(std::string &info) = 0; virtual const std::list& GetDisplayLists() = 0; virtual DisplayList* GetCurrentDisplayList() = 0; virtual bool DecodeTexture(u8* dest, GPUgstate state) = 0; diff --git a/GPU/Null/NullGpu.h b/GPU/Null/NullGpu.h index a6adf6b02d..4db63a5121 100644 --- a/GPU/Null/NullGpu.h +++ b/GPU/Null/NullGpu.h @@ -42,6 +42,7 @@ public: virtual void DumpNextFrame() {} virtual void Resized() {} + virtual void GetReportingInfo(std::string &info) { info = "NULL"; } protected: virtual void FastRunLoop(DisplayList &list);