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"
21 static const bool TRACE{
26 TestGlAbstraction::TestGlAbstraction()
27 : mBufferTrace(TRACE, std::string("gl")),
28 mCullFaceTrace(TRACE, "gl"),
29 mEnableDisableTrace(TRACE, "gl"),
30 mShaderTrace(TRACE, "gl"),
31 mTextureTrace(TRACE, std::string("gl")),
32 mTexParameterTrace(TRACE, "gl"),
33 mDrawTrace(TRACE, "gl"),
34 mDepthFunctionTrace(TRACE, "gl"),
35 mStencilFunctionTrace(TRACE, "gl"),
36 mScissorTrace(TRACE, "gl"),
37 mSetUniformTrace(TRACE, "Uniform "),
38 mViewportTrace(TRACE, "gl")
43 TestGlAbstraction::~TestGlAbstraction()
47 void TestGlAbstraction::Initialize()
50 mCompileStatus = GL_TRUE;
51 mLinkStatus = GL_TRUE;
52 mNumberOfActiveUniforms = 0;
54 mGetStringResult = NULL;
57 mIsFramebufferResult = 0;
59 mIsRenderbufferResult = 0;
62 mActiveTextureUnit = 0;
63 mCheckFramebufferStatusResult = 0;
64 mFramebufferStatus = 0;
65 mFramebufferDepthAttached = 0;
66 mFramebufferStencilAttached = 0;
67 mFramebufferColorAttachmentCount = 0;
68 mFrameBufferColorStatus = 0;
69 mNumBinaryFormats = 0;
71 mProgramBinaryLength = 0;
73 mVertexAttribArrayChanged = false;
74 mGetProgramBinaryCalled = false;
76 mLastShaderCompiled = 0;
77 mLastClearBitMask = 0;
78 mLastClearColor = Color::TRANSPARENT;
81 mLastBlendEquationRgb = 0;
82 mLastBlendEquationAlpha = 0;
83 mLastBlendFuncSrcRgb = 0;
84 mLastBlendFuncDstRgb = 0;
85 mLastBlendFuncSrcAlpha = 0;
86 mLastBlendFuncDstAlpha = 0;
87 mLastAutoTextureIdUsed = 0;
88 mNumGeneratedTextures = 0;
89 mLastShaderIdUsed = 0;
90 mLastProgramIdUsed = 0;
91 mLastUniformIdUsed = 0;
92 mLastDepthMask = false;
95 mProgramUniforms1i.clear();
96 mProgramUniforms1f.clear();
97 mProgramUniforms2f.clear();
98 mProgramUniforms3f.clear();
99 mProgramUniforms4f.clear();
102 mAttribLocs.push_back("aPosition");
103 mAttribLocs.push_back("aTexCoord");
104 mCullFaceTrace.Reset();
105 mDepthFunctionTrace.Reset();
106 mEnableDisableTrace.Reset();
107 mShaderTrace.Reset();
108 mStencilFunctionTrace.Reset();
109 mScissorTrace.Reset();
110 mTextureTrace.Reset();
111 mTexParameterTrace.Reset();
114 for(unsigned int i = 0; i < MAX_ATTRIBUTE_CACHE_SIZE; ++i)
116 mVertexAttribArrayState[i] = false;
120 void TestGlAbstraction::PreRender()
124 void TestGlAbstraction::PostRender()
128 bool TestGlAbstraction::IsSurfacelessContextSupported() const
133 bool TestGlAbstraction::IsAdvancedBlendEquationSupported()
138 bool TestGlAbstraction::IsBlendEquationSupported(DevelBlendEquation::Type blendEquation)
143 std::string TestGlAbstraction::GetShaderVersionPrefix()
145 return std::string("");
148 std::string TestGlAbstraction::GetVertexShaderPrefix()
150 return std::string("");
153 std::string TestGlAbstraction::GetFragmentShaderPrefix()
155 return std::string("");
158 bool TestGlAbstraction::TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const
160 return ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA));
165 bool BlendEnabled(const Dali::TraceCallStack& callStack)
167 std::stringstream out;
169 bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str());
173 bool BlendDisabled(const Dali::TraceCallStack& callStack)
175 std::stringstream out;
177 bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str());