Make undefined macro do not be used.
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles / gl-implementation.h
1 #ifndef DALI_INTERNAL_GL_IMPLEMENTATION_H
2 #define DALI_INTERNAL_GL_IMPLEMENTATION_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
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 <cstdlib>
28 #include <cstring>
29 #include <memory>
30
31 // INTERNAL INCLUDES
32 #include <dali/internal/graphics/gles/gles-abstraction.h>
33 #include <dali/internal/graphics/gles/gles2-implementation.h>
34 #include <dali/internal/graphics/gles/gles3-implementation.h>
35
36 namespace Dali
37 {
38 namespace Internal
39 {
40 namespace Adaptor
41 {
42 namespace
43 {
44 static constexpr int32_t     INITIAL_GLES_VERSION                         = 30;
45 static constexpr int32_t     GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED = 32;
46 static constexpr const char* LEGACY_SHADING_LANGUAGE_VERSION              = "100";
47 static constexpr const char* KHR_BLEND_EQUATION_ADVANCED                  = "GL_KHR_blend_equation_advanced";
48
49 static constexpr const char* DEFAULT_SAMPLER_TYPE = "sampler2D";
50
51 static constexpr const char* FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX =
52   "#ifdef GL_KHR_blend_equation_advanced\n"
53   "#extension GL_KHR_blend_equation_advanced : enable\n"
54   "#endif\n"
55
56   "#if defined(GL_KHR_blend_equation_advanced) || __VERSION__>=320\n"
57   "  layout(blend_support_all_equations) out;\n"
58   "#endif\n";
59
60 static constexpr const char* FRAGMENT_SHADER_OUTPUT_COLOR_STRING =
61   "out mediump vec4 fragColor;\n";
62
63 static constexpr const char* OES_EGL_IMAGE_EXTERNAL_STRING = "#extension GL_OES_EGL_image_external:require\n";
64
65 static constexpr const char* OES_EGL_IMAGE_EXTERNAL_STRING_ESSL3 = "#extension GL_OES_EGL_image_external_essl3:require\n";
66 } // namespace
67
68 /**
69  * GlImplementation is a concrete implementation for GlAbstraction.
70  * The class provides an OpenGL-ES 2.0 or 3.0 implementation.
71  * The class is provided when creating the Integration::Core object.
72  */
73 class GlImplementation : public Dali::Integration::GlAbstraction
74 {
75 public:
76   GlImplementation()
77   : mContextCreatedWaitCondition(),
78     mMaxTextureSize(0),
79     mVertexShaderPrefix(""),
80     mGlesVersion(INITIAL_GLES_VERSION),
81     mShadingLanguageVersion(100),
82     mShadingLanguageVersionCached(false),
83     mIsSurfacelessContextSupported(false),
84     mIsAdvancedBlendEquationSupportedCached(false),
85     mIsAdvancedBlendEquationSupported(false),
86     mIsContextCreated(false)
87   {
88     mImpl.reset(new Gles3Implementation());
89   }
90
91   virtual ~GlImplementation()
92   {
93   }
94
95   void PreRender() override
96   {
97     /* Do nothing in main implementation */
98   }
99
100   void PostRender() override
101   {
102     /* Do nothing in main implementation */
103   }
104
105   void ContextCreated()
106   {
107     glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
108
109     // Only change gles version for the device that support above gles 3.0.
110     if(mGlesVersion >= INITIAL_GLES_VERSION)
111     {
112       GLint majorVersion, minorVersion;
113       glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
114       glGetIntegerv(GL_MINOR_VERSION, &minorVersion);
115       mGlesVersion = majorVersion * 10 + minorVersion;
116     }
117
118     if(mGlesVersion >= GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED)
119     {
120       mIsAdvancedBlendEquationSupported = true;
121     }
122     else
123     {
124       // when mIsAdvancedBlendEquationSupported is cached, we don't need to check all the extensions.
125       if(!mIsAdvancedBlendEquationSupportedCached)
126       {
127         const char* const  extensionStr = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
128         std::istringstream stream(extensionStr);
129         std::string        currentExtension;
130         while(std::getline(stream, currentExtension, ' '))
131         {
132           if(currentExtension == KHR_BLEND_EQUATION_ADVANCED)
133           {
134             mIsAdvancedBlendEquationSupported = true;
135             break;
136           }
137         }
138       }
139     }
140
141     if(!mShadingLanguageVersionCached)
142     {
143       std::istringstream shadingLanguageVersionStream(reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
144       std::string        token;
145       uint32_t           tokenCount = 0;
146       while(std::getline(shadingLanguageVersionStream, token, ' '))
147       {
148         if(tokenCount == 3 && token == "ES")
149         {
150           std::getline(shadingLanguageVersionStream, token, '.');
151           mShadingLanguageVersion = std::atoi(token.c_str());
152           mShadingLanguageVersion *= 100;
153           std::getline(shadingLanguageVersionStream, token, '.');
154           mShadingLanguageVersion += std::atoi(token.c_str());
155           break;
156         }
157         tokenCount++;
158       }
159     }
160
161     {
162       ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
163       mIsContextCreated = true;
164       mContextCreatedWaitCondition.Notify(lock);
165     }
166   }
167
168   void SetGlesVersion(const int32_t glesVersion)
169   {
170     if(mGlesVersion / 10 != glesVersion / 10)
171     {
172       mGlesVersion = glesVersion;
173       if(mGlesVersion >= 30)
174       {
175         mImpl.reset(new Gles3Implementation());
176       }
177       else
178       {
179         mImpl.reset(new Gles2Implementation());
180       }
181     }
182   }
183
184   void SetIsSurfacelessContextSupported(const bool isSupported)
185   {
186     mIsSurfacelessContextSupported = isSupported;
187   }
188
189   bool IsSurfacelessContextSupported() const override
190   {
191     return mIsSurfacelessContextSupported;
192   }
193
194   void SetIsAdvancedBlendEquationSupported(const bool isSupported)
195   {
196     mIsAdvancedBlendEquationSupported       = isSupported;
197     mIsAdvancedBlendEquationSupportedCached = true;
198   }
199
200   bool IsAdvancedBlendEquationSupported()
201   {
202     ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
203     if(!mIsContextCreated && !mIsAdvancedBlendEquationSupportedCached)
204     {
205       mContextCreatedWaitCondition.Wait(lock);
206     }
207     return mIsAdvancedBlendEquationSupported;
208   }
209
210   bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation)
211   {
212     switch(blendEquation)
213     {
214       case DevelBlendEquation::ADD:
215       case DevelBlendEquation::SUBTRACT:
216       case DevelBlendEquation::REVERSE_SUBTRACT:
217       {
218         return true;
219       }
220       case DevelBlendEquation::MIN:
221       case DevelBlendEquation::MAX:
222       {
223         return (GetGlesVersion() >= 30);
224       }
225       case DevelBlendEquation::MULTIPLY:
226       case DevelBlendEquation::SCREEN:
227       case DevelBlendEquation::OVERLAY:
228       case DevelBlendEquation::DARKEN:
229       case DevelBlendEquation::LIGHTEN:
230       case DevelBlendEquation::COLOR_DODGE:
231       case DevelBlendEquation::COLOR_BURN:
232       case DevelBlendEquation::HARD_LIGHT:
233       case DevelBlendEquation::SOFT_LIGHT:
234       case DevelBlendEquation::DIFFERENCE:
235       case DevelBlendEquation::EXCLUSION:
236       case DevelBlendEquation::HUE:
237       case DevelBlendEquation::SATURATION:
238       case DevelBlendEquation::COLOR:
239       case DevelBlendEquation::LUMINOSITY:
240       {
241         return IsAdvancedBlendEquationSupported();
242       }
243
244       default:
245       {
246         return false;
247       }
248     }
249
250     return false;
251   }
252
253   std::string GetShaderVersionPrefix()
254   {
255     if(mShaderVersionPrefix == "")
256     {
257       mShaderVersionPrefix = "#version " + std::to_string(GetShadingLanguageVersion());
258       if(GetShadingLanguageVersion() < 300)
259       {
260         mShaderVersionPrefix += "\n";
261       }
262       else
263       {
264         mShaderVersionPrefix += " es\n";
265       }
266     }
267     return mShaderVersionPrefix;
268   }
269
270   std::string GetVertexShaderPrefix()
271   {
272     if(mVertexShaderPrefix == "")
273     {
274       mVertexShaderPrefix = GetShaderVersionPrefix();
275
276       if(GetShadingLanguageVersion() < 300)
277       {
278         mVertexShaderPrefix += "#define INPUT attribute\n";
279         mVertexShaderPrefix += "#define OUTPUT varying\n";
280       }
281       else
282       {
283         mVertexShaderPrefix += "#define INPUT in\n";
284         mVertexShaderPrefix += "#define OUTPUT out\n";
285       }
286     }
287     return mVertexShaderPrefix;
288   }
289
290   std::string GetFragmentShaderPrefix()
291   {
292     if(mFragmentShaderPrefix == "")
293     {
294       mFragmentShaderPrefix = GetShaderVersionPrefix();
295
296       if(GetShadingLanguageVersion() < 300)
297       {
298         mFragmentShaderPrefix += "#define INPUT varying\n";
299         mFragmentShaderPrefix += "#define OUT_COLOR gl_FragColor\n";
300         mFragmentShaderPrefix += "#define TEXTURE texture2D\n";
301       }
302       else
303       {
304         mFragmentShaderPrefix += "#define INPUT in\n";
305         mFragmentShaderPrefix += "#define OUT_COLOR fragColor\n";
306         mFragmentShaderPrefix += "#define TEXTURE texture\n";
307
308         if(IsAdvancedBlendEquationSupported())
309         {
310           mFragmentShaderPrefix += FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX;
311         }
312
313         mFragmentShaderPrefix += FRAGMENT_SHADER_OUTPUT_COLOR_STRING;
314       }
315     }
316     return mFragmentShaderPrefix;
317   }
318
319   bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const override
320   {
321     bool convert = ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA));
322     if(mGlesVersion >= 30)
323     {
324       // Don't convert manually from RGB to RGBA if GLES >= 3.0 and a sub-image is uploaded.
325       convert = (convert && !isSubImage);
326     }
327     return convert;
328   }
329
330   int GetMaxTextureSize()
331   {
332     ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
333     if(!mIsContextCreated)
334     {
335       mContextCreatedWaitCondition.Wait(lock);
336     }
337     return mMaxTextureSize;
338   }
339
340   int GetGlesVersion()
341   {
342     ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
343     if(!mIsContextCreated)
344     {
345       mContextCreatedWaitCondition.Wait(lock);
346     }
347     return mGlesVersion;
348   }
349
350   void SetShadingLanguageVersion(int shadingLanguageVersion)
351   {
352     mShadingLanguageVersion       = shadingLanguageVersion;
353     mShadingLanguageVersionCached = true;
354   }
355
356   int GetShadingLanguageVersion()
357   {
358     ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
359     if(!mIsContextCreated && !mShadingLanguageVersionCached)
360     {
361       mContextCreatedWaitCondition.Wait(lock);
362     }
363     return mShadingLanguageVersion;
364   }
365
366   bool ApplyNativeFragmentShader(std::string& shader, const char* customSamplerType)
367   {
368     bool        modified        = false;
369     std::string versionString   = "#version";
370     size_t      versionPosition = shader.find(versionString);
371     if(versionPosition != std::string::npos)
372     {
373       std::string extensionString;
374       size_t shadingLanguageVersionPosition = shader.find_first_not_of(" \t", versionPosition + versionString.length());
375       if(shadingLanguageVersionPosition != std::string::npos &&
376          shader.substr(shadingLanguageVersionPosition, 3) == LEGACY_SHADING_LANGUAGE_VERSION)
377       {
378         extensionString = OES_EGL_IMAGE_EXTERNAL_STRING;
379       }
380       else
381       {
382         extensionString = OES_EGL_IMAGE_EXTERNAL_STRING_ESSL3;
383       }
384
385       if(shader.find(extensionString) == std::string::npos)
386       {
387         modified                 = true;
388         size_t extensionPosition = shader.find_first_of("\n", versionPosition) + 1;
389         shader.insert(extensionPosition, extensionString);
390       }
391     }
392     else
393     {
394       if(shader.find(OES_EGL_IMAGE_EXTERNAL_STRING) == std::string::npos)
395       {
396         modified = true;
397         shader   = OES_EGL_IMAGE_EXTERNAL_STRING + shader;
398       }
399     }
400
401     if(shader.find(customSamplerType) == std::string::npos)
402     {
403       size_t pos = shader.find(DEFAULT_SAMPLER_TYPE);
404       if(pos != std::string::npos)
405       {
406         modified = true;
407         shader.replace(pos, strlen(DEFAULT_SAMPLER_TYPE), customSamplerType);
408       }
409     }
410
411     return modified;
412   }
413
414   /* OpenGL ES 2.0 */
415
416   void ActiveTexture(GLenum texture) override
417   {
418     glActiveTexture(texture);
419   }
420
421   void AttachShader(GLuint program, GLuint shader) override
422   {
423     glAttachShader(program, shader);
424   }
425
426   void BindAttribLocation(GLuint program, GLuint index, const char* name) override
427   {
428     glBindAttribLocation(program, index, name);
429   }
430
431   void BindBuffer(GLenum target, GLuint buffer) override
432   {
433     glBindBuffer(target, buffer);
434   }
435
436   void BindFramebuffer(GLenum target, GLuint framebuffer) override
437   {
438     glBindFramebuffer(target, framebuffer);
439   }
440
441   void BindRenderbuffer(GLenum target, GLuint renderbuffer) override
442   {
443     glBindRenderbuffer(target, renderbuffer);
444   }
445
446   void BindTexture(GLenum target, GLuint texture) override
447   {
448     glBindTexture(target, texture);
449   }
450
451   void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) override
452   {
453     glBlendColor(red, green, blue, alpha);
454   }
455
456   void BlendEquation(GLenum mode) override
457   {
458     glBlendEquation(mode);
459   }
460
461   void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) override
462   {
463     glBlendEquationSeparate(modeRGB, modeAlpha);
464   }
465
466   void BlendFunc(GLenum sfactor, GLenum dfactor) override
467   {
468     glBlendFunc(sfactor, dfactor);
469   }
470
471   void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) override
472   {
473     glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
474   }
475
476   void BufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) override
477   {
478     glBufferData(target, size, data, usage);
479   }
480
481   void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) override
482   {
483     glBufferSubData(target, offset, size, data);
484   }
485
486   GLenum CheckFramebufferStatus(GLenum target) override
487   {
488     return glCheckFramebufferStatus(target);
489   }
490
491   void Clear(GLbitfield mask) override
492   {
493     glClear(mask);
494   }
495
496   void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) override
497   {
498     glClearColor(red, green, blue, alpha);
499   }
500
501   void ClearDepthf(GLclampf depth) override
502   {
503     glClearDepthf(depth);
504   }
505
506   void ClearStencil(GLint s) override
507   {
508     glClearStencil(s);
509   }
510
511   void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) override
512   {
513     glColorMask(red, green, blue, alpha);
514   }
515
516   void CompileShader(GLuint shader) override
517   {
518     glCompileShader(shader);
519   }
520
521   void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) override
522   {
523     glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
524   }
525
526   void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) override
527   {
528     glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
529   }
530
531   void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) override
532   {
533     glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
534   }
535
536   void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) override
537   {
538     glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
539   }
540
541   GLuint CreateProgram(void) override
542   {
543     return glCreateProgram();
544   }
545
546   GLuint CreateShader(GLenum type) override
547   {
548     return glCreateShader(type);
549   }
550
551   void CullFace(GLenum mode) override
552   {
553     glCullFace(mode);
554   }
555
556   void DeleteBuffers(GLsizei n, const GLuint* buffers) override
557   {
558     glDeleteBuffers(n, buffers);
559   }
560
561   void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) override
562   {
563     glDeleteFramebuffers(n, framebuffers);
564   }
565
566   void DeleteProgram(GLuint program) override
567   {
568     glDeleteProgram(program);
569   }
570
571   void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) override
572   {
573     glDeleteRenderbuffers(n, renderbuffers);
574   }
575
576   void DeleteShader(GLuint shader) override
577   {
578     glDeleteShader(shader);
579   }
580
581   void DeleteTextures(GLsizei n, const GLuint* textures) override
582   {
583     glDeleteTextures(n, textures);
584   }
585
586   void DepthFunc(GLenum func) override
587   {
588     glDepthFunc(func);
589   }
590
591   void DepthMask(GLboolean flag) override
592   {
593     glDepthMask(flag);
594   }
595
596   void DepthRangef(GLclampf zNear, GLclampf zFar) override
597   {
598     glDepthRangef(zNear, zFar);
599   }
600
601   void DetachShader(GLuint program, GLuint shader) override
602   {
603     glDetachShader(program, shader);
604   }
605
606   void Disable(GLenum cap) override
607   {
608     glDisable(cap);
609   }
610
611   void DisableVertexAttribArray(GLuint index) override
612   {
613     glDisableVertexAttribArray(index);
614   }
615
616   void DrawArrays(GLenum mode, GLint first, GLsizei count) override
617   {
618     glDrawArrays(mode, first, count);
619   }
620
621   void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) override
622   {
623     glDrawElements(mode, count, type, indices);
624   }
625
626   void Enable(GLenum cap) override
627   {
628     glEnable(cap);
629   }
630
631   void EnableVertexAttribArray(GLuint index) override
632   {
633     glEnableVertexAttribArray(index);
634   }
635
636   void Finish(void) override
637   {
638     glFinish();
639   }
640
641   void Flush(void) override
642   {
643     glFlush();
644   }
645
646   void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) override
647   {
648     glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
649   }
650
651   void FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) override
652   {
653     glFramebufferTexture2D(target, attachment, textarget, texture, level);
654   }
655
656   void FrontFace(GLenum mode) override
657   {
658     glFrontFace(mode);
659   }
660
661   void GenBuffers(GLsizei n, GLuint* buffers) override
662   {
663     glGenBuffers(n, buffers);
664   }
665
666   void GenerateMipmap(GLenum target) override
667   {
668     glGenerateMipmap(target);
669   }
670
671   void GenFramebuffers(GLsizei n, GLuint* framebuffers) override
672   {
673     glGenFramebuffers(n, framebuffers);
674   }
675
676   void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) override
677   {
678     glGenRenderbuffers(n, renderbuffers);
679   }
680
681   void GenTextures(GLsizei n, GLuint* textures) override
682   {
683     glGenTextures(n, textures);
684   }
685
686   void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) override
687   {
688     glGetActiveAttrib(program, index, bufsize, length, size, type, name);
689   }
690
691   void GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) override
692   {
693     glGetActiveUniform(program, index, bufsize, length, size, type, name);
694   }
695
696   void GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) override
697   {
698     glGetAttachedShaders(program, maxcount, count, shaders);
699   }
700
701   int GetAttribLocation(GLuint program, const char* name) override
702   {
703     return glGetAttribLocation(program, name);
704   }
705
706   void GetBooleanv(GLenum pname, GLboolean* params) override
707   {
708     glGetBooleanv(pname, params);
709   }
710
711   void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) override
712   {
713     glGetBufferParameteriv(target, pname, params);
714   }
715
716   GLenum GetError(void) override
717   {
718     return glGetError();
719   }
720
721   void GetFloatv(GLenum pname, GLfloat* params) override
722   {
723     glGetFloatv(pname, params);
724   }
725
726   void GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) override
727   {
728     glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
729   }
730
731   void GetIntegerv(GLenum pname, GLint* params) override
732   {
733     glGetIntegerv(pname, params);
734   }
735
736   void GetProgramiv(GLuint program, GLenum pname, GLint* params) override
737   {
738     glGetProgramiv(program, pname, params);
739   }
740
741   void GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) override
742   {
743     glGetProgramInfoLog(program, bufsize, length, infolog);
744   }
745
746   void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) override
747   {
748     glGetRenderbufferParameteriv(target, pname, params);
749   }
750
751   void GetShaderiv(GLuint shader, GLenum pname, GLint* params) override
752   {
753     glGetShaderiv(shader, pname, params);
754   }
755
756   void GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) override
757   {
758     glGetShaderInfoLog(shader, bufsize, length, infolog);
759   }
760
761   void GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) override
762   {
763     glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
764   }
765
766   void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) override
767   {
768     glGetShaderSource(shader, bufsize, length, source);
769   }
770
771   const GLubyte* GetString(GLenum name) override
772   {
773     return glGetString(name);
774   }
775
776   void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) override
777   {
778     glGetTexParameterfv(target, pname, params);
779   }
780
781   void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) override
782   {
783     glGetTexParameteriv(target, pname, params);
784   }
785
786   void GetUniformfv(GLuint program, GLint location, GLfloat* params) override
787   {
788     glGetUniformfv(program, location, params);
789   }
790
791   void GetUniformiv(GLuint program, GLint location, GLint* params) override
792   {
793     glGetUniformiv(program, location, params);
794   }
795
796   int GetUniformLocation(GLuint program, const char* name) override
797   {
798     return glGetUniformLocation(program, name);
799   }
800
801   void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) override
802   {
803     glGetVertexAttribfv(index, pname, params);
804   }
805
806   void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) override
807   {
808     glGetVertexAttribiv(index, pname, params);
809   }
810
811   void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) override
812   {
813     glGetVertexAttribPointerv(index, pname, pointer);
814   }
815
816   void Hint(GLenum target, GLenum mode) override
817   {
818     glHint(target, mode);
819   }
820
821   GLboolean IsBuffer(GLuint buffer) override
822   {
823     return glIsBuffer(buffer);
824   }
825
826   GLboolean IsEnabled(GLenum cap) override
827   {
828     return glIsEnabled(cap);
829   }
830
831   GLboolean IsFramebuffer(GLuint framebuffer) override
832   {
833     return glIsFramebuffer(framebuffer);
834   }
835
836   GLboolean IsProgram(GLuint program) override
837   {
838     return glIsProgram(program);
839   }
840
841   GLboolean IsRenderbuffer(GLuint renderbuffer) override
842   {
843     return glIsRenderbuffer(renderbuffer);
844   }
845
846   GLboolean IsShader(GLuint shader) override
847   {
848     return glIsShader(shader);
849   }
850
851   GLboolean IsTexture(GLuint texture) override
852   {
853     return glIsTexture(texture);
854   }
855
856   void LineWidth(GLfloat width) override
857   {
858     glLineWidth(width);
859   }
860
861   void LinkProgram(GLuint program) override
862   {
863     glLinkProgram(program);
864   }
865
866   void PixelStorei(GLenum pname, GLint param) override
867   {
868     glPixelStorei(pname, param);
869   }
870
871   void PolygonOffset(GLfloat factor, GLfloat units) override
872   {
873     glPolygonOffset(factor, units);
874   }
875
876   void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) override
877   {
878     glReadPixels(x, y, width, height, format, type, pixels);
879   }
880
881   void ReleaseShaderCompiler(void) override
882   {
883     glReleaseShaderCompiler();
884   }
885
886   void RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) override
887   {
888     glRenderbufferStorage(target, internalformat, width, height);
889   }
890
891   void SampleCoverage(GLclampf value, GLboolean invert) override
892   {
893     glSampleCoverage(value, invert);
894   }
895
896   void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) override
897   {
898     glScissor(x, y, width, height);
899   }
900
901   void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) override
902   {
903     glShaderBinary(n, shaders, binaryformat, binary, length);
904   }
905
906   void ShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) override
907   {
908     glShaderSource(shader, count, string, length);
909   }
910
911   void StencilFunc(GLenum func, GLint ref, GLuint mask) override
912   {
913     glStencilFunc(func, ref, mask);
914   }
915
916   void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) override
917   {
918     glStencilFuncSeparate(face, func, ref, mask);
919   }
920
921   void StencilMask(GLuint mask) override
922   {
923     glStencilMask(mask);
924   }
925
926   void StencilMaskSeparate(GLenum face, GLuint mask) override
927   {
928     glStencilMaskSeparate(face, mask);
929   }
930
931   void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) override
932   {
933     glStencilOp(fail, zfail, zpass);
934   }
935
936   void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) override
937   {
938     glStencilOpSeparate(face, fail, zfail, zpass);
939   }
940
941   void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) override
942   {
943     glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
944   }
945
946   void TexParameterf(GLenum target, GLenum pname, GLfloat param) override
947   {
948     glTexParameterf(target, pname, param);
949   }
950
951   void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) override
952   {
953     glTexParameterfv(target, pname, params);
954   }
955
956   void TexParameteri(GLenum target, GLenum pname, GLint param) override
957   {
958     glTexParameteri(target, pname, param);
959   }
960
961   void TexParameteriv(GLenum target, GLenum pname, const GLint* params) override
962   {
963     glTexParameteriv(target, pname, params);
964   }
965
966   void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) override
967   {
968     glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
969   }
970
971   void Uniform1f(GLint location, GLfloat x) override
972   {
973     glUniform1f(location, x);
974   }
975
976   void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) override
977   {
978     glUniform1fv(location, count, v);
979   }
980
981   void Uniform1i(GLint location, GLint x) override
982   {
983     glUniform1i(location, x);
984   }
985
986   void Uniform1iv(GLint location, GLsizei count, const GLint* v) override
987   {
988     glUniform1iv(location, count, v);
989   }
990
991   void Uniform2f(GLint location, GLfloat x, GLfloat y) override
992   {
993     glUniform2f(location, x, y);
994   }
995
996   void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) override
997   {
998     glUniform2fv(location, count, v);
999   }
1000
1001   void Uniform2i(GLint location, GLint x, GLint y) override
1002   {
1003     glUniform2i(location, x, y);
1004   }
1005
1006   void Uniform2iv(GLint location, GLsizei count, const GLint* v) override
1007   {
1008     glUniform2iv(location, count, v);
1009   }
1010
1011   void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) override
1012   {
1013     glUniform3f(location, x, y, z);
1014   }
1015
1016   void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) override
1017   {
1018     glUniform3fv(location, count, v);
1019   }
1020
1021   void Uniform3i(GLint location, GLint x, GLint y, GLint z) override
1022   {
1023     glUniform3i(location, x, y, z);
1024   }
1025
1026   void Uniform3iv(GLint location, GLsizei count, const GLint* v) override
1027   {
1028     glUniform3iv(location, count, v);
1029   }
1030
1031   void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
1032   {
1033     glUniform4f(location, x, y, z, w);
1034   }
1035
1036   void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) override
1037   {
1038     glUniform4fv(location, count, v);
1039   }
1040
1041   void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) override
1042   {
1043     glUniform4i(location, x, y, z, w);
1044   }
1045
1046   void Uniform4iv(GLint location, GLsizei count, const GLint* v) override
1047   {
1048     glUniform4iv(location, count, v);
1049   }
1050
1051   void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1052   {
1053     glUniformMatrix2fv(location, count, transpose, value);
1054   }
1055
1056   void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1057   {
1058     glUniformMatrix3fv(location, count, transpose, value);
1059   }
1060
1061   void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1062   {
1063     glUniformMatrix4fv(location, count, transpose, value);
1064   }
1065
1066   void UseProgram(GLuint program) override
1067   {
1068     glUseProgram(program);
1069   }
1070
1071   void ValidateProgram(GLuint program) override
1072   {
1073     glValidateProgram(program);
1074   }
1075
1076   void VertexAttrib1f(GLuint indx, GLfloat x) override
1077   {
1078     glVertexAttrib1f(indx, x);
1079   }
1080
1081   void VertexAttrib1fv(GLuint indx, const GLfloat* values) override
1082   {
1083     glVertexAttrib1fv(indx, values);
1084   }
1085
1086   void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) override
1087   {
1088     glVertexAttrib2f(indx, x, y);
1089   }
1090
1091   void VertexAttrib2fv(GLuint indx, const GLfloat* values) override
1092   {
1093     glVertexAttrib2fv(indx, values);
1094   }
1095
1096   void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) override
1097   {
1098     glVertexAttrib3f(indx, x, y, z);
1099   }
1100
1101   void VertexAttrib3fv(GLuint indx, const GLfloat* values) override
1102   {
1103     glVertexAttrib3fv(indx, values);
1104   }
1105
1106   void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
1107   {
1108     glVertexAttrib4f(indx, x, y, z, w);
1109   }
1110
1111   void VertexAttrib4fv(GLuint indx, const GLfloat* values) override
1112   {
1113     glVertexAttrib4fv(indx, values);
1114   }
1115
1116   void VertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) override
1117   {
1118     glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
1119   }
1120
1121   void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override
1122   {
1123     glViewport(x, y, width, height);
1124   }
1125
1126   /* OpenGL ES 3.0 */
1127
1128   void ReadBuffer(GLenum mode) override
1129   {
1130     mImpl->ReadBuffer(mode);
1131   }
1132
1133   void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) override
1134   {
1135     mImpl->DrawRangeElements(mode, start, end, count, type, indices);
1136   }
1137
1138   void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) override
1139   {
1140     mImpl->TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
1141   }
1142
1143   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
1144   {
1145     mImpl->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
1146   }
1147
1148   void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) override
1149   {
1150     mImpl->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
1151   }
1152
1153   void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) override
1154   {
1155     mImpl->CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
1156   }
1157
1158   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
1159   {
1160     mImpl->CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
1161   }
1162
1163   void GenQueries(GLsizei n, GLuint* ids) override
1164   {
1165     mImpl->GenQueries(n, ids);
1166   }
1167
1168   void DeleteQueries(GLsizei n, const GLuint* ids) override
1169   {
1170     mImpl->DeleteQueries(n, ids);
1171   }
1172
1173   GLboolean IsQuery(GLuint id) override
1174   {
1175     return mImpl->IsQuery(id);
1176   }
1177
1178   void BeginQuery(GLenum target, GLuint id) override
1179   {
1180     mImpl->BeginQuery(target, id);
1181   }
1182
1183   void EndQuery(GLenum target) override
1184   {
1185     mImpl->EndQuery(target);
1186   }
1187
1188   void GetQueryiv(GLenum target, GLenum pname, GLint* params) override
1189   {
1190     mImpl->GetQueryiv(target, pname, params);
1191   }
1192
1193   void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) override
1194   {
1195     mImpl->GetQueryObjectuiv(id, pname, params);
1196   }
1197
1198   GLboolean UnmapBuffer(GLenum target) override
1199   {
1200     return mImpl->UnmapBuffer(target);
1201   }
1202
1203   void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) override
1204   {
1205     mImpl->GetBufferPointerv(target, pname, params);
1206   }
1207
1208   void DrawBuffers(GLsizei n, const GLenum* bufs) override
1209   {
1210     mImpl->DrawBuffers(n, bufs);
1211   }
1212
1213   void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1214   {
1215     mImpl->UniformMatrix2x3fv(location, count, transpose, value);
1216   }
1217
1218   void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1219   {
1220     mImpl->UniformMatrix3x2fv(location, count, transpose, value);
1221   }
1222
1223   void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1224   {
1225     mImpl->UniformMatrix2x4fv(location, count, transpose, value);
1226   }
1227
1228   void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1229   {
1230     mImpl->UniformMatrix4x2fv(location, count, transpose, value);
1231   }
1232
1233   void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1234   {
1235     mImpl->UniformMatrix3x4fv(location, count, transpose, value);
1236   }
1237
1238   void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1239   {
1240     mImpl->UniformMatrix4x3fv(location, count, transpose, value);
1241   }
1242
1243   void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) override
1244   {
1245     mImpl->BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
1246   }
1247
1248   void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) override
1249   {
1250     mImpl->RenderbufferStorageMultisample(target, samples, internalformat, width, height);
1251   }
1252
1253   void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) override
1254   {
1255     mImpl->FramebufferTextureLayer(target, attachment, texture, level, layer);
1256   }
1257
1258   GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) override
1259   {
1260     return mImpl->MapBufferRange(target, offset, length, access);
1261   }
1262
1263   void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) override
1264   {
1265     mImpl->FlushMappedBufferRange(target, offset, length);
1266   }
1267
1268   void BindVertexArray(GLuint array) override
1269   {
1270     mImpl->BindVertexArray(array);
1271   }
1272
1273   void DeleteVertexArrays(GLsizei n, const GLuint* arrays) override
1274   {
1275     mImpl->DeleteVertexArrays(n, arrays);
1276   }
1277
1278   void GenVertexArrays(GLsizei n, GLuint* arrays) override
1279   {
1280     mImpl->GenVertexArrays(n, arrays);
1281   }
1282
1283   GLboolean IsVertexArray(GLuint array) override
1284   {
1285     return mImpl->IsVertexArray(array);
1286   }
1287
1288   void GetIntegeri_v(GLenum target, GLuint index, GLint* data) override
1289   {
1290     mImpl->GetIntegeri_v(target, index, data);
1291   }
1292
1293   void BeginTransformFeedback(GLenum primitiveMode) override
1294   {
1295     mImpl->BeginTransformFeedback(primitiveMode);
1296   }
1297
1298   void EndTransformFeedback(void) override
1299   {
1300     mImpl->EndTransformFeedback();
1301   }
1302
1303   void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) override
1304   {
1305     mImpl->BindBufferRange(target, index, buffer, offset, size);
1306   }
1307
1308   void BindBufferBase(GLenum target, GLuint index, GLuint buffer) override
1309   {
1310     mImpl->BindBufferBase(target, index, buffer);
1311   }
1312
1313   void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) override
1314   {
1315     mImpl->TransformFeedbackVaryings(program, count, varyings, bufferMode);
1316   }
1317
1318   void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) override
1319   {
1320     mImpl->GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
1321   }
1322
1323   void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) override
1324   {
1325     mImpl->VertexAttribIPointer(index, size, type, stride, pointer);
1326   }
1327
1328   void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override
1329   {
1330     mImpl->GetVertexAttribIiv(index, pname, params);
1331   }
1332
1333   void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) override
1334   {
1335     mImpl->GetVertexAttribIuiv(index, pname, params);
1336   }
1337
1338   void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) override
1339   {
1340     mImpl->VertexAttribI4i(index, x, y, z, w);
1341   }
1342
1343   void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) override
1344   {
1345     mImpl->VertexAttribI4ui(index, x, y, z, w);
1346   }
1347
1348   void VertexAttribI4iv(GLuint index, const GLint* v) override
1349   {
1350     mImpl->VertexAttribI4iv(index, v);
1351   }
1352
1353   void VertexAttribI4uiv(GLuint index, const GLuint* v) override
1354   {
1355     mImpl->VertexAttribI4uiv(index, v);
1356   }
1357
1358   void GetUniformuiv(GLuint program, GLint location, GLuint* params) override
1359   {
1360     mImpl->GetUniformuiv(program, location, params);
1361   }
1362
1363   GLint GetFragDataLocation(GLuint program, const GLchar* name) override
1364   {
1365     return mImpl->GetFragDataLocation(program, name);
1366   }
1367
1368   void Uniform1ui(GLint location, GLuint v0) override
1369   {
1370     mImpl->Uniform1ui(location, v0);
1371   }
1372
1373   void Uniform2ui(GLint location, GLuint v0, GLuint v1) override
1374   {
1375     mImpl->Uniform2ui(location, v0, v1);
1376   }
1377
1378   void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) override
1379   {
1380     mImpl->Uniform3ui(location, v0, v1, v2);
1381   }
1382
1383   void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) override
1384   {
1385     mImpl->Uniform4ui(location, v0, v1, v2, v3);
1386   }
1387
1388   void Uniform1uiv(GLint location, GLsizei count, const GLuint* value) override
1389   {
1390     mImpl->Uniform1uiv(location, count, value);
1391   }
1392
1393   void Uniform2uiv(GLint location, GLsizei count, const GLuint* value) override
1394   {
1395     mImpl->Uniform2uiv(location, count, value);
1396   }
1397
1398   void Uniform3uiv(GLint location, GLsizei count, const GLuint* value) override
1399   {
1400     mImpl->Uniform3uiv(location, count, value);
1401   }
1402
1403   void Uniform4uiv(GLint location, GLsizei count, const GLuint* value) override
1404   {
1405     mImpl->Uniform4uiv(location, count, value);
1406   }
1407
1408   void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) override
1409   {
1410     mImpl->ClearBufferiv(buffer, drawbuffer, value);
1411   }
1412
1413   void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) override
1414   {
1415     mImpl->ClearBufferuiv(buffer, drawbuffer, value);
1416   }
1417
1418   void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) override
1419   {
1420     mImpl->ClearBufferfv(buffer, drawbuffer, value);
1421   }
1422
1423   void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) override
1424   {
1425     mImpl->ClearBufferfi(buffer, drawbuffer, depth, stencil);
1426   }
1427
1428   const GLubyte* GetStringi(GLenum name, GLuint index) override
1429   {
1430     return mImpl->GetStringi(name, index);
1431   }
1432
1433   void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) override
1434   {
1435     mImpl->CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
1436   }
1437
1438   void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) override
1439   {
1440     mImpl->GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
1441   }
1442
1443   void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) override
1444   {
1445     mImpl->GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
1446   }
1447
1448   GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) override
1449   {
1450     return mImpl->GetUniformBlockIndex(program, uniformBlockName);
1451   }
1452
1453   void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) override
1454   {
1455     mImpl->GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
1456   }
1457
1458   void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) override
1459   {
1460     mImpl->GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
1461   }
1462
1463   void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override
1464   {
1465     mImpl->UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
1466   }
1467
1468   void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) override
1469   {
1470     mImpl->DrawArraysInstanced(mode, first, count, instanceCount);
1471   }
1472
1473   void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) override
1474   {
1475     mImpl->DrawElementsInstanced(mode, count, type, indices, instanceCount);
1476   }
1477
1478   GLsync FenceSync(GLenum condition, GLbitfield flags) override
1479   {
1480     return mImpl->FenceSync(condition, flags);
1481   }
1482
1483   GLboolean IsSync(GLsync sync) override
1484   {
1485     return mImpl->IsSync(sync);
1486   }
1487
1488   void DeleteSync(GLsync sync) override
1489   {
1490     mImpl->DeleteSync(sync);
1491   }
1492
1493   GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
1494   {
1495     return mImpl->ClientWaitSync(sync, flags, timeout);
1496   }
1497
1498   void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
1499   {
1500     mImpl->WaitSync(sync, flags, timeout);
1501   }
1502
1503   void GetInteger64v(GLenum pname, GLint64* params) override
1504   {
1505     mImpl->GetInteger64v(pname, params);
1506   }
1507
1508   void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) override
1509   {
1510     mImpl->GetSynciv(sync, pname, bufSize, length, values);
1511   }
1512
1513   void GetInteger64i_v(GLenum target, GLuint index, GLint64* data) override
1514   {
1515     mImpl->GetInteger64i_v(target, index, data);
1516   }
1517
1518   void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) override
1519   {
1520     mImpl->GetBufferParameteri64v(target, pname, params);
1521   }
1522
1523   void GenSamplers(GLsizei count, GLuint* samplers) override
1524   {
1525     mImpl->GenSamplers(count, samplers);
1526   }
1527
1528   void DeleteSamplers(GLsizei count, const GLuint* samplers) override
1529   {
1530     mImpl->DeleteSamplers(count, samplers);
1531   }
1532
1533   GLboolean IsSampler(GLuint sampler) override
1534   {
1535     return mImpl->IsSampler(sampler);
1536   }
1537
1538   void BindSampler(GLuint unit, GLuint sampler) override
1539   {
1540     mImpl->BindSampler(unit, sampler);
1541   }
1542
1543   void SamplerParameteri(GLuint sampler, GLenum pname, GLint param) override
1544   {
1545     mImpl->SamplerParameteri(sampler, pname, param);
1546   }
1547
1548   void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) override
1549   {
1550     mImpl->SamplerParameteriv(sampler, pname, param);
1551   }
1552
1553   void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) override
1554   {
1555     mImpl->SamplerParameterf(sampler, pname, param);
1556   }
1557
1558   void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) override
1559   {
1560     mImpl->SamplerParameterfv(sampler, pname, param);
1561   }
1562
1563   void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) override
1564   {
1565     mImpl->GetSamplerParameteriv(sampler, pname, params);
1566   }
1567
1568   void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) override
1569   {
1570     mImpl->GetSamplerParameterfv(sampler, pname, params);
1571   }
1572
1573   void VertexAttribDivisor(GLuint index, GLuint divisor) override
1574   {
1575     mImpl->VertexAttribDivisor(index, divisor);
1576   }
1577
1578   void BindTransformFeedback(GLenum target, GLuint id) override
1579   {
1580     mImpl->BindTransformFeedback(target, id);
1581   }
1582
1583   void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids) override
1584   {
1585     mImpl->DeleteTransformFeedbacks(n, ids);
1586   }
1587
1588   void GenTransformFeedbacks(GLsizei n, GLuint* ids) override
1589   {
1590     mImpl->GenTransformFeedbacks(n, ids);
1591   }
1592
1593   GLboolean IsTransformFeedback(GLuint id) override
1594   {
1595     return mImpl->IsTransformFeedback(id);
1596   }
1597
1598   void PauseTransformFeedback(void) override
1599   {
1600     mImpl->PauseTransformFeedback();
1601   }
1602
1603   void ResumeTransformFeedback(void) override
1604   {
1605     mImpl->ResumeTransformFeedback();
1606   }
1607
1608   void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) override
1609   {
1610     mImpl->GetProgramBinary(program, bufSize, length, binaryFormat, binary);
1611   }
1612
1613   void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) override
1614   {
1615     mImpl->ProgramBinary(program, binaryFormat, binary, length);
1616   }
1617
1618   void ProgramParameteri(GLuint program, GLenum pname, GLint value) override
1619   {
1620     mImpl->ProgramParameteri(program, pname, value);
1621   }
1622
1623   void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) override
1624   {
1625     mImpl->InvalidateFramebuffer(target, numAttachments, attachments);
1626   }
1627
1628   void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) override
1629   {
1630     mImpl->InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
1631   }
1632
1633   void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) override
1634   {
1635     mImpl->TexStorage2D(target, levels, internalformat, width, height);
1636   }
1637
1638   void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) override
1639   {
1640     mImpl->TexStorage3D(target, levels, internalformat, width, height, depth);
1641   }
1642
1643   void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) override
1644   {
1645     mImpl->GetInternalformativ(target, internalformat, pname, bufSize, params);
1646   }
1647
1648   void BlendBarrier(void)
1649   {
1650     if(mIsAdvancedBlendEquationSupported)
1651     {
1652       mImpl->BlendBarrier();
1653     }
1654   }
1655
1656 private:
1657   std::unique_ptr<GlesAbstraction> mImpl;
1658
1659   ConditionalWait mContextCreatedWaitCondition;
1660   GLint           mMaxTextureSize;
1661   std::string     mShaderVersionPrefix;
1662   std::string     mVertexShaderPrefix;
1663   std::string     mFragmentShaderPrefix;
1664   int32_t         mGlesVersion;
1665   int32_t         mShadingLanguageVersion;
1666   bool            mShadingLanguageVersionCached;
1667   bool            mIsSurfacelessContextSupported;
1668   bool            mIsAdvancedBlendEquationSupportedCached;
1669   bool            mIsAdvancedBlendEquationSupported;
1670   bool            mIsContextCreated;
1671 };
1672
1673 } // namespace Adaptor
1674
1675 } // namespace Internal
1676
1677 } // namespace Dali
1678
1679 #endif // DALI_INTERNAL_GL_IMPLEMENTATION_H