For some time we've had requests to make some of the graphics pipeline more visible, so that developers can get things like the order of texture page usage, the size of vertex batches and even helping to debug shaders. The reason we've never bothered with these, is because theres already a tool that does this for you, and gives you more than we ever could - PIX.
Pix is a little temperamental to start up however, so I'll give a little walkthrough on using it with a GameMaker: Studio project. We'll use the Angry Cats Space demo for this so let's fire up Studio, select the Demos tab, open up the Intermediate folder, and select Angry_Cats_Space.
Once downloaded and created, create a final executable, but build to a ZIP file - like this:-
Now unzip it and you should be left with something like this in your folder....
Next lets fire up PIX. If you have a start button, search for it by typing PIX into the search at the bottom, if you don't - shame on you! but you can still find it in the DirectX SDK folder. (Download here....)
Once it's all running, select the File menu, and click New Experiment.This should give you a screen like this...
Browse for to your program, and then pick the "More Options" button at the bottom, which will take you to this screen.
Next click the "" button, and change the Trigger Type (on the right) to "Key Combination", and then select a key - I normally use CTRL+ALT+F9. Next select the Unspecified Action under this trigger, and set the Action Type to "Set Call Capture" , and then change the Capture Type to "Single-frame capture Direct3D".
Lastly, add another key combination trigger (again, I normally pick CTRL-ALT-F10 for this one), and change the Action Type to "Terminate Program". This should give you a project like this....
Save the PIX project, then click the little green START button on the toolbar. Once running, you should see some text at the top left - like this.
Next, go into the game by pressing the START button on the title screen - so that we have something interesting to look at, then press your 1st key combo (CTRL+ALT+F9 if you copied me...) a line of text will appear under the PIX output, and then fade away. Next press your second key combo (CTRL+ALT+F10). The game will now quit, and you should be left with a screen like this....
Okay - now the fun can start!!! Look in the Events section above, there is a Frame 7858 node in there - expand this, then on the right in the Details section, click the Render tab (you should get something like the image below).
Now the fun part. If you click the Frame 7858 node again (or whaterver yours is called), and use the cursors to move up and down (or click with the mouse on sub nodes under the Frame node.... you'll actually get to see the image on the right drawing.
On top of this, if you find a SetTexture() call, and right click on the Hex number you can view the texture about to be used. (as shown below). So what you have in this frame nodelist, is the entire D3D render sequence, in a debuggable list. You can view textures, shaders, meshes, vertex buffers - streams, the lot. All by clicking on nodes inside the Frame node list.
Using PIX is not only great fun, but it's an increadibly powerful debugging tool - especially for shaders, as you can see the data going in - and out. Not only that, but you can also see the order of surfaces (RenderTargets) being created, what textures get swapped in, and in which order and so on. There are many sites which take you through the details of actually using PIX, but from this static frame capture (and you can capture many frames in a single session by pressing CTRL+ALT+F9 multiple times in a single run), you can get everything you require about the graphics performance of your game.
Lastly... anything you do to help batching here, will carry onto other platforms, because they are all fundamentally the same.