One last question (hopefully). As I say, I'm trying to target any hardware from feature level 10.1 to 9.1, and falling back to a WARP/Direct3D 10 device where no hardware support could be found. With that in mind, I'm hoping to write all of my application including shaders etc. to work with feature level 9.1.
I assume subsequent versions support older shader profiles, etc. Is this a correct assumption? I ask because my test effect...
// ---------// Variables// ---------float4x4 worldViewProjection;texture tex;// ---------------// Texture Sampler// ---------------sampler textureSampler = sampler_state{ Texture = <tex>; Filter = MIN_MAG_POINT_MIP_LINEAR; // ANISOTROPIC AddressU = MIRROR; AddressV = MIRROR;};// ----------// Structures// ----------struct VS_IN{ float4 Position : POSITION0; float2 TexCoord : TEXCOORD0;};struct VS_OUT{ float4 Position : SV_POSITION; float2 TexCoord : TEXCOORD0;};struct PS_OUT{ float4 Colour : SV_TARGET;};// -------------// Vertex Shader// -------------VS_OUT vs_main(VS_IN input){ VS_OUT output; output.Position = mul(input.Position, worldViewProjection); output.TexCoord = input.TexCoord * 2; return output;}// ------------// Pixel Shader// ------------PS_OUT ps_main(VS_OUT input){ PS_OUT output; output.Colour = float4(1, 1, 1, 1); output.Colour = tex2D(textureSampler, input.TexCoord); output.Colour.g = input.TexCoord.g / 2; output.Colour.b = input.TexCoord.r / 2; return output;}// ----------// Techniques// ----------technique10 Render{ pass Pass_0 { VertexShader = compile vs_4_0 vs_main(); PixelShader = compile ps_4_0 ps_main(); }}
... seems to work on feature level 9.1, but the vertex and pixel shaders seem to compile to profile 4.0, and feature level 9.1 is supposed to only support profile 2.0. So presumably this wouldn't work on Direct3D 9 hardware that only supports shader model 2.0?
I assume that effect are written to target the Direct3D version (10) in this case, and the shaders within that effect are written to target specific shader profiles - in this case, 2.0 onwards. Please correct these assumptions where necessary!
I've been unable to create a Direct3D 10-loadable effect which compile to vs_2_0 / ps_2_0. If someone happens to have an example of this, it'd be very helpful.
Thanks