[Tizen] Fix attribute cache bug 78/285278/1 accepted/tizen/7.0/unified/20221212.015717
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 8 Dec 2022 09:29:52 +0000 (18:29 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 8 Dec 2022 09:29:52 +0000 (18:29 +0900)
Change-Id: I3b309833a0865ad175fabf376913c3ad91e64d4a
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/graphics/gles-impl/gles-context.cpp
dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp

index 1d981bc..9c5fa87 100644 (file)
@@ -64,6 +64,12 @@ struct Context::Impl
         mProgramVAOCurrentState = iter->second;
         gl.BindVertexArray(iter->second);
       }
+
+      // We should re-check enable attribute usage because geometry might be changed.
+      for(const auto& attr : vertexInputState.attributes)
+      {
+        gl.EnableVertexAttribArray(attr.location);
+      }
       return;
     }
 
index 05776c2..b7ad58c 100644 (file)
@@ -219,6 +219,8 @@ void Reflection::BuildVertexAttributeReflection()
 
   mVertexInputAttributes.clear();
   mVertexInputAttributes.resize(nAttribs);
+  
+  int maxLocationValue = nAttribs - 1;
 
   name = new GLchar[maxLength];
   for(int i = 0; i < nAttribs; i++)
@@ -228,13 +230,20 @@ void Reflection::BuildVertexAttributeReflection()
 
     if(location >= 0)
     {
+      if(maxLocationValue < location)
+      {
+        maxLocationValue = location;
+        mVertexInputAttributes.resize(maxLocationValue + 1u);
+      }
+
       AttributeInfo attributeInfo;
       attributeInfo.location = location;
       attributeInfo.name     = name;
       attributeInfo.format   = GetVertexAttributeTypeFormat(type);
-      mVertexInputAttributes.insert(mVertexInputAttributes.begin() + location, attributeInfo);
+      mVertexInputAttributes[location] = std::move(attributeInfo);
     }
   }
+
   delete[] name;
 }