diff --git a/build.sh b/build.sh index d61241b081..c4a2b4251f 100755 --- a/build.sh +++ b/build.sh @@ -23,7 +23,7 @@ do --dev|--devel) flags="$flags -DCMAKE_BUILD_TYPE=Devel" ;; - --debug) + --dbg|--debug) flags="$flags -DCMAKE_BUILD_TYPE=Debug" ;; --release) diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt index 4155128d05..d3a4a2c703 100644 --- a/plugins/GSdx/CMakeLists.txt +++ b/plugins/GSdx/CMakeLists.txt @@ -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 diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 53f60e82d3..a4c90a443a 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -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++) { diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index eb15831b26..5d34ff4978 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -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; diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index fb16f68e2e..a1680a898f 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -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 diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index 43be81e9b3..cfe2272e26 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -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(); diff --git a/plugins/GSdx/GSVertexArrayOGL.h b/plugins/GSdx/GSVertexArrayOGL.h index c85ae6743f..7e62c0c8d4 100644 --- a/plugins/GSdx/GSVertexArrayOGL.h +++ b/plugins/GSdx/GSVertexArrayOGL.h @@ -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); diff --git a/plugins/GSdx/config.h b/plugins/GSdx/config.h index c8a2aa9556..3ad4756bc9 100644 --- a/plugins/GSdx/config.h +++ b/plugins/GSdx/config.h @@ -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