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