1 #ifndef DALI_INTERNAL_GLES2_IMPLEMENTATION_H
2 #define DALI_INTERNAL_GLES2_IMPLEMENTATION_H
5 * Copyright (c) 2024 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/integration-api/debug.h>
25 #include <dali/internal/graphics/gles/gl-extensions.h>
26 #include <dali/internal/graphics/gles/gles-abstraction.h>
34 class Gles2Implementation : public GlesAbstraction
41 ~Gles2Implementation() override
45 void ReadBuffer(GLenum mode) override
47 DALI_LOG_ERROR("glReadBuffer is not supported in OpenGL es 2.0\n");
50 void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) override
52 DALI_LOG_ERROR("glDrawRangeElements is not supported in OpenGL es 2.0\n");
55 void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) override
57 DALI_LOG_ERROR("glTexImage3D is not supported in OpenGL es 2.0\n");
60 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
62 DALI_LOG_ERROR("glTexSubImage3D is not supported in OpenGL es 2.0\n");
65 void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) override
67 DALI_LOG_ERROR("glCopyTexSubImage3D is not supported in OpenGL es 2.0\n");
70 void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) override
72 DALI_LOG_ERROR("glCompressedTexImage3D is not supported in OpenGL es 2.0\n");
75 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
77 DALI_LOG_ERROR("glCompressedTexSubImage3D is not supported in OpenGL es 2.0\n");
80 void GenQueries(GLsizei n, GLuint* ids) override
82 DALI_LOG_ERROR("glGenQueries is not supported in OpenGL es 2.0\n");
85 void DeleteQueries(GLsizei n, const GLuint* ids) override
87 DALI_LOG_ERROR("glDeleteQueries is not supported in OpenGL es 2.0\n");
90 GLboolean IsQuery(GLuint id) override
92 DALI_LOG_ERROR("glIsQuery is not supported in OpenGL es 2.0\n");
96 void BeginQuery(GLenum target, GLuint id) override
98 DALI_LOG_ERROR("glBeginQuery is not supported in OpenGL es 2.0\n");
101 void EndQuery(GLenum target) override
103 DALI_LOG_ERROR("glEndQuery is not supported in OpenGL es 2.0\n");
106 void GetQueryiv(GLenum target, GLenum pname, GLint* params) override
108 DALI_LOG_ERROR("glGetQueryiv is not supported in OpenGL es 2.0\n");
111 void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) override
113 DALI_LOG_ERROR("glGetQueryObjectuiv is not supported in OpenGL es 2.0\n");
116 GLboolean UnmapBuffer(GLenum target) override
118 DALI_LOG_ERROR("glUnmapBuffer is not supported in OpenGL es 2.0\n");
122 void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) override
124 DALI_LOG_ERROR("glGetBufferPointerv is not supported in OpenGL es 2.0\n");
127 void DrawBuffers(GLsizei n, const GLenum* bufs) override
129 DALI_LOG_ERROR("glDrawBuffers is not supported in OpenGL es 2.0\n");
132 void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
134 DALI_LOG_ERROR("glUniformMatrix2x3fv is not supported in OpenGL es 2.0\n");
137 void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
139 DALI_LOG_ERROR("glUniformMatrix3x2fv is not supported in OpenGL es 2.0\n");
142 void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
144 DALI_LOG_ERROR("glUniformMatrix2x4fv is not supported in OpenGL es 2.0\n");
147 void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
149 DALI_LOG_ERROR("glUniformMatrix4x2fv is not supported in OpenGL es 2.0\n");
152 void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
154 DALI_LOG_ERROR("glUniformMatrix3x4fv is not supported in OpenGL es 2.0\n");
157 void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
159 DALI_LOG_ERROR("glUniformMatrix4x3fv is not supported in OpenGL es 2.0\n");
162 void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) override
164 DALI_LOG_ERROR("glBlitFramebuffer is not supported in OpenGL es 2.0\n");
167 void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) override
169 mGlExtensions.RenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height);
172 void FramebufferTexture2DMultisample(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) override
174 mGlExtensions.FramebufferTexture2DMultisampleEXT(target, attachment, textarget, texture, level, samples);
177 void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) override
179 DALI_LOG_ERROR("glFramebufferTextureLayer is not supported in OpenGL es 2.0\n");
182 GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) override
184 DALI_LOG_ERROR("glMapBufferRange is not supported in OpenGL es 2.0\n");
188 void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) override
190 DALI_LOG_ERROR("glFlushMappedBufferRange is not supported in OpenGL es 2.0\n");
193 void BindVertexArray(GLuint array) override
195 DALI_LOG_ERROR("glBindVertexArray is not supported in OpenGL es 2.0\n");
198 void DeleteVertexArrays(GLsizei n, const GLuint* arrays) override
200 DALI_LOG_ERROR("glDeleteVertexArrays is not supported in OpenGL es 2.0\n");
203 void GenVertexArrays(GLsizei n, GLuint* arrays) override
205 DALI_LOG_ERROR("glGenVertexArrays is not supported in OpenGL es 2.0\n");
208 GLboolean IsVertexArray(GLuint array) override
210 DALI_LOG_ERROR("glIsVertexArray is not supported in OpenGL es 2.0\n");
214 void GetIntegeri_v(GLenum target, GLuint index, GLint* data) override
216 DALI_LOG_ERROR("glGetIntegeri_v is not supported in OpenGL es 2.0\n");
219 void BeginTransformFeedback(GLenum primitiveMode) override
221 DALI_LOG_ERROR("glBeginTransformFeedback is not supported in OpenGL es 2.0\n");
224 void EndTransformFeedback(void) override
226 DALI_LOG_ERROR("glEndTransformFeedback is not supported in OpenGL es 2.0\n");
229 void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) override
231 DALI_LOG_ERROR("glBindBufferRange is not supported in OpenGL es 2.0\n");
234 void BindBufferBase(GLenum target, GLuint index, GLuint buffer) override
236 DALI_LOG_ERROR("glBindBufferBase is not supported in OpenGL es 2.0\n");
239 void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) override
241 DALI_LOG_ERROR("glTransformFeedbackVaryings is not supported in OpenGL es 2.0\n");
244 void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) override
246 DALI_LOG_ERROR("glGetTransformFeedbackVarying is not supported in OpenGL es 2.0\n");
249 void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) override
251 DALI_LOG_ERROR("glVertexAttribIPointer is not supported in OpenGL es 2.0\n");
254 void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override
256 DALI_LOG_ERROR("glGetVertexAttribIiv is not supported in OpenGL es 2.0\n");
259 void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) override
261 DALI_LOG_ERROR("glGetVertexAttribIuiv is not supported in OpenGL es 2.0\n");
264 void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) override
266 DALI_LOG_ERROR("glVertexAttribI4i is not supported in OpenGL es 2.0\n");
269 void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) override
271 DALI_LOG_ERROR("glVertexAttribI4ui is not supported in OpenGL es 2.0\n");
274 void VertexAttribI4iv(GLuint index, const GLint* v) override
276 DALI_LOG_ERROR("glVertexAttribI4iv is not supported in OpenGL es 2.0\n");
279 void VertexAttribI4uiv(GLuint index, const GLuint* v) override
281 DALI_LOG_ERROR("glVertexAttribI4uiv is not supported in OpenGL es 2.0\n");
284 void GetUniformuiv(GLuint program, GLint location, GLuint* params) override
286 DALI_LOG_ERROR("glGetUniformuiv is not supported in OpenGL es 2.0\n");
289 GLint GetFragDataLocation(GLuint program, const GLchar* name) override
291 DALI_LOG_ERROR("glGetFragDataLocation is not supported in OpenGL es 2.0\n");
295 void Uniform1ui(GLint location, GLuint v0) override
297 DALI_LOG_ERROR("glUniform1ui is not supported in OpenGL es 2.0\n");
300 void Uniform2ui(GLint location, GLuint v0, GLuint v1) override
302 DALI_LOG_ERROR("glUniform2ui is not supported in OpenGL es 2.0\n");
305 void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) override
307 DALI_LOG_ERROR("glUniform3ui is not supported in OpenGL es 2.0\n");
310 void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) override
312 DALI_LOG_ERROR("glUniform4ui is not supported in OpenGL es 2.0\n");
315 void Uniform1uiv(GLint location, GLsizei count, const GLuint* value) override
317 DALI_LOG_ERROR("glUniform1uiv is not supported in OpenGL es 2.0\n");
320 void Uniform2uiv(GLint location, GLsizei count, const GLuint* value) override
322 DALI_LOG_ERROR("glUniform2uiv is not supported in OpenGL es 2.0\n");
325 void Uniform3uiv(GLint location, GLsizei count, const GLuint* value) override
327 DALI_LOG_ERROR("glUniform3uiv is not supported in OpenGL es 2.0\n");
330 void Uniform4uiv(GLint location, GLsizei count, const GLuint* value) override
332 DALI_LOG_ERROR("glUniform4uiv is not supported in OpenGL es 2.0\n");
335 void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) override
337 DALI_LOG_ERROR("glClearBufferiv is not supported in OpenGL es 2.0\n");
340 void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) override
342 DALI_LOG_ERROR("glClearBufferuiv is not supported in OpenGL es 2.0\n");
345 void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) override
347 DALI_LOG_ERROR("glClearBufferfv is not supported in OpenGL es 2.0\n");
350 void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) override
352 DALI_LOG_ERROR("glClearBufferfi is not supported in OpenGL es 2.0\n");
355 const GLubyte* GetStringi(GLenum name, GLuint index) override
357 DALI_LOG_ERROR("glGetStringi is not supported in OpenGL es 2.0\n");
361 void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) override
363 DALI_LOG_ERROR("glCopyBufferSubData is not supported in OpenGL es 2.0\n");
366 void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) override
368 DALI_LOG_ERROR("glGetUniformIndices is not supported in OpenGL es 2.0\n");
371 void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) override
373 DALI_LOG_ERROR("glGetActiveUniformsiv is not supported in OpenGL es 2.0\n");
375 int maxUniformNameLength = 0;
376 glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformNameLength);
377 char* name = new char[maxUniformNameLength + 1];
379 for(auto i = 0; i < uniformCount; ++i)
384 glGetActiveUniform(program, uniformIndices[i], maxUniformNameLength, &written, &elementCount, &type, name);
386 if(pname == GL_UNIFORM_TYPE)
390 else if(pname == GL_UNIFORM_SIZE)
392 params[i] = elementCount;
394 else if(pname == GL_UNIFORM_NAME_LENGTH)
398 else if(pname == GL_UNIFORM_BLOCK_INDEX)
400 params[i] = -1; // Not support
402 else if(pname == GL_UNIFORM_OFFSET)
404 params[i] = 0; // Not support
410 GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) override
412 DALI_LOG_ERROR("glGetUniformBlockIndex is not supported in OpenGL es 2.0\n");
416 void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) override
418 DALI_LOG_ERROR("glGetActiveUniformBlockiv is not supported in OpenGL es 2.0\n");
421 void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) override
423 DALI_LOG_ERROR("glGetActiveUniformBlockName is not supported in OpenGL es 2.0\n");
426 void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override
428 DALI_LOG_ERROR("glUniformBlockBinding is not supported in OpenGL es 2.0\n");
431 void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) override
433 DALI_LOG_ERROR("glDrawArraysInstanced is not supported in OpenGL es 2.0\n");
436 void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) override
438 DALI_LOG_ERROR("glDrawElementsInstanced is not supported in OpenGL es 2.0\n");
441 GLsync FenceSync(GLenum condition, GLbitfield flags) override
443 DALI_LOG_ERROR("glFenceSync is not supported in OpenGL es 2.0\n");
447 GLboolean IsSync(GLsync sync) override
449 DALI_LOG_ERROR("glIsSync is not supported in OpenGL es 2.0\n");
453 void DeleteSync(GLsync sync) override
455 DALI_LOG_ERROR("glDeleteSync is not supported in OpenGL es 2.0\n");
458 GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
460 DALI_LOG_ERROR("glClientWaitSync is not supported in OpenGL es 2.0\n");
464 void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
466 DALI_LOG_ERROR("glWaitSync is not supported in OpenGL es 2.0\n");
469 void GetInteger64v(GLenum pname, GLint64* params) override
471 DALI_LOG_ERROR("glGetInteger64v is not supported in OpenGL es 2.0\n");
474 void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) override
476 DALI_LOG_ERROR("glGetSynciv is not supported in OpenGL es 2.0\n");
479 void GetInteger64i_v(GLenum target, GLuint index, GLint64* data) override
481 DALI_LOG_ERROR("glGetInteger64i_v is not supported in OpenGL es 2.0\n");
484 void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) override
486 DALI_LOG_ERROR("glGetBufferParameteri64v is not supported in OpenGL es 2.0\n");
489 void GenSamplers(GLsizei count, GLuint* samplers) override
491 DALI_LOG_ERROR("glGenSamplers is not supported in OpenGL es 2.0\n");
494 void DeleteSamplers(GLsizei count, const GLuint* samplers) override
496 DALI_LOG_ERROR("glDeleteSamplers is not supported in OpenGL es 2.0\n");
499 GLboolean IsSampler(GLuint sampler) override
501 DALI_LOG_ERROR("glIsSampler is not supported in OpenGL es 2.0\n");
505 void BindSampler(GLuint unit, GLuint sampler) override
507 DALI_LOG_ERROR("glBindSampler is not supported in OpenGL es 2.0\n");
510 void SamplerParameteri(GLuint sampler, GLenum pname, GLint param) override
512 DALI_LOG_ERROR("glSamplerParameteri is not supported in OpenGL es 2.0\n");
515 void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) override
517 DALI_LOG_ERROR("glSamplerParameteriv is not supported in OpenGL es 2.0\n");
520 void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) override
522 DALI_LOG_ERROR("glSamplerParameterf is not supported in OpenGL es 2.0\n");
525 void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) override
527 DALI_LOG_ERROR("glSamplerParameterfv is not supported in OpenGL es 2.0\n");
530 void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) override
532 DALI_LOG_ERROR("glGetSamplerParameteriv is not supported in OpenGL es 2.0\n");
535 void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) override
537 DALI_LOG_ERROR("glGetSamplerParameterfv is not supported in OpenGL es 2.0\n");
540 void VertexAttribDivisor(GLuint index, GLuint divisor) override
542 DALI_LOG_ERROR("glVertexAttribDivisor is not supported in OpenGL es 2.0\n");
545 void BindTransformFeedback(GLenum target, GLuint id) override
547 DALI_LOG_ERROR("glBindTransformFeedback is not supported in OpenGL es 2.0\n");
550 void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids) override
552 DALI_LOG_ERROR("glDeleteTransformFeedbacks is not supported in OpenGL es 2.0\n");
555 void GenTransformFeedbacks(GLsizei n, GLuint* ids) override
557 DALI_LOG_ERROR("glGenTransformFeedbacks is not supported in OpenGL es 2.0\n");
560 GLboolean IsTransformFeedback(GLuint id) override
562 DALI_LOG_ERROR("glIsTransformFeedback is not supported in OpenGL es 2.0\n");
566 void PauseTransformFeedback(void) override
568 DALI_LOG_ERROR("glPauseTransformFeedback is not supported in OpenGL es 2.0\n");
571 void ResumeTransformFeedback(void) override
573 DALI_LOG_ERROR("glResumeTransformFeedback is not supported in OpenGL es 2.0\n");
576 void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) override
578 mGlExtensions.GetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
581 void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) override
583 mGlExtensions.ProgramBinaryOES(program, binaryFormat, binary, length);
586 void ProgramParameteri(GLuint program, GLenum pname, GLint value) override
588 DALI_LOG_ERROR("glProgramParameteri is not supported in OpenGL es 2.0\n");
591 void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) override
593 mGlExtensions.DiscardFrameBuffer(target, numAttachments, attachments);
596 void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) override
598 DALI_LOG_ERROR("glInvalidateSubFramebuffer is not supported in OpenGL es 2.0\n");
601 void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) override
603 DALI_LOG_ERROR("glTexStorage2D is not supported in OpenGL es 2.0\n");
606 void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) override
608 DALI_LOG_ERROR("glTexStorage3D is not supported in OpenGL es 2.0\n");
611 void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) override
613 DALI_LOG_ERROR("glGetInternalformativ is not supported in OpenGL es 2.0\n");
616 void BlendBarrier(void) override
618 DALI_LOG_ERROR("BlendBarrier is not supported in OpenGL es 2.0\n");
622 GlExtensions mGlExtensions;
625 } // namespace Adaptor
627 } // namespace Internal
631 #endif // DALI_INTERNAL_GLES2_IMPLEMENTATION_H