Hi, I’m porting my game from XNA, and it’s mostly done. One of the things that’s holding me up is a crash when issuing a post-processing draw call with DrawUserIndexedPrimitives (which worked fine in XNA). It’s having trouble creating an “input layout”, which I presume relates to the vertex stream. I’ve tried it both without and without explicitly specifying the template parameter.
Does MonoGame support VertexPositionTexture or other predefined XNA vertex types? Should I use my own custom type? I have other cases where I call DrawUserIndexedPrimitives() with my own types without a problem.
Here’s the exception that I get:
HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.
at SharpDX.Result.CheckError()
at SharpDX.Direct3D11.Device.CreateInputLayout(InputElement[] inputElementDescsRef, Int32 numElements, IntPtr shaderBytecodeWithInputSignatureRef, PointerSize bytecodeLength, InputLayout inputLayoutOut)
at SharpDX.Direct3D11.InputLayout…ctor(Device device, Byte[] shaderBytecode, InputElement[] elements)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.GetInputLayout(Shader shader, VertexDeclaration decl)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformApplyState(Boolean applyShaders)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformDrawUserIndexedPrimitives[T](PrimitiveType primitiveType, T[] vertexData, Int32 vertexOffset, Int32 numVertices, Int32[] indexData, Int32 indexOffset, Int32 primitiveCount, VertexDeclaration vertexDeclaration)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawUserIndexedPrimitives[T](PrimitiveType primitiveType, T[] vertexData, Int32 vertexOffset, Int32 numVertices, Int32[] indexData, Int32 indexOffset, Int32 primitiveCount, VertexDeclaration vertexDeclaration)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawUserIndexedPrimitives[T](PrimitiveType primitiveType, T[] vertexData, Int32 vertexOffset, Int32 numVertices, Int32[] indexData, Int32 indexOffset, Int32 primitiveCount)
at GameWork.Graphics.PostProcessRenderer.Render(RenderSettings settings, Texture2D sceneTexture) in G:\Programming\XNA\GameWork\Graphics\PostProcessRenderer.cs:line 131
at GameWork.Graphics.RenderCamera.RenderPostProcesses(RenderSettings settings, Scene scene) in G:\Programming\XNA\GameWork\Graphics\RenderCamera.cs:line 411
at GameWork.Graphics.GameRenderer.RenderScene(Scene scene, GameTime currentTime) in G:\Programming\XNA\GameWork\Graphics\GameRenderer.cs:line 195
at GameWork.Graphics.GameRenderer.Render(GameTime currentTime) in G:\Programming\XNA\GameWork\Graphics\GameRenderer.cs:line 106
at GameWork.GameLoop.GameLoop.Render() in G:\Programming\XNA\GameWork\GameLoop\GameLoop.cs:line 1047
at Inversion2D.InversionGame.Draw(GameTime gameTime) in G:\Programming\XNA\Inversion2D\Inversion2DGame\InversionGame.cs:line 321