Selecting Reach vs. HiDef

When you create a Windows Phone game project, XNA defaults to Reach profile. When you create a Windows or Xbox 360 project, it defaults to HiDef. But it is also possible to target Reach from a Windows or Xbox game! There are two reasons you might want to do this:

If you want to distribute your Windows game and have it run on a wide range of computers that do not support HiDef functionality

If you are developing on Windows or Xbox, but plan on later porting to Windows Phone, and want to make sure you don't accidentally use graphics features that are not supported on the phone

To use Reach on Windows or Xbox:

Right-click your project in Solution Explorer

Choose Properties

Focus the XNA Game Studio tab, and make your selection

You can also choose profiles at runtime, by setting GraphicsDeviceManager.GraphicsProfile from your Game constructor. It is usually better to specify this via the project properties, though.

If you do not explicitly set GraphicsDeviceManager.GraphicsProfile, it defaults to whatever was chosen in the project properties

Project properties also control the Content Pipeline build process, so it knows how to validate things like max texture size and supported formats

HiDef is a superset of Reach, so if you build content for Reach, you can load the resulting .xnb files into a HiDef graphics device

The reverse is not true: you cannot load content that was built for HiDef into a Reach graphics device

Hehe, if you speak of the devil. I was just figuring out why my shaders refused to compile with the error "XNA Framework Reach profile does not support vertex shader model 3.0". An odd thing though: when I fixed that by following this blog post, they still refused to compile as the shader compiler didn't like me naming a pixelshader 'PixelShader'. When I renamed it 'PS', it compiled.

braddabug

19 Jul 2010 2:06 PM

What's the best way to fallback to Reach if HiDef isn't supported? Can we build assets using Reach even when the rest of the game is built with HiDef, and then at runtime detect if HiDef isn't supported and switch to Reach?

braddabug

19 Jul 2010 2:09 PM

Maybe an "opt-in" approach would work better than an "opt-out." So you build the game with Reach, then at runtime determine if HiDef is supported, and if it is switch to HiDef.

Write code in your game constructor that checks which profile the adapter supports and sets GraphicsDeviceManager.GraphicsProfile accordingly.

If all your content fits into Reach rules, you can build everything for Reach.

If you have some content that needs to be built only for HiDef, you will need to make one more more library projects, so you can split the content up, building one library for Reach and the other for HiDef.

RayB

19 Jul 2010 3:39 PM

I know this probably isn't the correct place to ask this, but I'm getting the same error that JulianR was, except that when I follow both directions, I'm still receiving the error that vertex shader model 3.0 isn't supported. In this version of the beta, is it possible to set the content project to just ignore them if building for a certain platform or even conditionally build techniques based on their version? My project used to work perfectly until this version of the beta :|

The error "XNA Framework Reach profile does not support vertex shader model 3.0" means that the Content Pipeline is building using Reach, not HiDef. Make sure you have changed this in the project properties for whichever project contains the content that is giving this error. If that content is built by a game library, you need to set this on the library itself, not just the game that references that library.

RayB

19 Jul 2010 4:05 PM

Is there a place on line I can look a bit more into this? My VS seems to be quite stubborn on using Reach no matter what I tell it to do :)

Ray: you can manually inspect your project XML files to see for sure what settings are stored in them. Also if you upgraded from an earlier CTP, try recreating new projects to make sure you don't have any legacy CTP stuff getting in the way.

RayB

19 Jul 2010 5:01 PM

Thanks for the help! I had to recreate the CTP instead of upgrading from the previous one! I owe you ten internets :)

JulianR

19 Jul 2010 5:05 PM

> Correct. 'PixelShader' is a reserved word in HLSL, so you can't use this for your own symbol names.

Figured as much, it's just that they compiled just fine under XNA 3.0, so I was a little surprised :)

How can I get a project that uses shader model 3.0 to run on a GPU that doesn't support DX10? With HiDef selected, XNA tells me my GPU (Geforce 7600 GT) isn't supported and with Reach selected it tells me shader model 3.0 isn't supported. The same project worked perfectly with XNA 3.1.

> How can I get a project that uses shader model 3.0 to run on a GPU that doesn't support DX10?

The short answer is you cannot. XNA 4 has only two graphics feature levels: Reach and HiDef. If your card does not support HiDef, you will only be able to run Reach games on it, which means you cannot use any HiDef features (such as shader model 3).

One of the costs of simplifying the hardware caps matrix is less flexibility when it comes to hardware that falls in the gaps between our feature levels. Fortunately, though, the install base of shader model 3 DX9 GPUs (which lie in between Reach and HiDef) is now quite small, and shrinking all the time...

If you want to make a HiDef game with GS4, you will have to upgrade to a more recent GPU.