I'm using the MiniTri D3D11 sample that's in the repository (DX11 branch), I've updated all of the code to match the changes made since that was written and the latest SDK (Feb 2010).
I'm having difficulty creating an InputLayout from the MiniTri.fx vertex shader however.
Relevant code is below:
string errors;
using (D3D11.ShaderBytecode vsShaderByte = D3D11.ShaderBytecode.CompileFromFile("MiniTri.fx", "VS", "vs_4_0", SlimDX.Direct3D11.ShaderFlags.None, SlimDX.Direct3D11.EffectFlags.None, null, null, out errors))
{
VertexShader = new SlimDX.Direct3D11.VertexShader(Device, vsShaderByte);
D3D11.ShaderSignature s = D3D11.ShaderSignature.GetInputSignature(vsShaderByte);
Layout = new D3D11.InputLayout(Device, s, inputElements);
}
The code breaks on the "Layout = ..." line, with the following error in my output window:
D3D11: ERROR: ID3D11Device::CreateInputLayout: Encoded Signature size doesn't match specified size. [ STATE_CREATION ERROR #161: CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE ]
Unfortunately, I don't have a clue what that means, and Google hasn't been too helpful so far either.
For reference, the MiniTri.fx file is as follows:
struct VS_IN
{
float4 pos : POSITION;
float4 col : COLOR;
};
struct PS_IN
{
float4 pos : SV_POSITION;
float4 col : COLOR;
};
PS_IN VS( VS_IN input )
{
PS_IN output = (PS_IN)0;
output.pos = input.pos;
output.col = input.col;
return output;
}
float4 PS( PS_IN input ) : SV_Target
{
return input.col;
}
technique10 Render
{
pass P0
{
SetGeometryShader( 0 );
SetVertexShader( CompileShader( vs_4_0, VS() ) );
SetPixelShader( CompileShader( ps_4_0, PS() ) );
}
}
[Edited by - adt7 on March 7, 2010 2:11:46 PM]