2018-08-10 04:09:40 +00:00
|
|
|
|
namespace Ryujinx.Graphics.Gal
|
|
|
|
|
{
|
2018-11-01 04:22:24 +00:00
|
|
|
|
public struct ColorMaskState
|
2018-10-17 21:02:23 +00:00
|
|
|
|
{
|
2019-03-04 01:45:25 +00:00
|
|
|
|
private static readonly ColorMaskState DefaultBackingField = new ColorMaskState()
|
2018-10-17 21:02:23 +00:00
|
|
|
|
{
|
|
|
|
|
Red = true,
|
|
|
|
|
Green = true,
|
|
|
|
|
Blue = true,
|
|
|
|
|
Alpha = true
|
|
|
|
|
};
|
|
|
|
|
|
2019-03-04 01:45:25 +00:00
|
|
|
|
public static ColorMaskState Default => DefaultBackingField;
|
2018-10-17 21:02:23 +00:00
|
|
|
|
|
|
|
|
|
public bool Red;
|
|
|
|
|
public bool Green;
|
|
|
|
|
public bool Blue;
|
|
|
|
|
public bool Alpha;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-01 04:22:24 +00:00
|
|
|
|
public struct BlendState
|
|
|
|
|
{
|
2019-03-04 01:45:25 +00:00
|
|
|
|
private static readonly BlendState DefaultBackingField = new BlendState()
|
2018-11-01 04:22:24 +00:00
|
|
|
|
{
|
|
|
|
|
Enabled = false,
|
|
|
|
|
SeparateAlpha = false,
|
2018-11-14 21:50:31 +00:00
|
|
|
|
EquationRgb = GalBlendEquation.FuncAdd,
|
2018-11-01 04:22:24 +00:00
|
|
|
|
FuncSrcRgb = GalBlendFactor.One,
|
|
|
|
|
FuncDstRgb = GalBlendFactor.Zero,
|
2018-11-14 21:50:31 +00:00
|
|
|
|
EquationAlpha = GalBlendEquation.FuncAdd,
|
2018-11-01 04:22:24 +00:00
|
|
|
|
FuncSrcAlpha = GalBlendFactor.One,
|
|
|
|
|
FuncDstAlpha = GalBlendFactor.Zero
|
|
|
|
|
};
|
|
|
|
|
|
2019-03-04 01:45:25 +00:00
|
|
|
|
public static BlendState Default => DefaultBackingField;
|
2018-11-01 04:22:24 +00:00
|
|
|
|
|
|
|
|
|
public bool Enabled;
|
|
|
|
|
public bool SeparateAlpha;
|
|
|
|
|
public GalBlendEquation EquationRgb;
|
|
|
|
|
public GalBlendFactor FuncSrcRgb;
|
|
|
|
|
public GalBlendFactor FuncDstRgb;
|
|
|
|
|
public GalBlendEquation EquationAlpha;
|
|
|
|
|
public GalBlendFactor FuncSrcAlpha;
|
|
|
|
|
public GalBlendFactor FuncDstAlpha;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-10 04:09:40 +00:00
|
|
|
|
public class GalPipelineState
|
|
|
|
|
{
|
2018-10-17 21:02:23 +00:00
|
|
|
|
public const int Stages = 5;
|
2018-08-10 04:09:40 +00:00
|
|
|
|
public const int ConstBuffersPerStage = 18;
|
2018-10-17 21:02:23 +00:00
|
|
|
|
public const int RenderTargetsCount = 8;
|
2018-08-10 04:09:40 +00:00
|
|
|
|
|
|
|
|
|
public long[][] ConstBufferKeys;
|
|
|
|
|
|
|
|
|
|
public GalVertexBinding[] VertexBindings;
|
|
|
|
|
|
2018-09-18 04:30:35 +00:00
|
|
|
|
public bool FramebufferSrgb;
|
|
|
|
|
|
2018-08-10 04:09:40 +00:00
|
|
|
|
public float FlipX;
|
|
|
|
|
public float FlipY;
|
|
|
|
|
|
2018-08-25 04:16:58 +00:00
|
|
|
|
public int Instance;
|
|
|
|
|
|
2018-08-10 04:09:40 +00:00
|
|
|
|
public GalFrontFace FrontFace;
|
|
|
|
|
|
2018-10-25 21:30:09 +00:00
|
|
|
|
public bool CullFaceEnabled;
|
2018-08-10 04:09:40 +00:00
|
|
|
|
public GalCullFace CullFace;
|
|
|
|
|
|
2018-10-25 21:30:09 +00:00
|
|
|
|
public bool DepthTestEnabled;
|
|
|
|
|
public bool DepthWriteEnabled;
|
2018-08-10 04:09:40 +00:00
|
|
|
|
public GalComparisonOp DepthFunc;
|
2018-10-23 19:04:08 +00:00
|
|
|
|
public float DepthRangeNear;
|
|
|
|
|
public float DepthRangeFar;
|
2018-08-10 04:09:40 +00:00
|
|
|
|
|
|
|
|
|
public bool StencilTestEnabled;
|
2018-10-14 02:54:14 +00:00
|
|
|
|
public bool StencilTwoSideEnabled;
|
2018-08-10 04:09:40 +00:00
|
|
|
|
|
|
|
|
|
public GalComparisonOp StencilBackFuncFunc;
|
2018-10-25 21:30:09 +00:00
|
|
|
|
public int StencilBackFuncRef;
|
|
|
|
|
public uint StencilBackFuncMask;
|
|
|
|
|
public GalStencilOp StencilBackOpFail;
|
|
|
|
|
public GalStencilOp StencilBackOpZFail;
|
|
|
|
|
public GalStencilOp StencilBackOpZPass;
|
|
|
|
|
public uint StencilBackMask;
|
2018-08-10 04:09:40 +00:00
|
|
|
|
|
|
|
|
|
public GalComparisonOp StencilFrontFuncFunc;
|
2018-10-25 21:30:09 +00:00
|
|
|
|
public int StencilFrontFuncRef;
|
|
|
|
|
public uint StencilFrontFuncMask;
|
|
|
|
|
public GalStencilOp StencilFrontOpFail;
|
|
|
|
|
public GalStencilOp StencilFrontOpZFail;
|
|
|
|
|
public GalStencilOp StencilFrontOpZPass;
|
|
|
|
|
public uint StencilFrontMask;
|
|
|
|
|
|
2019-01-13 21:26:42 +00:00
|
|
|
|
public int ScissorTestCount;
|
|
|
|
|
public bool[] ScissorTestEnabled;
|
|
|
|
|
public int[] ScissorTestX;
|
|
|
|
|
public int[] ScissorTestY;
|
|
|
|
|
public int[] ScissorTestWidth;
|
|
|
|
|
public int[] ScissorTestHeight;
|
|
|
|
|
|
2018-11-01 04:22:24 +00:00
|
|
|
|
public bool BlendIndependent;
|
|
|
|
|
public BlendState[] Blends;
|
2018-08-10 04:09:40 +00:00
|
|
|
|
|
2018-11-01 04:22:24 +00:00
|
|
|
|
public bool ColorMaskCommon;
|
|
|
|
|
public ColorMaskState[] ColorMasks;
|
2018-10-14 02:54:14 +00:00
|
|
|
|
|
2018-08-10 04:09:40 +00:00
|
|
|
|
public bool PrimitiveRestartEnabled;
|
|
|
|
|
public uint PrimitiveRestartIndex;
|
|
|
|
|
|
|
|
|
|
public GalPipelineState()
|
|
|
|
|
{
|
|
|
|
|
ConstBufferKeys = new long[Stages][];
|
|
|
|
|
|
2019-03-04 01:45:25 +00:00
|
|
|
|
for (int stage = 0; stage < Stages; stage++)
|
2018-08-10 04:09:40 +00:00
|
|
|
|
{
|
2019-03-04 01:45:25 +00:00
|
|
|
|
ConstBufferKeys[stage] = new long[ConstBuffersPerStage];
|
2018-08-10 04:09:40 +00:00
|
|
|
|
}
|
2018-10-17 21:02:23 +00:00
|
|
|
|
|
2018-11-01 04:22:24 +00:00
|
|
|
|
Blends = new BlendState[RenderTargetsCount];
|
|
|
|
|
|
2019-01-13 21:26:42 +00:00
|
|
|
|
ScissorTestEnabled = new bool[RenderTargetsCount];
|
|
|
|
|
ScissorTestY = new int[RenderTargetsCount];
|
|
|
|
|
ScissorTestX = new int[RenderTargetsCount];
|
|
|
|
|
ScissorTestWidth = new int[RenderTargetsCount];
|
|
|
|
|
ScissorTestHeight = new int[RenderTargetsCount];
|
|
|
|
|
|
2018-11-01 04:22:24 +00:00
|
|
|
|
ColorMasks = new ColorMaskState[RenderTargetsCount];
|
2018-08-10 04:09:40 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|