yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Implemented glColorMask

This commit is contained in:
tfarley 2015-05-28 21:41:37 -04:00
parent b1cb0a3f2c
commit d42275f11c
3 changed files with 24 additions and 0 deletions

View File

@ -652,6 +652,10 @@ void RasterizerOpenGL::SyncDepthTest() {
const auto& regs = Pica::g_state.regs; const auto& regs = Pica::g_state.regs;
state.depth.test_enabled = (regs.output_merger.depth_test_enable == 1); state.depth.test_enabled = (regs.output_merger.depth_test_enable == 1);
state.depth.test_func = PicaToGL::CompareFunc(regs.output_merger.depth_test_func); state.depth.test_func = PicaToGL::CompareFunc(regs.output_merger.depth_test_func);
state.color_mask.red_enabled = regs.output_merger.red_enable;
state.color_mask.green_enabled = regs.output_merger.green_enable;
state.color_mask.blue_enabled = regs.output_merger.blue_enable;
state.color_mask.alpha_enabled = regs.output_merger.alpha_enable;
state.depth.write_mask = regs.output_merger.depth_write_enable ? GL_TRUE : GL_FALSE; state.depth.write_mask = regs.output_merger.depth_write_enable ? GL_TRUE : GL_FALSE;
} }

View File

@ -16,6 +16,11 @@ OpenGLState::OpenGLState() {
depth.test_func = GL_LESS; depth.test_func = GL_LESS;
depth.write_mask = GL_TRUE; depth.write_mask = GL_TRUE;
color_mask.red_enabled = GL_TRUE;
color_mask.green_enabled = GL_TRUE;
color_mask.blue_enabled = GL_TRUE;
color_mask.alpha_enabled = GL_TRUE;
stencil.test_enabled = false; stencil.test_enabled = false;
stencil.test_func = GL_ALWAYS; stencil.test_func = GL_ALWAYS;
stencil.test_ref = 0; stencil.test_ref = 0;
@ -77,6 +82,14 @@ void OpenGLState::Apply() {
glDepthMask(depth.write_mask); glDepthMask(depth.write_mask);
} }
// Color mask
if (color_mask.red_enabled != cur_state.color_mask.red_enabled ||
color_mask.green_enabled != cur_state.color_mask.green_enabled ||
color_mask.blue_enabled != cur_state.color_mask.blue_enabled ||
color_mask.alpha_enabled != cur_state.color_mask.alpha_enabled) {
glColorMask(color_mask.red_enabled, color_mask.green_enabled, color_mask.blue_enabled, color_mask.alpha_enabled);
}
// Stencil test // Stencil test
if (stencil.test_enabled != cur_state.stencil.test_enabled) { if (stencil.test_enabled != cur_state.stencil.test_enabled) {
if (stencil.test_enabled) { if (stencil.test_enabled) {

View File

@ -19,6 +19,13 @@ public:
GLboolean write_mask; // GL_DEPTH_WRITEMASK GLboolean write_mask; // GL_DEPTH_WRITEMASK
} depth; } depth;
struct {
GLboolean red_enabled;
GLboolean green_enabled;
GLboolean blue_enabled;
GLboolean alpha_enabled;
} color_mask; // GL_COLOR_WRITEMASK
struct { struct {
bool test_enabled; // GL_STENCIL_TEST bool test_enabled; // GL_STENCIL_TEST
GLenum test_func; // GL_STENCIL_FUNC GLenum test_func; // GL_STENCIL_FUNC