#define __DALI_INTERNAL_CONTEXT_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
void PrintGlString(const char* stringName, GLenum stringId)
{
- DALI_LOG_INFO(Debug::Filter::gRender, Debug::General, "GL %s = %s\n", stringName, (const char *)GetString( stringId ) );
+ DALI_LOG_INFO(Debug::Filter::gRender, Debug::General, "GL %s = %s\n", stringName, reinterpret_cast< const char * >( GetString( stringId ) ) );
}
/****************************************************************************************
*/
void DepthMask(GLboolean flag)
{
+ bool booleanFlag = flag != GL_FALSE;
// only change state if needed
- if( flag != mDepthMaskEnabled )
+ if( booleanFlag != mDepthMaskEnabled )
{
- mDepthMaskEnabled = flag;
- LOG_GL("DepthMask %s\n", flag ? "True" : "False");
+ mDepthMaskEnabled = booleanFlag;
+ LOG_GL("DepthMask %s\n", booleanFlag ? "True" : "False");
CHECK_GL( mGlAbstraction, mGlAbstraction.DepthMask( mDepthMaskEnabled ) );
}
}
*/
void StencilFunc(GLenum func, GLint ref, GLuint mask)
{
+ if( ( func != mStencilFunc ) || ( ref != mStencilFuncRef ) || ( mask != mStencilFuncMask ) )
+ {
+ mStencilFunc = func;
+ mStencilFuncRef = ref;
+ mStencilFuncMask = mask;
-
- LOG_GL("StencilFunc %x %d %d\n", func, ref, mask);
- CHECK_GL( mGlAbstraction, mGlAbstraction.StencilFunc(func, ref, mask) );
+ LOG_GL("StencilFunc %x %d %d\n", func, ref, mask);
+ CHECK_GL( mGlAbstraction, mGlAbstraction.StencilFunc(func, ref, mask) );
+ }
}
/**
*/
void StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
{
- LOG_GL("StencilOp %x %x %x\n", fail, zfail, zpass);
- CHECK_GL( mGlAbstraction, mGlAbstraction.StencilOp(fail, zfail, zpass) );
+ if( ( fail != mStencilOpFail ) || ( zfail != mStencilOpDepthFail ) || ( zpass != mStencilOpDepthPass ) )
+ {
+ mStencilOpFail = fail;
+ mStencilOpDepthFail = zfail;
+ mStencilOpDepthPass = zpass;
+
+ LOG_GL("StencilOp %x %x %x\n", fail, zfail, zpass);
+ CHECK_GL( mGlAbstraction, mGlAbstraction.StencilOp(fail, zfail, zpass) );
+ }
}
/**
GLenum mBlendEquationSeparateModeRGB; ///< Controls RGB blend mode
GLenum mBlendEquationSeparateModeAlpha; ///< Controls Alpha blend mode
+ // glStencilFunc() and glStencilOp() state.
+ GLenum mStencilFunc;
+ GLint mStencilFuncRef;
+ GLuint mStencilFuncMask;
+ GLenum mStencilOpFail;
+ GLenum mStencilOpDepthFail;
+ GLenum mStencilOpDepthPass;
+
GLenum mDepthFunction; ///The depth function
GLint mMaxTextureSize; ///< return value from GetIntegerv(GL_MAX_TEXTURE_SIZE)