GLES1: gl(Push|Pop)Matrix

BUG=angleproject:2306

Change-Id: I96498aebbbc62ebd53e5320db17ef6a54d20d2dc
Reviewed-on: https://chromium-review.googlesource.com/998308
Commit-Queue: Lingfeng Yang <lfy@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES1.cpp b/src/libANGLE/validationES1.cpp
index d8f8c85..58e32f8 100644
--- a/src/libANGLE/validationES1.cpp
+++ b/src/libANGLE/validationES1.cpp
@@ -504,13 +504,25 @@
 
 bool ValidatePopMatrix(Context *context)
 {
-    UNIMPLEMENTED();
+    ANGLE_VALIDATE_IS_GLES1(context);
+    const auto &stack = context->getGLState().gles1().currentMatrixStack();
+    if (stack.size() == 1)
+    {
+        ANGLE_VALIDATION_ERR(context, StackUnderflow(), MatrixStackUnderflow);
+        return false;
+    }
     return true;
 }
 
 bool ValidatePushMatrix(Context *context)
 {
-    UNIMPLEMENTED();
+    ANGLE_VALIDATE_IS_GLES1(context);
+    const auto &stack = context->getGLState().gles1().currentMatrixStack();
+    if (stack.size() == stack.max_size())
+    {
+        ANGLE_VALIDATION_ERR(context, StackOverflow(), MatrixStackOverflow);
+        return false;
+    }
     return true;
 }