[M76 Migration] Remove redundant glGetIntegerv call 62/222062/2
authorChandan Padhi <c.padhi@samsung.com>
Mon, 16 Dec 2019 13:03:48 +0000 (18:33 +0530)
committerDae-Hyun Ko <dhyuna.ko@samsung.com>
Fri, 10 Jan 2020 01:22:07 +0000 (01:22 +0000)
glGetIntegerv call is expensive and its usage is generally not
recommended. As we already know the value of |current_program|,
glGetIntegerv call becomes redundant and can be avoided.

Reference: https://review.tizen.org/gerrit/#/c/195981/

Change-Id: I406a6af1452d3a49fbeffbf402db4f2864435af8
Signed-off-by: Chandan Padhi <c.padhi@samsung.com>
(cherry picked from commit 11dce8ecc6c073019b3002b679358511a37d9ce4)

tizen_src/chromium_impl/gpu/command_buffer/client/gles2_implementation_efl.cc
tizen_src/chromium_impl/gpu/command_buffer/client/gles2_implementation_efl.h

index a13af8b782244a3465390ec26766849d55ac7ae3..ced0a1c9b94b0a4d560f288218845de95eb7c349 100644 (file)
@@ -84,8 +84,6 @@ bool GLES2ImplementationEfl::HasGrContextSupport() const {
 
 GLES2ImplementationEfl::ProgramData& GLES2ImplementationEfl::GetProgramData(
     GLint program) {
-  if (program == -1)
-    program = current_program_;
   auto it_program = program_map_.find(program);
   DCHECK(it_program != program_map_.end());
   return it_program->second;
@@ -93,16 +91,15 @@ GLES2ImplementationEfl::ProgramData& GLES2ImplementationEfl::GetProgramData(
 
 GLuint GLES2ImplementationEfl::DoCreateProgram() {
   GLuint program = evas_gl_api_->glCreateProgram();
-  program_map_[program] = ProgramData();
-  auto it_program = program_map_.find(program);
-  DCHECK(it_program != program_map_.end());
-  it_program->second.service_id_ = program;
+  ProgramData program_data;
+  program_data.service_id_ = program;
+  program_map_[program] = program_data;
   return program;
 }
 
 void GLES2ImplementationEfl::DoUseProgram(GLuint program) {
   evas_gl_api_->glUseProgram(program);
-  evas_gl_api_->glGetIntegerv(GL_CURRENT_PROGRAM, &current_program_);
+  current_program_ = program;
 }
 
 void GLES2ImplementationEfl::DoDeleteProgram(GLuint program) {
@@ -111,15 +108,14 @@ void GLES2ImplementationEfl::DoDeleteProgram(GLuint program) {
 }
 
 GLint GLES2ImplementationEfl::GetBoundUniformLocation(GLint location) {
-  const ProgramData& program_data = GetProgramData();
+  const ProgramData& program_data = GetProgramData(current_program_);
 
   auto it_location = program_data.uniform_location_map_.find(location);
   DCHECK(it_location != program_data.uniform_location_map_.end());
   const std::string& name = it_location->second;
 
-  GLint newloc = evas_gl_api_->glGetUniformLocation(program_data.service_id_,
-                                                    name.c_str());
-  return newloc;
+  return evas_gl_api_->glGetUniformLocation(program_data.service_id_,
+                                            name.c_str());
 }
 
 void GLES2ImplementationEfl::DoBindUniformLocationCHROMIUM(GLuint program,
index aff5f119063c8bfd69bb1d217d348e08b45b51c2..e41f46bdc729710b419f66fd95ee50496523f0e4 100644 (file)
@@ -158,7 +158,7 @@ class GLES2_IMPL_EXPORT GLES2ImplementationEfl : public ContextSupport,
   std::set<GLuint> textures_;
 
   GLint GetBoundUniformLocation(GLint location);
-  ProgramData& GetProgramData(GLint program = -1);
+  ProgramData& GetProgramData(GLint program);
 };
 
 }  // namespace gles2