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?
int finished = theApp.GetConfig("linux_replay", 1);
unsigned long frame_number = 0;
unsigned long total_frame_nb = 0;
while(finished > 0)
{
frame_number = 0;
@ -1642,6 +1643,7 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
sleep(1);
finished--;
total_frame_nb += frame_number;
}
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);
}
#ifdef ENABLE_OGL_DEBUG_MEM_BW
fprintf(stderr, "memory bandwith. T: %f KB/f. V: %f KB/f. U: %f KB/f\n",
(float)g_texture_upload_byte/(float)frame_number/1024,
(float)g_vertex_upload_byte/(float)frame_number/1024,
(float)g_uniform_upload_byte/(float)frame_number/1024
total_frame_nb *= 1024;
fprintf(stderr, "memory bandwith. T: %f KB/f. RT: %f KB/f. V: %f KB/f. U: %f KB/f\n",
(float)g_texture_upload_byte/(float)total_frame_nb,
(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

View File

@ -33,9 +33,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;
uint32 g_uniform_upload_byte = 0;
uint64 g_texture_upload_byte = 0;
uint64 g_real_texture_upload_byte = 0;
uint64 g_vertex_upload_byte = 0;
uint64 g_uniform_upload_byte = 0;
#endif
static const uint32 g_merge_cb_index = 10;

View File

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

View File

@ -25,7 +25,8 @@
#include "GLState.h"
#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
// 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
// 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_real_texture_upload_byte += (r.width() * r.height()) << m_int_shift;
#endif
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_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?
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // Restore default behavior

View File

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

View File

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