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"
22 TestGlAbstraction::TestGlAbstraction()
23 : mBufferTrace(true, "gl"),
24 mTextureTrace(true, "gl"),
25 mTexParameterTrace(true, "gl"),
26 mDrawTrace(true, "gl")
31 TestGlAbstraction::~TestGlAbstraction()
35 void TestGlAbstraction::Initialize()
38 mCompileStatus = GL_TRUE;
39 mLinkStatus = GL_TRUE;
40 mNumberOfActiveUniforms = 0;
42 mGetStringResult = NULL;
45 mIsFramebufferResult = 0;
47 mIsRenderbufferResult = 0;
50 mActiveTextureUnit = 0;
51 mCheckFramebufferStatusResult = 0;
52 mFramebufferStatus = 0;
53 mFramebufferDepthAttached = 0;
54 mFramebufferStencilAttached = 0;
55 mFramebufferColorAttachmentCount = 0;
56 mFrameBufferColorStatus = 0;
57 mNumBinaryFormats = 0;
59 mProgramBinaryLength = 0;
61 mVertexAttribArrayChanged = false;
62 mGetProgramBinaryCalled = false;
64 mLastShaderCompiled = 0;
65 mLastClearBitMask = 0;
66 mLastClearColor = Color::TRANSPARENT;
69 mLastBlendEquationRgb = 0;
70 mLastBlendEquationAlpha = 0;
71 mLastBlendFuncSrcRgb = 0;
72 mLastBlendFuncDstRgb = 0;
73 mLastBlendFuncSrcAlpha = 0;
74 mLastBlendFuncDstAlpha = 0;
75 mLastAutoTextureIdUsed = 0;
76 mNumGeneratedTextures = 0;
77 mLastShaderIdUsed = 0;
78 mLastProgramIdUsed = 0;
79 mLastUniformIdUsed = 0;
80 mLastDepthMask = false;
83 mProgramUniforms1i.clear();
84 mProgramUniforms1f.clear();
85 mProgramUniforms2f.clear();
86 mProgramUniforms3f.clear();
87 mProgramUniforms4f.clear();
90 mAttribLocs.push_back("aPosition");
91 mAttribLocs.push_back("aTexCoord");
92 mCullFaceTrace.Reset();
93 mDepthFunctionTrace.Reset();
94 mEnableDisableTrace.Reset();
96 mStencilFunctionTrace.Reset();
97 mScissorTrace.Reset();
98 mTextureTrace.Reset();
99 mTexParameterTrace.Reset();
102 for(unsigned int i = 0; i < MAX_ATTRIBUTE_CACHE_SIZE; ++i)
104 mVertexAttribArrayState[i] = false;
108 void TestGlAbstraction::PreRender()
112 void TestGlAbstraction::PostRender()
116 bool TestGlAbstraction::IsSurfacelessContextSupported() const
121 bool TestGlAbstraction::IsAdvancedBlendEquationSupported()
126 bool TestGlAbstraction::IsBlendEquationSupported(DevelBlendEquation::Type blendEquation)
131 std::string TestGlAbstraction::GetShaderVersionPrefix()
133 return std::string("");
136 std::string TestGlAbstraction::GetVertexShaderPrefix()
138 return std::string("");
141 std::string TestGlAbstraction::GetFragmentShaderPrefix()
143 return std::string("");
146 bool TestGlAbstraction::TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const
148 return ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA));
153 bool BlendEnabled(const Dali::TraceCallStack& callStack)
155 std::stringstream out;
157 bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str());
161 bool BlendDisabled(const Dali::TraceCallStack& callStack)
163 std::stringstream out;
165 bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str());