X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fgl-resources%2Fcontext.cpp;h=ead1be3ad6b423611743311f27958970cf803d08;hb=79881246746f65474b24ea4fe14151ccef8df3f4;hp=2112488a5044feba591a7d2efe793e890e0e2515;hpb=468b1a9ac8e6436b7210d8e1023a37ea28dca66e;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/gl-resources/context.cpp b/dali/internal/render/gl-resources/context.cpp index 2112488..ead1be3 100644 --- a/dali/internal/render/gl-resources/context.cpp +++ b/dali/internal/render/gl-resources/context.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -20,14 +20,15 @@ // EXTERNAL INCLUDES #include +#include +#include // INTERNAL INCLUDES #include -#include +#include #include #include #include -#include namespace Dali { @@ -38,7 +39,7 @@ namespace Internal namespace // unnamed namespace { -DALI_COMPILE_TIME_ASSERT( TEXTURE_UNIT_LAST <= Context::MAX_TEXTURE_UNITS ); +static_assert( TEXTURE_UNIT_LAST <= Context::MAX_TEXTURE_UNITS, "TEXTURE_UNIT_LAST is greater than Context::MAX_TEXTURE_UNITS" ); /** * GL error strings @@ -63,7 +64,12 @@ errorStrings errors[] = Debug::Filter* gContextLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_CONTEXT_STATE"); #endif -Context::Context(Integration::GlAbstraction& glAbstraction) +Context::Context( Integration::GlAbstraction& glAbstraction ) +: Context( glAbstraction, nullptr ) +{ +} + +Context::Context( Integration::GlAbstraction& glAbstraction, std::vector< Context* >* contexts ) : mGlAbstraction(glAbstraction), mGlContextCreated(false), mColorMask(true), @@ -90,13 +96,18 @@ Context::Context(Integration::GlAbstraction& glAbstraction) mBlendFuncSeparateDstAlpha(GL_ZERO), mBlendEquationSeparateModeRGB( GL_FUNC_ADD ), mBlendEquationSeparateModeAlpha( GL_FUNC_ADD ), + mStencilFunc( GL_ALWAYS ), + mStencilFuncRef( 0 ), + mStencilFuncMask( 0xFFFFFFFF ), + mStencilOpFail( GL_KEEP ), + mStencilOpDepthFail( GL_KEEP ), + mStencilOpDepthPass( GL_KEEP ), + mDepthFunction( GL_LESS ), mMaxTextureSize(0), mClearColor(Color::WHITE), // initial color, never used until it's been set by the user - mCullFaceMode( Dali::Material::NONE ), + mCullFaceMode( FaceCullingMode::NONE ), mViewPort( 0, 0, 0, 0 ), - mFrameCount( 0 ), - mCulledCount( 0 ), - mRendererCount( 0 ) + mSceneContexts( contexts ) { } @@ -229,7 +240,7 @@ void Context::InitializeGlState() mBlendEquationSeparateModeRGB = GL_FUNC_ADD; mBlendEquationSeparateModeAlpha = GL_FUNC_ADD; - mCullFaceMode = Dali::Material::NONE; //By default cullface is disabled, front face is set to CCW and cull face is set to back + mCullFaceMode = FaceCullingMode::NONE; //By default cullface is disabled, front face is set to CCW and cull face is set to back // get maximum texture size mGlAbstraction.GetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); @@ -237,6 +248,13 @@ void Context::InitializeGlState() // reset viewport, this will be set to something useful when rendering mViewPort.x = mViewPort.y = mViewPort.width = mViewPort.height = 0; + //Initialze vertex attribute cache + memset( &mVertexAttributeCachedState, 0, sizeof(mVertexAttributeCachedState) ); + memset( &mVertexAttributeCurrentState, 0, sizeof(mVertexAttributeCurrentState) ); + + //Initialize bound 2d texture cache + memset( &mBoundTextureId, 0, sizeof(mBoundTextureId) ); + mFrameBufferStateCache.Reset(); }