Jump to content
  • Advertisement
Sign in to follow this  
Muhammad Haggag

[C++] Direct3D hooking sample

This topic is 2901 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Quote:
Original post by Promit
Maybe I'm missing something here, but isn't that exactly what PIX does?

D'oh...

I just tried that using PIX on GTA: San Andreas. Some sample stats:


DrawPrim............32
DrawIndexedPrim.....160
VB Locks............45
IB Locks............13
SetRenderState......163
SetTexture..........190
SetVertexShader.....6
SetPixelShader......0
SetRenderTarget.....12


Considering that this was a really simple scene (just inside the main characters house, very low complexity) I think those numbers are high.

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
Maybe I'm missing something here, but isn't that exactly what PIX does?

Yeah, essentially... I have to admit I haven't tried it, but you can't get PIX to generate an overdraw of the image, can you? deep pixel analysis yes, but not shader complexity and so on..?

The idea came from this thread. It'd be pretty awesome if you could somehow display the number of pixel shader arithmetic or texture instruction count per-pixel. Could make for a great performance debugging tool - the brighter the colours the more fill-rate related work you're doing etc...

Then again, hacking that in via hooking stands as much chance of breaking things as it does working [lol]

Oh, and the obvious advantage is that it'd be overlayed - giving immediate feedback rather than the capture full stream then analyse the data.

Jack

Share this post


Link to post
Share on other sites
Why might you need that many VB and IB locks per frame?
Was there a legendary particle system in the house or something?

Share this post


Link to post
Share on other sites
Quote:
Original post by DrGUI
Why might you need that many VB and IB locks per frame?
Was there a legendary particle system in the house or something?


Yea, and this is inside a really simple house. I did some more investigating, and profiled a complex scene outside:


DIP Calls: 1300 - 2300 (:O !!!)
VB Locks: 120-145
IB Locks: 50-75

New VBs: 1-5
New IBs: 1-7

FPS: 10-20


Yea...so I wonder really what the frick is going on. Looks like someone at Rockstar needs to read the renown instancing slidedeck...

Share this post


Link to post
Share on other sites
Oh my. This could be used for some serious hacking of applications. Really, you could trace exactly how the api is used - frankly I think it is pretty cool but I am surprised that MS allows this type of thing to be done.

I think I am going to try a few experiments with my own engine and see if this can be used for some type of runtime analysis of my rendering calls. Great work, I appreciate your effort (and typing abilities!).

Share this post


Link to post
Share on other sites
Quote:
Original post by Jason Z
Oh my. This could be used for some serious hacking of applications. Really, you could trace exactly how the api is used - frankly I think it is pretty cool but I am surprised that MS allows this type of thing to be done.

I think so, since they full support the ultimate "hacking" application - PIX. PIX makes it easy to analyze exactly what an application is doing, D3D-wise. IMO, after doing some trials on commercial games, it is more helpful than the hooking approach for profiling.

Share this post


Link to post
Share on other sites
Holy Crap!

I just ran a test run of PIX on the latest build of my game. I tried using PIX long ago when it first came out and wasn't very impressed, but it has really evolved quite a bit from what I remember.

The object window alone is worth using, not to mention the frame rendering stream. So this will work with any D3D9 commercial application? I guess once you ship something you are essentially allowing everyone to see what you are doing - it kind of opens up the doors to smaller developers (like me!) to see what the big boys are doing.

Thats pretty cool.

Share this post


Link to post
Share on other sites
Quote:
Original post by Jason Z
The object window alone is worth using, not to mention the frame rendering stream. So this will work with any D3D9 commercial application? I guess once you ship something you are essentially allowing everyone to see what you are doing - it kind of opens up the doors to smaller developers (like me!) to see what the big boys are doing.

Yea pretty much - they have worked on all commercial games I have tried it on (HL2, Farcry, GTA:SA). If you read a few posts above, I show some figures about GTA that are a little disturbing [crying]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!