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