From 677f890c5c574dc84da9076c847e4e07b5b3f905 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Tue, 4 Oct 2016 19:23:27 +0200 Subject: [PATCH] gsdx debug: static GSState::s_n This way you can access the current draw call anywhere. Very useful for debug. --- plugins/GSdx/GSDeviceOGL.cpp | 10 +++++----- plugins/GSdx/GSDeviceOGL.h | 1 - plugins/GSdx/GSRendererOGL.cpp | 1 - plugins/GSdx/GSState.cpp | 4 +++- plugins/GSdx/GSState.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 6a76b105ce..124b14db4e 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -20,6 +20,7 @@ */ #include "stdafx.h" +#include "GSState.h" #include "GSDeviceOGL.h" #include "GLState.h" #include "GSUtil.h" @@ -45,7 +46,6 @@ static const uint32 g_ps_cb_index = 21; static const uint32 g_gs_cb_index = 22; bool GSDeviceOGL::m_debug_gl_call = false; -int GSDeviceOGL::s_n = 0; int GSDeviceOGL::m_shader_inst = 0; int GSDeviceOGL::m_shader_reg = 0; FILE* GSDeviceOGL::m_debug_gl_file = NULL; @@ -898,7 +898,7 @@ void GSDeviceOGL::InitPrimDateTexture(GSTexture* rt, const GSVector4i& area) void GSDeviceOGL::RecycleDateTexture() { if (m_date.t) { - //static_cast(m_date.t)->Save(format("/tmp/date_adv_%04ld.csv", s_n)); + //static_cast(m_date.t)->Save(format("/tmp/date_adv_%04ld.csv", GSState::s_n)); Recycle(m_date.t); m_date.t = NULL; @@ -1890,11 +1890,11 @@ void GSDeviceOGL::DebugOutputToFile(GLenum gl_source, GLenum gl_type, GLuint id, #ifdef _DEBUG // Don't spam noisy information on the terminal if (gl_severity != GL_DEBUG_SEVERITY_NOTIFICATION) { - fprintf(stderr,"T:%s\tID:%d\tS:%s\t=> %s\n", type.c_str(), s_n, severity.c_str(), message.c_str()); + fprintf(stderr,"T:%s\tID:%d\tS:%s\t=> %s\n", type.c_str(), GSState::s_n, severity.c_str(), message.c_str()); } #else // Print nouveau shader compiler info - if (s_n == 0) { + if (GSState::s_n == 0) { int t, local, gpr, inst, byte; int status = sscanf(message.c_str(), "type: %d, local: %d, gpr: %d, inst: %d, bytes: %d", &t, &local, &gpr, &inst, &byte); @@ -1907,7 +1907,7 @@ void GSDeviceOGL::DebugOutputToFile(GLenum gl_source, GLenum gl_type, GLuint id, #endif if (m_debug_gl_file) - fprintf(m_debug_gl_file,"T:%s\tID:%d\tS:%s\t=> %s\n", type.c_str(), s_n, severity.c_str(), message.c_str()); + fprintf(m_debug_gl_file,"T:%s\tID:%d\tS:%s\t=> %s\n", type.c_str(), GSState::s_n, severity.c_str(), message.c_str()); #ifdef _DEBUG if (sev_counter >= 5) { diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index bc509d79a8..09cb4645bf 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -395,7 +395,6 @@ public: static const int m_NO_BLEND; static const int m_MERGE_BLEND; - static int s_n; static int m_shader_inst; static int m_shader_reg; diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index bd5e0b2f62..92383d08f8 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -1098,7 +1098,6 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour ASSERT(m_dev != NULL); GSDeviceOGL* dev = (GSDeviceOGL*)m_dev; - dev->s_n = s_n; // HLE implementation of the channel selection effect // diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index 0036be8c5d..64683d0916 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -27,6 +27,8 @@ extern int g_crc_hack_level; //#define Offset_ST // Fixes Persona3 mini map alignment which is off even in software rendering +int GSState::s_n = 0; + GSState::GSState() : m_version(6) , m_mt(false) @@ -49,7 +51,7 @@ GSState::GSState() m_userhacks_skipdraw = theApp.GetConfigB("UserHacks") ? theApp.GetConfigI("UserHacks_SkipDraw") : 0; m_userhacks_auto_flush = theApp.GetConfigB("UserHacks") ? theApp.GetConfigB("UserHacks_AutoFlush") : 0; - s_n = 0; + s_n = 0; s_dump = theApp.GetConfigB("dump"); s_save = theApp.GetConfigB("save"); s_savet = theApp.GetConfigB("savet"); diff --git a/plugins/GSdx/GSState.h b/plugins/GSdx/GSState.h index c6bec05b80..0cebd8195e 100644 --- a/plugins/GSdx/GSState.h +++ b/plugins/GSdx/GSState.h @@ -224,7 +224,7 @@ public: bool m_nativeres; bool m_mipmap; - int s_n; + static int s_n; bool s_dump; bool s_save; bool s_savet;