Fix incorrect conversion in ConvertToGLint

This patch fixes a bug in function ConvertToGLint. This function
should convert ParamType into GLint instead of GLenum.

This patch can fix the bug that no errors are generated when trying
to set negative base level or max level by glTexParameteri because
ConvertToGLint always incorrectly converts a negative integer into
an unsigned integer in ValidateTexParameterBase.

BUG=angleproject:2371
TEST=angle_end2end_tests
     dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texparameter*
Change-Id: Id5baf3430ae574a083bcc40a7a8f7db1cb2d07ed
Reviewed-on: https://chromium-review.googlesource.com/933923
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jiajia Qin <jiajia.qin@intel.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/gl_tests/TextureTest.cpp b/src/tests/gl_tests/TextureTest.cpp
index 01f58e2..507bc9a 100644
--- a/src/tests/gl_tests/TextureTest.cpp
+++ b/src/tests/gl_tests/TextureTest.cpp
@@ -3655,6 +3655,21 @@
     EXPECT_PIXEL_COLOR_EQ(0, 0, angle::GLColor::white);
 }
 
+// Verify that using negative texture base level and max level generates GL_INVALID_VALUE.
+TEST_P(Texture2DTestES3, NegativeTextureBaseLevelAndMaxLevel)
+{
+    GLuint texture = create2DTexture();
+
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, -1);
+    EXPECT_GL_ERROR(GL_INVALID_VALUE);
+
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, -1);
+    EXPECT_GL_ERROR(GL_INVALID_VALUE);
+
+    glDeleteTextures(1, &texture);
+    EXPECT_GL_NO_ERROR();
+}
+
 // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
 // TODO(oetuaho): Enable all below tests on OpenGL. Requires a fix for ANGLE bug 1278.
 ANGLE_INSTANTIATE_TEST(Texture2DTest,