What links? :confused:
What links? :confused:
Quote:
Originally posted by Electroman
What links? :confused:
I copied it from the documentation in the SDK. So you could have a look at it if you have the time. If not I will do it over the weekend. But there is always lots of links in the documentation to elaborate on the diffrent topics. If you need any more info on the ones I have BOLDed out, let me know, and I can copy paste that too. But I guess you can find it in the documentation if you want too....;)
I found this pretty intresting:
Maybe it isn't using 100% anyway? Or maybe it is....maybe I should send my first mail to the group and ask about that profiler..:D...let me do it..:DQuote:
> i have written a rather small app that shows a couple of videos. When
> my app is in Windowed Mode it uses about 70% processing power with
> four videos on 4 square Meshes. When i switch to fullscreen the app
> uses 100% and even when i have it in Windowed Mode but it put another
> Window in front of it, it uses 100% of the cpu time.
>
> I checked this kind of behaviour with some directx apps from the
> directx
> sdk: same problem there.
>
> Is this a bug in directx?
>
> I am using directx9 on a 3.2 Ghz Pentium Windows 2000 system with an
> ati raddeon 9800 with 256MB.
The CPU usage you see in task manager and similar tools has absolutely nothing to do with how busy the processor is. It simply tells how much CPU time is allocated to the respective process.
A DirectX application, unlike most "normal" Windows apps, typically is continously rendering frames, instead of only being active when there are window messages to process. While in windowed mode, the other processes will still be given time to repaint and process their own messages; as soon as you're in fullscreen mode, their windows are invisible, so the message traffic to these windows is greatly reduced, while your DirectX app will still happily gobble up what's left of CPU time.
If you want to know how busy the processor really is (and, more importantly, what it's busy with), use a profiler.
-Fabian "ryg" Giesen
theprodukkt
Ohhh...my ****...I have done it...I feel so stupid now...I am not ready for this ****...:D
Ohh ****...did you get two of those mails? Hope that was just me. If not I am screwed..:D
I am getting so many nice answers...please beproud of me....niw we have 2 profilers....do you have a AMD prosessor? I have..think I will try that one.
Took me some time to find it...but here it is if you want to try it..
http://www.developwithamd.com/appPar...fm?action=home
I didn't want to spam the "thread" even more, so I didn't answer the last guy. So he sendt me a private mail in stead..:D
Looks like he burns for that other app from Devpartner. Think I will try that one now..:DQuote:
Its been awhile (1 maybe 2 years) since I've used CodeAnalyst. Its okay. Devpartner completely outclasses it, however. Devparter community edition integrates into the IDE, is easy to switch profiling on/off (simple check a box and rebuild), has call graphs, separates system calls from your source, supports saving profile session results making it easy to compare progress (very nice), etc...
Seriously try Devpartner community edition. This is the profiler that replaced MS' (very bad) profile application.
james
The Devparter one was even harder to find...but here it is...
http://www.compuware.com/products/de...evPartner&sf=1
And it works as hell too. Looks like it has some problems to detect the calls in the inline functions, but the rest is great.
It looks like the EndScene() function is using most of our time. But it isn't doing any redundant work anyway. So we just have to live with it..
Finaly I know what you mean with STUPENDUS...I have worked my ass for the last hours to get DX, to print some text for me..:D..never done that before..:D...and then I had to calculate the time. .Ended up stealing MS code for it. Will have to change it a bit I think. And wrap up the calculation of the FPS. Becuase now it is changing the FPS for every frame. And we don't want that...:D
But the STUPENDUS thing was that in windowed mode I am getting about 750-850FPS. But in full screen I am getting about 2700-2800. I am realy looking forward to see if you can get it to go even faster. Push it over 3k..:D...thats faster then I have ever seen before..:D
Ohh...and here is the code..:D
If you want to change anything of what I have done in the GameLoop, or with my functions, I would be glad if you told be before you did it. Becuase I have a lot of ideas on how to do it...just havn't had the time...;)
Where did that code bit go?? It was to big, and I didn't get the chance to go back...
well I have zipped only the files you need now.
ØØ
*** is going on here. I leave you to go to work and you first of all make a fool of your self on the mail list (which I saw yes), then you SPAM this thread and then you go expoding the FPS :eek2:
BTW I don't think you made a fool of your self by hijacking that guys thread ;) :D.
Will check out the project.....
Arrrrrhhhhhh!!!!
How am I meant to test it with out gametimer.obj :mad:
I guess this is the code that you stole off MS in obj form :rolleyes:
:D :D
Ow sorry I see now the workspace is meant to include gametimer.cpp & .h which would create this obj file. But still you aint gave me them :(. I want to test this :cry:.
BTW don't you think its strange no ones mentioned the new Ads :confused:
And what you going on about by me using STUPENDUS ?? I used that in the Hyper threading thread? Which you didn't even reply to :(.
Quote:
Originally posted by Electroman
And what you going on about by me using STUPENDUS ?? I used that in the Hyper threading thread? Which you didn't even reply to :(.
But I did read that thread...and I think you used it once before that too...on some other thread, or on MSN or something....
But I can't understand why you need thegame timer obj file. Becuase I deleted the gime timer cpp and h file from the project. It was two files that you had given me once. But I couldn't figgure out how to convert a big ****ing int to a float or small int without loosing too much presission.
So I have to look at the code again then...and fix it..:(
Look at the time....how fast I did this...and I even fixed it so you can compile it in release version too....;)..you are stupid..:D
:eek2::eek2::eek2::eek2::eek2::eek2::eek2:
:lol: :lol: :lol: Frame rate I got was over 6000 :D:D:D:D
:eek2::eek2::eek2::eek2::eek2::eek2::eek2:
Ohhh...myyyyy ****ing gooood....thats just ****ing hilarious..:D...I have never checked the frame rate on other C++ DX apps I have made, but I can't belive it will be that much..:D...
BTW I got a PM from Keda and he asked us why we used two threads. He said that two threads where slower. But there was some tricks you could do about it. I think I will PM him again, and ask him what those tricks are.
ow, ok, I suppose if we changed the priorities that might be better :confused:, like if the Message thread had a lower priority then it wouldn't take up as much processor time, or would it not run at all becuase the Game Thread is higher priority. Ow and I tried to take a screen shot of my Frame Rate but it doesn't work :(. I guess we will need to code that our self :D.
Quote:
Originally posted by Electroman
ow, ok, I suppose if we changed the priorities that might be better :confused:, like if the Message thread had a lower priority then it wouldn't take up as much processor time, or would it not run at all becuase the Game Thread is higher priority. Ow and I tried to take a screen shot of my Frame Rate but it doesn't work :(. I guess we will need to code that our self :D.
Yeah I tried too last night to get a screen shot. I think there is an article on how to to that in my Game Programming Gems 2 book..;)
Yeah I was thinking about that with the threads too. And when I am thinking about I think he has a "solution" to that in the Game Terrain book too. I am too lazy to pick it up right now. But I think he has his own rendering thread or somtehing. And when that one starts, he will push up the priority, so he doesn't get as many context changes when he is rendering. Then when the rendering is done, he push it back to normal. And then use sleep(0), so it can get a context change. That way other threads can have their saying...
But the biggest problem right now, is that the Alt+Tab thing is not working as it should..:(
BTW I will fix the Frame rate thing so it doesn't update every frame.....I have done this before because last time I posted a game in the games section everyone complained mine did that so i have code that works by updating every second now :D.
Is the only problem with the Alt + Tab the fact theat when focus is given back it doesn't go back to full screen??
Ow yeah and that sounds good having a high priority Game Thread and using Sleep(0) at the end of each cycle :D. Almost like in VB using the DoEvents ;).
Yea and you said the gametimer.cpp & .h are the ones I gave you....I have actually updated them since so I don't know if its worth using it now they work? :D
Yeah as I said I was thinking about doing that. But I didn't have the time last night...used to much time to get it to print the text....:DQuote:
Originally posted by Electroman
BTW I will fix the Frame rate thing so it doesn't update every frame.....I have done this before because last time I posted a game in the games section everyone complained mine did that so i have code that works by updating every second now :D.
but if you are going to do it. See if you can get that code in an inline function instead of screwing up the whole game loop. I didn't have time time to do that either.
Printing some text was harder then I first though..:D..at least when I never have done it before. And there was no real tutorial on it either.
I am not sure what the problem is. But it freezes the whole app when it gets the focus again. Maybe there is some messages or something we have to pump, or maybe we are getting to many of them. No idea actualy.Quote:
Originally posted by Electroman
Is the only problem with the Alt + Tab the fact theat when focus is given back it doesn't go back to full screen??
??? Come again? They probably worked. But the problem was to convert the result to a null terminated string, so we could show it on the screen. Suit your self if you can manage it. I just added the timer, just to test it. It was actualy how to print to the window I wanted to test out yesterday. So I don't care if you remove all my timer code. As long as you try to use inline functions for all "big chunks" of code that is called every frame. And maybe a init function that is not inline for the code that you have to write to set up. But that depends more on how much "set up" code cou have to write.Quote:
Originally posted by Electroman
.... I don't know if its worth using it now they work? :D
PS: Tell me if you need any assistance on how to print to the screen. I will be glad to help. But converting datatypes in C++, that is realy not my area...:D
ØØ
You do know I made it automatically pause the game when it loses focus so pressing P should unfrezze it ;).Quote:
Posted by NoteMe
I am not sure what the problem is. But it freezes the whole app when it gets the focus again. Maybe there is some messages or something we have to pump, or maybe we are getting to many of them. No idea actualy.
No I see the window isn't actually comming back up, its just sitting in the corner :(.Quote:
Posted by Electroman
You do know I made it automatically pause the game when it loses focus so pressing P should unfrezze it ;).
Quote:
Originally posted by Electroman
You do know I made it automatically pause the game when it loses focus so pressing P should unfrezze it ;).
I wish that was true...does that work for you??? NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
I just got it...then you have to check for keypresses too...
but no...that will not work either...becuase D3DDebug modes, sais that TestCooperativeLevel fails..
BTW I think you have screwwed up the exit process. :lol:
Those memory unallocated errors are back ;).
Yeah it does....there must be something wrong here:Quote:
Originally posted by Electroman
No I see the window isn't actually comming back up, its just sitting in the corner :(.
But I can't see what...Code:__forceinline HRESULT RestoreDevice()
{
HRESULT Result = g_pD3DDevice->TestCooperativeLevel();
//If the device is lost, enter a loop waiting for
//it to be restored.
while(Result == D3DERR_DEVICELOST)
{
//Keep testing the level until it says we
//can reset.
while(Result != D3DERR_DEVICENOTRESET)
{
//Give up control to other applications
Sleep(1000);
//Pump messages in order to respond to messages
//that may lead to restoration.
//MSG Message;
//PeekMessage(&Message, 0, 0, 0, PM_REMOVE);
//TranslateMessage(&Message);
//DispatchMessage(&Message);
//Check to see if things are ready to be reset
Result = g_pD3DDevice->TestCooperativeLevel();
}
//Reset the device using the saved parameters
if (FAILED(g_pD3DDevice->Reset(&g_d3dpp)))
Result = D3DERR_DEVICELOST;
}
return S_OK;
}
Yea but it should restore the window ok (as long as that code is run even when paused?) Then DInput will be restored and the user sees the paused screen then they press P its like if you press P before Aly Tabbing then it just frezzes the animation ;).Quote:
Posted by NoteMe
I wish that was true...does that work for you??? NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
I just got it...then you have to check for keypresses too...
but no...that will not work either...becuase D3DDebug modes, sais that TestCooperativeLevel fails..
Quote:
Originally posted by Electroman
BTW I think you have screwwed up the exit process. :lol:
Those memory unallocated errors are back ;).
All of them? I didn't get them I think...but I know that I am not deallocating the Font object right...I have a comment over the init function for it...
Quote:
Originally posted by Electroman
Yea but it should restore the window ok (as long as that code is run even when paused?) Then DInput will be restored and the user sees the paused screen then they press P its like if you press P before Aly Tabbing then it just frezzes the animation ;).
Yeah, but the problem is that TestCooperativeLevel fails, and as long as that fail, you won't even see the Pause screen...
If you see this code:
It is in the middle of the RestoreDevice function. That code was there in the DX8 samples that I had. But I have commented it out here, becuase it doesn't work anyway. But if it is not commented away, will they get to the message handler?Code://Pump messages in order to respond to messages
//that may lead to restoration.
//MSG Message;
//PeekMessage(&Message, 0, 0, 0, PM_REMOVE);
//TranslateMessage(&Message);
//DispatchMessage(&Message);
Myabe we are not getting the propper message where it should go...
You should have known better than to do this :rolleyes:I've highlighted my chnage.....It now restores the device and the Input works once it gets focus back. However it still doesn't display :confused:Code:if (D3DERR_DEVICENOTRESET == PostRender()){
//do any pre-cleanup
PreReset();
//Let the device class reset the device
RestoreDevice();
//Tell the rest of the app that this has happened
PostReset();
}
I'm getting these errors back. It is probably caused by the GameThread not exiting before the WinThread, which I'm not sure why. I haven't spotted what could have changed to do this yet..Quote:
Originally posted by NoteMe
All of them? I didn't get them I think...but I know that I am not deallocating the Font object right...I have a comment over the init function for it...
Code:The thread 'Win32 Thread' (0xe10) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xb04) has exited with code 0 (0x0).
Direct3D9: (ERROR) :Memory still allocated! Alloc count = 142
Direct3D9: (ERROR) :Current Process (pid) = 00000c78
Direct3D9: (ERROR) :Memory Address: 0033856c lAllocID=1 dwSize=000047f8, ReturnAddr=00e63796 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 00335bf4 lAllocID=9 dwSize=000019bc, ReturnAddr=00e5e1e9 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 00335224 lAllocID=10 dwSize=00000008, ReturnAddr=00e5e289 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 0033f24c lAllocID=11 dwSize=00000860, ReturnAddr=00e62f45 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 0033cd9c lAllocID=20 dwSize=000006bc, ReturnAddr=00e6f12f (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 0033d48c lAllocID=22 dwSize=00001d88, ReturnAddr=00e6478b (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 003384ec lAllocID=24 dwSize=00000008, ReturnAddr=00e648bc (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 01020064 lAllocID=26 dwSize=00003500, ReturnAddr=00e63796 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 00335834 lAllocID=27 dwSize=00000198, ReturnAddr=00e63796 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 00335314 lAllocID=28 dwSize=00000030, ReturnAddr=00e63796 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 0102359c lAllocID=29 dwSize=00001020, ReturnAddr=00e63796 (pid=00000c78)
Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 54608 bytes
The program '[3192] Basis.exe: Native' has exited with code 0 (0x0).
The program '[3192] Basis.exe: Direct3D HAL (HWVP) Device 1' has exited with code 0 (0x0).
Quote:
Originally posted by Electroman
I'm getting these errors back. It is probably caused by the GameThread not exiting before the WinThread, which I'm not sure why. I haven't spotted what could have changed to do this yet..
Code:The thread 'Win32 Thread' (0xe10) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xb04) has exited with code 0 (0x0).
Direct3D9: (ERROR) :Memory still allocated! Alloc count = 142
Direct3D9: (ERROR) :Current Process (pid) = 00000c78
Direct3D9: (ERROR) :Memory Address: 0033856c lAllocID=1 dwSize=000047f8, ReturnAddr=00e63796 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 00335bf4 lAllocID=9 dwSize=000019bc, ReturnAddr=00e5e1e9 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 00335224 lAllocID=10 dwSize=00000008, ReturnAddr=00e5e289 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 0033f24c lAllocID=11 dwSize=00000860, ReturnAddr=00e62f45 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 0033cd9c lAllocID=20 dwSize=000006bc, ReturnAddr=00e6f12f (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 0033d48c lAllocID=22 dwSize=00001d88, ReturnAddr=00e6478b (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 003384ec lAllocID=24 dwSize=00000008, ReturnAddr=00e648bc (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 01020064 lAllocID=26 dwSize=00003500, ReturnAddr=00e63796 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 00335834 lAllocID=27 dwSize=00000198, ReturnAddr=00e63796 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 00335314 lAllocID=28 dwSize=00000030, ReturnAddr=00e63796 (pid=00000c78)
Direct3D9: (ERROR) :Memory Address: 0102359c lAllocID=29 dwSize=00001020, ReturnAddr=00e63796 (pid=00000c78)
Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 54608 bytes
The program '[3192] Basis.exe: Native' has exited with code 0 (0x0).
The program '[3192] Basis.exe: Direct3D HAL (HWVP) Device 1' has exited with code 0 (0x0).
I think has something to do with the Font object...;)...becuase I didn't find out a good way to free up the fon't object...so it doesn't do it at all..;)