PDA

View Full Version : 8800GTX + Direct3D8 + Visual C++ + XP = Random Performance Increase


walterman
08-02-07, 03:40 AM
I've been coding a lot lately in C++ & Direct3D8 (yes, i know it's old).

I use Fraps to measure the performance, each time that i change something in my D3D code.

Well, this week, i thought that i had found a faster code, cause, i was drawing more primitives, and i was having the same FPS.

The fact, is that the card was working faster, a 10% more.

I don't understand how happened, but, i was getting a 10% performance boost in all games. Global.

After a system restart, the performance is back to normal, but seems like after a long coding session, with a lot of tests, the same global performance increase is back.

Also, the memory usage, after the weird performance increase, is 600MB higher than usually, and after a long investigation with process explorer & another tools, i found that that memory was being used by the kernel, so, by a driver.

I was reading about that alt-tab performance increase today. I haven't that problem in my system, but, this new 'coding bug' is really weird.

I'll keep trying to find the key of this performance increase.

I'm using 158.27 for XP atm.

walterman
10-05-07, 05:20 AM
I'm with last Forceware 163.71 WHQL XP, and i still have that weird 'bug'.

After several hours coding, and a lot of errors in my applications, the system starts to use around 600MB of ram, and the 10% performance speedup appears.

I would like to know how to reproduce it, cause it's an 'interesting' bug.

walterman
10-23-07, 08:07 AM
I found something interesting.

After several tests, the non-local video memory usage, starts to grow, till 250MB.

I also see in task manager that my system is using 500MB of ram, while it uses usually 200-250MB.

There isn't any process using those extra 250MB, so, it must be memory used by the kernel or a driver.

http://img87.imageshack.us/img87/8808/rtlo0.th.png (http://img87.imageshack.us/my.php?image=rtlo0.png)

When this happens, my framerate grows a 10% in all the games.

Why ? I dunno yet.

Absolution
10-25-07, 03:22 PM
Send a driver bug form to nVidia. Send the source code along with it. Its your best bet, check to see if it performs the same as other cards (preferably different series, ex 6,7,8, along with ATI cards).

The problem is impossible to diagnose without the program.

walterman
10-30-07, 06:27 PM
I found one way to reproduce the 'bug'.

I load my fav game, BloodRayne2, with my patch for FSAA (my vc++ project).

I start a new game, and i start to do 'alt-tab', between the game & desktop.

Each time, that i do alt-tab, there's an increase in the non-local videomemory usage of 6-7MB.

When, i reach 240-250MB (after 30-40 alt-tabs), there's a nice boost in the fps, from 90 to 100 fps (+-10%)

Just check my graph:

http://img106.imageshack.us/img106/3500/rtvv0.th.png (http://img106.imageshack.us/my.php?image=rtvv0.png)

Why ?

I've no idea, but it's a interesting bug.

I tried without my patch, with just the retail game, and same result.

If you do this process 2 times, the 2nd time, the system doesn't free the non-local video memory usage, and the boost is permanent, and the funny is that it works for all the games.

If somebody knows how to report a bug to nVidia, this is one that they really should investigate. A 10% increase in performance for free.

walterman
10-31-07, 11:29 AM
I solved it.

This is something really interesting.

It seems like the nVidia driver has some sort of problem with BR2. When you do alt-tab, the non-shared video memory use is increased in 7MB.

When you reach 250MB +-, with my 768MB GTX, the non-shared video memory stops growing (1 GB total ?).

This non-shared video memory, is like the old AGP memory, a block of system ram, that the gfx card can use too, to store buffers.

It seems like when this part of the ram is filled, the direct3d memory manager, puts all the buffers in the local video memory of your gfx card, which is much faster.

I changed the memory zone in which i create the vertex buffers in my application, from D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY to D3DUSAGE_WRITEONLY, and now the vertex buffers are created in the local video memory of the card, and they are processed a 10% faster now.

The funny, is that this 'bug' affected other games, for the same reason. This bug was forcing all the buffers to be created on the local video memory of the card, and that's why i was getting this global 10% boost.

Gooseone
08-07-09, 07:22 PM
Hi Walterman

Your discovery is fantastic. I am running MS FSX and I get decent performance, but it still stutters a bit. Anywhere from 15% to 40% of my video memory is non-local (as displayed by Riva Tuner), which I believe causes the stuttering. I am trying to locate the file which contains the D3DUSAGE_DYNAMIC entry so I can change it to D3DUSAGE_WRITEONLY, and experiment with it. Can you help me to locate it? Smooth gaming.

Gooseone

P.S. I discovered a very simple way (just few mouse clicks on the task manager) to run any game on ALL cores of any multicore processor be it two or four. Disregard what they say that most games are single-threaded. You can run them on ALL threads, distributing the load approximately evenly on all cores. You might already know how to do it, if not I will let you know.

walterman
08-10-09, 07:34 AM
Well,

I fixed the problem from my application, changing some parameters in this D3D8 function call:

::CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer8** ppVertexBuffer)

I did 'Usage = D3DUSAGE_WRITEONLY' instead of 'Usage = D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC'.

About FSX, i dunno if it has any option to change the way in which the application creates the buffers. But, yes, prolly all those stuttering problems share the same root. Anyway, i thought that nVidia fixed this problem, because i discovered it a couple of years ago.

About your discovery, well, send me more details to try it.

Feyy
09-16-09, 07:13 PM
P.S. I discovered a very simple way (just few mouse clicks on the task manager) to run any game on ALL cores of any multicore processor be it two or four. Disregard what they say that most games are single-threaded. You can run them on ALL threads, distributing the load approximately evenly on all cores. You might already know how to do it, if not I will let you know.

Anymore news on this? :)

tekkuy
12-26-09, 07:58 AM
P.S. I discovered a very simple way (just few mouse clicks on the task manager) to run any game on ALL cores of any multicore processor be it two or four. Disregard what they say that most games are single-threaded. You can run them on ALL threads, distributing the load approximately evenly on all cores. You might already know how to do it, if not I will let you know.

Please can you give more details in a following post? I'm also interested in this performance boost, thanks. If you do, I'll be this happy... (nana2) :captnkill: