Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix bug using several blend modes at same time on PSVITA.

  • Loading branch information...
commit 7e7c6586948e4ce1eacce20f70b73fcd31d50e32 1 parent 266937f
Jose Antonio Leal de Farias authored
View
1  MonoGame.Framework/Graphics/GraphicsDevice.cs
@@ -1094,7 +1094,6 @@ public void Clear(ClearOptions options, Vector4 color, float depth, int stencil)
_graphics.SetClearColor(color.ToPssVector4());
_graphics.Clear();
- ApplyState(false);
#elif OPENGL
// Unlike with XNA and DirectX... GL.Clear() obeys several
View
6 MonoGame.Framework/Graphics/SpriteBatch.cs
@@ -87,7 +87,11 @@ public void End ()
if (_sortMode != SpriteSortMode.Immediate)
Setup();
-
+#if PSM
+ GraphicsDevice.BlendState = _blendState;
+ _blendState.ApplyState(GraphicsDevice);
+#endif
+
_batcher.DrawBatch(_sortMode);
}
View
7 MonoGame.Framework/Graphics/States/BlendState.cs
@@ -323,24 +323,27 @@ static private SharpDX.Direct3D11.ColorWriteMaskFlags GetColorWriteMask(ColorWri
#if PSM
internal void ApplyState(GraphicsDevice device)
{
-#warning its a simplistic implementation..i am not sure about this equivalence
- device._graphics.Enable(EnableMode.Blend);
if (device.BlendState == BlendState.Additive)
{
+ device._graphics.Enable(EnableMode.Blend);
device._graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.One, BlendFuncFactor.One);
}
else if (device.BlendState == BlendState.AlphaBlend)
{
+ device._graphics.Enable(EnableMode.Blend);
device._graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcAlpha, BlendFuncFactor.OneMinusSrcAlpha);
}
else if (device.BlendState == BlendState.NonPremultiplied)
{
+ device._graphics.Enable(EnableMode.Blend);
device._graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.SrcColor, BlendFuncFactor.OneMinusSrcColor);
}
else if (device.BlendState == BlendState.Opaque)
{
+ device._graphics.Enable(EnableMode.Blend);
device._graphics.SetBlendFunc(BlendFuncMode.Add, BlendFuncFactor.One, BlendFuncFactor.Zero);
}
+ else device._graphics.Disable(EnableMode.Blend);
}
#endif
}
Please sign in to comment.
Something went wrong with that request. Please try again.