I have an effect code with a basic structure like
technique TechniqueName {
pass FirstPass {
Profile = fx_4_0
VertexShader = RenderFirstVS
GeometryShader = null
PixelShader = RenderFirstPS
}
pass SecondPass {
Profile = fx_4_0
VetrexShader = RenderSecondVS
GeometryShader = null
PixelShader = RenderSecondPS
}
pass ThirdPass {
Profile = fx_4_0
VertexShader = RenderThirdVS
GeometryShader = null
PixelShader = RenderThirdPS
}
}
Now I tried to compile this with
using (BinaryReader reader = new BinaryReader(stream)) {
CompilationResult result = ShaderBytecode.Compile(reader.ReadBytes((int)stream.Length), "fx_4_0");
if (result.HasErrors) {
throw new Exception(result.Message, new Exception(result.ResultCode.ToString()));
}
Data = result.Bytecode.Data;
}
stream is new MemoryStream(Encoding.Default.GetBytes(effectContent)).
The Data-Property (byte[]) is about 1 KiB large but if I try to load it via
context.InputAssembler.InputLayout = new InputLayout(device, effect.Data, someElements)
it crashes with following exception D3D11 ERROR: ID3D11Device::CreateInputLayout: Input Signature in bytecode could not be parsed. Data may be corrupt or in an unrecognizable format. [ STATE_CREATION ERROR #161: CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE]
Any idea how I can fix this or why the error is thrown? I do not want to use multiple shaders because I reuse many parameters I do not want to reassign in a deferred shading setup.