void GL::EnableStencilTest(BinaryStencilTest aTest, GLint aComparand, GLuint aTestMask, StencilOperation aOp, GLuint aWriteMask) { MOZ_ASSERT(IsCurrent()); if (!mStencilTestEnabled) { Enable(GL_STENCIL_TEST); mStencilTestEnabled = true; } if (mStencilTest != aTest || mStencilComparand != aComparand || mStencilTestMask != aTestMask) { GLenum func; switch (aTest) { default: MOZ_ASSERT(!"Invalid stencil test"); case ALWAYS_PASS: func = GL_ALWAYS; break; case PASS_IF_EQUAL: func = GL_EQUAL; break; case PASS_IF_NOT_EQUAL: func = GL_NOTEQUAL; break; } StencilFunc(func, aComparand, aTestMask); mStencilTest = aTest; mStencilComparand = aComparand; mStencilTestMask = aTestMask; } if (mStencilOp != aOp) { switch (aOp) { case LEAVE_UNCHANGED: StencilOp(GL_KEEP, GL_KEEP, GL_KEEP); break; case CLEAR_PASSING_VALUES: StencilOp(GL_KEEP, GL_ZERO, GL_ZERO); break; case REPLACE_PASSING_WITH_COMPARAND: StencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); break; case REPLACE_PASSING_CLEAR_FAILING: StencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE); break; } mStencilOp = aOp; } if (mStencilWriteMask != aWriteMask) { StencilMask(aWriteMask); mStencilWriteMask = aWriteMask; } }
StencilOp *StencilOp::getOrCreate(GLenum fsfail, GLenum fdfail, GLenum fdspass, GLenum bsfail, GLenum bdfail, GLenum bdspass) { return getOrCreateImpl(StencilOp(fsfail, fdfail, fdspass, bsfail, bdfail, bdspass)); }
static void StencilOp(const StencilOperations& ops) { StencilOp(ops._sfail, ops._dfail, ops._dpass); }