gsdx-ogl: improve debugging capabilities

allow to print memory transfer usage
Check gl call in dev build
This commit is contained in:
Gregory Hainaut 2014-03-24 15:03:02 +01:00
parent bde2e3956d
commit 8b78551b92
8 changed files with 33 additions and 3 deletions

View File

@ -23,7 +23,7 @@ do
--dev|--devel)
flags="$flags -DCMAKE_BUILD_TYPE=Devel"
;;
--debug)
--dbg|--debug)
flags="$flags -DCMAKE_BUILD_TYPE=Debug"
;;
--release)

View File

@ -32,7 +32,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Debug)
# Devel - Build
if(CMAKE_BUILD_TYPE STREQUAL Devel)
add_definitions(${CommonFlags} ${OptimizationFlags} -g -W)
add_definitions(${CommonFlags} ${OptimizationFlags} -D_DEVEL -g -W)
endif(CMAKE_BUILD_TYPE STREQUAL Devel)
# Release - Build

View File

@ -1628,6 +1628,9 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
fprintf(stderr, "Mean by frame: %fms (%ffps)\n", mean/(float)frame_number, 1000.0f*frame_number/mean);
fprintf(stderr, "Standard deviatin by frame: %fms\n", sd/(float)frame_number);
}
#ifdef ENABLE_OGL_DEBUG_MEM_BW
fprintf(stderr, "memory bandwith. T: %f. V: %f\n", (float)g_texture_upload_byte/(float)frame_number/1024, (float)g_vertex_upload_byte/(float)frame_number/1024);
#endif
for(auto i = packets.begin(); i != packets.end(); i++)
{

View File

@ -31,6 +31,10 @@
static uint32 g_draw_count = 0;
static uint32 g_frame_count = 1;
#ifdef ENABLE_OGL_DEBUG_MEM_BW
uint32 g_texture_upload_byte = 0;
uint32 g_vertex_upload_byte = 0;
#endif
static const uint32 g_merge_cb_index = 10;
static const uint32 g_interlace_cb_index = 11;

View File

@ -29,6 +29,11 @@
#include "GSShaderOGL.h"
#include "GLState.h"
#ifdef ENABLE_OGL_DEBUG_MEM_BW
extern uint32 g_texture_upload_byte;
extern uint32 g_vertex_upload_byte;
#endif
class GSBlendStateOGL {
// Note: You can also select the index of the draw buffer for which to set the blend setting
// We will keep basic the first try

View File

@ -24,6 +24,10 @@
#include "GSTextureOGL.h"
#include "GLState.h"
#ifdef ENABLE_OGL_DEBUG_MEM_BW
extern uint32 g_texture_upload_byte;
#endif
// FIXME OGL4: investigate, only 1 unpack buffer always bound
namespace PboPool {
@ -341,6 +345,10 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
}
src += pitch;
map += line_size;
#ifdef ENABLE_OGL_DEBUG_MEM_BW
g_texture_upload_byte += line_size;
#endif
}
PboPool::Unmap();

View File

@ -21,6 +21,12 @@
#pragma once
#include "config.h"
#ifdef ENABLE_OGL_DEBUG_MEM_BW
extern uint32 g_vertex_upload_byte;
#endif
struct GSInputLayoutOGL {
GLuint index;
GLint size;
@ -146,6 +152,9 @@ class GSBufferOGL {
data[i] += basevertex;
}
}
#endif
#ifdef ENABLE_OGL_DEBUG_MEM_BW
g_vertex_upload_byte += count*m_stride;
#endif
if (m_sub_data_config && !m_buffer_storage) {
subdata_upload(src, count);

View File

@ -38,9 +38,10 @@
//#define DISABLE_DATE
#ifdef _DEBUG
#if defined(_DEBUG) || defined(_DEVEL)
#define ENABLE_OGL_DEBUG // Create a debug context and check opengl command status. Allow also to dump various textures/states.
#endif
//#define ENABLE_OGL_DEBUG_MEM_BW // compute the quantity of data transfered (debug purpose)
// Output stencil to a color buffer
//#define ENABLE_OGL_STENCIL_DEBUG