Merge "Performance enhancement, cache glClear state" into tizen
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / dali-test-suite-utils / test-gl-abstraction.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include "test-gl-abstraction.h"
19
20 namespace Dali
21 {
22
23 TestGlAbstraction::TestGlAbstraction()
24 {
25   Initialize();
26 }
27
28 TestGlAbstraction::~TestGlAbstraction() {}
29
30 void TestGlAbstraction::Initialize()
31 {
32   mCurrentProgram = 0;
33   mCompileStatus = GL_TRUE;
34   mLinkStatus = GL_TRUE;
35
36   mGetAttribLocationResult = 0;
37   mGetErrorResult = 0;
38   mGetStringResult = NULL;
39   mIsBufferResult = 0;
40   mIsEnabledResult = 0;
41   mIsFramebufferResult = 0;
42   mIsProgramResult = 0;
43   mIsRenderbufferResult = 0;
44   mIsShaderResult = 0;
45   mIsTextureResult = 0;
46   mVertexAttribArrayChanged = false;
47
48   mCheckFramebufferStatusResult = 0;
49   mNumBinaryFormats = 0;
50   mBinaryFormats = 0;
51   mProgramBinaryLength = 0;
52   mGetProgramBinaryCalled = false;
53
54   mLastAutoTextureIdUsed = 0;
55
56   mLastShaderIdUsed = 0;
57   mLastProgramIdUsed = 0;
58   mLastUniformIdUsed = 0;
59   mLastShaderCompiled = 0;
60   mLastClearBitMask = 0;
61   mClearCount = 0;
62
63   mLastBlendEquationRgb   = 0;
64   mLastBlendEquationAlpha = 0;
65   mLastBlendFuncSrcRgb    = 0;
66   mLastBlendFuncDstRgb    = 0;
67   mLastBlendFuncSrcAlpha  = 0;
68   mLastBlendFuncDstAlpha  = 0;
69
70   mUniforms.clear();
71   mProgramUniforms1i.clear();
72   mProgramUniforms1f.clear();
73   mProgramUniforms2f.clear();
74   mProgramUniforms3f.clear();
75   mProgramUniforms4f.clear();
76 }
77
78 void TestGlAbstraction::PreRender()
79 {
80 }
81
82 void TestGlAbstraction::PostRender(unsigned int timeDelta)
83 {
84 }
85
86 } // Namespace dali
87
88 bool BlendEnabled(const Dali::TraceCallStack& callStack)
89 {
90   std::stringstream out;
91   out << GL_BLEND;
92   bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str());
93   return blendEnabled;
94 }
95
96 bool BlendDisabled(const Dali::TraceCallStack& callStack)
97 {
98   std::stringstream out;
99   out << GL_BLEND;
100   bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str());
101   return blendEnabled;
102 }