///////////////////////////////////////////////////////
| 750 | |
| 751 | //////////////////////////////////////////////////////////// |
| 752 | void RenderTarget::applyStencilMode(const StencilMode& mode) |
| 753 | { |
| 754 | using RenderTargetImpl::stencilFunctionToGlConstant; |
| 755 | using RenderTargetImpl::stencilOperationToGlConstant; |
| 756 | |
| 757 | // Fast path if we have a default (disabled) stencil mode |
| 758 | if (mode == StencilMode()) |
| 759 | { |
| 760 | if (!m_cache.enable || m_cache.stencilEnabled) |
| 761 | { |
| 762 | glCheck(glDisable(GL_STENCIL_TEST)); |
| 763 | glCheck(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)); |
| 764 | |
| 765 | m_cache.stencilEnabled = false; |
| 766 | } |
| 767 | } |
| 768 | else |
| 769 | { |
| 770 | // Apply the stencil mode |
| 771 | if (!m_cache.enable || !m_cache.stencilEnabled) |
| 772 | glCheck(glEnable(GL_STENCIL_TEST)); |
| 773 | |
| 774 | glCheck(glStencilOp(GL_KEEP, |
| 775 | stencilOperationToGlConstant(mode.stencilUpdateOperation), |
| 776 | stencilOperationToGlConstant(mode.stencilUpdateOperation))); |
| 777 | glCheck(glStencilFunc(stencilFunctionToGlConstant(mode.stencilComparison), |
| 778 | static_cast<int>(mode.stencilReference.value), |
| 779 | mode.stencilMask.value)); |
| 780 | |
| 781 | m_cache.stencilEnabled = true; |
| 782 | } |
| 783 | |
| 784 | m_cache.lastStencilMode = mode; |
| 785 | } |
| 786 | |
| 787 | |
| 788 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected