3
#include "GPU/ge_constants.h"
5
enum StencilValueType {
17
enum ReplaceAlphaType {
19
REPLACE_ALPHA_YES = 1,
20
REPLACE_ALPHA_DUALSOURCE = 2,
23
enum ReplaceBlendType {
25
REPLACE_BLEND_STANDARD,
26
REPLACE_BLEND_PRE_SRC,
27
REPLACE_BLEND_PRE_SRC_2X_ALPHA,
28
REPLACE_BLEND_2X_ALPHA,
30
REPLACE_BLEND_COPY_FBO,
33
enum LogicOpReplaceType {
39
bool IsAlphaTestTriviallyTrue();
40
bool IsColorTestAgainstZero();
41
bool IsColorTestTriviallyTrue();
42
bool IsAlphaTestAgainstZero();
44
StencilValueType ReplaceAlphaWithStencilType();
45
ReplaceAlphaType ReplaceAlphaWithStencil(ReplaceBlendType replaceBlend);
46
ReplaceBlendType ReplaceBlendWithShader(bool allowShaderBlend, GEBufferFormat bufferFormat);
48
bool CanUseHardwareTransform(int prim);
49
LogicOpReplaceType ReplaceLogicOpType();
52
// Common representation, should be able to set this directly with any modern API.
53
struct ViewportAndScissor {
68
void ConvertViewportAndScissor(bool useBufferedRendering, float renderWidth, float renderHeight, int bufferWidth, int bufferHeight, ViewportAndScissor &out);
69
float ToScaledDepth(u16 z);
70
float FromScaledDepth(float z);
71
float DepthSliceFactor();
73
// These are common to all modern APIs and can be easily converted with a lookup table.
74
enum class BlendFactor : uint8_t {
86
ONE_MINUS_CONSTANT_COLOR,
88
ONE_MINUS_CONSTANT_ALPHA,
95
enum class BlendEq : uint8_t {
104
struct GenericBlendState {
106
bool resetShaderBlending;
107
bool applyShaderBlending;
108
bool dirtyShaderBlend;
109
ReplaceAlphaType replaceAlphaWithStencil;
111
BlendFactor srcColor;
112
BlendFactor dstColor;
113
BlendFactor srcAlpha;
114
BlendFactor dstAlpha;
122
void setFactors(BlendFactor srcC, BlendFactor dstC, BlendFactor srcA, BlendFactor dstA) {
128
void setEquation(BlendEq eqC, BlendEq eqA) {
132
void setBlendColor(uint32_t color, uint8_t alpha) {
133
blendColor = color | ((uint32_t)alpha << 24);
134
useBlendColor = true;
136
void defaultBlendColor(uint8_t alpha) {
137
blendColor = 0xFFFFFF | ((uint32_t)alpha << 24);
138
useBlendColor = true;
142
void ConvertBlendState(GenericBlendState &blendState, bool allowShaderBlend);
143
void ApplyStencilReplaceAndLogicOp(ReplaceAlphaType replaceAlphaWithStencil, GenericBlendState &blendState);
145
struct GenericStencilFuncState {
147
GEComparison testFunc;
156
void ConvertStencilFuncState(GenericStencilFuncState &stencilFuncState);