1 #ifndef DALI_INTERNAL_GL_IMPLEMENTATION_H
2 #define DALI_INTERNAL_GL_IMPLEMENTATION_H
5 * Copyright (c) 2021 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>
31 #include <dali/internal/graphics/gles/gles-abstraction.h>
32 #include <dali/internal/graphics/gles/gles2-implementation.h>
33 #include <dali/internal/graphics/gles/gles3-implementation.h>
43 const int32_t INITIAL_GLES_VERSION = 30;
44 const int32_t GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED = 32;
45 const char* KHR_BLEND_EQUATION_ADVANCED = "GL_KHR_blend_equation_advanced";
47 const char* FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX =
48 "#extension GL_KHR_blend_equation_advanced : enable\n"
50 "#if GL_KHR_blend_equation_advanced==1 || __VERSION__>=320\n"
51 " layout(blend_support_all_equations) out;\n"
54 const char* FRAGMENT_SHADER_OUTPUT_COLOR_STRING =
55 "out mediump vec4 fragColor;\n";
59 * GlImplementation is a concrete implementation for GlAbstraction.
60 * The class provides an OpenGL-ES 2.0 or 3.0 implementation.
61 * The class is provided when creating the Integration::Core object.
63 class GlImplementation : public Dali::Integration::GlAbstraction
67 : mContextCreatedWaitCondition(),
69 mVertexShaderPrefix(""),
70 mGlesVersion(INITIAL_GLES_VERSION),
71 mShadingLanguageVersion(100),
72 mShadingLanguageVersionCached(false),
73 mIsSurfacelessContextSupported(false),
74 mIsAdvancedBlendEquationSupportedCached(false),
75 mIsAdvancedBlendEquationSupported(false),
76 mIsContextCreated(false)
78 mImpl.reset(new Gles3Implementation());
81 virtual ~GlImplementation()
85 void PreRender() override
87 /* Do nothing in main implementation */
90 void PostRender() override
92 /* Do nothing in main implementation */
97 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
99 // Only change gles version for the device that support above gles 3.0.
100 if(mGlesVersion >= INITIAL_GLES_VERSION)
102 GLint majorVersion, minorVersion;
103 glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
104 glGetIntegerv(GL_MINOR_VERSION, &minorVersion);
105 mGlesVersion = majorVersion * 10 + minorVersion;
108 if(mGlesVersion >= GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED)
110 mIsAdvancedBlendEquationSupported = true;
114 // when mIsAdvancedBlendEquationSupported is cached, we don't need to check all the extensions.
115 if(!mIsAdvancedBlendEquationSupportedCached)
117 const char* const extensionStr = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
118 std::istringstream stream(extensionStr);
119 std::string currentExtension;
120 while(std::getline(stream, currentExtension, ' '))
122 if(currentExtension == KHR_BLEND_EQUATION_ADVANCED)
124 mIsAdvancedBlendEquationSupported = true;
131 if(!mShadingLanguageVersionCached)
133 std::istringstream shadingLanguageVersionStream(reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
135 uint32_t tokenCount = 0;
136 while(std::getline(shadingLanguageVersionStream, token, ' '))
138 if(tokenCount == 3 && token == "ES")
140 std::getline(shadingLanguageVersionStream, token, '.');
141 mShadingLanguageVersion = std::atoi(token.c_str());
142 mShadingLanguageVersion *= 100;
143 std::getline(shadingLanguageVersionStream, token, '.');
144 mShadingLanguageVersion += std::atoi(token.c_str());
152 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
153 mIsContextCreated = true;
154 mContextCreatedWaitCondition.Notify(lock);
158 void SetGlesVersion(const int32_t glesVersion)
160 if(mGlesVersion / 10 != glesVersion / 10)
162 mGlesVersion = glesVersion;
163 if(mGlesVersion >= 30)
165 mImpl.reset(new Gles3Implementation());
169 mImpl.reset(new Gles2Implementation());
174 void SetIsSurfacelessContextSupported(const bool isSupported)
176 mIsSurfacelessContextSupported = isSupported;
179 bool IsSurfacelessContextSupported() const override
181 return mIsSurfacelessContextSupported;
184 void SetIsAdvancedBlendEquationSupported(const bool isSupported)
186 mIsAdvancedBlendEquationSupported = isSupported;
187 mIsAdvancedBlendEquationSupportedCached = true;
190 bool IsAdvancedBlendEquationSupported()
192 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
193 if(!mIsContextCreated && !mIsAdvancedBlendEquationSupportedCached)
195 mContextCreatedWaitCondition.Wait(lock);
197 return mIsAdvancedBlendEquationSupported;
200 bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation)
202 switch(blendEquation)
204 case DevelBlendEquation::ADD:
205 case DevelBlendEquation::SUBTRACT:
206 case DevelBlendEquation::REVERSE_SUBTRACT:
210 case DevelBlendEquation::MIN:
211 case DevelBlendEquation::MAX:
213 return (GetGlesVersion() >= 30);
215 case DevelBlendEquation::MULTIPLY:
216 case DevelBlendEquation::SCREEN:
217 case DevelBlendEquation::OVERLAY:
218 case DevelBlendEquation::DARKEN:
219 case DevelBlendEquation::LIGHTEN:
220 case DevelBlendEquation::COLOR_DODGE:
221 case DevelBlendEquation::COLOR_BURN:
222 case DevelBlendEquation::HARD_LIGHT:
223 case DevelBlendEquation::SOFT_LIGHT:
224 case DevelBlendEquation::DIFFERENCE:
225 case DevelBlendEquation::EXCLUSION:
226 case DevelBlendEquation::HUE:
227 case DevelBlendEquation::SATURATION:
228 case DevelBlendEquation::COLOR:
229 case DevelBlendEquation::LUMINOSITY:
231 return IsAdvancedBlendEquationSupported();
243 std::string GetShaderVersionPrefix()
245 if(mShaderVersionPrefix == "")
247 mShaderVersionPrefix = "#version " + std::to_string(GetShadingLanguageVersion());
248 if(GetShadingLanguageVersion() < 300)
250 mShaderVersionPrefix += "\n";
254 mShaderVersionPrefix += " es\n";
257 return mShaderVersionPrefix;
260 std::string GetVertexShaderPrefix()
262 if(mVertexShaderPrefix == "")
264 mVertexShaderPrefix = GetShaderVersionPrefix();
266 if(GetShadingLanguageVersion() < 300)
268 mVertexShaderPrefix += "#define INPUT attribute\n";
269 mVertexShaderPrefix += "#define OUTPUT varying\n";
273 mVertexShaderPrefix += "#define INPUT in\n";
274 mVertexShaderPrefix += "#define OUTPUT out\n";
277 return mVertexShaderPrefix;
280 std::string GetFragmentShaderPrefix()
282 if(mFragmentShaderPrefix == "")
284 mFragmentShaderPrefix = GetShaderVersionPrefix();
286 if(GetShadingLanguageVersion() < 300)
288 mFragmentShaderPrefix += "#define INPUT varying\n";
289 mFragmentShaderPrefix += "#define OUT_COLOR gl_FragColor\n";
290 mFragmentShaderPrefix += "#define TEXTURE texture2D\n";
294 mFragmentShaderPrefix += "#define INPUT in\n";
295 mFragmentShaderPrefix += "#define OUT_COLOR fragColor\n";
296 mFragmentShaderPrefix += "#define TEXTURE texture\n";
298 if(IsAdvancedBlendEquationSupported())
300 mFragmentShaderPrefix += FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX;
303 mFragmentShaderPrefix += FRAGMENT_SHADER_OUTPUT_COLOR_STRING;
306 return mFragmentShaderPrefix;
309 bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const override
311 bool convert = ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA));
312 if(mGlesVersion >= 30)
314 // Don't convert manually from RGB to RGBA if GLES >= 3.0 and a sub-image is uploaded.
315 convert = (convert && !isSubImage);
320 int GetMaxTextureSize()
322 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
323 if(!mIsContextCreated)
325 mContextCreatedWaitCondition.Wait(lock);
327 return mMaxTextureSize;
332 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
333 if(!mIsContextCreated)
335 mContextCreatedWaitCondition.Wait(lock);
340 void SetShadingLanguageVersion(int shadingLanguageVersion)
342 mShadingLanguageVersion = shadingLanguageVersion;
343 mShadingLanguageVersionCached = true;
346 int GetShadingLanguageVersion()
348 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
349 if(!mIsContextCreated && !mShadingLanguageVersionCached)
351 mContextCreatedWaitCondition.Wait(lock);
353 return mShadingLanguageVersion;
358 void ActiveTexture(GLenum texture) override
360 glActiveTexture(texture);
363 void AttachShader(GLuint program, GLuint shader) override
365 glAttachShader(program, shader);
368 void BindAttribLocation(GLuint program, GLuint index, const char* name) override
370 glBindAttribLocation(program, index, name);
373 void BindBuffer(GLenum target, GLuint buffer) override
375 glBindBuffer(target, buffer);
378 void BindFramebuffer(GLenum target, GLuint framebuffer) override
380 glBindFramebuffer(target, framebuffer);
383 void BindRenderbuffer(GLenum target, GLuint renderbuffer) override
385 glBindRenderbuffer(target, renderbuffer);
388 void BindTexture(GLenum target, GLuint texture) override
390 glBindTexture(target, texture);
393 void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) override
395 glBlendColor(red, green, blue, alpha);
398 void BlendEquation(GLenum mode) override
400 glBlendEquation(mode);
403 void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) override
405 glBlendEquationSeparate(modeRGB, modeAlpha);
408 void BlendFunc(GLenum sfactor, GLenum dfactor) override
410 glBlendFunc(sfactor, dfactor);
413 void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) override
415 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
418 void BufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) override
420 glBufferData(target, size, data, usage);
423 void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) override
425 glBufferSubData(target, offset, size, data);
428 GLenum CheckFramebufferStatus(GLenum target) override
430 return glCheckFramebufferStatus(target);
433 void Clear(GLbitfield mask) override
438 void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) override
440 glClearColor(red, green, blue, alpha);
443 void ClearDepthf(GLclampf depth) override
445 glClearDepthf(depth);
448 void ClearStencil(GLint s) override
453 void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) override
455 glColorMask(red, green, blue, alpha);
458 void CompileShader(GLuint shader) override
460 glCompileShader(shader);
463 void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) override
465 glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
468 void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) override
470 glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
473 void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) override
475 glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
478 void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) override
480 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
483 GLuint CreateProgram(void) override
485 return glCreateProgram();
488 GLuint CreateShader(GLenum type) override
490 return glCreateShader(type);
493 void CullFace(GLenum mode) override
498 void DeleteBuffers(GLsizei n, const GLuint* buffers) override
500 glDeleteBuffers(n, buffers);
503 void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) override
505 glDeleteFramebuffers(n, framebuffers);
508 void DeleteProgram(GLuint program) override
510 glDeleteProgram(program);
513 void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) override
515 glDeleteRenderbuffers(n, renderbuffers);
518 void DeleteShader(GLuint shader) override
520 glDeleteShader(shader);
523 void DeleteTextures(GLsizei n, const GLuint* textures) override
525 glDeleteTextures(n, textures);
528 void DepthFunc(GLenum func) override
533 void DepthMask(GLboolean flag) override
538 void DepthRangef(GLclampf zNear, GLclampf zFar) override
540 glDepthRangef(zNear, zFar);
543 void DetachShader(GLuint program, GLuint shader) override
545 glDetachShader(program, shader);
548 void Disable(GLenum cap) override
553 void DisableVertexAttribArray(GLuint index) override
555 glDisableVertexAttribArray(index);
558 void DrawArrays(GLenum mode, GLint first, GLsizei count) override
560 glDrawArrays(mode, first, count);
563 void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) override
565 glDrawElements(mode, count, type, indices);
568 void Enable(GLenum cap) override
573 void EnableVertexAttribArray(GLuint index) override
575 glEnableVertexAttribArray(index);
578 void Finish(void) override
583 void Flush(void) override
588 void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) override
590 glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
593 void FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) override
595 glFramebufferTexture2D(target, attachment, textarget, texture, level);
598 void FrontFace(GLenum mode) override
603 void GenBuffers(GLsizei n, GLuint* buffers) override
605 glGenBuffers(n, buffers);
608 void GenerateMipmap(GLenum target) override
610 glGenerateMipmap(target);
613 void GenFramebuffers(GLsizei n, GLuint* framebuffers) override
615 glGenFramebuffers(n, framebuffers);
618 void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) override
620 glGenRenderbuffers(n, renderbuffers);
623 void GenTextures(GLsizei n, GLuint* textures) override
625 glGenTextures(n, textures);
628 void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) override
630 glGetActiveAttrib(program, index, bufsize, length, size, type, name);
633 void GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) override
635 glGetActiveUniform(program, index, bufsize, length, size, type, name);
638 void GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) override
640 glGetAttachedShaders(program, maxcount, count, shaders);
643 int GetAttribLocation(GLuint program, const char* name) override
645 return glGetAttribLocation(program, name);
648 void GetBooleanv(GLenum pname, GLboolean* params) override
650 glGetBooleanv(pname, params);
653 void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) override
655 glGetBufferParameteriv(target, pname, params);
658 GLenum GetError(void) override
663 void GetFloatv(GLenum pname, GLfloat* params) override
665 glGetFloatv(pname, params);
668 void GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) override
670 glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
673 void GetIntegerv(GLenum pname, GLint* params) override
675 glGetIntegerv(pname, params);
678 void GetProgramiv(GLuint program, GLenum pname, GLint* params) override
680 glGetProgramiv(program, pname, params);
683 void GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) override
685 glGetProgramInfoLog(program, bufsize, length, infolog);
688 void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) override
690 glGetRenderbufferParameteriv(target, pname, params);
693 void GetShaderiv(GLuint shader, GLenum pname, GLint* params) override
695 glGetShaderiv(shader, pname, params);
698 void GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) override
700 glGetShaderInfoLog(shader, bufsize, length, infolog);
703 void GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) override
705 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
708 void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) override
710 glGetShaderSource(shader, bufsize, length, source);
713 const GLubyte* GetString(GLenum name) override
715 return glGetString(name);
718 void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) override
720 glGetTexParameterfv(target, pname, params);
723 void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) override
725 glGetTexParameteriv(target, pname, params);
728 void GetUniformfv(GLuint program, GLint location, GLfloat* params) override
730 glGetUniformfv(program, location, params);
733 void GetUniformiv(GLuint program, GLint location, GLint* params) override
735 glGetUniformiv(program, location, params);
738 int GetUniformLocation(GLuint program, const char* name) override
740 return glGetUniformLocation(program, name);
743 void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) override
745 glGetVertexAttribfv(index, pname, params);
748 void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) override
750 glGetVertexAttribiv(index, pname, params);
753 void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) override
755 glGetVertexAttribPointerv(index, pname, pointer);
758 void Hint(GLenum target, GLenum mode) override
760 glHint(target, mode);
763 GLboolean IsBuffer(GLuint buffer) override
765 return glIsBuffer(buffer);
768 GLboolean IsEnabled(GLenum cap) override
770 return glIsEnabled(cap);
773 GLboolean IsFramebuffer(GLuint framebuffer) override
775 return glIsFramebuffer(framebuffer);
778 GLboolean IsProgram(GLuint program) override
780 return glIsProgram(program);
783 GLboolean IsRenderbuffer(GLuint renderbuffer) override
785 return glIsRenderbuffer(renderbuffer);
788 GLboolean IsShader(GLuint shader) override
790 return glIsShader(shader);
793 GLboolean IsTexture(GLuint texture) override
795 return glIsTexture(texture);
798 void LineWidth(GLfloat width) override
803 void LinkProgram(GLuint program) override
805 glLinkProgram(program);
808 void PixelStorei(GLenum pname, GLint param) override
810 glPixelStorei(pname, param);
813 void PolygonOffset(GLfloat factor, GLfloat units) override
815 glPolygonOffset(factor, units);
818 void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) override
820 glReadPixels(x, y, width, height, format, type, pixels);
823 void ReleaseShaderCompiler(void) override
825 glReleaseShaderCompiler();
828 void RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) override
830 glRenderbufferStorage(target, internalformat, width, height);
833 void SampleCoverage(GLclampf value, GLboolean invert) override
835 glSampleCoverage(value, invert);
838 void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) override
840 glScissor(x, y, width, height);
843 void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) override
845 glShaderBinary(n, shaders, binaryformat, binary, length);
848 void ShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) override
850 glShaderSource(shader, count, string, length);
853 void StencilFunc(GLenum func, GLint ref, GLuint mask) override
855 glStencilFunc(func, ref, mask);
858 void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) override
860 glStencilFuncSeparate(face, func, ref, mask);
863 void StencilMask(GLuint mask) override
868 void StencilMaskSeparate(GLenum face, GLuint mask) override
870 glStencilMaskSeparate(face, mask);
873 void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) override
875 glStencilOp(fail, zfail, zpass);
878 void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) override
880 glStencilOpSeparate(face, fail, zfail, zpass);
883 void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) override
885 glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
888 void TexParameterf(GLenum target, GLenum pname, GLfloat param) override
890 glTexParameterf(target, pname, param);
893 void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) override
895 glTexParameterfv(target, pname, params);
898 void TexParameteri(GLenum target, GLenum pname, GLint param) override
900 glTexParameteri(target, pname, param);
903 void TexParameteriv(GLenum target, GLenum pname, const GLint* params) override
905 glTexParameteriv(target, pname, params);
908 void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) override
910 glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
913 void Uniform1f(GLint location, GLfloat x) override
915 glUniform1f(location, x);
918 void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) override
920 glUniform1fv(location, count, v);
923 void Uniform1i(GLint location, GLint x) override
925 glUniform1i(location, x);
928 void Uniform1iv(GLint location, GLsizei count, const GLint* v) override
930 glUniform1iv(location, count, v);
933 void Uniform2f(GLint location, GLfloat x, GLfloat y) override
935 glUniform2f(location, x, y);
938 void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) override
940 glUniform2fv(location, count, v);
943 void Uniform2i(GLint location, GLint x, GLint y) override
945 glUniform2i(location, x, y);
948 void Uniform2iv(GLint location, GLsizei count, const GLint* v) override
950 glUniform2iv(location, count, v);
953 void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) override
955 glUniform3f(location, x, y, z);
958 void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) override
960 glUniform3fv(location, count, v);
963 void Uniform3i(GLint location, GLint x, GLint y, GLint z) override
965 glUniform3i(location, x, y, z);
968 void Uniform3iv(GLint location, GLsizei count, const GLint* v) override
970 glUniform3iv(location, count, v);
973 void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
975 glUniform4f(location, x, y, z, w);
978 void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) override
980 glUniform4fv(location, count, v);
983 void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) override
985 glUniform4i(location, x, y, z, w);
988 void Uniform4iv(GLint location, GLsizei count, const GLint* v) override
990 glUniform4iv(location, count, v);
993 void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
995 glUniformMatrix2fv(location, count, transpose, value);
998 void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1000 glUniformMatrix3fv(location, count, transpose, value);
1003 void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1005 glUniformMatrix4fv(location, count, transpose, value);
1008 void UseProgram(GLuint program) override
1010 glUseProgram(program);
1013 void ValidateProgram(GLuint program) override
1015 glValidateProgram(program);
1018 void VertexAttrib1f(GLuint indx, GLfloat x) override
1020 glVertexAttrib1f(indx, x);
1023 void VertexAttrib1fv(GLuint indx, const GLfloat* values) override
1025 glVertexAttrib1fv(indx, values);
1028 void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) override
1030 glVertexAttrib2f(indx, x, y);
1033 void VertexAttrib2fv(GLuint indx, const GLfloat* values) override
1035 glVertexAttrib2fv(indx, values);
1038 void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) override
1040 glVertexAttrib3f(indx, x, y, z);
1043 void VertexAttrib3fv(GLuint indx, const GLfloat* values) override
1045 glVertexAttrib3fv(indx, values);
1048 void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
1050 glVertexAttrib4f(indx, x, y, z, w);
1053 void VertexAttrib4fv(GLuint indx, const GLfloat* values) override
1055 glVertexAttrib4fv(indx, values);
1058 void VertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) override
1060 glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
1063 void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override
1065 glViewport(x, y, width, height);
1070 void ReadBuffer(GLenum mode) override
1072 mImpl->ReadBuffer(mode);
1075 void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) override
1077 mImpl->DrawRangeElements(mode, start, end, count, type, indices);
1080 void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) override
1082 mImpl->TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
1085 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
1087 mImpl->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
1090 void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) override
1092 mImpl->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
1095 void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) override
1097 mImpl->CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
1100 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
1102 mImpl->CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
1105 void GenQueries(GLsizei n, GLuint* ids) override
1107 mImpl->GenQueries(n, ids);
1110 void DeleteQueries(GLsizei n, const GLuint* ids) override
1112 mImpl->DeleteQueries(n, ids);
1115 GLboolean IsQuery(GLuint id) override
1117 return mImpl->IsQuery(id);
1120 void BeginQuery(GLenum target, GLuint id) override
1122 mImpl->BeginQuery(target, id);
1125 void EndQuery(GLenum target) override
1127 mImpl->EndQuery(target);
1130 void GetQueryiv(GLenum target, GLenum pname, GLint* params) override
1132 mImpl->GetQueryiv(target, pname, params);
1135 void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) override
1137 mImpl->GetQueryObjectuiv(id, pname, params);
1140 GLboolean UnmapBuffer(GLenum target) override
1142 return mImpl->UnmapBuffer(target);
1145 void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) override
1147 mImpl->GetBufferPointerv(target, pname, params);
1150 void DrawBuffers(GLsizei n, const GLenum* bufs) override
1152 mImpl->DrawBuffers(n, bufs);
1155 void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1157 mImpl->UniformMatrix2x3fv(location, count, transpose, value);
1160 void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1162 mImpl->UniformMatrix3x2fv(location, count, transpose, value);
1165 void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1167 mImpl->UniformMatrix2x4fv(location, count, transpose, value);
1170 void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1172 mImpl->UniformMatrix4x2fv(location, count, transpose, value);
1175 void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1177 mImpl->UniformMatrix3x4fv(location, count, transpose, value);
1180 void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1182 mImpl->UniformMatrix4x3fv(location, count, transpose, value);
1185 void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) override
1187 mImpl->BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
1190 void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) override
1192 mImpl->RenderbufferStorageMultisample(target, samples, internalformat, width, height);
1195 void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) override
1197 mImpl->FramebufferTextureLayer(target, attachment, texture, level, layer);
1200 GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) override
1202 return mImpl->MapBufferRange(target, offset, length, access);
1205 void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) override
1207 mImpl->FlushMappedBufferRange(target, offset, length);
1210 void BindVertexArray(GLuint array) override
1212 mImpl->BindVertexArray(array);
1215 void DeleteVertexArrays(GLsizei n, const GLuint* arrays) override
1217 mImpl->DeleteVertexArrays(n, arrays);
1220 void GenVertexArrays(GLsizei n, GLuint* arrays) override
1222 mImpl->GenVertexArrays(n, arrays);
1225 GLboolean IsVertexArray(GLuint array) override
1227 return mImpl->IsVertexArray(array);
1230 void GetIntegeri_v(GLenum target, GLuint index, GLint* data) override
1232 mImpl->GetIntegeri_v(target, index, data);
1235 void BeginTransformFeedback(GLenum primitiveMode) override
1237 mImpl->BeginTransformFeedback(primitiveMode);
1240 void EndTransformFeedback(void) override
1242 mImpl->EndTransformFeedback();
1245 void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) override
1247 mImpl->BindBufferRange(target, index, buffer, offset, size);
1250 void BindBufferBase(GLenum target, GLuint index, GLuint buffer) override
1252 mImpl->BindBufferBase(target, index, buffer);
1255 void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) override
1257 mImpl->TransformFeedbackVaryings(program, count, varyings, bufferMode);
1260 void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) override
1262 mImpl->GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
1265 void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) override
1267 mImpl->VertexAttribIPointer(index, size, type, stride, pointer);
1270 void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override
1272 mImpl->GetVertexAttribIiv(index, pname, params);
1275 void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) override
1277 mImpl->GetVertexAttribIuiv(index, pname, params);
1280 void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) override
1282 mImpl->VertexAttribI4i(index, x, y, z, w);
1285 void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) override
1287 mImpl->VertexAttribI4ui(index, x, y, z, w);
1290 void VertexAttribI4iv(GLuint index, const GLint* v) override
1292 mImpl->VertexAttribI4iv(index, v);
1295 void VertexAttribI4uiv(GLuint index, const GLuint* v) override
1297 mImpl->VertexAttribI4uiv(index, v);
1300 void GetUniformuiv(GLuint program, GLint location, GLuint* params) override
1302 mImpl->GetUniformuiv(program, location, params);
1305 GLint GetFragDataLocation(GLuint program, const GLchar* name) override
1307 return mImpl->GetFragDataLocation(program, name);
1310 void Uniform1ui(GLint location, GLuint v0) override
1312 mImpl->Uniform1ui(location, v0);
1315 void Uniform2ui(GLint location, GLuint v0, GLuint v1) override
1317 mImpl->Uniform2ui(location, v0, v1);
1320 void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) override
1322 mImpl->Uniform3ui(location, v0, v1, v2);
1325 void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) override
1327 mImpl->Uniform4ui(location, v0, v1, v2, v3);
1330 void Uniform1uiv(GLint location, GLsizei count, const GLuint* value) override
1332 mImpl->Uniform1uiv(location, count, value);
1335 void Uniform2uiv(GLint location, GLsizei count, const GLuint* value) override
1337 mImpl->Uniform2uiv(location, count, value);
1340 void Uniform3uiv(GLint location, GLsizei count, const GLuint* value) override
1342 mImpl->Uniform3uiv(location, count, value);
1345 void Uniform4uiv(GLint location, GLsizei count, const GLuint* value) override
1347 mImpl->Uniform4uiv(location, count, value);
1350 void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) override
1352 mImpl->ClearBufferiv(buffer, drawbuffer, value);
1355 void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) override
1357 mImpl->ClearBufferuiv(buffer, drawbuffer, value);
1360 void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) override
1362 mImpl->ClearBufferfv(buffer, drawbuffer, value);
1365 void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) override
1367 mImpl->ClearBufferfi(buffer, drawbuffer, depth, stencil);
1370 const GLubyte* GetStringi(GLenum name, GLuint index) override
1372 return mImpl->GetStringi(name, index);
1375 void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) override
1377 mImpl->CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
1380 void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) override
1382 mImpl->GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
1385 void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) override
1387 mImpl->GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
1390 GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) override
1392 return mImpl->GetUniformBlockIndex(program, uniformBlockName);
1395 void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) override
1397 mImpl->GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
1400 void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) override
1402 mImpl->GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
1405 void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override
1407 mImpl->UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
1410 void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) override
1412 mImpl->DrawArraysInstanced(mode, first, count, instanceCount);
1415 void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) override
1417 mImpl->DrawElementsInstanced(mode, count, type, indices, instanceCount);
1420 GLsync FenceSync(GLenum condition, GLbitfield flags) override
1422 return mImpl->FenceSync(condition, flags);
1425 GLboolean IsSync(GLsync sync) override
1427 return mImpl->IsSync(sync);
1430 void DeleteSync(GLsync sync) override
1432 mImpl->DeleteSync(sync);
1435 GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
1437 return mImpl->ClientWaitSync(sync, flags, timeout);
1440 void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
1442 mImpl->WaitSync(sync, flags, timeout);
1445 void GetInteger64v(GLenum pname, GLint64* params) override
1447 mImpl->GetInteger64v(pname, params);
1450 void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) override
1452 mImpl->GetSynciv(sync, pname, bufSize, length, values);
1455 void GetInteger64i_v(GLenum target, GLuint index, GLint64* data) override
1457 mImpl->GetInteger64i_v(target, index, data);
1460 void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) override
1462 mImpl->GetBufferParameteri64v(target, pname, params);
1465 void GenSamplers(GLsizei count, GLuint* samplers) override
1467 mImpl->GenSamplers(count, samplers);
1470 void DeleteSamplers(GLsizei count, const GLuint* samplers) override
1472 mImpl->DeleteSamplers(count, samplers);
1475 GLboolean IsSampler(GLuint sampler) override
1477 return mImpl->IsSampler(sampler);
1480 void BindSampler(GLuint unit, GLuint sampler) override
1482 mImpl->BindSampler(unit, sampler);
1485 void SamplerParameteri(GLuint sampler, GLenum pname, GLint param) override
1487 mImpl->SamplerParameteri(sampler, pname, param);
1490 void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) override
1492 mImpl->SamplerParameteriv(sampler, pname, param);
1495 void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) override
1497 mImpl->SamplerParameterf(sampler, pname, param);
1500 void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) override
1502 mImpl->SamplerParameterfv(sampler, pname, param);
1505 void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) override
1507 mImpl->GetSamplerParameteriv(sampler, pname, params);
1510 void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) override
1512 mImpl->GetSamplerParameterfv(sampler, pname, params);
1515 void VertexAttribDivisor(GLuint index, GLuint divisor) override
1517 mImpl->VertexAttribDivisor(index, divisor);
1520 void BindTransformFeedback(GLenum target, GLuint id) override
1522 mImpl->BindTransformFeedback(target, id);
1525 void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids) override
1527 mImpl->DeleteTransformFeedbacks(n, ids);
1530 void GenTransformFeedbacks(GLsizei n, GLuint* ids) override
1532 mImpl->GenTransformFeedbacks(n, ids);
1535 GLboolean IsTransformFeedback(GLuint id) override
1537 return mImpl->IsTransformFeedback(id);
1540 void PauseTransformFeedback(void) override
1542 mImpl->PauseTransformFeedback();
1545 void ResumeTransformFeedback(void) override
1547 mImpl->ResumeTransformFeedback();
1550 void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) override
1552 mImpl->GetProgramBinary(program, bufSize, length, binaryFormat, binary);
1555 void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) override
1557 mImpl->ProgramBinary(program, binaryFormat, binary, length);
1560 void ProgramParameteri(GLuint program, GLenum pname, GLint value) override
1562 mImpl->ProgramParameteri(program, pname, value);
1565 void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) override
1567 mImpl->InvalidateFramebuffer(target, numAttachments, attachments);
1570 void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) override
1572 mImpl->InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
1575 void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) override
1577 mImpl->TexStorage2D(target, levels, internalformat, width, height);
1580 void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) override
1582 mImpl->TexStorage3D(target, levels, internalformat, width, height, depth);
1585 void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) override
1587 mImpl->GetInternalformativ(target, internalformat, pname, bufSize, params);
1590 void BlendBarrier(void)
1592 if(mIsAdvancedBlendEquationSupported)
1594 mImpl->BlendBarrier();
1599 std::unique_ptr<GlesAbstraction> mImpl;
1601 ConditionalWait mContextCreatedWaitCondition;
1602 GLint mMaxTextureSize;
1603 std::string mShaderVersionPrefix;
1604 std::string mVertexShaderPrefix;
1605 std::string mFragmentShaderPrefix;
1606 int32_t mGlesVersion;
1607 int32_t mShadingLanguageVersion;
1608 bool mShadingLanguageVersionCached;
1609 bool mIsSurfacelessContextSupported;
1610 bool mIsAdvancedBlendEquationSupportedCached;
1611 bool mIsAdvancedBlendEquationSupported;
1612 bool mIsContextCreated;
1615 } // namespace Adaptor
1617 } // namespace Internal
1621 #endif // DALI_INTERNAL_GL_IMPLEMENTATION_H