Thomas Sampson


1 Comment

Debugging DirectX applications with PIX for Windows

Introduction

 After using Microsoft’s PIX tool numerous times over the past couple of years, on a number of projects (all Windows/DX9 based), I was surprised to find that many other students weren’t using PIX and would often spend many hours close to submission date, getting to the bottom of the most tedious graphical bugs or rendering artefacts. I’m confident that the bugs in question could often have been identified and fixed in a matter of moments given the right tools . This brings me to “PIX for Windows”, Microsoft’s graphics debugger for DirectX. Don’t get me wrong, PIX isn’t the answer to all your problems, neither will it fix anything for you automatically out of the box. The purpose of this post is to provide a quick run through the essential prerequisites required in order to get up and running with PIX, followed by a brief explanation of some of the most useful features PIX has to offer. I also demonstrate how you can configure your C++ DirectX application to be “PIX aware”, communicating with PIX to make the debugging experience a little simpler and smarter. For further reference, please see PIX for Windows documentation.

Installing PIX

PIX for Windows is a GUI tool distributed with the Microsoft DirectX SDK and can be found in the following location after install;

%DXSDK_DIR%\Utilities\bin\%ARCHITECTURE%\PIXWin.exe

Configuring Your System

Before firing up PIX, first head to the DirectX Control Panel, this is a nice GUI utility which allows you to tweak the DirectX runtime by enabling/disabling certain features and components.

The DirectX control panel is also part of the Microsoft DirectX SDK and can be found in the following location after install;

%DXSDK_DIR%\Utilities\bin\%ARCHITECTURE%\dxcpl.exe

Regardless of whether or not you choose to use PIX,  it is handy to know about this utility as it can be used to toggle between the debug/release DirectX DLLs and turn on useful compile/runtime feedback . This feedback ranges from efficiency warnings to runtime memory leak reports.

Figure 1 (Click to enlarge)

Figure 1 shows my DirectX Control Panel configuration, which I have tweaked for personal preference. Mirroring this configuration should ensure PIX operates correctly, although not all the options I have enabled are not necessarily fundamental or related to PIX in any way. Play around with this configuration utility and find a configuration you are comfortable with. I often find myself tweaking the “Debug Output Level” slider based on the scenario, and disabling “Break on memory leaks” when I’m looking at someone else’s code and don’t care too much about memory leaks. Also, use “Software Only” mode judiciously, as this disables all hardware acceleration and forces everything to be rendered in software on the CPU (which can be painfully slow!).

Note: The “Render” and “Mesh” windows within PIX do not function correctly when “Maximum Validation” is disabled.

Next: Experiment One >>


2 Comments

Online File Coversion

I know how anoying it is when you get a file you cant open, and that happened to me today when I received a “docX” file from work. I stumbled upon Zamzar which is a great web service which will convert files from many file types to a long list of other file types, and all for free. The service worked great when converting my “docX” file to a simple “doc” file and boasts a long list of file types for documents, images, videos and even archives!

So Whats the catch?

  • Ads (and plenty of them)
  • Document is emailed to you shortly after conversion
  • Converted file must be retrieved within 24 hours after conversion

Other than the points above, brilliant free service. Something like this should definately be integrated into Google Documents which currently lacks support for most of the files zamzar works with!


Leave a comment

C# Microsoft Access database access

This can be used in either a windows application OR an asp.net file.

NOTICE: if using with asp.net file the access file MUST be placed and refered to in the ROOT directory of IIS.

ok, first make the reference

using System.Data.OleDb;

to open and close connection….

OleDbConnection thisConnection = new OleDbConnection(
@”Provider=Microsoft.Jet.OLEDB.4.0;” +
@”Data Source=E:/WEB_SERVER/server_user_database.MDB”);
thisConnection.Open();
//work here//
thisConnection.Close();

to add data…

OleDbCommand new1 = new OleDbCommand(“INSERT INTO tablename (column(s)) values(‘valueshere’)”, thisConnection);
new1.ExecuteNonQuery();

to retrieve data…

OleDbDataReader myReader=null;
OleDbCommand test = new OleDbCommand(“select * from tablename, thisConnection);
myReader = test.ExecuteReader();
while(myReader.Read())
{Label1.Text=(myReader[“columnnamehere”].ToString());};
myReader.Close();

always close connection!!!…

thisConnection.Close();