1 #ifndef DALI_INTERNAL_GL_IMPLEMENTATION_H
2 #define DALI_INTERNAL_GL_IMPLEMENTATION_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <GLES2/gl2.h>
23 #include <GLES2/gl2ext.h>
24 #include <dali/devel-api/threading/conditional-wait.h>
25 #include <dali/integration-api/gl-abstraction.h>
26 #include <dali/internal/graphics/common/egl-include.h>
27 #include <dali/public-api/common/vector-wrapper.h>
33 #include <dali/devel-api/adaptor-framework/environment-variable.h>
34 #include <dali/internal/graphics/gles/gl-extensions-support.h>
35 #include <dali/internal/graphics/gles/gles-abstraction.h>
36 #include <dali/internal/graphics/gles/gles2-implementation.h>
37 #include <dali/internal/graphics/gles/gles3-implementation.h>
38 #include <dali/internal/system/common/time-service.h>
47 * GlImplementation is a concrete implementation for GlAbstraction.
48 * The class provides an OpenGL-ES 2.0 or 3.0 implementation.
49 * The class is provided when creating the Integration::Core object.
51 class GlImplementation : public Dali::Integration::GlAbstraction
56 virtual ~GlImplementation()
60 void PreRender() override
62 /* Do nothing in main implementation */
65 void PostRender() override
67 /* Do nothing in main implementation */
70 void ContextCreated();
72 void SetGlesVersion(const int32_t glesVersion)
74 if(mGlesVersion / 10 != glesVersion / 10)
76 mGlesVersion = glesVersion;
77 if(mGlesVersion >= 30)
79 mImpl.reset(new Gles3Implementation());
83 mImpl.reset(new Gles2Implementation());
88 void SetIsSurfacelessContextSupported(const bool isSupported)
90 mIsSurfacelessContextSupported = isSupported;
93 bool IsSurfacelessContextSupported() const override
95 return mIsSurfacelessContextSupported;
98 void SetIsAdvancedBlendEquationSupported(const bool isSupported)
100 mGlExtensionSupportedCacheList.SetSupported(GlExtensionCache::GlExtensionCheckerType::BLEND_EQUATION_ADVANCED, isSupported);
103 bool IsAdvancedBlendEquationSupported() override
105 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
107 const auto type = GlExtensionCache::GlExtensionCheckerType::BLEND_EQUATION_ADVANCED;
108 if(!mIsContextCreated && !mGlExtensionSupportedCacheList.GetCached(type))
110 mContextCreatedWaitCondition.Wait(lock);
112 return mGlExtensionSupportedCacheList.GetSupported(type);
115 void SetIsMultisampledRenderToTextureSupported(const bool isSupported)
117 mGlExtensionSupportedCacheList.SetSupported(GlExtensionCache::GlExtensionCheckerType::MULTISAMPLED_RENDER_TO_TEXTURE, isSupported);
120 bool IsMultisampledRenderToTextureSupported() override
122 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
124 const auto type = GlExtensionCache::GlExtensionCheckerType::MULTISAMPLED_RENDER_TO_TEXTURE;
125 if(!mIsContextCreated && !mGlExtensionSupportedCacheList.GetCached(type))
127 mContextCreatedWaitCondition.Wait(lock);
129 return mGlExtensionSupportedCacheList.GetSupported(type);
132 bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation) override
134 switch(blendEquation)
136 case DevelBlendEquation::ADD:
137 case DevelBlendEquation::SUBTRACT:
138 case DevelBlendEquation::REVERSE_SUBTRACT:
142 case DevelBlendEquation::MIN:
143 case DevelBlendEquation::MAX:
145 return (GetGlesVersion() >= 30);
147 case DevelBlendEquation::MULTIPLY:
148 case DevelBlendEquation::SCREEN:
149 case DevelBlendEquation::OVERLAY:
150 case DevelBlendEquation::DARKEN:
151 case DevelBlendEquation::LIGHTEN:
152 case DevelBlendEquation::COLOR_DODGE:
153 case DevelBlendEquation::COLOR_BURN:
154 case DevelBlendEquation::HARD_LIGHT:
155 case DevelBlendEquation::SOFT_LIGHT:
156 case DevelBlendEquation::DIFFERENCE:
157 case DevelBlendEquation::EXCLUSION:
158 case DevelBlendEquation::HUE:
159 case DevelBlendEquation::SATURATION:
160 case DevelBlendEquation::COLOR:
161 case DevelBlendEquation::LUMINOSITY:
163 return IsAdvancedBlendEquationSupported();
175 std::string GetShaderVersionPrefix() override
177 if(mShaderVersionPrefix == "")
179 mShaderVersionPrefix = "#version " + std::to_string(GetShadingLanguageVersion());
180 if(GetShadingLanguageVersion() < 300)
182 mShaderVersionPrefix += "\n";
186 mShaderVersionPrefix += " es\n";
189 return mShaderVersionPrefix;
192 std::string GetVertexShaderPrefix() override
194 if(mVertexShaderPrefix == "")
196 mVertexShaderPrefix = GetShaderVersionPrefix();
198 if(GetShadingLanguageVersion() < 300)
200 mVertexShaderPrefix += "#define INPUT attribute\n";
201 mVertexShaderPrefix += "#define OUTPUT varying\n";
205 mVertexShaderPrefix += "#define INPUT in\n";
206 mVertexShaderPrefix += "#define OUTPUT out\n";
209 return mVertexShaderPrefix;
212 std::string GetFragmentShaderPrefix() override;
214 bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const override
216 bool convert = ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA));
217 if(mGlesVersion >= 30)
219 // Don't convert manually from RGB to RGBA if GLES >= 3.0 and a sub-image is uploaded.
220 convert = (convert && !isSubImage);
225 int GetMaxTextureSize()
227 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
228 if(!mIsContextCreated)
230 mContextCreatedWaitCondition.Wait(lock);
232 return mMaxTextureSize;
235 int GetMaxTextureSamples()
237 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
238 if(!mIsContextCreated)
240 mContextCreatedWaitCondition.Wait(lock);
242 return mMaxTextureSamples;
245 int32_t GetGlesVersion()
247 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
248 if(!mIsContextCreated)
250 mContextCreatedWaitCondition.Wait(lock);
255 void SetShadingLanguageVersion(int shadingLanguageVersion)
257 mShadingLanguageVersion = shadingLanguageVersion;
258 mShadingLanguageVersionCached = true;
261 int GetShadingLanguageVersion()
263 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
264 if(!mIsContextCreated && !mShadingLanguageVersionCached)
266 mContextCreatedWaitCondition.Wait(lock);
268 return mShadingLanguageVersion;
271 bool ApplyNativeFragmentShader(std::string& shader, const char* customSamplerType);
275 void ActiveTexture(GLenum texture) override
277 glActiveTexture(texture);
280 void AttachShader(GLuint program, GLuint shader) override
282 glAttachShader(program, shader);
285 void BindAttribLocation(GLuint program, GLuint index, const char* name) override
287 glBindAttribLocation(program, index, name);
290 void BindBuffer(GLenum target, GLuint buffer) override
292 glBindBuffer(target, buffer);
295 void BindFramebuffer(GLenum target, GLuint framebuffer) override
297 glBindFramebuffer(target, framebuffer);
300 void BindRenderbuffer(GLenum target, GLuint renderbuffer) override
302 glBindRenderbuffer(target, renderbuffer);
305 void BindTexture(GLenum target, GLuint texture) override
307 glBindTexture(target, texture);
310 void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) override
312 glBlendColor(red, green, blue, alpha);
315 void BlendEquation(GLenum mode) override
317 glBlendEquation(mode);
320 void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) override
322 glBlendEquationSeparate(modeRGB, modeAlpha);
325 void BlendFunc(GLenum sfactor, GLenum dfactor) override
327 glBlendFunc(sfactor, dfactor);
330 void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) override
332 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
335 void BufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) override
337 glBufferData(target, size, data, usage);
340 void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) override
342 glBufferSubData(target, offset, size, data);
345 GLenum CheckFramebufferStatus(GLenum target) override
347 return glCheckFramebufferStatus(target);
350 void Clear(GLbitfield mask) override
352 uint32_t startTime = 0, endTime = 0;
355 startTime = TimeService::GetMilliSeconds();
362 endTime = TimeService::GetMilliSeconds();
363 if(endTime - startTime > mLogThreshold)
365 DALI_LOG_DEBUG_INFO("glClear takes long time! [%u ms]\n", endTime - startTime);
370 void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) override
372 glClearColor(red, green, blue, alpha);
375 void ClearDepthf(GLclampf depth) override
377 glClearDepthf(depth);
380 void ClearStencil(GLint s) override
385 void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) override
387 glColorMask(red, green, blue, alpha);
390 void CompileShader(GLuint shader) override
392 glCompileShader(shader);
395 void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) override
397 glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
400 void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) override
402 glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
405 void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) override
407 glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
410 void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) override
412 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
415 GLuint CreateProgram(void) override
417 return glCreateProgram();
420 GLuint CreateShader(GLenum type) override
422 return glCreateShader(type);
425 void CullFace(GLenum mode) override
430 void DeleteBuffers(GLsizei n, const GLuint* buffers) override
432 glDeleteBuffers(n, buffers);
435 void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) override
437 glDeleteFramebuffers(n, framebuffers);
440 void DeleteProgram(GLuint program) override
442 glDeleteProgram(program);
445 void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) override
447 glDeleteRenderbuffers(n, renderbuffers);
450 void DeleteShader(GLuint shader) override
452 glDeleteShader(shader);
455 void DeleteTextures(GLsizei n, const GLuint* textures) override
457 glDeleteTextures(n, textures);
460 void DepthFunc(GLenum func) override
465 void DepthMask(GLboolean flag) override
470 void DepthRangef(GLclampf zNear, GLclampf zFar) override
472 glDepthRangef(zNear, zFar);
475 void DetachShader(GLuint program, GLuint shader) override
477 glDetachShader(program, shader);
480 void Disable(GLenum cap) override
485 void DisableVertexAttribArray(GLuint index) override
487 glDisableVertexAttribArray(index);
490 void DrawArrays(GLenum mode, GLint first, GLsizei count) override
492 glDrawArrays(mode, first, count);
495 void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) override
497 glDrawElements(mode, count, type, indices);
500 void Enable(GLenum cap) override
505 void EnableVertexAttribArray(GLuint index) override
507 glEnableVertexAttribArray(index);
510 void Finish(void) override
515 void Flush(void) override
520 void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) override
522 glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
525 void FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) override
527 glFramebufferTexture2D(target, attachment, textarget, texture, level);
530 void FrontFace(GLenum mode) override
535 void GenBuffers(GLsizei n, GLuint* buffers) override
537 glGenBuffers(n, buffers);
540 void GenerateMipmap(GLenum target) override
542 glGenerateMipmap(target);
545 void GenFramebuffers(GLsizei n, GLuint* framebuffers) override
547 glGenFramebuffers(n, framebuffers);
550 void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) override
552 glGenRenderbuffers(n, renderbuffers);
555 void GenTextures(GLsizei n, GLuint* textures) override
557 glGenTextures(n, textures);
560 void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) override
562 glGetActiveAttrib(program, index, bufsize, length, size, type, name);
565 void GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) override
567 glGetActiveUniform(program, index, bufsize, length, size, type, name);
570 void GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) override
572 glGetAttachedShaders(program, maxcount, count, shaders);
575 int GetAttribLocation(GLuint program, const char* name) override
577 return glGetAttribLocation(program, name);
580 void GetBooleanv(GLenum pname, GLboolean* params) override
582 glGetBooleanv(pname, params);
585 void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) override
587 glGetBufferParameteriv(target, pname, params);
590 GLenum GetError(void) override
595 void GetFloatv(GLenum pname, GLfloat* params) override
597 glGetFloatv(pname, params);
600 void GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) override
602 glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
605 void GetIntegerv(GLenum pname, GLint* params) override
607 glGetIntegerv(pname, params);
610 void GetProgramiv(GLuint program, GLenum pname, GLint* params) override
612 glGetProgramiv(program, pname, params);
615 void GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) override
617 glGetProgramInfoLog(program, bufsize, length, infolog);
620 void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) override
622 glGetRenderbufferParameteriv(target, pname, params);
625 void GetShaderiv(GLuint shader, GLenum pname, GLint* params) override
627 glGetShaderiv(shader, pname, params);
630 void GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) override
632 glGetShaderInfoLog(shader, bufsize, length, infolog);
635 void GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) override
637 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
640 void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) override
642 glGetShaderSource(shader, bufsize, length, source);
645 const GLubyte* GetString(GLenum name) override
647 return glGetString(name);
650 void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) override
652 glGetTexParameterfv(target, pname, params);
655 void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) override
657 glGetTexParameteriv(target, pname, params);
660 void GetUniformfv(GLuint program, GLint location, GLfloat* params) override
662 glGetUniformfv(program, location, params);
665 void GetUniformiv(GLuint program, GLint location, GLint* params) override
667 glGetUniformiv(program, location, params);
670 int GetUniformLocation(GLuint program, const char* name) override
672 return glGetUniformLocation(program, name);
675 void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) override
677 glGetVertexAttribfv(index, pname, params);
680 void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) override
682 glGetVertexAttribiv(index, pname, params);
685 void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) override
687 glGetVertexAttribPointerv(index, pname, pointer);
690 void Hint(GLenum target, GLenum mode) override
692 glHint(target, mode);
695 GLboolean IsBuffer(GLuint buffer) override
697 return glIsBuffer(buffer);
700 GLboolean IsEnabled(GLenum cap) override
702 return glIsEnabled(cap);
705 GLboolean IsFramebuffer(GLuint framebuffer) override
707 return glIsFramebuffer(framebuffer);
710 GLboolean IsProgram(GLuint program) override
712 return glIsProgram(program);
715 GLboolean IsRenderbuffer(GLuint renderbuffer) override
717 return glIsRenderbuffer(renderbuffer);
720 GLboolean IsShader(GLuint shader) override
722 return glIsShader(shader);
725 GLboolean IsTexture(GLuint texture) override
727 return glIsTexture(texture);
730 void LineWidth(GLfloat width) override
735 void LinkProgram(GLuint program) override
737 glLinkProgram(program);
740 void PixelStorei(GLenum pname, GLint param) override
742 glPixelStorei(pname, param);
745 void PolygonOffset(GLfloat factor, GLfloat units) override
747 glPolygonOffset(factor, units);
750 void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) override
752 glReadPixels(x, y, width, height, format, type, pixels);
755 void ReleaseShaderCompiler(void) override
757 glReleaseShaderCompiler();
760 void RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) override
762 glRenderbufferStorage(target, internalformat, width, height);
765 void SampleCoverage(GLclampf value, GLboolean invert) override
767 glSampleCoverage(value, invert);
770 void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) override
772 glScissor(x, y, width, height);
775 void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) override
777 glShaderBinary(n, shaders, binaryformat, binary, length);
780 void ShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) override
782 glShaderSource(shader, count, string, length);
785 void StencilFunc(GLenum func, GLint ref, GLuint mask) override
787 glStencilFunc(func, ref, mask);
790 void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) override
792 glStencilFuncSeparate(face, func, ref, mask);
795 void StencilMask(GLuint mask) override
800 void StencilMaskSeparate(GLenum face, GLuint mask) override
802 glStencilMaskSeparate(face, mask);
805 void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) override
807 glStencilOp(fail, zfail, zpass);
810 void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) override
812 glStencilOpSeparate(face, fail, zfail, zpass);
815 void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) override
817 glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
820 void TexParameterf(GLenum target, GLenum pname, GLfloat param) override
822 glTexParameterf(target, pname, param);
825 void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) override
827 glTexParameterfv(target, pname, params);
830 void TexParameteri(GLenum target, GLenum pname, GLint param) override
832 glTexParameteri(target, pname, param);
835 void TexParameteriv(GLenum target, GLenum pname, const GLint* params) override
837 glTexParameteriv(target, pname, params);
840 void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) override
842 glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
845 void Uniform1f(GLint location, GLfloat x) override
847 glUniform1f(location, x);
850 void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) override
852 glUniform1fv(location, count, v);
855 void Uniform1i(GLint location, GLint x) override
857 glUniform1i(location, x);
860 void Uniform1iv(GLint location, GLsizei count, const GLint* v) override
862 glUniform1iv(location, count, v);
865 void Uniform2f(GLint location, GLfloat x, GLfloat y) override
867 glUniform2f(location, x, y);
870 void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) override
872 glUniform2fv(location, count, v);
875 void Uniform2i(GLint location, GLint x, GLint y) override
877 glUniform2i(location, x, y);
880 void Uniform2iv(GLint location, GLsizei count, const GLint* v) override
882 glUniform2iv(location, count, v);
885 void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) override
887 glUniform3f(location, x, y, z);
890 void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) override
892 glUniform3fv(location, count, v);
895 void Uniform3i(GLint location, GLint x, GLint y, GLint z) override
897 glUniform3i(location, x, y, z);
900 void Uniform3iv(GLint location, GLsizei count, const GLint* v) override
902 glUniform3iv(location, count, v);
905 void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
907 glUniform4f(location, x, y, z, w);
910 void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) override
912 glUniform4fv(location, count, v);
915 void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) override
917 glUniform4i(location, x, y, z, w);
920 void Uniform4iv(GLint location, GLsizei count, const GLint* v) override
922 glUniform4iv(location, count, v);
925 void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
927 glUniformMatrix2fv(location, count, transpose, value);
930 void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
932 glUniformMatrix3fv(location, count, transpose, value);
935 void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
937 glUniformMatrix4fv(location, count, transpose, value);
940 void UseProgram(GLuint program) override
942 glUseProgram(program);
945 void ValidateProgram(GLuint program) override
947 glValidateProgram(program);
950 void VertexAttrib1f(GLuint indx, GLfloat x) override
952 glVertexAttrib1f(indx, x);
955 void VertexAttrib1fv(GLuint indx, const GLfloat* values) override
957 glVertexAttrib1fv(indx, values);
960 void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) override
962 glVertexAttrib2f(indx, x, y);
965 void VertexAttrib2fv(GLuint indx, const GLfloat* values) override
967 glVertexAttrib2fv(indx, values);
970 void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) override
972 glVertexAttrib3f(indx, x, y, z);
975 void VertexAttrib3fv(GLuint indx, const GLfloat* values) override
977 glVertexAttrib3fv(indx, values);
980 void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
982 glVertexAttrib4f(indx, x, y, z, w);
985 void VertexAttrib4fv(GLuint indx, const GLfloat* values) override
987 glVertexAttrib4fv(indx, values);
990 void VertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) override
992 glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
995 void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override
997 glViewport(x, y, width, height);
1002 void ReadBuffer(GLenum mode) override
1004 mImpl->ReadBuffer(mode);
1007 void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) override
1009 mImpl->DrawRangeElements(mode, start, end, count, type, indices);
1012 void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) override
1014 mImpl->TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
1017 void TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) override
1019 mImpl->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
1022 void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) override
1024 mImpl->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
1027 void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) override
1029 mImpl->CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
1032 void CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) override
1034 mImpl->CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
1037 void GenQueries(GLsizei n, GLuint* ids) override
1039 mImpl->GenQueries(n, ids);
1042 void DeleteQueries(GLsizei n, const GLuint* ids) override
1044 mImpl->DeleteQueries(n, ids);
1047 GLboolean IsQuery(GLuint id) override
1049 return mImpl->IsQuery(id);
1052 void BeginQuery(GLenum target, GLuint id) override
1054 mImpl->BeginQuery(target, id);
1057 void EndQuery(GLenum target) override
1059 mImpl->EndQuery(target);
1062 void GetQueryiv(GLenum target, GLenum pname, GLint* params) override
1064 mImpl->GetQueryiv(target, pname, params);
1067 void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) override
1069 mImpl->GetQueryObjectuiv(id, pname, params);
1072 GLboolean UnmapBuffer(GLenum target) override
1074 return mImpl->UnmapBuffer(target);
1077 void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) override
1079 mImpl->GetBufferPointerv(target, pname, params);
1082 void DrawBuffers(GLsizei n, const GLenum* bufs) override
1084 mImpl->DrawBuffers(n, bufs);
1087 void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1089 mImpl->UniformMatrix2x3fv(location, count, transpose, value);
1092 void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1094 mImpl->UniformMatrix3x2fv(location, count, transpose, value);
1097 void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1099 mImpl->UniformMatrix2x4fv(location, count, transpose, value);
1102 void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1104 mImpl->UniformMatrix4x2fv(location, count, transpose, value);
1107 void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1109 mImpl->UniformMatrix3x4fv(location, count, transpose, value);
1112 void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1114 mImpl->UniformMatrix4x3fv(location, count, transpose, value);
1117 void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) override
1119 mImpl->BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
1122 void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) override
1124 mImpl->RenderbufferStorageMultisample(target, samples, internalformat, width, height);
1127 void FramebufferTexture2DMultisample(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) override
1129 mImpl->FramebufferTexture2DMultisample(target, attachment, textarget, texture, level, samples);
1132 void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) override
1134 mImpl->FramebufferTextureLayer(target, attachment, texture, level, layer);
1137 GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) override
1139 return mImpl->MapBufferRange(target, offset, length, access);
1142 void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) override
1144 mImpl->FlushMappedBufferRange(target, offset, length);
1147 void BindVertexArray(GLuint array) override
1149 mImpl->BindVertexArray(array);
1152 void DeleteVertexArrays(GLsizei n, const GLuint* arrays) override
1154 mImpl->DeleteVertexArrays(n, arrays);
1157 void GenVertexArrays(GLsizei n, GLuint* arrays) override
1159 mImpl->GenVertexArrays(n, arrays);
1162 GLboolean IsVertexArray(GLuint array) override
1164 return mImpl->IsVertexArray(array);
1167 void GetIntegeri_v(GLenum target, GLuint index, GLint* data) override
1169 mImpl->GetIntegeri_v(target, index, data);
1172 void BeginTransformFeedback(GLenum primitiveMode) override
1174 mImpl->BeginTransformFeedback(primitiveMode);
1177 void EndTransformFeedback(void) override
1179 mImpl->EndTransformFeedback();
1182 void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) override
1184 mImpl->BindBufferRange(target, index, buffer, offset, size);
1187 void BindBufferBase(GLenum target, GLuint index, GLuint buffer) override
1189 mImpl->BindBufferBase(target, index, buffer);
1192 void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) override
1194 mImpl->TransformFeedbackVaryings(program, count, varyings, bufferMode);
1197 void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) override
1199 mImpl->GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
1202 void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) override
1204 mImpl->VertexAttribIPointer(index, size, type, stride, pointer);
1207 void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override
1209 mImpl->GetVertexAttribIiv(index, pname, params);
1212 void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) override
1214 mImpl->GetVertexAttribIuiv(index, pname, params);
1217 void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) override
1219 mImpl->VertexAttribI4i(index, x, y, z, w);
1222 void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) override
1224 mImpl->VertexAttribI4ui(index, x, y, z, w);
1227 void VertexAttribI4iv(GLuint index, const GLint* v) override
1229 mImpl->VertexAttribI4iv(index, v);
1232 void VertexAttribI4uiv(GLuint index, const GLuint* v) override
1234 mImpl->VertexAttribI4uiv(index, v);
1237 void GetUniformuiv(GLuint program, GLint location, GLuint* params) override
1239 mImpl->GetUniformuiv(program, location, params);
1242 GLint GetFragDataLocation(GLuint program, const GLchar* name) override
1244 return mImpl->GetFragDataLocation(program, name);
1247 void Uniform1ui(GLint location, GLuint v0) override
1249 mImpl->Uniform1ui(location, v0);
1252 void Uniform2ui(GLint location, GLuint v0, GLuint v1) override
1254 mImpl->Uniform2ui(location, v0, v1);
1257 void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) override
1259 mImpl->Uniform3ui(location, v0, v1, v2);
1262 void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) override
1264 mImpl->Uniform4ui(location, v0, v1, v2, v3);
1267 void Uniform1uiv(GLint location, GLsizei count, const GLuint* value) override
1269 mImpl->Uniform1uiv(location, count, value);
1272 void Uniform2uiv(GLint location, GLsizei count, const GLuint* value) override
1274 mImpl->Uniform2uiv(location, count, value);
1277 void Uniform3uiv(GLint location, GLsizei count, const GLuint* value) override
1279 mImpl->Uniform3uiv(location, count, value);
1282 void Uniform4uiv(GLint location, GLsizei count, const GLuint* value) override
1284 mImpl->Uniform4uiv(location, count, value);
1287 void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) override
1289 mImpl->ClearBufferiv(buffer, drawbuffer, value);
1292 void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) override
1294 mImpl->ClearBufferuiv(buffer, drawbuffer, value);
1297 void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) override
1299 mImpl->ClearBufferfv(buffer, drawbuffer, value);
1302 void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) override
1304 mImpl->ClearBufferfi(buffer, drawbuffer, depth, stencil);
1307 const GLubyte* GetStringi(GLenum name, GLuint index) override
1309 return mImpl->GetStringi(name, index);
1312 void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) override
1314 mImpl->CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
1317 void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) override
1319 mImpl->GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
1322 void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) override
1324 mImpl->GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
1327 GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) override
1329 return mImpl->GetUniformBlockIndex(program, uniformBlockName);
1332 void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) override
1334 mImpl->GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
1337 void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) override
1339 mImpl->GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
1342 void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override
1344 mImpl->UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
1347 void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) override
1349 mImpl->DrawArraysInstanced(mode, first, count, instanceCount);
1352 void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) override
1354 mImpl->DrawElementsInstanced(mode, count, type, indices, instanceCount);
1357 GLsync FenceSync(GLenum condition, GLbitfield flags) override
1359 return mImpl->FenceSync(condition, flags);
1362 GLboolean IsSync(GLsync sync) override
1364 return mImpl->IsSync(sync);
1367 void DeleteSync(GLsync sync) override
1369 mImpl->DeleteSync(sync);
1372 GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
1374 return mImpl->ClientWaitSync(sync, flags, timeout);
1377 void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
1379 mImpl->WaitSync(sync, flags, timeout);
1382 void GetInteger64v(GLenum pname, GLint64* params) override
1384 mImpl->GetInteger64v(pname, params);
1387 void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) override
1389 mImpl->GetSynciv(sync, pname, bufSize, length, values);
1392 void GetInteger64i_v(GLenum target, GLuint index, GLint64* data) override
1394 mImpl->GetInteger64i_v(target, index, data);
1397 void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) override
1399 mImpl->GetBufferParameteri64v(target, pname, params);
1402 void GenSamplers(GLsizei count, GLuint* samplers) override
1404 mImpl->GenSamplers(count, samplers);
1407 void DeleteSamplers(GLsizei count, const GLuint* samplers) override
1409 mImpl->DeleteSamplers(count, samplers);
1412 GLboolean IsSampler(GLuint sampler) override
1414 return mImpl->IsSampler(sampler);
1417 void BindSampler(GLuint unit, GLuint sampler) override
1419 mImpl->BindSampler(unit, sampler);
1422 void SamplerParameteri(GLuint sampler, GLenum pname, GLint param) override
1424 mImpl->SamplerParameteri(sampler, pname, param);
1427 void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) override
1429 mImpl->SamplerParameteriv(sampler, pname, param);
1432 void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) override
1434 mImpl->SamplerParameterf(sampler, pname, param);
1437 void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) override
1439 mImpl->SamplerParameterfv(sampler, pname, param);
1442 void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) override
1444 mImpl->GetSamplerParameteriv(sampler, pname, params);
1447 void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) override
1449 mImpl->GetSamplerParameterfv(sampler, pname, params);
1452 void VertexAttribDivisor(GLuint index, GLuint divisor) override
1454 mImpl->VertexAttribDivisor(index, divisor);
1457 void BindTransformFeedback(GLenum target, GLuint id) override
1459 mImpl->BindTransformFeedback(target, id);
1462 void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids) override
1464 mImpl->DeleteTransformFeedbacks(n, ids);
1467 void GenTransformFeedbacks(GLsizei n, GLuint* ids) override
1469 mImpl->GenTransformFeedbacks(n, ids);
1472 GLboolean IsTransformFeedback(GLuint id) override
1474 return mImpl->IsTransformFeedback(id);
1477 void PauseTransformFeedback(void) override
1479 mImpl->PauseTransformFeedback();
1482 void ResumeTransformFeedback(void) override
1484 mImpl->ResumeTransformFeedback();
1487 void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) override
1489 mImpl->GetProgramBinary(program, bufSize, length, binaryFormat, binary);
1492 void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) override
1494 mImpl->ProgramBinary(program, binaryFormat, binary, length);
1497 void ProgramParameteri(GLuint program, GLenum pname, GLint value) override
1499 mImpl->ProgramParameteri(program, pname, value);
1502 void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) override
1504 mImpl->InvalidateFramebuffer(target, numAttachments, attachments);
1507 void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) override
1509 mImpl->InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
1512 void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) override
1514 mImpl->TexStorage2D(target, levels, internalformat, width, height);
1517 void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) override
1519 mImpl->TexStorage3D(target, levels, internalformat, width, height, depth);
1522 void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) override
1524 mImpl->GetInternalformativ(target, internalformat, pname, bufSize, params);
1527 void BlendBarrier(void)
1529 if(mGlExtensionSupportedCacheList.GetSupported(GlExtensionCache::GlExtensionCheckerType::BLEND_EQUATION_ADVANCED))
1531 mImpl->BlendBarrier();
1536 std::unique_ptr<GlesAbstraction> mImpl;
1538 GlExtensionCache::GlExtensionSupportedCacheList mGlExtensionSupportedCacheList;
1540 ConditionalWait mContextCreatedWaitCondition;
1541 GLint mMaxTextureSize;
1542 GLint mMaxTextureSamples;
1543 std::string mShaderVersionPrefix;
1544 std::string mVertexShaderPrefix;
1545 std::string mFragmentShaderPrefix;
1546 int32_t mGlesVersion;
1547 int32_t mShadingLanguageVersion;
1548 uint32_t mLogThreshold{0};
1549 bool mShadingLanguageVersionCached;
1550 bool mIsSurfacelessContextSupported;
1551 bool mIsContextCreated;
1552 bool mLogEnabled{false};
1555 } // namespace Adaptor
1557 } // namespace Internal
1561 #endif // DALI_INTERNAL_GL_IMPLEMENTATION_H