Reputation: 807
Currently, i'm developing an app for the Windows 8 Store, Windows 8 Desktop and also Windows 7. The App should run smoothly on a Tablet and also on a "normal" Windows 7/8 Device. So, i got a tablet from my work and installed Windows 8 on it, just to realize, that the creepy Intel Graphics Media Accellerator (600) only supports DirectX 9.0c.
So, i tried for hours now to get my DirectX10/11 Effects/Shaders working on DirectX9, but nothing seems to work.. a Test with NVidia's FxComposer shows me, that DirectX9 Effects run good.
I'm programming with SharpDX / C#, and the technique10's and technique11's both are valid (MyTechnique.IsValid == true). To load the effect, i use theese lines of code:
var EffectByteCode = ShaderBytecode.CompileFromFile("DirectX/Shaders/"+FxFile, "fx_5_0", ShaderFlags.None, EffectFlags.None);
var Effect = new Effect(GraphicsProvider.Device, EffectByteCode, EffectFlags.None);
mEffect = FxEffect;
mTechnique11 = mEffect.GetTechniqueByName("main_11"); //works
mTechnique10 = mEffect.GetTechniqueByName("main_10"); //works
mTechnique9 = mEffect.GetTechniqueByName("main_9"); //doesn't work
I pasted the effect source code here: http://pastebin.com/KPxBN1DD.. excluded "main_11" and "main_10", in my tests, i commented them out, so i just removed those comment blocks.. i think dx9 should understand this very simple code..
So my final questions are: - Is the parameter "fx_5_0" valid for loading technique, technique10 and technique11? - Is my shader code correct? Or have i done something terribly wrong? - Do i have to specify any other/additional information/functions/parameters for loading DX9 technique's? - Maybe its a bug of SharpDX? I will take look on the code for this now i think..
Edit: Tried to make the question(s) a bit clearer..
Upvotes: 1
Views: 932
Reputation: 3762
The legacy Effect framework is not supported on Windows 8 Metro (because D3DCompiler_xx.dll is not supported), so you should better work with another solution. Also, Effect is deprecated by Microsoft and no longer supported.
The old Direct3D9 technique(compiled with vs_2_0 or ps_2_0) are not stored in FX files compiled with fx_5_0 (just check the output of fxc.exe compiler and you won't see them).
You have to use vs_4_0_level_9_x or ps_4_0_level_9_x in order to compile them for 9.x down level hardware support using technique10/11 syntax. Also, if all your original shaders could work with vs_4_0_level_9_x and you don't have any specific optimized version for 10.0 or 11.1, then you wouldn't have to compile a main_10 or main_11, as level_9_x shaders are working on any hardware from 9.x to 11.x.
You can probably have a look at SharpDX.Toolkit, not yet official, but It is supporting an Effect framework (with some XNA stock effects like BasicEffect or SpriteBatch). A beta of the toolkit will be available later this month.
Upvotes: 3
Reputation:
Try replacing the SV_TARGET semantic with COLOR0. I've never seen SV_TARGET semantic in D3D9 shaders so far.
Upvotes: 1