Sign in to follow this  
davepl1968

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

Recommended Posts

davepl1968    166

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 this post


Link to post
Share on other sites
Ravyne    14300

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 this post


Link to post
Share on other sites
Matias Goldberg    9573

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 this post


Link to post
Share on other sites
Hodgman    51222

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 this post


Link to post
Share on other sites
davepl1968    166

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 this post


Link to post
Share on other sites
Hodgman    51222

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 :/

Share this post


Link to post
Share on other sites
ongamex92    3255

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
MrCodeSushi    1066

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
Hodgman    51222

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 this post


Link to post
Share on other sites
Ravyne    14300

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."
  • More info at the end of August, at GamesCon.

 

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.

Share this post


Link to post
Share on other sites

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

Sign in to follow this  

  • Similar Content

    • By gsc
      Hi! I am trying to implement simple SSAO postprocess. The main source of my knowledge on this topic is that awesome tutorial.
      But unfortunately something doesn't work... And after a few long hours I need some help. Here is my hlsl shader:
      float3 randVec = _noise * 2.0f - 1.0f; // noise: vec: {[0;1], [0;1], 0} float3 tangent = normalize(randVec - normalVS * dot(randVec, normalVS)); float3 bitangent = cross(tangent, normalVS); float3x3 TBN = float3x3(tangent, bitangent, normalVS); float occlusion = 0.0; for (int i = 0; i < kernelSize; ++i) { float3 samplePos = samples[i].xyz; // samples: {[-1;1], [-1;1], [0;1]} samplePos = mul(samplePos, TBN); samplePos = positionVS.xyz + samplePos * ssaoRadius; float4 offset = float4(samplePos, 1.0f); offset = mul(offset, projectionMatrix); offset.xy /= offset.w; offset.y = -offset.y; offset.xy = offset.xy * 0.5f + 0.5f; float sampleDepth = tex_4.Sample(textureSampler, offset.xy).a; sampleDepth = vsPosFromDepth(sampleDepth, offset.xy).z; const float threshold = 0.025f; float rangeCheck = abs(positionVS.z - sampleDepth) < ssaoRadius ? 1.0 : 0.0; occlusion += (sampleDepth <= samplePos.z + threshold ? 1.0 : 0.0) * rangeCheck; } occlusion = saturate(1 - (occlusion / kernelSize)); And current result: http://imgur.com/UX2X1fc
      I will really appreciate for any advice!
    • By isu diss
       I'm trying to code Rayleigh part of Nishita's model (Display Method of the Sky Color Taking into Account Multiple Scattering). I get black screen no colors. Can anyone find the issue for me?
       
      #define InnerRadius 6320000 #define OutterRadius 6420000 #define PI 3.141592653 #define Isteps 20 #define Ksteps 10 static float3 RayleighCoeffs = float3(6.55e-6, 1.73e-5, 2.30e-5); RWTexture2D<float4> SkyColors : register (u0); cbuffer CSCONSTANTBUF : register( b0 ) { float fHeight; float3 vSunDir; } float Density(float Height) { return exp(-Height/8340); } float RaySphereIntersection(float3 RayOrigin, float3 RayDirection, float3 SphereOrigin, float Radius) { float t1, t0; float3 L = SphereOrigin - RayOrigin; float tCA = dot(L, RayDirection); if (tCA < 0) return -1; float lenL = length(L); float D2 = (lenL*lenL) - (tCA*tCA); float Radius2 = (Radius*Radius); if (D2<=Radius2) { float tHC = sqrt(Radius2 - D2); t0 = tCA-tHC; t1 = tCA+tHC; } else return -1; return t1; } float RayleighPhaseFunction(float cosTheta) { return ((3/(16*PI))*(1+cosTheta*cosTheta)); } float OpticalDepth(float3 StartPosition, float3 EndPosition) { float3 Direction = normalize(EndPosition - StartPosition); float RayLength = RaySphereIntersection(StartPosition, Direction, float3(0, 0, 0), OutterRadius); float SampleLength = RayLength / Isteps; float3 tmpPos = StartPosition + 0.5 * SampleLength * Direction; float tmp; for (int i=0; i<Isteps; i++) { tmp += Density(length(tmpPos)-InnerRadius); tmpPos += SampleLength * Direction; } return tmp*SampleLength; } static float fExposure = -2; float3 HDR( float3 LDR) { return 1.0f - exp( fExposure * LDR ); } [numthreads(32, 32, 1)] //disptach 8, 8, 1 it's 256 by 256 image void ComputeSky(uint3 DTID : SV_DispatchThreadID) { float X = ((2 * DTID.x) / 255) - 1; float Y = 1 - ((2 * DTID.y) / 255); float r = sqrt(((X*X)+(Y*Y))); float Theta = r * (PI); float Phi = atan2(Y, X); static float3 Eye = float3(0, 10, 0); float ViewOD = 0, SunOD = 0, tmpDensity = 0; float3 Attenuation = 0, tmp = 0, Irgb = 0; //if (r<=1) { float3 ViewDir = normalize(float3(sin(Theta)*cos(Phi), cos(Theta),sin(Theta)*sin(Phi) )); float ViewRayLength = RaySphereIntersection(Eye, ViewDir, float3(0, 0, 0), OutterRadius); float SampleLength = ViewRayLength / Ksteps; //vSunDir = normalize(vSunDir); float cosTheta = dot(normalize(vSunDir), ViewDir); float3 tmpPos = Eye + 0.5 * SampleLength * ViewDir; for(int k=0; k<Ksteps; k++) { float SunRayLength = RaySphereIntersection(tmpPos, vSunDir, float3(0, 0, 0), OutterRadius); float3 TopAtmosphere = tmpPos + SunRayLength*vSunDir; ViewOD = OpticalDepth(Eye, tmpPos); SunOD = OpticalDepth(tmpPos, TopAtmosphere); tmpDensity = Density(length(tmpPos)-InnerRadius); Attenuation = exp(-RayleighCoeffs*(ViewOD+SunOD)); tmp += tmpDensity*Attenuation; tmpPos += SampleLength * ViewDir; } Irgb = RayleighCoeffs*RayleighPhaseFunction(cosTheta)*tmp*SampleLength; SkyColors[DTID.xy] = float4(Irgb, 1); } }  
    • By amadeus12
      I made my obj parser
      and It also calculate tagent space for normalmap.
      it seems calculation is wrong..
      any good suggestion for this?
      I can't upload my pics so I link my question.
      https://gamedev.stackexchange.com/questions/147199/how-to-debug-calculating-tangent-space
      and I uploaded my code here


      ObjLoader.cpp
      ObjLoader.h
    • By Alessandro Pozzer
      Hi guys, 

      I dont know if this is the right section, but I did not know where to post this. 
      I am implementing a day night cycle on my game engine and I was wondering if there was a nice way to interpolate properly between warm colors, such as orange (sunset) and dark blue (night) color. I am using HSL format.
      Thank  you.
    • By thefoxbard
      I am aiming to learn Windows Forms with the purpose of creating some game-related tools, but since I know absolutely nothing about Windows Forms yet, I wonder:
      Is it possible to render a Direct3D 11 viewport inside a Windows Form Application? I see a lot of game editors that have a region of the window reserved for displaying and manipulating a 3D or 2D scene. That's what I am aiming for.
      Otherwise, would you suggest another library to create a GUI for game-related tools?
       
      EDIT:
      I've found a tutorial here in gamedev that shows a solution:
      Though it's for D3D9, I'm not sure if it would work for D3D11?
       
  • Popular Now