Implement Constant Color blends (#1119)

* Implement Constant Color blends and init blend states

* Address gdkchan's comments

Also adds Set methods to GpuState

* Fix descriptions of QueryModified
This commit is contained in:
mageven 2020-04-25 18:30:43 +05:30 committed by GitHub
parent 75ec30c962
commit a728610b40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 140 additions and 16 deletions

View file

@ -35,6 +35,8 @@ namespace Ryujinx.Graphics.OpenGL
private bool _scissor0Enable = false;
ColorF _blendConstant = new ColorF(0, 0, 0, 0);
internal Pipeline()
{
_rasterizerDiscard = false;
@ -478,11 +480,6 @@ namespace Ryujinx.Graphics.OpenGL
}
}
public void SetBlendColor(ColorF color)
{
GL.BlendColor(color.Red, color.Green, color.Blue, color.Alpha);
}
public void SetBlendState(int index, BlendDescriptor blend)
{
if (!blend.Enable)
@ -504,6 +501,17 @@ namespace Ryujinx.Graphics.OpenGL
(BlendingFactorSrc)blend.AlphaSrcFactor.Convert(),
(BlendingFactorDest)blend.AlphaDstFactor.Convert());
if (_blendConstant != blend.BlendConstant)
{
_blendConstant = blend.BlendConstant;
GL.BlendColor(
blend.BlendConstant.Red,
blend.BlendConstant.Green,
blend.BlendConstant.Blue,
blend.BlendConstant.Alpha);
}
GL.Enable(IndexedEnableCap.Blend, index);
}