Converting Directx 9 shaders for Directx 11.1 (Windows Store Apps)

I am trying to learn writing DirectX shaders with hlsl for a DirectX Windows Store App.

Visual Studio 2012 has a great tool to help designing shaders but since I am novice in shaders, I can not interpret the exported hlsl source and possibly alter it to fine-tune the shaders.

What I would like to have actually is to be able to re-use some of shaders written for DirectX 9 (mostly to be used with XNA). Also, net has very useful tutorials to teach shaders for DirectX 9. I am comparing the shaders for DirectX 9 and 11 but can not see how I may convert existing DirectX 9 shaders to the ones I may use in DirectX 11.

I think I am missing some basic concepts to dive into details on this. Please let me know the differences between the shaders in the two platforms.

A reference to a document or a good tutorial will greatly be appreciated.

The biggest difference I see is that DirectX 11 shaders has a main function like below although old shaders do not.

P2F main(V2P pixel)

Instead they have something like below:

technique10 FireTechnique
{
    pass pass0
    {
        SetBlendState(AlphaBlendingOn, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
        SetVertexShader(CompileShader(vs_4_0, FireVertexShader()));
        SetPixelShader(CompileShader(ps_4_0, FirePixelShader()));
        SetGeometryShader(NULL);
    }
}

Upvotes: 2

Views: 2472

Answers (1)

bjorke
bjorke

Reputation: 3305

Try http://msdn.microsoft.com/en-us/library/windows/desktop/ff476190(v=vs.85).aspx

But really maybe you should get a handle on the DX9 shaders first (FXComposer? I'm not sure how you have sourced these DX9 shaders) -- it feels a bit like you'd like to translate from one language you don't know into another you don't know without learning the first one.

Upvotes: 1

Related Questions