mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-12-27 18:51:22 -08:00
add AlphaToCoverage and AlphaToOne
This commit is contained in:
parent
8ed7e1af2c
commit
53b4a1af0f
@ -726,7 +726,12 @@ public:
|
|||||||
|
|
||||||
u32 zeta_enable;
|
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 {
|
struct {
|
||||||
u32 tsc_address_high;
|
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(vb_element_base, 0x50D);
|
||||||
ASSERT_REG_POSITION(point_size, 0x546);
|
ASSERT_REG_POSITION(point_size, 0x546);
|
||||||
ASSERT_REG_POSITION(zeta_enable, 0x54E);
|
ASSERT_REG_POSITION(zeta_enable, 0x54E);
|
||||||
|
ASSERT_REG_POSITION(multisample_control, 0x54F);
|
||||||
ASSERT_REG_POSITION(tsc, 0x557);
|
ASSERT_REG_POSITION(tsc, 0x557);
|
||||||
ASSERT_REG_POSITION(tic, 0x55D);
|
ASSERT_REG_POSITION(tic, 0x55D);
|
||||||
ASSERT_REG_POSITION(stencil_two_side_enable, 0x565);
|
ASSERT_REG_POSITION(stencil_two_side_enable, 0x565);
|
||||||
|
@ -583,6 +583,7 @@ void RasterizerOpenGL::DrawArrays() {
|
|||||||
ConfigureFramebuffers(state);
|
ConfigureFramebuffers(state);
|
||||||
SyncColorMask();
|
SyncColorMask();
|
||||||
SyncFragmentColorClampState();
|
SyncFragmentColorClampState();
|
||||||
|
SyncMultiSampleState();
|
||||||
SyncDepthTestState();
|
SyncDepthTestState();
|
||||||
SyncStencilTestState();
|
SyncStencilTestState();
|
||||||
SyncBlendState();
|
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() {
|
void RasterizerOpenGL::SyncFragmentColorClampState() {
|
||||||
const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
|
const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
|
||||||
state.fragment_color_clamp.enabled = regs.frag_color_clamp != 0;
|
state.fragment_color_clamp.enabled = regs.frag_color_clamp != 0;
|
||||||
|
@ -163,6 +163,9 @@ private:
|
|||||||
/// Syncs the the color clamp state
|
/// Syncs the the color clamp state
|
||||||
void SyncFragmentColorClampState();
|
void SyncFragmentColorClampState();
|
||||||
|
|
||||||
|
/// Syncs the alpha coverage and alpha to one
|
||||||
|
void SyncMultiSampleState();
|
||||||
|
|
||||||
/// Syncs the scissor test state to match the guest state
|
/// Syncs the scissor test state to match the guest state
|
||||||
void SyncScissorTest();
|
void SyncScissorTest();
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ OpenGLState::OpenGLState() {
|
|||||||
// These all match default OpenGL values
|
// These all match default OpenGL values
|
||||||
geometry_shaders.enabled = false;
|
geometry_shaders.enabled = false;
|
||||||
framebuffer_srgb.enabled = false;
|
framebuffer_srgb.enabled = false;
|
||||||
|
multisample_control.alpha_to_coverage = false;
|
||||||
|
multisample_control.alpha_to_one = false;
|
||||||
cull.enabled = false;
|
cull.enabled = false;
|
||||||
cull.mode = GL_BACK;
|
cull.mode = GL_BACK;
|
||||||
cull.front_face = GL_CCW;
|
cull.front_face = GL_CCW;
|
||||||
@ -504,6 +506,21 @@ void OpenGLState::Apply() const {
|
|||||||
fragment_color_clamp.enabled ? GL_TRUE : GL_FALSE);
|
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();
|
ApplyColorMask();
|
||||||
ApplyViewport();
|
ApplyViewport();
|
||||||
ApplyStencilTest();
|
ApplyStencilTest();
|
||||||
|
@ -39,6 +39,11 @@ public:
|
|||||||
bool enabled; // GL_FRAMEBUFFER_SRGB
|
bool enabled; // GL_FRAMEBUFFER_SRGB
|
||||||
} framebuffer_srgb;
|
} framebuffer_srgb;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool alpha_to_coverage; // GL_ALPHA_TO_COVERAGE
|
||||||
|
bool alpha_to_one; // GL_ALPHA_TO_ONE
|
||||||
|
} multisample_control;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool enabled; // GL_CLAMP_FRAGMENT_COLOR_ARB
|
bool enabled; // GL_CLAMP_FRAGMENT_COLOR_ARB
|
||||||
} fragment_color_clamp;
|
} fragment_color_clamp;
|
||||||
|
Loading…
Reference in New Issue
Block a user