Fix typo error at ArrayBuffer bind 67/289367/1
authorEunki Hong <eunkiki.hong@samsung.com>
Mon, 6 Mar 2023 17:52:49 +0000 (02:52 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Mon, 6 Mar 2023 17:52:49 +0000 (02:52 +0900)
Previously, we don't consider glBindBuffer for
GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER.
I think this is kind of typo error. So fix it.

Change-Id: I813b90633cc769d23c32150194cea9fe25d30c0e
Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
dali/internal/graphics/gles-impl/gles-context.cpp

index 32f490d..1723e5a 100644 (file)
@@ -950,13 +950,31 @@ void Context::GenerateMipmap(GLenum target)
 
 void Context::BindBuffer(GLenum target, uint32_t bufferId)
 {
-  if(mImpl->mGlStateCache.mBoundArrayBufferId != bufferId)
+  switch(target)
   {
-    mImpl->mGlStateCache.mBoundArrayBufferId = bufferId;
-
-    auto& gl = *mImpl->mController.GetGL();
-    gl.BindBuffer(target, bufferId);
+    case GL_ARRAY_BUFFER:
+    {
+      if(mImpl->mGlStateCache.mBoundArrayBufferId == bufferId)
+      {
+        return;
+      }
+      mImpl->mGlStateCache.mBoundArrayBufferId = bufferId;
+      break;
+    }
+    case GL_ELEMENT_ARRAY_BUFFER:
+    {
+      if(mImpl->mGlStateCache.mBoundElementArrayBufferId == bufferId)
+      {
+        return;
+      }
+      mImpl->mGlStateCache.mBoundElementArrayBufferId = bufferId;
+      break;
+    }
   }
+
+  // Cache miss. Bind buffer.
+  auto& gl = *mImpl->mController.GetGL();
+  gl.BindBuffer(target, bufferId);
 }
 
 void Context::DrawBuffers(uint32_t count, const GLenum* buffers)