Hi everyone.
I’ve got simple Phong shader texturing model with noise. When I try to apply this shader to model, program crashes with exception:
System.InvalidOperationException: "An error occurred while preparing to draw. This is probably because the current vertex declaration does not include all the elements required by the current vertex shader. The current vertex declaration includes these elements: SV_Position0, NORMAL0."
Inner exception:
SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.
Stack trace:
at Microsoft.Xna.Framework.Graphics.InputLayoutCache.GetOrCreate(VertexBufferBindings vertexBuffers)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformApplyState(Boolean applyShaders)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.ApplyState(Boolean applyShaders)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformDrawIndexedPrimitives(PrimitiveType primitiveType, Int32 baseVertex, Int32 startIndex, Int32 primitiveCount)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType primitiveType, Int32 baseVertex, Int32 startIndex, Int32 primitiveCount)
at Microsoft.Xna.Framework.Graphics.ModelMesh.Draw()
at AS.Fractalyze.Core.FractalyzeGame.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DoDraw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.UAPGameWindow.Tick()
at Microsoft.Xna.Framework.UAPGamePlatform.<>c.<StartRunLoop>b__11_0(IAsyncAction action)
I have a couple of other shaders (just texturing, no Phong or noise stuff), they are applies ok.
Shader is built ok with pipeline tool; also I tested it in RenderMonkey (lol), it works ok.
What can cause this trouble?