And another progress update…

Well, I’ve mostly been busy with cleaning up some of the code. The engine went through various iterations of Direct3D and Visual Studio over the years. I think some of the components are around 10 years old now. My coding style has also changed over the years, and Visual Studio has become more picky.

First I completed the backporting of D3D9 into the engine. I now have a single codebase that can be used for D3D9, D3D10 and D3D11. It’s not quite perfect yet, as I still would like to reduce the number of special cases in the code, and make the whole thing more generic… Also not all parts of the D3D9 functionality are fully covered in D3D10/11 yet. I just add those as I go. However, it does produce working binaries in all three APIs, so as far as proof-of-concept goes, that’s good enough.

After getting the initial code working, I decided to also clean up the code, and make it more up-to-date. I’ve made the MFC code cleaner, and started using unicode. I’ve also fixed up most of the warnings that the compiler would generate. It’s gotten to a point where a full compile would reach about 100 warnings. Getting a bit crazy.

Another thing I did was to put the actual engine code inside a DLL, and use an executable as a loader. This allowed me to test for compatible API/hardware without too much trouble. If I put all the code in a DLL, I don’t have to do any dynamic loading of the D3D API functions myself. If the DLL loads, then all its imports have loaded as well. So I just created a few simple functions in my own DLL, to see if it was possible to create a hardware device on the API as well, and then start the engine. The executable just tries to load D3D11 first, if that fails, it tries to load D3D10, then finally D3D9. It all works silently, so the user just has to click the executable, and he should automatically see the initialization dialog for the API that best suits his hardware.

I didn’t stop there, because I also wanted to have a nice frontend for 32-bit and 64-bit. So I decided to make a simple loader application. The application itself is 32-bit, so it should run everywhere. It then tries to determine whether you are actually running a 32-bit OS, or if it is a Wow64 process on a 64-bit OS instead. Then it will either start the 64-bit or the 32-bit binary for the actual engine. I don’t name those .exe but rather .bin. This way the end-user will only see a single executable, and will just run that one. Very simple and clean. I’ve put up a simple test application here:

The next step will be to expand the functionality. I still have to make my BHM object loader compatible with the new D3D10/11 engine. I also haven’t fully implemented the lighting yet. After that, I’m not entirely sure where to go from there. There’s still this idea of making a REYES-style tessellating rendering pipeline via Cuda, OpenCL or DirectX 11 Compute Shaders… and back in the day of the D3D9 engine, I wanted to write some streaming code to handle really large objects efficiently. The 3dsmax exporter could use an update as well, I suppose. It never quite worked with tangentspace exports anyway. And some other minor things to clean up the general code and make it all more functional and efficient.

On another note… Vista Service Pack 2 was finally released in Dutch… so I could install it on my laptop as well… Or at least, that’s what I tried. For some reason it completes the whole installation, but then after stage 3 of 3 at 100%, it still says the installation failed, and then it does a complete rollback. At the end I just get error 0x80004005, which is apparently a very generic “Something went wrong, but we don’t know what” message. Generally it’s caused by applications or drivers that aren’t compatible with Service Pack 2, like some Norton stuff etc… or so some Googling told me. Well, I tried to update all the drivers for my hardware, uninstall everything I didn’t need, and tried a few times more… but everytime with the same result: 0x80004005. One thing I haven’t tried yet is to disable/remove the OptiArc DVD driver. I vaguely recall having issues with that thing before. Since it doesn’t appear to be any of the other devices, that thing is my last hope. If that doesn’t fix it, I’ll just have to give up… no SP2 for my laptop then…

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s