flibitijibibo/MonoGame — pull request #223 by nickgravelyn (2014-05-16 17:46:47+00:00)
Title: Fixing sampler state flushing

The sampler state flushing was relying on the OpenGLState.NeedsFlush method which relies on an instance level equality comparison. This will fail if the managed object hasn't actually been replaced with another managed object.

I added a NeedsFlush method to OpenGLTexture that just delegates down to each of the OpenGLState objects it has to see if any need to be flushed. I then call this in the main OpenGLDevice.FlushGLState method in addition to the existing checks.

The bug here is easy to repro: make a new game that just loads and draws a single texture using SamplerState.PointClamp and SpriteBatch. You'll see that it doesn't actually draw using point sampling at all, likely because the OpenGLTexture instance is never changed out in the device.