The Renderloop.. Re-re-re-revisited.

My coworker Rick has taken the time to write out his thoughts on the infamous render loop.  Naturally, he needed to do this for his upcoming book, but it’s something we here have been talking about for a long time and I simply haven’t had the time to look at very indepth..

He’s bounced some ideas off of me periodically for the last few weeks, and I think the solution he came up with looks pretty solid.. I haven’t played with it much (ok, not at all), but will do so soon..

Game Developers Conference…

In a little over twelve hours from now I leave once again for the annual Game Developers Conference.  This year there are a few things different.. One, it’s earlier in the year than previously.. Two, it’s in San Francisco rather than San Jose this year..  Three, I’m not actually speaking at this one.

Not speaking has both a good side and a bad side.  The good side naturally being that I’m not speaking.  Despite the number of times I’ve given presentations to large audiences and spoken in public, it still comes with a sense of nervousness and anxiety.  The bad side is there is a bit of new stuff I want to talk about I can’t..  I guess everyone will have to wait.. =)

Hopefully the change of venue will ‘help’ some of the overcrowding that was happening back in San Jose..  I guess we’ll find out soon enough..

It’s come to my attention…

That the folks over at TrayGames are starting to make some noise..  They’re looking to meet some prospective developers at this years Game Developers Conference (yes i’ll be there), and even have a blog started up for their community.

With their new platform coming out soon, it seems likely we’ll be seeing a much larger array of Managed DX games soon.  I’d highly recommend you go check them out!

February DirectX SDK Available!

It’s actually been available a few days, but..  Here are the new features:

What’s New in this Release:

For a complete list of updates, please refer to the SDK Documentation “What’s New” sections.

SDK

  • Windows 2000 is no longer a supported platform for the SDK.
  • All of the DirectShow components (Header, Libs, Utilities, Tools, and Samples) were moved to the extras folder.

New Samples and Technical Articles

  • New “Top Issues for Windows Titles” article
  • New PRTCmdLine sample
  • New Managed HDRFormat sample
  • Updated “Install-on-Demand for Games” and “Gaming with Least-Privileged User Accounts” with information about patching

Tool Updates

 

Enhancements to PIX have been made:

  • You can now capture the Microsoft Direct3D calls made by a single frame of your application and play them back within PIX.
  • When grabbing screenshots:
    • You can append an incrementing number, or the current frame number, to the screenshot filename.
    • You can specify whether to overwrite existing image files with the same filename.
    • You can specify whether to show or hide the mouse cursor in the screenshot.
  • New command-line options are available to:
    • Convert a .PIXRun file to a .csv format that can be read by Microsoft
    • Save an exclusive-or comparison of two images to a file

D3DX

 


Precomputed Radiance Transfer
The precomputed radiance transfer (PRT) system has been enhanced:

  • New fast raytracing methods have been added for direct computation of ray/mesh intersections against a simulation scene.
  • GPU-accelerated direct-lighting computation now supports normal maps.

Math Library

  • D3DX math functions on X64 have been heavily optimized for 64-bit processors in this release.

HLSL Compiler

  • A series of improvements and bug fixes have been made to the HLSL compiler

Effects Framework

  • New functions have been added to allow a developer to specify parameters to be ignored by the effects system and managed directly by the application.

D3DX as a Dynamic-Link Library

  • Starting with this SDK release, D3DX is being released as a dynamic-link library (DLL). Updates to D3DX in the future will continue to ship as uniquely-named DLLs that exist side-by-side on the system. This allows for continued improvements to the library without imposing regression risk. D3DX9.lib is still provided as the import library for the DLL which your application can statically link against. See documentation for details.
  • The D3DX DLL included in the SDK is automatically installed as part of Installing DirectX with DirectSetup. If your application does not use D3DX, you can remove D3DX from the redistributable (see Directx redist.txt for details).
  • The statically-linked debug library (D3DX9dt.lib) has been removed; use D3DX9d.lib instead

Other

  • D3DX for DirectX8 was removed from the SDK in December. This was not mentioned in the release notes for the December SDK.

 
You can download the new SDK here.

A cornucopia of topics!

It’s been a while since I’ve written anything here, but a few other posts today have gotten me to change that now.  First David Weller tries answering the question “Does Managed DirectX discriminate against VB.NET Developers”..  Since he put me on the spot to answer it, i’ll do that first.

In short, no, of course not.  He hits the nail on the head that it’s mainly about time, and given my busy schedule, it’s quite difficult to get the stuff out that I do end up releasing.  It’s also at least partially about maintenance.  Considering in the past when we had VB.NET and C# version of the samples, the VB.NET versions were simply mirrors of the C# version.  Which means not only do you need to ‘write’ two versions of the same code (3 if you count the original unmanaged version), whenever any one of them changes, all of them must be updated..  It can become quite a bit of work when the samples are changing daily.

I’d also disagree with David’s assertion that you can’t possibly master DX without knowing C++, but the fact is the *majority* of our customers (the game developers) do know c++, C# is a more logical language to use as the starting block for the managed samples.  We will have a VB.NET sample in this upcoming release though.  Oh, and the original post that David quotes is using a bug that shipped in the summer 2004 release as the reason for the discrimination question..  It is just that, a bug.  One that has now been fixed and will be released soon.  We would *never* intentionally ‘break’ something out of spite or whatever the case may be.

So, to summarize, we have no intentional ‘discrimination’ against vb developers in the least.  In a perfect world, where I had infinite time, we would have thousands of samples, in all the languages available, but the fact is, it’s not a perfect world.  We’re trying to add new stuff (including VB samples) as we’re progressing.

David also mentioned Andy Dunn’s new web site on Managed DirectX.  It includes an interview with the lead developer on the first retail MDX game i posted about last time.  In his ‘disadvantages’ section, he lists a few problems he had with MDX, which were all based on the Summer 2003 version.  I believe that I addressed all of those in the latest version, but by all means, if people are seeing bugs and/or issues in the assemblies, please let me know.

Since i’m on a writing roll, let’s continue on to books..  The second book should be hitting store shelves ‘soon’ (it’s definitely already been sent to printing, i’m just not exactly sure when it’ll arrive on shelves).  However, the third book is a different story.  At this point in time, I simply do not have the time required to dedicate myself to writing that book.  I think it’s an important book that is written though, so I’m glad that one of my coworkers has picked up the project.  While it may be not be me writing the book or the code directly, I will be at least tangentally involved (he’s right down the hall from me after all).  The project has been left in good hands, and i’m excited to see the end result.

Oh, and unlike David, I haven’t found Half Life 2 to be all that great.  Sure, the graphics engine is *amazing*, but in reality, I’m so burnt out on first person shooters, I just get annoyed with the gameplay half the time..  I fully expect to get flamed for those last two sentences. =)  It would be hard to disagree with the statement on World of Warcraft though.  I find myself playing that way too often..  (Even though I was sad when they deleted my level 60 warlock from the closed beta)

Why can’t I compile Managed DX code using the MC++ Compiler?

This has become a popular quest recently, so naturally that means it must be time to blog about it..  People have been discovering that simple MDX code just doesn’t seem to compile with the Summer 2004 release of the Managed DX assemblies..  Simple code such as this:

Form1 __gc* pForm = new Form1();
// Create a new device
Device __gc* pDevice = NULL;
PresentParameters __gc* pParams = new PresentParameters();
PresentParameters* pArrayParams __gc[] = {pParams};
// Setup params
pParams->SwapEffect = SwapEffect::Discard;
pParams->Windowed = true;
pDevice = new Device(0, DeviceType::Hardware, pForm, CreateFlags::SoftwareVertexProcessing, pArrayParams);

They’ll see compilation errors such as:

Form1.cpp(24) : error C3635: ‘Microsoft.DirectX.PrivateImplementationDetails::IDirect3DDevice9’: undefined native type used in ‘Microsoft::DirectX::Direct3D::Device’; imported native types must be defined in the importing source code
did you forget to include a header file?

Which is puzzling to say the least, and even more so because using the Summer 2003 SDK release will work correctly.  The problem lies in how the MC++ compiler generates assemblies with native code in them.  First, it will actually create public variations of the unmanaged components (i.e., IDirect3DDevice9) and stick them in the assembly.  Unfortunately, it places these ‘types’ in whatever namespace the #include for the header file happened to be in, normally the ‘blank’ namespace.  Look at the MDX assemblies from the 2003 release in the object browser and you’ll see what I mean as it is literally cluttered with hundreds of these bogus types.

For the 2004 release, we decided to ‘tidy up’ these references, and move them into a single ‘private’ namespace.  Looking at the MDX assemblies for the 2004 release, you’ll see that all of those unusable ‘types’ are now found in the Microsoft.DirectX.PrivateImplementationDetails namespace.  Much cleaner to look at, much better organized.

However, now when the MC++ compiler tries to *use* these assemblies, for whatever reason it looks for the native types to be declared *within that same namespace*.  You’d have to ask the MC++ team why this is since it seems a little strange to me (i.e., C# and VB.NET work just fine without this information)..  In order to successfully compile the code above using the 2004 release you need to actually *include* the d3d9 header files within the namespace mentioned above.  Something such as:

namespace Microsoft
{
namespace DirectX
{
namespace PrivateImplementationDetails
{
#include
}
}
}

Thankfully, the MC++ compiler for the Whidbey timeframe is much improved, and situations like this will soon be a thing of the past.  But in the meantime, this is how you get around the issue people are having trouble with.  (Note that you’d also need to include the file if you’re using the functionality provided there)

The Summer 2004 SDK Update For DirectX has been released..

— Official announcement – DX Web site should be updated soon..
The DirectX(r) Team is pleased to announce the final release of DirectX 9.0 SDK Update (Summer 2004)!
The DirectX 9.0 SDK Update (Summer 2004) contains updated versions of the D3DX library, graphics samples, sample framework, tools and Managed DirectX documentation. Areas of concentration in the DirectX 9.0 SDK Update (Summer 2004) release are:
– HLSL support for Pixel Shader & Vertex Shader 3.0
– Effects Framework performance improvements
– Pre computed Radiance Transfer improvements
– New Sample framework
– New & Updated Samples
– Improved Documentation
– PIX tool for better debugging of Direct3D applications
– Introduction of the Preview Pipeline for easier content creation
For information on what is supported in shader model 3.0, refer to the updated reference documentation. You can install the final releases from the below locations.
Software Developer Kit (230Mb+)
Extras (40Mb+)

Symbols (20Mb+)

Release Notes
Please feel free to post any concerns and/or discuss any issues with this SDK release within this forum, the public newsgroups or mail us directly at directx@microsoft.com
Enjoy!