So I'm diagnosing a crash I have when porting over to iOS, and I've narrowed it down to the following:
At some point in the update loop, I create a new RenderTarget2D using the following:
new RenderTarget2D(graphics, screenWidth, screenHeight, false, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents). I don't even need to use the RenderTarget for this error to occur, I just need to create it.
After creating the RenderTarget, MonoGame will start throwing exceptions stating OpenGL InvalidEnum whenever I try to do something else with graphics. I've seen this happening on calls to VertexBuffer.Dispose as well as PlatformApply for a shader. As far as I can tell, neither of these calls should throw InvalidEnum.
Whenever I remove the line that creates the RenderTarget, my game launches and works perfectly fine. Is there something I'm missing about RenderTargets on iOS? (this works fine on other platforms like Windows and Android). Do I need to create it in the Render loop? Am I passing incorrect parameters when creating it?
I've spent a few weeks trying to debug this issue, and could really use the help. Thanks!