gl-render-manager: Implement logic ops

This commit is contained in:
Henrik Rydgård 2018-01-19 20:24:09 +01:00
parent acb692677b
commit e531a7da43
4 changed files with 41 additions and 9 deletions

View file

@ -405,6 +405,9 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
glDisable(GL_CULL_FACE);
glDisable(GL_DITHER);
glEnable(GL_SCISSOR_TEST);
#ifndef USING_GLES2
glDisable(GL_COLOR_LOGIC_OP);
#endif
/*
#ifndef USING_GLES2
@ -430,12 +433,14 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
int colorMask = -1;
int depthMask = -1;
int depthFunc = -1;
int logicOp = -1;
GLuint curArrayBuffer = (GLuint)-1;
GLuint curElemArrayBuffer = (GLuint)-1;
bool depthEnabled = false;
bool blendEnabled = false;
bool cullEnabled = false;
bool ditherEnabled = false;
bool logicEnabled = false;
GLuint blendEqColor = (GLuint)-1;
GLuint blendEqAlpha = (GLuint)-1;
@ -496,6 +501,22 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
colorMask = c.blend.mask;
}
break;
case GLRRenderCommand::LOGICOP:
#ifndef USING_GLES2
if (c.logic.enabled) {
if (!logicEnabled) {
glEnable(GL_COLOR_LOGIC_OP);
logicEnabled = true;
}
if (logicOp != c.logic.logicOp) {
glLogicOp(c.logic.logicOp);
}
} else if (!c.logic.enabled && logicEnabled) {
glDisable(GL_COLOR_LOGIC_OP);
logicEnabled = false;
}
#endif
break;
case GLRRenderCommand::CLEAR:
glDisable(GL_SCISSOR_TEST);
if (c.clear.colorMask != colorMask) {
@ -814,6 +835,9 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step) {
glDisable(GL_STENCIL_TEST);
glDisable(GL_BLEND);
glDisable(GL_CULL_FACE);
#ifndef USING_GLES2
glDisable(GL_COLOR_LOGIC_OP);
#endif
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}