2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include "test-gl-abstraction.h"
19 #include "test-trace-call-stack.h"
23 TestGlAbstraction::TestGlAbstraction()
24 : mBufferTrace(true, std::string("gl")),
25 mCullFaceTrace(true, "gl"),
26 mEnableDisableTrace(true, "gl"),
27 mShaderTrace(true, "gl"),
28 mTextureTrace(true, std::string("gl")),
29 mTexParameterTrace(true, "gl"),
30 mDrawTrace(true, "gl"),
31 mDepthFunctionTrace(true, "gl"),
32 mStencilFunctionTrace(true, "gl"),
33 mScissorTrace(true, "gl"),
34 mSetUniformTrace(true, "Uniform "),
35 mViewportTrace(true, "gl")
40 TestGlAbstraction::~TestGlAbstraction()
44 void TestGlAbstraction::Initialize()
47 mCompileStatus = GL_TRUE;
48 mLinkStatus = GL_TRUE;
49 mNumberOfActiveUniforms = 0;
51 mGetStringResult = NULL;
54 mIsFramebufferResult = 0;
56 mIsRenderbufferResult = 0;
59 mActiveTextureUnit = 0;
60 mCheckFramebufferStatusResult = 0;
61 mFramebufferStatus = 0;
62 mFramebufferDepthAttached = 0;
63 mFramebufferStencilAttached = 0;
64 mFramebufferColorAttachmentCount = 0;
65 mFrameBufferColorStatus = 0;
66 mNumBinaryFormats = 0;
68 mProgramBinaryLength = 0;
70 mVertexAttribArrayChanged = false;
71 mGetProgramBinaryCalled = false;
73 mLastShaderCompiled = 0;
74 mLastClearBitMask = 0;
75 mLastClearColor = Color::TRANSPARENT;
78 mLastBlendEquationRgb = 0;
79 mLastBlendEquationAlpha = 0;
80 mLastBlendFuncSrcRgb = 0;
81 mLastBlendFuncDstRgb = 0;
82 mLastBlendFuncSrcAlpha = 0;
83 mLastBlendFuncDstAlpha = 0;
84 mLastAutoTextureIdUsed = 0;
85 mNumGeneratedTextures = 0;
86 mLastShaderIdUsed = 0;
87 mLastProgramIdUsed = 0;
88 mLastUniformIdUsed = 0;
89 mLastDepthMask = false;
92 mProgramUniforms1i.clear();
93 mProgramUniforms1f.clear();
94 mProgramUniforms2f.clear();
95 mProgramUniforms3f.clear();
96 mProgramUniforms4f.clear();
99 mAttribLocs.push_back("aPosition");
100 mAttribLocs.push_back("aTexCoord");
101 mCullFaceTrace.Reset();
102 mDepthFunctionTrace.Reset();
103 mEnableDisableTrace.Reset();
104 mShaderTrace.Reset();
105 mStencilFunctionTrace.Reset();
106 mScissorTrace.Reset();
107 mTextureTrace.Reset();
108 mTexParameterTrace.Reset();
111 for(unsigned int i = 0; i < MAX_ATTRIBUTE_CACHE_SIZE; ++i)
113 mVertexAttribArrayState[i] = false;
117 void TestGlAbstraction::PreRender()
121 void TestGlAbstraction::PostRender()
125 bool TestGlAbstraction::IsSurfacelessContextSupported() const
130 bool TestGlAbstraction::IsAdvancedBlendEquationSupported()
135 bool TestGlAbstraction::IsBlendEquationSupported(DevelBlendEquation::Type blendEquation)
140 std::string TestGlAbstraction::GetShaderVersionPrefix()
142 return std::string("");
145 std::string TestGlAbstraction::GetVertexShaderPrefix()
147 return std::string("");
150 std::string TestGlAbstraction::GetFragmentShaderPrefix()
152 return std::string("");
155 bool TestGlAbstraction::TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const
157 return ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA));
162 bool BlendEnabled(const Dali::TraceCallStack& callStack)
164 std::stringstream out;
166 bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str());
170 bool BlendDisabled(const Dali::TraceCallStack& callStack)
172 std::stringstream out;
174 bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str());