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