flibitijibibo / FNA-MGHistory

FNA - Accuracy-focused XNA4 reimplementation for open platforms
http://fna-xna.github.io/
246 stars 37 forks source link

[MojoShader] MOJOSHADER_glSetVertexAttribDivisor causes 'System.AccessViolationException' on some computers #310

Closed SeanColombo closed 9 years ago

SeanColombo commented 9 years ago

We recently deployed Reversi with full FNA (HEAD of master as of about a week ago) and the version of MojoShader.dll (from the fnalibs) that was built on April 21st.

This works fine on our testing computers, including a Windows 7 computer, but a user in the wild reported this problem on a Win 7 computer (with updated video drivers):

20150508_15:27:52.632 INFO : Beginning first draw call
20150508_15:27:52.745 ERROR : Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
20150508_15:27:52.748 ERROR : at MojoShader.MOJOSHADER_glSetVertexAttribDivisor(MOJOSHADER_usage usage, Int32 index, UInt32 divisor)
at Microsoft.Xna.Framework.Graphics.OpenGLDevice.ApplyVertexAttributes(VertexBufferBinding[] bindings, Int32 numBindings, Boolean bindingsUpdated, Int32 baseVertex)
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType primitiveType, Int32 baseVertex, Int32 minVertexIndex, Int32 numVertices, Int32 startIndex, Int32 primitiveCount)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.RenderBatch(Int32 offset, Int32 batchSize)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.FlushBatch()
at Microsoft.Xna.Framework.Graphics.SpriteBatch.End()

I verified that they have the right MojoShader.dll, and they don't have any other MojoShader.dlls installed.

(Apologies if I'm misunderstanding, and this doesn't end up being an FNA issue, but that's my best guess at the moment).

flibitijibibo commented 9 years ago

I'm thinking you found someone that managed to have ARB_draw_instanced, but not ARB_instanced_arrays. This will probably fix it:

https://github.com/flibitijibibo/FNA/commit/213c96453f541d80c1837b2f4f4c0cd8c6aba17a

SeanColombo commented 9 years ago

@flibitijibibo thank you for the quick fix! Rebuilt & pushed it live, will let you know what the user says :)

SeanColombo commented 9 years ago

That did the trick. Thanks @flibitijibibo! :D