[Tizen] Fix to do not try to bind texture when there is no active texture in shader...
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles-impl / gles-context.cpp
index 56625a0..2b56974 100644 (file)
@@ -313,6 +313,12 @@ void Context::Flush(bool reset, const GLES::DrawCallDescriptor& drawCall, GLES::
   // elements. This avoids having to sort the bindings.
   for(const auto& binding : mImpl->mCurrentTextureBindings)
   {
+    if(currentSampler >= samplers.size())
+    {
+      // Don't bind more textures than there are active samplers.
+      break;
+    }
+
     auto texture = const_cast<GLES::Texture*>(static_cast<const GLES::Texture*>(binding.texture));
 
     // Texture may not have been initialized yet...(tbm_surface timing issue?)
@@ -336,11 +342,6 @@ void Context::Flush(bool reset, const GLES::DrawCallDescriptor& drawCall, GLES::
       ++currentSampler;
       currentElement = 0;
     }
-    if(currentSampler >= samplers.size())
-    {
-      // Don't bind more textures than there are active samplers.
-      break;
-    }
   }
 
   // for each attribute bind vertices