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