# DX11 If targetting DX9, should I use the DX11 SDK and methods?

This topic is 1663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I really have no -need- for the new features of DX11, but given its the current and cleaned-up interface, I'm tempted to use it.  However, I will need my game to run on machines that do not have DX11 hardware.  I don't need to target XP (Win7 is fine).

What I'm (obviously) completely unclear about is:  if I write to the DX11 apis and link to the DX11 dlls, but do not use any DX11-specific functionality, will the game run on a machine that only has DX9 hardware but that -does- have the DX11 redistributable?

Since (according to Steam's stats) DX11 penetration is still only about 60%, and I don't require anything new from DX11, it seems like a no-brainer to use DX9.  But if I can write to DX11 and it'll run on DX9 hardware, all the better.

Can someone clarify this for me?

As a tangential question, I've also been playing with the DXUT framework which seems to be able to target both, but if I call D3DX11CompileFromFile to compile a shader (vs_2_0), is there any way that's going to work on DX9 hardware?

Thanks for humoring the DX noob!

Cheers,

Dave

##### Share on other sites

If I'm not mistaken, you can target the DX11 API if you don't need to support XP, and its a good idea for the reasons you cite. Be aware that Win7 (and Vista?) only got a partial update to D3D11 so some features aren't available, but its not an issue if you're targetting feature-level 9_x anyhow. Your game will run fine on DX9 hardware.

If you want to run on Windows RT tablets like Microsoft Surface to reach the widest possible market, target feature-level 9_1 -- which is what all but one of the current ARM-based platforms support, including Surface RT. As an added note, be aware that the current arm-based platforms are typically fill-rate limited (as is the case with SurfaceRT's Tegra3), so be careful to reduce overdraw.

As for shaders, you need to select the shader profiles that are appropriate for feature-level 9_1, and you might have to simplify your shader too. Down-level shader profiles support fewer instruction slots than newer profiles, and may not have enough room to run larger shaders that you might prefer with more-capable hardware.

Edited by Ravyne

##### Share on other sites

Starting DirectX 11, they introduced the notion of "feature levels".

When you initialize D3D with a specific feature level, the API will fail if you try to do something that is only available on higher levels even if your HW is fully D3D 11 compliant.

However it's always advisable of course, to test that your game still works on real older hardware (mostly because of driver issues).

Note that your users will still need Windows 7 to play it (or Windows Vista with DX11 installed)

##### Share on other sites

As Matias mentions, check out the different feature levels.

Feature level 11 gives you access to SM5 hardware (aka DX11 era hardware).
Feature level 10 gives you access to SM4 hardware (aka DX10 era hardware).
Feature level 9 gives you access to SM2 hardware (aka early DX9 era hardware).

You only need to use D3D9 if you require XP support, or you specifically want to target SM3 hardware (aka late DX9 / PS3 / 360 era hardware), because it was left out of the feature levels for some reason (simplicity?)...

As a tangential question, I've also been playing with the DXUT framework which seems to be able to target both, but if I call D3DX11CompileFromFile to compile a shader (vs_2_0), is there any way that's going to work on DX9 hardware?

Yes. The important detail is the target profile (shader model) that you specify. The vs_2_0 profile will produce a SM2 compatible shader, which will work on DX9+ era hardware.

Edited by Hodgman

##### Share on other sites

I'd like to keep my options open for a 360 port, which I assume is a lot easier from a DX9 codebase.  Otherwise it sounds like the DX11 api would be the way to go, but I'm thinking it's a lot of work to port DX11 -> DX9 since the 360 probably lacks the whole "Deal with DX11 apis but map them to DX9_3 features".

##### Share on other sites

I'd like to keep my options open for a 360 port, which I assume is a lot easier from a DX9 codebase.

Keep in mind though that the general public isn't allowed to make DX9/360 games.
The general public can make 360 games using C# and XNA.
Professional companies that have gone through the trouble (and cost) of becoming a licensed 360 developer can make 360 games using C++ and DX9. If you're not a professional company that can afford to spend many tens of thousands on licensing and hardware, then making this kind of 360 game is out of the question :/

I think that the XDK for the xbox one will be released for the public and we will be able to make indie C++ written indie games without paying tons $$. But these thoughts are currently only dreams... #### Share this post ##### Link to post ##### Share on other sites I think that the XDK for the xbox one will be released for the public and we will be able to make indie C++ written indie games without paying tons$$$. But these thoughts are currently only dreams... I sure hope that'll be the case. Current info on the Xbox one indie/self-publishing is scant right now but i think we're supposed to get more info about that next month from Microsoft. #### Share this post ##### Link to post ##### Share on other sites I think that the XDK for the xbox one will be released for the public and we will be able to make indie C++ written indie games without paying tons$.
But these thoughts are currently only dreams...

I sure hope that'll be the case. Current info on the Xbox one indie/self-publishing is scant right now but i think we're supposed to get more info about that next month from Microsoft.

Keep in mind that "indie self publishing" doesn't mean that anyone can publish games on their system.
Sony have been making big noises about how they're now allowing "indie self publishing", but this just means that licensed developers can release a game without requiring them to be signed with a publisher. You still need to be a licensed developer, buy expensive dev-kits, and pay ten grand for a formal submission review prior to publishing...

##### Share on other sites

I doubt if its going to be as accessible as XNA was -- if for the technology alone. XNA was much simplified compared to using DX natively, and the content pipeline was huge. That said, given that you had to manage memory anyways if you wanted to do anything worth a darn, and that C# is a curly-brace language, that C++/CX closes many of the remaining gaps where it applies most (the UI layer), and that DX11 has a smaller conceptual footprint than DX9 ever did, I don't think it'll be so traumatic a transition, once you get over fear of the unknown.

Here's what they've said publicly:

• Every Xbox one can run unsigned code.
• No need for a publisher (I believe by default, Microsoft is considered the publisher, but they don't take ownership of IP, etc)
• psuedo-quote: "If you wanted to prepare for that future today, developing a Windows Store app would be a good place to start."

Putting that all together, I'm wagering on a frills-light SDK based on native C++, C++/CX possibly, that has a similar app-model to Windows Store apps. What I'm kind of curious about, is whether they'll allow access to the game hardware partition on hypervisor. If not, your app will share the OS with some smallish percent of the overall resources -- sources say between 10-20% -- which is still probably about on par with Xbox 360 and very capable. But things would be really interesting if you could use the game partition with 80-90% of the hardware dedicated to your game.

• 10
• 12
• 10
• 10
• 11
• ### Similar Content

• Hi, right now building my engine in visual studio involves a shader compiling step to build hlsl 5.0 shaders. I have a separate project which only includes shader sources and the compiler is the visual studio integrated fxc compiler. I like this method because on any PC that has visual studio installed, I can just download the solution from GitHub and everything just builds without additional dependencies and using the latest version of the compiler. I also like it because the shaders are included in the solution explorer and easy to browse, and double-click to open (opening files can be really a pain in the ass in visual studio run in admin mode). Also it's nice that VS displays the build output/errors in the output window.
Anyone with some experience in this?

• Hello!
Have a problem with reflection shader for D3D11:
1>engine_render_d3d11_system.obj : error LNK2001: unresolved external symbol IID_ID3D11ShaderReflection
#include <D3Dcompiler.h>
#include <D3DCompiler.inl>
#pragma comment(lib, "D3DCompiler.lib")
//#pragma comment(lib, "D3DCompiler_47.lib")
As MSDN tells me but still no fortune. I think lot of people did that already, what I missing?
where recommend to use SDK headers and libs before Wind SDK, but I am not using DirectX SDK for this project at all, should I?

• Hi there, this is my first post in what looks to be a very interesting forum.
I am using DirectXTK to put together my 2D game engine but would like to use the GPU depth buffer in order to avoid sorting back-to-front on the CPU and I think I also want to use GPU instancing, so can I do that with SpriteBatch or am I looking at implementing my own sprite rendering?

• I am trying to draw a screen-aligned quad with arbitrary sizes.

currently I just send 4 vertices to the vertex shader like so:
pDevCon->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
pDevCon->Draw(4, 0);

then in the vertex shader I am doing this:
float4 main(uint vI : SV_VERTEXID) : SV_POSITION
{
float2 texcoord = float2(vI & 1, vI >> 1);
return float4((texcoord.x - 0.5f) * 2, -(texcoord.y - 0.5f) * 2, 0, 1);
}
that gets me a screen-sized quad...ok .. what's the correct way to get arbitrary sizes?...I have messed around with various numbers, but I think I don't quite get something in these relationships.
one thing I tried is:

float4 quad = float4((texcoord.x - (xpos/screensizex)) * (width/screensizex), -(texcoord.y - (ypos/screensizey)) * (height/screensizey), 0, 1);

.. where xpos and ypos is number of pixels from upper right corner..width and height is the desired size of the quad in pixels
this gets me somewhat close, but not right.. a bit too small..so I'm missing something ..any ideas?

.
• By Stewie.G
Hi,
I've been trying to implement a gaussian blur recently, it would seem the best way to achieve this is by running a bur on one axis, then another blur on the other axis.
I think I have successfully implemented the blur part per axis, but now I have to blend both calls with a proper BlendState, at least I think this is where my problem is.
Here are my passes:
D3DX11_TECHNIQUE_DESC techDesc; mBlockEffect->mTech->GetDesc( &techDesc ); for(UINT p = 0; p < techDesc.Passes; ++p) { deviceContext->IASetVertexBuffers(0, 2, bufferPointers, stride, offset); deviceContext->IASetIndexBuffer(mIB, DXGI_FORMAT_R32_UINT, 0); mBlockEffect->mTech->GetPassByIndex(p)->Apply(0, deviceContext); deviceContext->DrawIndexedInstanced(36, mNumberOfActiveCubes, 0, 0, 0); } No blur

PS_BlurV

PS_BlurH

P0 + P1

As you can see, it does not work at all.
I think the issue is in my BlendState, but I am not sure.
I've seen many articles going with the render to texture approach, but I've also seen articles where both shaders were called in succession, and it worked just fine, I'd like to go with that second approach. Unfortunately, the code was in OpenGL where the syntax for running multiple passes is quite different (http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/). So I need some help doing the same in HLSL :-)

Thanks!