From 404067b430cacaca4c2c4ed87c9a246bd5feb047 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Mon, 28 Apr 2014 21:24:44 -0400 Subject: [PATCH] clean up Show_cpu and Show_mem routines; use generic Gr_textures_in --- src/freespace2/freespace.cpp | 35 +++++------------------------------ src/graphics/2d.cpp | 7 +++++++ src/graphics/grgl1texture.cpp | 21 ++++++--------------- 3 files changed, 18 insertions(+), 45 deletions(-) diff --git a/src/freespace2/freespace.cpp b/src/freespace2/freespace.cpp index 5fb7ef3..3d8f627 100644 --- a/src/freespace2/freespace.cpp +++ b/src/freespace2/freespace.cpp @@ -2687,19 +2687,9 @@ void game_show_framerate() gr_set_color_fast(&HUD_color_debug); { -#ifndef PLAT_UNIX - extern int D3D_textures_in; - extern int D3D_textures_in_frame; - extern int Glide_textures_in; - extern int Glide_textures_in_frame; - extern int Glide_explosion_vram; - gr_printf( sx, sy, NOX("VRAM: %d KB\n"), (D3D_textures_in+Glide_textures_in)/1024 ); - sy += dy; - gr_printf( sx, sy, NOX("VRAM: +%d KB\n"), (Glide_textures_in_frame+D3D_textures_in_frame)/1024 ); + extern int Gr_textures_in; + gr_printf( sx, sy, NOX("VRAM: %d KB\n"), Gr_textures_in/1024 ); sy += dy; - gr_printf( sx, sy, NOX("EXP VRAM: %dKB\n"), (Glide_explosion_vram)/1024 ); - sy += dy; -#endif } // gr_printf( sx, sy, "BPP: %d", gr_screen.bits_per_pixel ); // sy += dy; @@ -2767,26 +2757,11 @@ void game_show_framerate() sy += dy; gr_printf( sx, sy, NOX("S-SRAM: %d KB\n"), Snd_sram/1024 ); // mem used to store game sound sy += dy; -#ifndef PLAT_UNIX - gr_printf( sx, sy, NOX("S-HRAM: %d KB\n"), Snd_hram/1024 ); // mem used to store game sound - sy += dy; - { - extern int D3D_textures_in; - extern int Glide_textures_in; - extern int Glide_textures_in_frame; - extern int Glide_explosion_vram; - gr_printf( sx, sy, NOX("VRAM: %d KB\n"), (D3D_textures_in+Glide_textures_in)/1024 ); - sy += dy; - gr_printf( sx, sy, NOX("VRAM: +%d KB\n"), (Glide_textures_in_frame)/1024 ); - sy += dy; - gr_printf( sx, sy, NOX("EXP VRAM: %dKB\n"), (Glide_explosion_vram)/1024 ); - sy += dy; -#else + { - extern int GL_textures_in; - gr_printf( sx, sy, NOX("VRAM: %d KB\n"), (GL_textures_in)/1024 ); + extern int Gr_textures_in; + gr_printf( sx, sy, NOX("VRAM: %d KB\n"), Gr_textures_in/1024 ); sy += dy; -#endif } } diff --git a/src/graphics/2d.cpp b/src/graphics/2d.cpp index 2f39b2f..653379f 100644 --- a/src/graphics/2d.cpp +++ b/src/graphics/2d.cpp @@ -515,6 +515,9 @@ float Gr_gamma = 1.8f; int Gr_gamma_int = 180; int Gr_gamma_lookup[256]; +int Gr_textures_in = 0; + + void gr_close() { if ( !Gr_inited ) return; @@ -531,6 +534,8 @@ void gr_close() break; } + Gr_textures_in = 0; + gr_font_close(); Gr_inited = 0; @@ -676,6 +681,8 @@ int gr_init(int res, int mode, int depth, int fred_x, int fred_y) gr_screen.clip_width = gr_screen.max_w; gr_screen.clip_height = gr_screen.max_h; + Gr_textures_in = 0; + switch( gr_screen.mode ) { case GR_OPENGL: gr_opengl_init(); diff --git a/src/graphics/grgl1texture.cpp b/src/graphics/grgl1texture.cpp index 1740e90..10f05e9 100644 --- a/src/graphics/grgl1texture.cpp +++ b/src/graphics/grgl1texture.cpp @@ -41,7 +41,6 @@ static tcache_slot_opengl *Textures = NULL; static tcache_slot_opengl *GL_bound_texture; static int GL_frame_count = 0; -static int GL_textures_in_frame = 0; static int GL_last_bitmap_id = -1; static int GL_last_detail = -1; static int GL_last_bitmap_type = -1; @@ -49,7 +48,7 @@ static int GL_last_section_x = -1; static int GL_last_section_y = -1; static int GL_should_preload = 0; -int GL_textures_in = 0; +extern int Gr_textures_in; static gr_texture_source GL_current_texture_source = (gr_texture_source) -1; @@ -150,9 +149,6 @@ void opengl1_tcache_init() GL_last_section_x = -1; GL_last_section_y = -1; - - GL_textures_in = 0; - GL_textures_in_frame = 0; } static int opengl1_free_texture ( tcache_slot_opengl *t ) @@ -200,7 +196,7 @@ static int opengl1_free_texture ( tcache_slot_opengl *t ) t->bitmap_id = -1; t->used_this_frame = 0; - GL_textures_in -= t->size; + Gr_textures_in -= t->size; t->size = 0; } @@ -224,9 +220,9 @@ void opengl1_tcache_flush() for( i=0; iw = (ushort)tex_w; t->h = (ushort)tex_h; - GL_textures_in_frame += t->size; if (!reload) { - GL_textures_in += t->size; + Gr_textures_in += t->size; } return ret_val; -- 2.39.2