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