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 GLint majorVersion, minorVersion;
100 glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
101 glGetIntegerv(GL_MINOR_VERSION, &minorVersion);
102 mGlesVersion = majorVersion * 10 + minorVersion;
104 if(mGlesVersion >= GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED)
106 mIsAdvancedBlendEquationSupported = true;
110 // when mIsAdvancedBlendEquationSupported is cached, we don't need to check all the extensions.
111 if(!mIsAdvancedBlendEquationSupportedCached)
113 const char* const extensionStr = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
114 std::istringstream stream(extensionStr);
115 std::string currentExtension;
116 while(std::getline(stream, currentExtension, ' '))
118 if(currentExtension == KHR_BLEND_EQUATION_ADVANCED)
120 mIsAdvancedBlendEquationSupported = true;
127 if(!mShadingLanguageVersionCached)
129 std::istringstream shadingLanguageVersionStream(reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
131 uint32_t tokenCount = 0;
132 while(std::getline(shadingLanguageVersionStream, token, ' '))
134 if(tokenCount == 3 && token == "ES")
136 std::getline(shadingLanguageVersionStream, token, '.');
137 mShadingLanguageVersion = std::atoi(token.c_str());
138 mShadingLanguageVersion *= 100;
139 std::getline(shadingLanguageVersionStream, token, '.');
140 mShadingLanguageVersion += std::atoi(token.c_str());
148 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
149 mIsContextCreated = true;
150 mContextCreatedWaitCondition.Notify(lock);
154 void SetGlesVersion(const int32_t glesVersion)
156 if(mGlesVersion / 10 != glesVersion / 10)
158 mGlesVersion = glesVersion;
159 if(mGlesVersion >= 30)
161 mImpl.reset(new Gles3Implementation());
165 mImpl.reset(new Gles2Implementation());
170 void SetIsSurfacelessContextSupported(const bool isSupported)
172 mIsSurfacelessContextSupported = isSupported;
175 bool IsSurfacelessContextSupported() const override
177 return mIsSurfacelessContextSupported;
180 void SetIsAdvancedBlendEquationSupported(const bool isSupported)
182 mIsAdvancedBlendEquationSupported = isSupported;
183 mIsAdvancedBlendEquationSupportedCached = true;
186 bool IsAdvancedBlendEquationSupported()
188 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
189 if(!mIsContextCreated && !mIsAdvancedBlendEquationSupportedCached)
191 mContextCreatedWaitCondition.Wait(lock);
193 return mIsAdvancedBlendEquationSupported;
196 bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation)
198 switch(blendEquation)
200 case DevelBlendEquation::ADD:
201 case DevelBlendEquation::SUBTRACT:
202 case DevelBlendEquation::REVERSE_SUBTRACT:
206 case DevelBlendEquation::MIN:
207 case DevelBlendEquation::MAX:
209 return (GetGlesVersion() >= 30);
211 case DevelBlendEquation::MULTIPLY:
212 case DevelBlendEquation::SCREEN:
213 case DevelBlendEquation::OVERLAY:
214 case DevelBlendEquation::DARKEN:
215 case DevelBlendEquation::LIGHTEN:
216 case DevelBlendEquation::COLOR_DODGE:
217 case DevelBlendEquation::COLOR_BURN:
218 case DevelBlendEquation::HARD_LIGHT:
219 case DevelBlendEquation::SOFT_LIGHT:
220 case DevelBlendEquation::DIFFERENCE:
221 case DevelBlendEquation::EXCLUSION:
222 case DevelBlendEquation::HUE:
223 case DevelBlendEquation::SATURATION:
224 case DevelBlendEquation::COLOR:
225 case DevelBlendEquation::LUMINOSITY:
227 return IsAdvancedBlendEquationSupported();
239 std::string GetShaderVersionPrefix()
241 if(mShaderVersionPrefix == "")
243 mShaderVersionPrefix = "#version " + std::to_string(GetShadingLanguageVersion());
244 if(GetShadingLanguageVersion() < 300)
246 mShaderVersionPrefix += "\n";
250 mShaderVersionPrefix += " es\n";
253 return mShaderVersionPrefix;
256 std::string GetVertexShaderPrefix()
258 if(mVertexShaderPrefix == "")
260 mVertexShaderPrefix = GetShaderVersionPrefix();
262 if(GetShadingLanguageVersion() < 300)
264 mVertexShaderPrefix += "#define INPUT attribute\n";
265 mVertexShaderPrefix += "#define OUTPUT varying\n";
269 mVertexShaderPrefix += "#define INPUT in\n";
270 mVertexShaderPrefix += "#define OUTPUT out\n";
273 return mVertexShaderPrefix;
276 std::string GetFragmentShaderPrefix()
278 if(mFragmentShaderPrefix == "")
280 mFragmentShaderPrefix = GetShaderVersionPrefix();
282 if(GetShadingLanguageVersion() < 300)
284 mFragmentShaderPrefix += "#define INPUT varying\n";
285 mFragmentShaderPrefix += "#define OUT_COLOR gl_FragColor\n";
286 mFragmentShaderPrefix += "#define TEXTURE texture2D\n";
290 mFragmentShaderPrefix += "#define INPUT in\n";
291 mFragmentShaderPrefix += "#define OUT_COLOR fragColor\n";
292 mFragmentShaderPrefix += "#define TEXTURE texture\n";
294 if(IsAdvancedBlendEquationSupported())
296 mFragmentShaderPrefix += FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX;
299 mFragmentShaderPrefix += FRAGMENT_SHADER_OUTPUT_COLOR_STRING;
302 return mFragmentShaderPrefix;
305 bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const override
307 bool convert = ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA));
308 if(mGlesVersion >= 30)
310 // Don't convert manually from RGB to RGBA if GLES >= 3.0 and a sub-image is uploaded.
311 convert = (convert && !isSubImage);
316 int GetMaxTextureSize()
318 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
319 if(!mIsContextCreated)
321 mContextCreatedWaitCondition.Wait(lock);
323 return mMaxTextureSize;
328 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
329 if(!mIsContextCreated)
331 mContextCreatedWaitCondition.Wait(lock);
336 void SetShadingLanguageVersion(int shadingLanguageVersion)
338 mShadingLanguageVersion = shadingLanguageVersion;
339 mShadingLanguageVersionCached = true;
342 int GetShadingLanguageVersion()
344 ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
345 if(!mIsContextCreated && !mShadingLanguageVersionCached)
347 mContextCreatedWaitCondition.Wait(lock);
349 return mShadingLanguageVersion;
354 void ActiveTexture(GLenum texture) override
356 glActiveTexture(texture);
359 void AttachShader(GLuint program, GLuint shader) override
361 glAttachShader(program, shader);
364 void BindAttribLocation(GLuint program, GLuint index, const char* name) override
366 glBindAttribLocation(program, index, name);
369 void BindBuffer(GLenum target, GLuint buffer) override
371 glBindBuffer(target, buffer);
374 void BindFramebuffer(GLenum target, GLuint framebuffer) override
376 glBindFramebuffer(target, framebuffer);
379 void BindRenderbuffer(GLenum target, GLuint renderbuffer) override
381 glBindRenderbuffer(target, renderbuffer);
384 void BindTexture(GLenum target, GLuint texture) override
386 glBindTexture(target, texture);
389 void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) override
391 glBlendColor(red, green, blue, alpha);
394 void BlendEquation(GLenum mode) override
396 glBlendEquation(mode);
399 void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) override
401 glBlendEquationSeparate(modeRGB, modeAlpha);
404 void BlendFunc(GLenum sfactor, GLenum dfactor) override
406 glBlendFunc(sfactor, dfactor);
409 void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) override
411 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
414 void BufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) override
416 glBufferData(target, size, data, usage);
419 void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) override
421 glBufferSubData(target, offset, size, data);
424 GLenum CheckFramebufferStatus(GLenum target) override
426 return glCheckFramebufferStatus(target);
429 void Clear(GLbitfield mask) override
434 void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) override
436 glClearColor(red, green, blue, alpha);
439 void ClearDepthf(GLclampf depth) override
441 glClearDepthf(depth);
444 void ClearStencil(GLint s) override
449 void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) override
451 glColorMask(red, green, blue, alpha);
454 void CompileShader(GLuint shader) override
456 glCompileShader(shader);
459 void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) override
461 glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
464 void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) override
466 glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
469 void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) override
471 glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
474 void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) override
476 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
479 GLuint CreateProgram(void) override
481 return glCreateProgram();
484 GLuint CreateShader(GLenum type) override
486 return glCreateShader(type);
489 void CullFace(GLenum mode) override
494 void DeleteBuffers(GLsizei n, const GLuint* buffers) override
496 glDeleteBuffers(n, buffers);
499 void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) override
501 glDeleteFramebuffers(n, framebuffers);
504 void DeleteProgram(GLuint program) override
506 glDeleteProgram(program);
509 void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) override
511 glDeleteRenderbuffers(n, renderbuffers);
514 void DeleteShader(GLuint shader) override
516 glDeleteShader(shader);
519 void DeleteTextures(GLsizei n, const GLuint* textures) override
521 glDeleteTextures(n, textures);
524 void DepthFunc(GLenum func) override
529 void DepthMask(GLboolean flag) override
534 void DepthRangef(GLclampf zNear, GLclampf zFar) override
536 glDepthRangef(zNear, zFar);
539 void DetachShader(GLuint program, GLuint shader) override
541 glDetachShader(program, shader);
544 void Disable(GLenum cap) override
549 void DisableVertexAttribArray(GLuint index) override
551 glDisableVertexAttribArray(index);
554 void DrawArrays(GLenum mode, GLint first, GLsizei count) override
556 glDrawArrays(mode, first, count);
559 void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) override
561 glDrawElements(mode, count, type, indices);
564 void Enable(GLenum cap) override
569 void EnableVertexAttribArray(GLuint index) override
571 glEnableVertexAttribArray(index);
574 void Finish(void) override
579 void Flush(void) override
584 void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) override
586 glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
589 void FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) override
591 glFramebufferTexture2D(target, attachment, textarget, texture, level);
594 void FrontFace(GLenum mode) override
599 void GenBuffers(GLsizei n, GLuint* buffers) override
601 glGenBuffers(n, buffers);
604 void GenerateMipmap(GLenum target) override
606 glGenerateMipmap(target);
609 void GenFramebuffers(GLsizei n, GLuint* framebuffers) override
611 glGenFramebuffers(n, framebuffers);
614 void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) override
616 glGenRenderbuffers(n, renderbuffers);
619 void GenTextures(GLsizei n, GLuint* textures) override
621 glGenTextures(n, textures);
624 void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) override
626 glGetActiveAttrib(program, index, bufsize, length, size, type, name);
629 void GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) override
631 glGetActiveUniform(program, index, bufsize, length, size, type, name);
634 void GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) override
636 glGetAttachedShaders(program, maxcount, count, shaders);
639 int GetAttribLocation(GLuint program, const char* name) override
641 return glGetAttribLocation(program, name);
644 void GetBooleanv(GLenum pname, GLboolean* params) override
646 glGetBooleanv(pname, params);
649 void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) override
651 glGetBufferParameteriv(target, pname, params);
654 GLenum GetError(void) override
659 void GetFloatv(GLenum pname, GLfloat* params) override
661 glGetFloatv(pname, params);
664 void GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) override
666 glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
669 void GetIntegerv(GLenum pname, GLint* params) override
671 glGetIntegerv(pname, params);
674 void GetProgramiv(GLuint program, GLenum pname, GLint* params) override
676 glGetProgramiv(program, pname, params);
679 void GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) override
681 glGetProgramInfoLog(program, bufsize, length, infolog);
684 void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) override
686 glGetRenderbufferParameteriv(target, pname, params);
689 void GetShaderiv(GLuint shader, GLenum pname, GLint* params) override
691 glGetShaderiv(shader, pname, params);
694 void GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) override
696 glGetShaderInfoLog(shader, bufsize, length, infolog);
699 void GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) override
701 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
704 void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) override
706 glGetShaderSource(shader, bufsize, length, source);
709 const GLubyte* GetString(GLenum name) override
711 return glGetString(name);
714 void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) override
716 glGetTexParameterfv(target, pname, params);
719 void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) override
721 glGetTexParameteriv(target, pname, params);
724 void GetUniformfv(GLuint program, GLint location, GLfloat* params) override
726 glGetUniformfv(program, location, params);
729 void GetUniformiv(GLuint program, GLint location, GLint* params) override
731 glGetUniformiv(program, location, params);
734 int GetUniformLocation(GLuint program, const char* name) override
736 return glGetUniformLocation(program, name);
739 void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) override
741 glGetVertexAttribfv(index, pname, params);
744 void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) override
746 glGetVertexAttribiv(index, pname, params);
749 void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) override
751 glGetVertexAttribPointerv(index, pname, pointer);
754 void Hint(GLenum target, GLenum mode) override
756 glHint(target, mode);
759 GLboolean IsBuffer(GLuint buffer) override
761 return glIsBuffer(buffer);
764 GLboolean IsEnabled(GLenum cap) override
766 return glIsEnabled(cap);
769 GLboolean IsFramebuffer(GLuint framebuffer) override
771 return glIsFramebuffer(framebuffer);
774 GLboolean IsProgram(GLuint program) override
776 return glIsProgram(program);
779 GLboolean IsRenderbuffer(GLuint renderbuffer) override
781 return glIsRenderbuffer(renderbuffer);
784 GLboolean IsShader(GLuint shader) override
786 return glIsShader(shader);
789 GLboolean IsTexture(GLuint texture) override
791 return glIsTexture(texture);
794 void LineWidth(GLfloat width) override
799 void LinkProgram(GLuint program) override
801 glLinkProgram(program);
804 void PixelStorei(GLenum pname, GLint param) override
806 glPixelStorei(pname, param);
809 void PolygonOffset(GLfloat factor, GLfloat units) override
811 glPolygonOffset(factor, units);
814 void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) override
816 glReadPixels(x, y, width, height, format, type, pixels);
819 void ReleaseShaderCompiler(void) override
821 glReleaseShaderCompiler();
824 void RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) override
826 glRenderbufferStorage(target, internalformat, width, height);
829 void SampleCoverage(GLclampf value, GLboolean invert) override
831 glSampleCoverage(value, invert);
834 void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) override
836 glScissor(x, y, width, height);
839 void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) override
841 glShaderBinary(n, shaders, binaryformat, binary, length);
844 void ShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) override
846 glShaderSource(shader, count, string, length);
849 void StencilFunc(GLenum func, GLint ref, GLuint mask) override
851 glStencilFunc(func, ref, mask);
854 void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) override
856 glStencilFuncSeparate(face, func, ref, mask);
859 void StencilMask(GLuint mask) override
864 void StencilMaskSeparate(GLenum face, GLuint mask) override
866 glStencilMaskSeparate(face, mask);
869 void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) override
871 glStencilOp(fail, zfail, zpass);
874 void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) override
876 glStencilOpSeparate(face, fail, zfail, zpass);
879 void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) override
881 glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
884 void TexParameterf(GLenum target, GLenum pname, GLfloat param) override
886 glTexParameterf(target, pname, param);
889 void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) override
891 glTexParameterfv(target, pname, params);
894 void TexParameteri(GLenum target, GLenum pname, GLint param) override
896 glTexParameteri(target, pname, param);
899 void TexParameteriv(GLenum target, GLenum pname, const GLint* params) override
901 glTexParameteriv(target, pname, params);
904 void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) override
906 glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
909 void Uniform1f(GLint location, GLfloat x) override
911 glUniform1f(location, x);
914 void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) override
916 glUniform1fv(location, count, v);
919 void Uniform1i(GLint location, GLint x) override
921 glUniform1i(location, x);
924 void Uniform1iv(GLint location, GLsizei count, const GLint* v) override
926 glUniform1iv(location, count, v);
929 void Uniform2f(GLint location, GLfloat x, GLfloat y) override
931 glUniform2f(location, x, y);
934 void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) override
936 glUniform2fv(location, count, v);
939 void Uniform2i(GLint location, GLint x, GLint y) override
941 glUniform2i(location, x, y);
944 void Uniform2iv(GLint location, GLsizei count, const GLint* v) override
946 glUniform2iv(location, count, v);
949 void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) override
951 glUniform3f(location, x, y, z);
954 void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) override
956 glUniform3fv(location, count, v);
959 void Uniform3i(GLint location, GLint x, GLint y, GLint z) override
961 glUniform3i(location, x, y, z);
964 void Uniform3iv(GLint location, GLsizei count, const GLint* v) override
966 glUniform3iv(location, count, v);
969 void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
971 glUniform4f(location, x, y, z, w);
974 void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) override
976 glUniform4fv(location, count, v);
979 void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) override
981 glUniform4i(location, x, y, z, w);
984 void Uniform4iv(GLint location, GLsizei count, const GLint* v) override
986 glUniform4iv(location, count, v);
989 void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
991 glUniformMatrix2fv(location, count, transpose, value);
994 void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
996 glUniformMatrix3fv(location, count, transpose, value);
999 void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1001 glUniformMatrix4fv(location, count, transpose, value);
1004 void UseProgram(GLuint program) override
1006 glUseProgram(program);
1009 void ValidateProgram(GLuint program) override
1011 glValidateProgram(program);
1014 void VertexAttrib1f(GLuint indx, GLfloat x) override
1016 glVertexAttrib1f(indx, x);
1019 void VertexAttrib1fv(GLuint indx, const GLfloat* values) override
1021 glVertexAttrib1fv(indx, values);
1024 void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) override
1026 glVertexAttrib2f(indx, x, y);
1029 void VertexAttrib2fv(GLuint indx, const GLfloat* values) override
1031 glVertexAttrib2fv(indx, values);
1034 void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) override
1036 glVertexAttrib3f(indx, x, y, z);
1039 void VertexAttrib3fv(GLuint indx, const GLfloat* values) override
1041 glVertexAttrib3fv(indx, values);
1044 void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
1046 glVertexAttrib4f(indx, x, y, z, w);
1049 void VertexAttrib4fv(GLuint indx, const GLfloat* values) override
1051 glVertexAttrib4fv(indx, values);
1054 void VertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) override
1056 glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
1059 void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override
1061 glViewport(x, y, width, height);
1066 void ReadBuffer(GLenum mode) override
1068 mImpl->ReadBuffer(mode);
1071 void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) override
1073 mImpl->DrawRangeElements(mode, start, end, count, type, indices);
1076 void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) override
1078 mImpl->TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
1081 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
1083 mImpl->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
1086 void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) override
1088 mImpl->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
1091 void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) override
1093 mImpl->CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
1096 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
1098 mImpl->CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
1101 void GenQueries(GLsizei n, GLuint* ids) override
1103 mImpl->GenQueries(n, ids);
1106 void DeleteQueries(GLsizei n, const GLuint* ids) override
1108 mImpl->DeleteQueries(n, ids);
1111 GLboolean IsQuery(GLuint id) override
1113 return mImpl->IsQuery(id);
1116 void BeginQuery(GLenum target, GLuint id) override
1118 mImpl->BeginQuery(target, id);
1121 void EndQuery(GLenum target) override
1123 mImpl->EndQuery(target);
1126 void GetQueryiv(GLenum target, GLenum pname, GLint* params) override
1128 mImpl->GetQueryiv(target, pname, params);
1131 void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) override
1133 mImpl->GetQueryObjectuiv(id, pname, params);
1136 GLboolean UnmapBuffer(GLenum target) override
1138 return mImpl->UnmapBuffer(target);
1141 void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) override
1143 mImpl->GetBufferPointerv(target, pname, params);
1146 void DrawBuffers(GLsizei n, const GLenum* bufs) override
1148 mImpl->DrawBuffers(n, bufs);
1151 void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1153 mImpl->UniformMatrix2x3fv(location, count, transpose, value);
1156 void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1158 mImpl->UniformMatrix3x2fv(location, count, transpose, value);
1161 void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1163 mImpl->UniformMatrix2x4fv(location, count, transpose, value);
1166 void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1168 mImpl->UniformMatrix4x2fv(location, count, transpose, value);
1171 void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1173 mImpl->UniformMatrix3x4fv(location, count, transpose, value);
1176 void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1178 mImpl->UniformMatrix4x3fv(location, count, transpose, value);
1181 void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) override
1183 mImpl->BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
1186 void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) override
1188 mImpl->RenderbufferStorageMultisample(target, samples, internalformat, width, height);
1191 void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) override
1193 mImpl->FramebufferTextureLayer(target, attachment, texture, level, layer);
1196 GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) override
1198 return mImpl->MapBufferRange(target, offset, length, access);
1201 void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) override
1203 mImpl->FlushMappedBufferRange(target, offset, length);
1206 void BindVertexArray(GLuint array) override
1208 mImpl->BindVertexArray(array);
1211 void DeleteVertexArrays(GLsizei n, const GLuint* arrays) override
1213 mImpl->DeleteVertexArrays(n, arrays);
1216 void GenVertexArrays(GLsizei n, GLuint* arrays) override
1218 mImpl->GenVertexArrays(n, arrays);
1221 GLboolean IsVertexArray(GLuint array) override
1223 return mImpl->IsVertexArray(array);
1226 void GetIntegeri_v(GLenum target, GLuint index, GLint* data) override
1228 mImpl->GetIntegeri_v(target, index, data);
1231 void BeginTransformFeedback(GLenum primitiveMode) override
1233 mImpl->BeginTransformFeedback(primitiveMode);
1236 void EndTransformFeedback(void) override
1238 mImpl->EndTransformFeedback();
1241 void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) override
1243 mImpl->BindBufferRange(target, index, buffer, offset, size);
1246 void BindBufferBase(GLenum target, GLuint index, GLuint buffer) override
1248 mImpl->BindBufferBase(target, index, buffer);
1251 void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) override
1253 mImpl->TransformFeedbackVaryings(program, count, varyings, bufferMode);
1256 void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) override
1258 mImpl->GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
1261 void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) override
1263 mImpl->VertexAttribIPointer(index, size, type, stride, pointer);
1266 void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override
1268 mImpl->GetVertexAttribIiv(index, pname, params);
1271 void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) override
1273 mImpl->GetVertexAttribIuiv(index, pname, params);
1276 void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) override
1278 mImpl->VertexAttribI4i(index, x, y, z, w);
1281 void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) override
1283 mImpl->VertexAttribI4ui(index, x, y, z, w);
1286 void VertexAttribI4iv(GLuint index, const GLint* v) override
1288 mImpl->VertexAttribI4iv(index, v);
1291 void VertexAttribI4uiv(GLuint index, const GLuint* v) override
1293 mImpl->VertexAttribI4uiv(index, v);
1296 void GetUniformuiv(GLuint program, GLint location, GLuint* params) override
1298 mImpl->GetUniformuiv(program, location, params);
1301 GLint GetFragDataLocation(GLuint program, const GLchar* name) override
1303 return mImpl->GetFragDataLocation(program, name);
1306 void Uniform1ui(GLint location, GLuint v0) override
1308 mImpl->Uniform1ui(location, v0);
1311 void Uniform2ui(GLint location, GLuint v0, GLuint v1) override
1313 mImpl->Uniform2ui(location, v0, v1);
1316 void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) override
1318 mImpl->Uniform3ui(location, v0, v1, v2);
1321 void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) override
1323 mImpl->Uniform4ui(location, v0, v1, v2, v3);
1326 void Uniform1uiv(GLint location, GLsizei count, const GLuint* value) override
1328 mImpl->Uniform1uiv(location, count, value);
1331 void Uniform2uiv(GLint location, GLsizei count, const GLuint* value) override
1333 mImpl->Uniform2uiv(location, count, value);
1336 void Uniform3uiv(GLint location, GLsizei count, const GLuint* value) override
1338 mImpl->Uniform3uiv(location, count, value);
1341 void Uniform4uiv(GLint location, GLsizei count, const GLuint* value) override
1343 mImpl->Uniform4uiv(location, count, value);
1346 void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) override
1348 mImpl->ClearBufferiv(buffer, drawbuffer, value);
1351 void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) override
1353 mImpl->ClearBufferuiv(buffer, drawbuffer, value);
1356 void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) override
1358 mImpl->ClearBufferfv(buffer, drawbuffer, value);
1361 void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) override
1363 mImpl->ClearBufferfi(buffer, drawbuffer, depth, stencil);
1366 const GLubyte* GetStringi(GLenum name, GLuint index) override
1368 return mImpl->GetStringi(name, index);
1371 void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) override
1373 mImpl->CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
1376 void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) override
1378 mImpl->GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
1381 void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) override
1383 mImpl->GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
1386 GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) override
1388 return mImpl->GetUniformBlockIndex(program, uniformBlockName);
1391 void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) override
1393 mImpl->GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
1396 void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) override
1398 mImpl->GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
1401 void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override
1403 mImpl->UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
1406 void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) override
1408 mImpl->DrawArraysInstanced(mode, first, count, instanceCount);
1411 void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) override
1413 mImpl->DrawElementsInstanced(mode, count, type, indices, instanceCount);
1416 GLsync FenceSync(GLenum condition, GLbitfield flags) override
1418 return mImpl->FenceSync(condition, flags);
1421 GLboolean IsSync(GLsync sync) override
1423 return mImpl->IsSync(sync);
1426 void DeleteSync(GLsync sync) override
1428 mImpl->DeleteSync(sync);
1431 GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
1433 return mImpl->ClientWaitSync(sync, flags, timeout);
1436 void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
1438 mImpl->WaitSync(sync, flags, timeout);
1441 void GetInteger64v(GLenum pname, GLint64* params) override
1443 mImpl->GetInteger64v(pname, params);
1446 void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) override
1448 mImpl->GetSynciv(sync, pname, bufSize, length, values);
1451 void GetInteger64i_v(GLenum target, GLuint index, GLint64* data) override
1453 mImpl->GetInteger64i_v(target, index, data);
1456 void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) override
1458 mImpl->GetBufferParameteri64v(target, pname, params);
1461 void GenSamplers(GLsizei count, GLuint* samplers) override
1463 mImpl->GenSamplers(count, samplers);
1466 void DeleteSamplers(GLsizei count, const GLuint* samplers) override
1468 mImpl->DeleteSamplers(count, samplers);
1471 GLboolean IsSampler(GLuint sampler) override
1473 return mImpl->IsSampler(sampler);
1476 void BindSampler(GLuint unit, GLuint sampler) override
1478 mImpl->BindSampler(unit, sampler);
1481 void SamplerParameteri(GLuint sampler, GLenum pname, GLint param) override
1483 mImpl->SamplerParameteri(sampler, pname, param);
1486 void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) override
1488 mImpl->SamplerParameteriv(sampler, pname, param);
1491 void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) override
1493 mImpl->SamplerParameterf(sampler, pname, param);
1496 void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) override
1498 mImpl->SamplerParameterfv(sampler, pname, param);
1501 void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) override
1503 mImpl->GetSamplerParameteriv(sampler, pname, params);
1506 void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) override
1508 mImpl->GetSamplerParameterfv(sampler, pname, params);
1511 void VertexAttribDivisor(GLuint index, GLuint divisor) override
1513 mImpl->VertexAttribDivisor(index, divisor);
1516 void BindTransformFeedback(GLenum target, GLuint id) override
1518 mImpl->BindTransformFeedback(target, id);
1521 void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids) override
1523 mImpl->DeleteTransformFeedbacks(n, ids);
1526 void GenTransformFeedbacks(GLsizei n, GLuint* ids) override
1528 mImpl->GenTransformFeedbacks(n, ids);
1531 GLboolean IsTransformFeedback(GLuint id) override
1533 return mImpl->IsTransformFeedback(id);
1536 void PauseTransformFeedback(void) override
1538 mImpl->PauseTransformFeedback();
1541 void ResumeTransformFeedback(void) override
1543 mImpl->ResumeTransformFeedback();
1546 void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) override
1548 mImpl->GetProgramBinary(program, bufSize, length, binaryFormat, binary);
1551 void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) override
1553 mImpl->ProgramBinary(program, binaryFormat, binary, length);
1556 void ProgramParameteri(GLuint program, GLenum pname, GLint value) override
1558 mImpl->ProgramParameteri(program, pname, value);
1561 void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) override
1563 mImpl->InvalidateFramebuffer(target, numAttachments, attachments);
1566 void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) override
1568 mImpl->InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
1571 void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) override
1573 mImpl->TexStorage2D(target, levels, internalformat, width, height);
1576 void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) override
1578 mImpl->TexStorage3D(target, levels, internalformat, width, height, depth);
1581 void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) override
1583 mImpl->GetInternalformativ(target, internalformat, pname, bufSize, params);
1586 void BlendBarrier(void)
1588 if(mIsAdvancedBlendEquationSupported)
1590 mImpl->BlendBarrier();
1595 std::unique_ptr<GlesAbstraction> mImpl;
1597 ConditionalWait mContextCreatedWaitCondition;
1598 GLint mMaxTextureSize;
1599 std::string mShaderVersionPrefix;
1600 std::string mVertexShaderPrefix;
1601 std::string mFragmentShaderPrefix;
1602 int32_t mGlesVersion;
1603 int32_t mShadingLanguageVersion;
1604 bool mShadingLanguageVersionCached;
1605 bool mIsSurfacelessContextSupported;
1606 bool mIsAdvancedBlendEquationSupportedCached;
1607 bool mIsAdvancedBlendEquationSupported;
1608 bool mIsContextCreated;
1611 } // namespace Adaptor
1613 } // namespace Internal
1617 #endif // DALI_INTERNAL_GL_IMPLEMENTATION_H