blob: c044a55fc3bd17b39958ae97d71e159702a3ac8d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
namespace Ryujinx.Graphics.Gal
{
public struct ColorMaskState
{
private static readonly ColorMaskState DefaultBackingField = new ColorMaskState()
{
Red = true,
Green = true,
Blue = true,
Alpha = true
};
public static ColorMaskState Default => DefaultBackingField;
public bool Red;
public bool Green;
public bool Blue;
public bool Alpha;
}
public struct BlendState
{
private static readonly BlendState DefaultBackingField = new BlendState()
{
Enabled = false,
SeparateAlpha = false,
EquationRgb = GalBlendEquation.FuncAdd,
FuncSrcRgb = GalBlendFactor.One,
FuncDstRgb = GalBlendFactor.Zero,
EquationAlpha = GalBlendEquation.FuncAdd,
FuncSrcAlpha = GalBlendFactor.One,
FuncDstAlpha = GalBlendFactor.Zero
};
public static BlendState Default => DefaultBackingField;
public bool Enabled;
public bool SeparateAlpha;
public GalBlendEquation EquationRgb;
public GalBlendFactor FuncSrcRgb;
public GalBlendFactor FuncDstRgb;
public GalBlendEquation EquationAlpha;
public GalBlendFactor FuncSrcAlpha;
public GalBlendFactor FuncDstAlpha;
}
public class GalPipelineState
{
public const int Stages = 5;
public const int ConstBuffersPerStage = 18;
public const int RenderTargetsCount = 8;
public long[][] ConstBufferKeys;
public GalVertexBinding[] VertexBindings;
public bool FramebufferSrgb;
public float FlipX;
public float FlipY;
public int Instance;
public GalFrontFace FrontFace;
public bool CullFaceEnabled;
public GalCullFace CullFace;
public bool DepthTestEnabled;
public bool DepthWriteEnabled;
public GalComparisonOp DepthFunc;
public float DepthRangeNear;
public float DepthRangeFar;
public bool StencilTestEnabled;
public bool StencilTwoSideEnabled;
public GalComparisonOp StencilBackFuncFunc;
public int StencilBackFuncRef;
public uint StencilBackFuncMask;
public GalStencilOp StencilBackOpFail;
public GalStencilOp StencilBackOpZFail;
public GalStencilOp StencilBackOpZPass;
public uint StencilBackMask;
public GalComparisonOp StencilFrontFuncFunc;
public int StencilFrontFuncRef;
public uint StencilFrontFuncMask;
public GalStencilOp StencilFrontOpFail;
public GalStencilOp StencilFrontOpZFail;
public GalStencilOp StencilFrontOpZPass;
public uint StencilFrontMask;
public int ScissorTestCount;
public bool[] ScissorTestEnabled;
public int[] ScissorTestX;
public int[] ScissorTestY;
public int[] ScissorTestWidth;
public int[] ScissorTestHeight;
public bool BlendIndependent;
public BlendState[] Blends;
public bool ColorMaskCommon;
public ColorMaskState[] ColorMasks;
public bool PrimitiveRestartEnabled;
public uint PrimitiveRestartIndex;
public GalPipelineState()
{
ConstBufferKeys = new long[Stages][];
for (int stage = 0; stage < Stages; stage++)
{
ConstBufferKeys[stage] = new long[ConstBuffersPerStage];
}
Blends = new BlendState[RenderTargetsCount];
ScissorTestEnabled = new bool[RenderTargetsCount];
ScissorTestY = new int[RenderTargetsCount];
ScissorTestX = new int[RenderTargetsCount];
ScissorTestWidth = new int[RenderTargetsCount];
ScissorTestHeight = new int[RenderTargetsCount];
ColorMasks = new ColorMaskState[RenderTargetsCount];
}
}
}
|