Fix an issue with instanced drawing in the D3D9 path.

TRAC #22447

Signed-off-by: Geoff Lang
Signed-off-by: Nicolas Capens
Author: Jamie Madill

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1787 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/renderer/VertexDeclarationCache.cpp b/src/libGLESv2/renderer/VertexDeclarationCache.cpp
index f5c9273..8ed226d 100644
--- a/src/libGLESv2/renderer/VertexDeclarationCache.cpp
+++ b/src/libGLESv2/renderer/VertexDeclarationCache.cpp
@@ -56,21 +56,16 @@
         {
             if (attributes[i].active)
             {
-                if (indexedAttribute == gl::MAX_VERTEX_ATTRIBS)
+                if (indexedAttribute == gl::MAX_VERTEX_ATTRIBS && attributes[i].divisor == 0)
                 {
-                    if (attributes[i].divisor == 0)
-                    {
-                        indexedAttribute = i;
-                    }
+                    indexedAttribute = i;
                 }
-                else if (instancedAttribute == gl::MAX_VERTEX_ATTRIBS)
+                else if (instancedAttribute == gl::MAX_VERTEX_ATTRIBS && attributes[i].divisor != 0)
                 {
-                    if (attributes[i].divisor != 0)
-                    {
-                        instancedAttribute = i;
-                    }
+                    instancedAttribute = i;
                 }
-                else break;   // Found both an indexed and instanced attribute
+                if (indexedAttribute != gl::MAX_VERTEX_ATTRIBS && instancedAttribute != gl::MAX_VERTEX_ATTRIBS)
+                    break;   // Found both an indexed and instanced attribute
             }
         }