gsdx-ogl: use 64 bits counter + fix division factor

I also added a counter of the real size of the texture.

I have a bad overhead for pbo transfer
This commit is contained in:
Gregory Hainaut 2015-04-25 14:18:21 +02:00
parent 00e62919c5
commit ee244071fa
6 changed files with 21 additions and 13 deletions

View File

@ -1589,6 +1589,7 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
//FIXME map? //FIXME map?
int finished = theApp.GetConfig("linux_replay", 1); int finished = theApp.GetConfig("linux_replay", 1);
unsigned long frame_number = 0; unsigned long frame_number = 0;
unsigned long total_frame_nb = 0;
while(finished > 0) while(finished > 0)
{ {
frame_number = 0; frame_number = 0;
@ -1642,6 +1643,7 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
sleep(1); sleep(1);
finished--; finished--;
total_frame_nb += frame_number;
} }
if (theApp.GetConfig("linux_replay", 1) > 1) { if (theApp.GetConfig("linux_replay", 1) > 1) {
@ -1666,10 +1668,12 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
fprintf(stderr, "Standard deviatin by frame: %fms\n", sd/(float)frame_number); fprintf(stderr, "Standard deviatin by frame: %fms\n", sd/(float)frame_number);
} }
#ifdef ENABLE_OGL_DEBUG_MEM_BW #ifdef ENABLE_OGL_DEBUG_MEM_BW
fprintf(stderr, "memory bandwith. T: %f KB/f. V: %f KB/f. U: %f KB/f\n", total_frame_nb *= 1024;
(float)g_texture_upload_byte/(float)frame_number/1024, fprintf(stderr, "memory bandwith. T: %f KB/f. RT: %f KB/f. V: %f KB/f. U: %f KB/f\n",
(float)g_vertex_upload_byte/(float)frame_number/1024, (float)g_texture_upload_byte/(float)total_frame_nb,
(float)g_uniform_upload_byte/(float)frame_number/1024 (float)g_real_texture_upload_byte/(float)total_frame_nb,
(float)g_vertex_upload_byte/(float)total_frame_nb,
(float)g_uniform_upload_byte/(float)total_frame_nb
); );
#endif #endif

View File

@ -33,9 +33,10 @@
static uint32 g_draw_count = 0; static uint32 g_draw_count = 0;
static uint32 g_frame_count = 1; static uint32 g_frame_count = 1;
#ifdef ENABLE_OGL_DEBUG_MEM_BW #ifdef ENABLE_OGL_DEBUG_MEM_BW
uint32 g_texture_upload_byte = 0; uint64 g_texture_upload_byte = 0;
uint32 g_vertex_upload_byte = 0; uint64 g_real_texture_upload_byte = 0;
uint32 g_uniform_upload_byte = 0; uint64 g_vertex_upload_byte = 0;
uint64 g_uniform_upload_byte = 0;
#endif #endif
static const uint32 g_merge_cb_index = 10; static const uint32 g_merge_cb_index = 10;

View File

@ -30,8 +30,9 @@
#include "GLState.h" #include "GLState.h"
#ifdef ENABLE_OGL_DEBUG_MEM_BW #ifdef ENABLE_OGL_DEBUG_MEM_BW
extern uint32 g_texture_upload_byte; extern uint64 g_texture_upload_byte;
extern uint32 g_vertex_upload_byte; extern uint64 g_real_texture_upload_byte;
extern uint64 g_vertex_upload_byte;
#endif #endif
class GSBlendStateOGL { class GSBlendStateOGL {

View File

@ -25,7 +25,8 @@
#include "GLState.h" #include "GLState.h"
#ifdef ENABLE_OGL_DEBUG_MEM_BW #ifdef ENABLE_OGL_DEBUG_MEM_BW
extern uint32 g_texture_upload_byte; extern uint64 g_texture_upload_byte;
extern uint64 g_real_texture_upload_byte;
#endif #endif
// FIXME OGL4: investigate, only 1 unpack buffer always bound // FIXME OGL4: investigate, only 1 unpack buffer always bound
@ -295,6 +296,7 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
// Note: pitch is the line size that will be copied into the PBO // Note: pitch is the line size that will be copied into the PBO
// pitch >> m_int_shift is the line size that will be actually dma-ed into the GPU // pitch >> m_int_shift is the line size that will be actually dma-ed into the GPU
g_texture_upload_byte += pitch * r.height(); g_texture_upload_byte += pitch * r.height();
g_real_texture_upload_byte += (r.width() * r.height()) << m_int_shift;
#endif #endif
memcpy(map, src, pitch*r.height()); memcpy(map, src, pitch*r.height());
@ -329,7 +331,7 @@ bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
glPixelStorei(GL_UNPACK_ALIGNMENT, m_int_alignment); glPixelStorei(GL_UNPACK_ALIGNMENT, m_int_alignment);
glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch >> m_int_shift); glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch >> m_int_shift);
glTexSubImage2D(GL_TEXTURE_2D, 0, r.x, r.y, r.width(), r.height(), m_int_format, m_int_type, data); gl_TextureSubImage2D(m_texture_id, GL_TEX_LEVEL_0, r.x, r.y, r.width(), r.height(), m_int_format, m_int_type, data);
// FIXME useful? // FIXME useful?
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // Restore default behavior glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // Restore default behavior

View File

@ -24,7 +24,7 @@
#include "GLState.h" #include "GLState.h"
#ifdef ENABLE_OGL_DEBUG_MEM_BW #ifdef ENABLE_OGL_DEBUG_MEM_BW
extern uint32 g_uniform_upload_byte; extern uint64 g_uniform_upload_byte;
#endif #endif

View File

@ -24,7 +24,7 @@
#include "config.h" #include "config.h"
#ifdef ENABLE_OGL_DEBUG_MEM_BW #ifdef ENABLE_OGL_DEBUG_MEM_BW
extern uint32 g_vertex_upload_byte; extern uint64 g_vertex_upload_byte;
#endif #endif
struct GSInputLayoutOGL { struct GSInputLayoutOGL {