I feel I might be doing something tremendously stupid - but I seem to be getting some seriously bizarre errors occuring. To give you a summary of what's occurring, I get an exception thrown by DPSF telling me that essentially the XBox only has 512 megs available and I'm trying to allocate a much smaller number.
An unhandled exception of type 'System.Exception' occurred in DPSFXbox360.dll
Additional information: Not enough video memory to draw the particle system. The XBox 360 can only allocate about 524,287 bytes in video memory when using DrawUserPrimitives(). You are trying to allocate 12,672 bytes.
I'm using SgMotion to animate our games main character - it's not particularly demanding:
3922 verts, 4097 polys, 44 bones - with up to 600 or so keyframes.
The game has a 6 sided cube which is instanced.
We're allowing 500 particles at most from a single emitter using DefaultTexturedQuadParticleSystem
Has anyone encountered this sort of issue before? DPSF runs fine on its own, but the moment my Skinned Model comes in to play - it thows that exception when I call DrawAllParticleSystems
More info on the exception:
Inner exception: System.InvalidOperationException: An unexpected error has occurred.
at Microsoft.Xna.Framework.Graphics.GraphicsHelpers.ThrowExceptionFromResult(UInt32 result)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawUserIndexedPrimitives[T](PrimitiveType primitiveType, DefaultTexturedQuadParticleVertex vertexData, Int32 vertexOffset, Int32 numVertices, Array indexData, Int32 indexOffset, Int32 primitiveCount, VertexDeclaration vertexDeclaration, Boolean sixteenBit)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawUserIndexedPrimitives[T](PrimitiveType primitiveType, DefaultTexturedQuadParticleVertex vertexData, Int32 vertexOffset, Int32 numVertices, Int32 indexData, Int32 indexOffset, Int32 primitiveCount, VertexDeclaration vertexDeclaration)
at DPSF.DPSF`2.Draw(Boolean bCalledByDrawableGameComponent)
at SunBurnGame3.StarterGame.RenderSunburnScene(GameTime gameTime)
at SunBurnGame3.StarterGame.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at SunBurnGame3.StarterGame.Program.Main(String args)
4:44am here and I've been staring at this for far too long. If anyone has any thoughts on things I could inspect, or if this is a known issue - that would be great. I mostly tend to code gameplay, so this stuff tends to put me a little out of my depth :-(
Dan here, the creator of DPSF. Just as a heads up, while creating DPSF I noticed during my testing that if an InvalidOperationException was thrown while trying to draw particles it was typically due to trying to draw too much (i.e. not enough memory), which is why I catch any InvalidOperationExceptions and wrap them with that little blurb about how much memory is being used to draw the particles.
It's possible though that the InvalidOperationException could be thrown for a different reason other than "out of memory". So while memory limitations might be the case, the problem could possibly be something else as well. So I would maybe ignore the part about being out of memory, and just pay attention to the inner exception, which is what was actually thrown by XNA. A good place to start might be to Google possible reasons why an InvalidOperationException might be thrown when trying to draw in XNA.