Jump to content
  • Advertisement
  • entries
  • comments
  • views

Hieroglyph 3 and Metro Apps

Sign in to follow this  
Jason Z


Getting Started

My overall goal as mentioned in my last entry is to get Hieroglyph 3 operational in a Metro style app. In an ideal world, I would want to have the complete library running in both "Desktop" mode (i.e. Win32 applications) and also in "Metro" mode (i.e. WinRT applications). However, after my initial analysis, pulling this off will probably require changing the library to such an extent that it wouldn't be able to run on Windows 7 where the WinRT library functions aren't available. So at the moment, all of the changes that I make and describe in this mini-series of posts are done on a local copy of the Hieroglyph unless indicated otherwise. This may be the beginning of Hieroglyph 4, but if possible I would like to keep the main library in a single repository... We'll see how that goes sometime down the road.

The setup I am using for development is my netbook, which is a single core AMD Athlon II Neo @1.7GHz and with a AMD Radeon HD 4225. Since I'm targetting Metro style apps, I naturally am running on the Windows 8 Consumer Preview and using the Visual Studio 11 Beta, both of which you can get here.

Identifying What Needs To Be Done

Microsoft is doing a good job of making tutorials and samples available for the general public to get started on Metro development. However, the proof is in the pudding - the first step in converting Hieroglyph over to Metro capable is to get it to compile under VS11. On the first try, I just cloned the latest Hieroglyph 3 repository and loaded it up in VS11 and tried to compile. The first thing to notice is the six billion errors because of missing dependencies. Since Direct3D and all his friends are now part of the core Windows development setup, there is no DirectX SDK anymore.

In Visual Studio 2010, the specific directories that a project needs to include are inserted via a per-project property setting - typically using a system variable to identify where the DirectX SDK include files are. VS11 also has the same property setup, so I just changed the existing include references to point to the new location. On my machine, this was located in the {...} directory. After updating these, I tried compiling again, and had more of the files trying to compile - but still lots and lots of errors.

To determine everything that needs to be updated, I simply disabled and/or commented out the portions of the library that weren't compiling due to things that aren't available to Metro style apps. After about an hour of going through this process, I compiled the library successfully and produced quite a list of things that need to be updated. They can roughly be categorized into a few main topics, as described below:

  1. Shader Compilation / Reflection

  2. Texture Loading

  3. Matrix Functions

  4. Text Rendering

  5. Application Model

  6. Enumeration Updates

Each of these topics is going to take some time to get past, and I'll be writing about them as I go. However, I wanted to give a quick indication of what is behind each of these issues.

Shader Compilation / Reflection

For Metro style apps, you are not allowed to compile your shaders at runtime. This does indeed make sense, since the compilation of some shaders takes quite a bit of time, which can cause unnecessary delays to starting up your program and consuming power (which can become important in tablets / mobile devices). However, for the developer this kind of stinks - it more or less means that you have to pre-process your shaders, and if you are actively changing them to get them working, this may cause some problems. Even so, there are work arounds possible, which we will talk about in a dedicated post.

Texture Loading
In general, the super library D3DX has gone the way of the Dodo - it isn't available anymore for Metro apps. This has lots of implications, including the loss of its texture loading functions. Once again, all is not lost - there are other libraries available to do this, and we will talk about it in a future post. Specifically there is DirectXTex if you want to read ahead...

Matrix Functions
Also due to the removal of D3DX, many matrix functions that I used to use are not available anymore. Once again, there is a replacement library that can be used called DirectXMath.

Text Rendering

Hieroglyph 3 uses GDI+ for its glyph generation and text rendering solution. This library is apparently not available anymore for Metro apps, so I will finally have to bite the bullet and upgrade to Direct2D and DirectWrite... That will certainly be a topic for another day...

Application Model

Perhaps the most obvious area to update is the fact that Win32 isn't generally available to Metro apps. This includes the file IO, threading, and a few other areas which are inevitable to update when migrating to Metro compatibility.

Enumeration Updates

This final point appears to be the removal of some old enum values that were dual defined with both D3D10_XXX and generic D3D_XXX names. I checked the headers in the DXSDK, and the D3D_XXX versions were there already and I was just using the old names. This is probably due to the fact that I started on Hieroglyph 3 with the pre-release version of D3D11 and just never updated. So these corrections I will make in the main line of Hieroglyph 3 as well as my Metro port.

Wrapping Up

So with the library compiling, now it is time to fix and replace the items that I had to disable. It will be a long road to get something rendered into a window, but I am already having fun learning about all the new goodies that are available in Metro style apps. Once these areas have been addressed, we will also start exploring these new capabilities too. I hope you enjoy the ride as much as I am smile.png
Sign in to follow this  


Recommended Comments

Hi Jason

I just want to check, for those of us that have little or no interest in Metro style apps, are you still going to continue developing and enhancing the Win32 version of Hieroglyph, or will you be parking that and focusing purely on the Metro version in future?


Share this comment

Link to comment
Hi Ben,

Actually it is quite the contrary - my research into the Metro side of things is actually driving me to improve the standard Win32 version. In fact, my statement above about creating Glyph4 was a little premature. After checking more into how the new APIs are structured, I think Metro is going to be more like just a different windowing framework for the engine.

In this form, the core D3D11 engine will remain one code base, and the Metro app code will be at the application level - much like the Win32 and MFC versions are already in the current engine.

Have no fear - Hieroglyph3 will most certainly continue to be developed and extended for Win32. Actually, that is what the desktop app (on Win8) setup will use anyways - so there is a clear need to support a variety of runtimes... I think this will help drive a cleaner design that allows for easier interchangability in the app side components.

Thanks for the question though - and I'm happy to hear that you are watching what is happening with Hieroglyph 3!

Share this comment

Link to comment
Nice work Jason, and an interesting read.

Glad to hear you can consider Metro just another windowing framework wrt engine design.

Hopefully we won't have too long to wait for D3D11 tablets - I'm itching to touch my shaders!

Share this comment

Link to comment
Right on about the tablets - I've been waiting since the //BUILD event to get my hands on a Win8 tablet. Hopefully the OEMs can come up with some worthy competitors to the iPad...

The Metro stuff is certainly different than Win32, but I think its possible to massage things enough to keep them mostly common. We'll see over time how right I am :)

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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!