/*
- * 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.
// EXTERNAL INCLUDES
#include <algorithm>
+#include <cstring>
+#include <type_traits>
// INTERNAL INCLUDES
#include <dali/public-api/common/constants.h>
-#include <dali/public-api/common/compile-time-assert.h>
+#include <dali/public-api/rendering/texture-set.h>
#include <dali/integration-api/platform-abstraction.h>
#include <dali/integration-api/debug.h>
#include <dali/internal/render/common/render-manager.h>
-#include <dali/devel-api/rendering/material.h>
namespace Dali
{
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
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),
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 )
{
}
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);
// 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();
}