|
|
video memory usage
#341766
09/20/10 06:50
09/20/10 06:50
|
Joined: Feb 2006
Posts: 1,011 Germany
pegamode
OP
Serious User
|
OP
Serious User
Joined: Feb 2006
Posts: 1,011
Germany
|
Hi, is there a way to get the overall video memory usage? I know there are some d3d_ commands, but: 1) d3d_texfree I'm not sure if it's a bug, but even when starting just an empty main.c "d3d_textfree" always returns a negative value (e.g. -19532830) though in the manual is said that the value should be higher than 0. (I've tested it with the latest A7 Pro and A8 Pro) 2) d3d_texbmaps, d3d_texskins, d3d_texsmaps, d3d_texsurfs The manual says: "Due to swapping and compression, the total value can be remarkably higher than the amount of video memory available on the 3D card." Hmm ... so how can I interpret those values? Is there any chance to get NVIDIA PerfHud running using lite-c? ( http://developer.nvidia.com/object/nvperfhud_home.html) I haven't found the time to get a closer look at PerfHud, but I'm not sure if the binding code can be used in lite-c. Regards, Pegamode.
|
|
|
Re: video memory usage
[Re: jcl]
#341770
09/20/10 07:11
09/20/10 07:11
|
Joined: Feb 2006
Posts: 1,011 Germany
pegamode
OP
Serious User
|
OP
Serious User
Joined: Feb 2006
Posts: 1,011
Germany
|
Is there any way to get the "real" value (e.g. read something from directX into a string)? Currently it would be hard to do something like this:
if (d3d_texfree < 10000) {
// do something
}
I could do it like this:
if (d3d_texfree < 10000 && d3d_texfree >= 0) {
// do something
}
But it's not a nice code. But it would be more interesting to get the value how much video memory is in use instead of the value how much video memory is left, because this value would be independent from the gfx-card. Is there any way to get good values? Maybe from DirectX?
Last edited by pegamode; 09/20/10 07:19.
|
|
|
Re: video memory usage
[Re: pegamode]
#341778
09/20/10 11:37
09/20/10 11:37
|
Joined: Jun 2009
Posts: 43
MCKiller
Newbie
|
Newbie
Joined: Jun 2009
Posts: 43
|
I tried that with the following code:
#include <acknex.h>
#include <d3d9.h>
FONT* standard_font = "Arial#20b";
STRING* memo = "not available";
TEXT* dx =
{
layer = 1;
pos_x = 400;
pos_y = 100;
font = standard_font;
string = memo;
flags = CENTER_X | TRANSLUCENT | SHOW;
}
void main() {
video_mode = 8;
video_depth = 32;
fps_max = 60;
d3d_texdepth = 4;
STRING* tmp ="0";
level_load(NULL);
while(1){
LPDIRECT3DDEVICE9 pd3dDev;
pd3dDev = (LPDIRECT3DDEVICE9)draw_begin();
if (!pd3dDev) return;
long mem = (LPDIRECT3DDEVICE9)pd3dDev)->GetAvailableTextureMem();
//printf("freeTextureMem: %i",mem);
str_for_int(tmp,mem);
str_cpy(memo,tmp);
wait(1);
}
}
The result is: -1360003072 MSDN says that GetAvailableTextureMem() returns the values in Megabytes?!? So maybe there is something strange....
|
|
|
Re: video memory usage
[Re: MCKiller]
#341811
09/20/10 19:32
09/20/10 19:32
|
Joined: Feb 2006
Posts: 1,011 Germany
pegamode
OP
Serious User
|
OP
Serious User
Joined: Feb 2006
Posts: 1,011
Germany
|
I overworked MCKiller's code a bit, but I also get this negative value (btw. the same as if I use d3d_texfree). The code I use:
#include <acknex.h>
#include <d3d9.h>
void main() {
video_mode = 8;
video_depth = 32;
fps_max = 60;
d3d_texdepth = 4;
level_load(NULL);
wait(1);
LPDIRECT3DDEVICE9 pd3dDev = (LPDIRECT3DDEVICE9)draw_begin();
if (!pd3dDev) sys_exit("-1");
while(1){
long mem = pd3dDev->GetAvailableTextureMem();
draw_text(str_printf(NULL, "freemem: %d",mem),10,10,COLOR_RED);
wait(1);
}
}
Any hint??? Regards, Pegamode.
|
|
|
Re: video memory usage
[Re: pegamode]
#341813
09/20/10 19:43
09/20/10 19:43
|
Joined: Feb 2006
Posts: 1,011 Germany
pegamode
OP
Serious User
|
OP
Serious User
Joined: Feb 2006
Posts: 1,011
Germany
|
I changed the draw_text line from
draw_text(str_printf(NULL, "freemem: %d",mem),10,10,COLOR_RED);
to
draw_text(str_printf(NULL, "freemem: %u",mem),10,10,COLOR_RED);
The value I see now could be the right one ... I will check it out a little further.
|
|
|
|