View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002067 | FSSCP | graphics | public | 2009-12-14 18:51 | 2009-12-16 03:03 |
| Reporter | KeldorKatarn | Assigned To | taylor | ||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | resolved | Resolution | no change required | ||
| Platform | IBM PC | OS | MS Windows | OS Version | Vista SP2 |
| Product Version | 3.6.11 | ||||
| Summary | 0002067: Display used bitmap slots in debug info | ||||
| Description | There have been some discussions, (especially in this thread: http://www.hard-light.net/forums/index.php?topic=62565.0), about the number of available bitmap slots. Some modders in that thread stated their concerns about the size of that number. I tried to find out for Saga at what level we are, but I didn't find any way to display how many slots are used. Since I thought that information would be useful for mods, concerned with the question whether or not they are using too many textures, I implemented such a check. With the attached patch the number of bitmaps will be displayed below the other memory usage information like S-SRAM or VRAM. If this is not the best location for it, it can easily be moved. The main part of the patch is keeping track of the number in the first place. I added a variable that keeps track and for testing purposes temporarily added a function which loops over the entire array, counting the free slots, and compared the two numbers ingame. Since the numbers were always identical during tests I'm pretty sure I implemented the variable increases and decreases correctly. The testing function is of course not part of the patch. | ||||
| Steps To Reproduce | Just start a mission in debug build and look at the number in the upper right corner. it will say something like: BMPs: 1063/4750 Which means <used slots>/<max slots> | ||||
| Tags | No tags attached. | ||||
|
2009-12-14 18:51
|
loaded_bitmaps.patch (1,906 bytes)
Index: code/bmpman/bmpman.cpp
===================================================================
--- code/bmpman/bmpman.cpp (revision 5709)
+++ code/bmpman/bmpman.cpp (working copy)
@@ -53,6 +53,7 @@
bitmap_entry bm_bitmaps[MAX_BITMAPS];
+int loaded_bitmaps = 0;
int bm_texture_ram = 0;
int bm_inited = 0;
int Bm_paging = 0;
@@ -291,6 +292,8 @@
bm_free_data(i); // clears flags, bbp, data, etc
}
+
+ loaded_bitmaps = 0;
}
// Returns number of bytes of bitmaps locked this frame
@@ -385,6 +388,8 @@
gr_bm_create(n);
+ loaded_bitmaps++;
+
return bm_bitmaps[n].handle;
}
@@ -578,6 +583,8 @@
if (img_cfp != NULL)
cfclose(img_cfp);
+ loaded_bitmaps++;
+
return handle;
}
@@ -985,6 +992,7 @@
sprintf( bm_bitmaps[n+i].filename, "%s[%d]", filename, i );
}
+ loaded_bitmaps++;
}
if (nframes)
@@ -1821,6 +1829,8 @@
bm_bitmaps[first+i].info.ani.first_frame = -1;
bm_bitmaps[first+i].handle = -1;
+
+ loaded_bitmaps--;
}
} else {
bm_free_data(n, true); // clears flags, bbp, data, etc
@@ -1844,6 +1854,8 @@
bm_bitmaps[n].info.ani.first_frame = -1;
bm_bitmaps[n].handle = -1;
+
+ loaded_bitmaps--;
}
return 1;
@@ -2720,6 +2732,8 @@
}
// bm_update_memory_used( n, bm_bitmaps[n].mem_taken );
+ loaded_bitmaps++;
+
return bm_bitmaps[n].handle;
}
Index: code/freespace2/freespace.cpp
===================================================================
--- code/freespace2/freespace.cpp (revision 5709)
+++ code/freespace2/freespace.cpp (working copy)
@@ -2556,6 +2556,12 @@
gr_printf( sx, sy, NOX("VRAM: %d KB\n"), (GL_textures_in + GL_vertex_data_in)/1024 );
sy += dy;
}
+
+ {
+ extern int loaded_bitmaps;
+ gr_printf( sx, sy, NOX("BMPs: %d/%d\n"), loaded_bitmaps, MAX_BITMAPS );
+ sy += dy;
+ }
}
|
|
|
This info is already written to the log file. And adding "+BmpInfo", "+BmpMan" and "+BMP DEBUG" to your debug_filter.cfg will make sure to print out all of the info needed to figure out what files are loaded and what is taking up how much memory (individually and overall). This info will be printed to the log for each level loaded so it is pretty simple to test a bunch of levels and then check the log to see bitmap usage for each level. |
|
|
But is also written there how many bitmap slots are used? This isn't about memory usage, it is about free slots in the bitmap array... |
|
|
Yes. Even without modifying the debug_filter.cfg it adds "Bmpman: %d/%d bitmap slots in use." to the log after every mission is loaded. Adding the extra info to debug_filter.cfg just gives you more detail info about what bitmaps are loaded. |
|
|
alright. Didn't know this. This should however possibly be emphasised somewhere. From the thread I got the feeling that not exactly that many modders are aware of this =) Issue can be closed. |
|
|
The used/total info has been there since retail, so I'm surprised that more people aren't aware of it. I'm pretty sure that I have mentioned it several times over the years when people complain about bitmap slot related issues as well. I think it's just that lots of people have come and gone since it was a big problem, so I guess it's possible that pretty much nobody current is really aware of the details surrounding all of that stuff. It was nearly 5 years ago after all. :) |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2009-12-14 18:51 | KeldorKatarn | New Issue | |
| 2009-12-14 18:51 | KeldorKatarn | File Added: loaded_bitmaps.patch | |
| 2009-12-15 01:43 | taylor | Note Added: 0011418 | |
| 2009-12-15 01:54 | KeldorKatarn | Note Added: 0011419 | |
| 2009-12-15 02:19 | taylor | Note Added: 0011420 | |
| 2009-12-15 05:19 | KeldorKatarn | Note Added: 0011421 | |
| 2009-12-15 05:47 | taylor | Note Added: 0011422 | |
| 2009-12-16 03:03 | taylor | Status | new => resolved |
| 2009-12-16 03:03 | taylor | Resolution | open => no change required |
| 2009-12-16 03:03 | taylor | Assigned To | => taylor |