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