add AlphaToCoverage and AlphaToOne
This commit is contained in:
parent
8ed7e1af2c
commit
53b4a1af0f
5 changed files with 39 additions and 1 deletions
|
@ -726,7 +726,12 @@ public:
|
|||
|
||||
u32 zeta_enable;
|
||||
|
||||
INSERT_PADDING_WORDS(0x8);
|
||||
union {
|
||||
BitField<1, 1, u32> alpha_to_coverage;
|
||||
BitField<2, 1, u32> alpha_to_one;
|
||||
} multisample_control;
|
||||
|
||||
INSERT_PADDING_WORDS(0x7);
|
||||
|
||||
struct {
|
||||
u32 tsc_address_high;
|
||||
|
@ -1149,6 +1154,7 @@ ASSERT_REG_POSITION(screen_y_control, 0x4EB);
|
|||
ASSERT_REG_POSITION(vb_element_base, 0x50D);
|
||||
ASSERT_REG_POSITION(point_size, 0x546);
|
||||
ASSERT_REG_POSITION(zeta_enable, 0x54E);
|
||||
ASSERT_REG_POSITION(multisample_control, 0x54F);
|
||||
ASSERT_REG_POSITION(tsc, 0x557);
|
||||
ASSERT_REG_POSITION(tic, 0x55D);
|
||||
ASSERT_REG_POSITION(stencil_two_side_enable, 0x565);
|
||||
|
|
|
@ -583,6 +583,7 @@ void RasterizerOpenGL::DrawArrays() {
|
|||
ConfigureFramebuffers(state);
|
||||
SyncColorMask();
|
||||
SyncFragmentColorClampState();
|
||||
SyncMultiSampleState();
|
||||
SyncDepthTestState();
|
||||
SyncStencilTestState();
|
||||
SyncBlendState();
|
||||
|
@ -1033,6 +1034,12 @@ void RasterizerOpenGL::SyncColorMask() {
|
|||
}
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::SyncMultiSampleState() {
|
||||
const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
|
||||
state.multisample_control.alpha_to_coverage = regs.multisample_control.alpha_to_coverage != 0;
|
||||
state.multisample_control.alpha_to_one = regs.multisample_control.alpha_to_one != 0;
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::SyncFragmentColorClampState() {
|
||||
const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
|
||||
state.fragment_color_clamp.enabled = regs.frag_color_clamp != 0;
|
||||
|
|
|
@ -163,6 +163,9 @@ private:
|
|||
/// Syncs the the color clamp state
|
||||
void SyncFragmentColorClampState();
|
||||
|
||||
/// Syncs the alpha coverage and alpha to one
|
||||
void SyncMultiSampleState();
|
||||
|
||||
/// Syncs the scissor test state to match the guest state
|
||||
void SyncScissorTest();
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@ OpenGLState::OpenGLState() {
|
|||
// These all match default OpenGL values
|
||||
geometry_shaders.enabled = false;
|
||||
framebuffer_srgb.enabled = false;
|
||||
multisample_control.alpha_to_coverage = false;
|
||||
multisample_control.alpha_to_one = false;
|
||||
cull.enabled = false;
|
||||
cull.mode = GL_BACK;
|
||||
cull.front_face = GL_CCW;
|
||||
|
@ -504,6 +506,21 @@ void OpenGLState::Apply() const {
|
|||
fragment_color_clamp.enabled ? GL_TRUE : GL_FALSE);
|
||||
}
|
||||
}
|
||||
if (multisample_control.alpha_to_coverage != cur_state.multisample_control.alpha_to_coverage) {
|
||||
if (multisample_control.alpha_to_coverage) {
|
||||
glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
||||
} else {
|
||||
glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
|
||||
}
|
||||
}
|
||||
if (multisample_control.alpha_to_one != cur_state.multisample_control.alpha_to_one) {
|
||||
if (multisample_control.alpha_to_one) {
|
||||
glEnable(GL_SAMPLE_ALPHA_TO_ONE);
|
||||
} else {
|
||||
glDisable(GL_SAMPLE_ALPHA_TO_ONE);
|
||||
}
|
||||
}
|
||||
|
||||
ApplyColorMask();
|
||||
ApplyViewport();
|
||||
ApplyStencilTest();
|
||||
|
|
|
@ -39,6 +39,11 @@ public:
|
|||
bool enabled; // GL_FRAMEBUFFER_SRGB
|
||||
} framebuffer_srgb;
|
||||
|
||||
struct {
|
||||
bool alpha_to_coverage; // GL_ALPHA_TO_COVERAGE
|
||||
bool alpha_to_one; // GL_ALPHA_TO_ONE
|
||||
} multisample_control;
|
||||
|
||||
struct {
|
||||
bool enabled; // GL_CLAMP_FRAGMENT_COLOR_ARB
|
||||
} fragment_color_clamp;
|
||||
|
|
Loading…
Reference in a new issue