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/libANGLE/queryconversions.h b/src/libANGLE/queryconversions.h
index 805f36c..d295091 100644
--- a/src/libANGLE/queryconversions.h
+++ b/src/libANGLE/queryconversions.h
@@ -82,7 +82,7 @@
}
template <typename ParamType>
-GLenum ConvertToGLint(ParamType param)
+GLint ConvertToGLint(ParamType param)
{
return CastQueryValueTo<GLint>(GL_NONE, param);
}
diff --git a/src/tests/deqp_support/deqp_gles31_test_expectations.txt b/src/tests/deqp_support/deqp_gles31_test_expectations.txt
index a6e8dc0..e311ec5 100644
--- a/src/tests/deqp_support/deqp_gles31_test_expectations.txt
+++ b/src/tests/deqp_support/deqp_gles31_test_expectations.txt
@@ -79,9 +79,6 @@
1442 D3D11 : dEQP-GLES31.functional.layout_binding.ssbo.* = FAIL
1442 D3D11 : dEQP-GLES31.functional.compute* = FAIL
1442 D3D11 : dEQP-GLES31.functional.atomic_counter.* = FAIL
-1442 D3D11 : dEQP-GLES31.functional.debug.negative_coverage.callbacks.texture.texparameter* = SKIP
-1442 D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texparameter* = SKIP
-1442 D3D11 : dEQP-GLES31.functional.debug.negative_coverage.log.texture.texparameter* = SKIP
1442 D3D11 : dEQP-GLES31.functional.debug.async.case_4_log = SKIP
1442 D3D11 : dEQP-GLES31.functional.debug.async.case_5_callback = SKIP
1442 D3D11 : dEQP-GLES31.functional.debug.error_filters.case_2 = SKIP
@@ -1219,10 +1216,6 @@
1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.copyteximage2d_max_width_height = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.copytexsubimage2d_invalid_offset = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.copytexsubimage2d_texture_internalformat = FAIL
-1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texparameteri = FAIL
-1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texparameterf = FAIL
-1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texparameteriv = FAIL
-1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texparameterfv = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.compressedtexsubimage2d = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.compressedtexsubimage2d_invalid_size = FAIL
1442 OPENGL D3D11 : dEQP-GLES31.functional.debug.negative_coverage.get_error.texture.texsubimage3d_neg_level = FAIL
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,