StateManagerGL: Remove setGenericShaderState.

We can mutate the BitSetIterator as it clears dirty bits. This removes
the risk of doing a double state update. Improves the proformance of
the GL back-end state update.

Also do an early-out before calling syncDrawArraysState.

Bug: angleproject:2763
Change-Id: Idd25bdd67a6aceff05529a533260b661b07c2928
Reviewed-on: https://chromium-review.googlesource.com/c/1262740
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/common/bitset_utils_unittest.cpp b/src/common/bitset_utils_unittest.cpp
index fc2c752..fea451f 100644
--- a/src/common/bitset_utils_unittest.cpp
+++ b/src/common/bitset_utils_unittest.cpp
@@ -109,4 +109,53 @@
     }
 }
 
+// Tests adding bits to the iterator during iteration.
+TEST_F(BitSetIteratorTest, SetLaterBit)
+{
+    std::set<size_t> expectedValues = {1, 3, 5, 7, 9};
+    mStateBits.set(1);
+
+    std::set<size_t> actualValues;
+
+    for (auto iter = mStateBits.begin(), end = mStateBits.end(); iter != end; ++iter)
+    {
+        if (*iter == 1)
+        {
+            iter.setLaterBit(3);
+            iter.setLaterBit(5);
+            iter.setLaterBit(7);
+            iter.setLaterBit(9);
+        }
+
+        actualValues.insert(*iter);
+    }
+
+    EXPECT_EQ(expectedValues, actualValues);
+}
+
+// Tests removing bits from the iterator during iteration.
+TEST_F(BitSetIteratorTest, ResetLaterBit)
+{
+    std::set<size_t> expectedValues = {1, 3, 5, 7, 9};
+
+    for (size_t index = 1; index <= 9; ++index)
+        mStateBits.set(index);
+
+    std::set<size_t> actualValues;
+
+    for (auto iter = mStateBits.begin(), end = mStateBits.end(); iter != end; ++iter)
+    {
+        if (*iter == 1)
+        {
+            iter.resetLaterBit(2);
+            iter.resetLaterBit(4);
+            iter.resetLaterBit(6);
+            iter.resetLaterBit(8);
+        }
+
+        actualValues.insert(*iter);
+    }
+
+    EXPECT_EQ(expectedValues, actualValues);
+}
 }  // anonymous namespace