From: Eunki, Hong Date: Mon, 5 Feb 2024 11:49:06 +0000 (+0900) Subject: Support gles2.0 device also use BuildUniformBlockReflection() API X-Git-Tag: dali_2.3.10~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F26%2F305626%2F2;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Support gles2.0 device also use BuildUniformBlockReflection() API Since glGetActiveUniformsiv only implements on gles3.1 or over, BuildUniformBLockReflection API doesn't work well on gles2.0 devices. To support it, let we implement naive way of glGetActiveUniform, so let we make it didn't break down at least. Change-Id: I3f50f2e74763968d19712d5dc37377f283000383 Signed-off-by: Eunki, Hong --- diff --git a/dali/internal/graphics/gles/gles2-implementation.h b/dali/internal/graphics/gles/gles2-implementation.h index 527cebf..57cb40f 100644 --- a/dali/internal/graphics/gles/gles2-implementation.h +++ b/dali/internal/graphics/gles/gles2-implementation.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_GLES2_IMPLEMENTATION_H /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -371,6 +371,40 @@ public: void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) override { DALI_LOG_ERROR("glGetActiveUniformsiv is not supported in OpenGL es 2.0\n"); + + int maxUniformNameLength = 0; + glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformNameLength); + char* name = new char[maxUniformNameLength + 1]; + + for(auto i = 0; i < uniformCount; ++i) + { + GLint elementCount; + GLint written; + GLenum type; + glGetActiveUniform(program, uniformIndices[i], maxUniformNameLength, &written, &elementCount, &type, name); + + if(pname == GL_UNIFORM_TYPE) + { + params[i] = type; + } + else if(pname == GL_UNIFORM_SIZE) + { + params[i] = elementCount; + } + else if(pname == GL_UNIFORM_NAME_LENGTH) + { + params[i] = written; + } + else if(pname == GL_UNIFORM_BLOCK_INDEX) + { + params[i] = -1; // Not support + } + else if(pname == GL_UNIFORM_OFFSET) + { + params[i] = 0; // Not support + } + } + delete[] name; } GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) override