ES31: TexParameter{if} validation for TEXTURE_2D_MULTISAMPLE on OpenGL
When setting parameters by TexParameter{if} for TEXTURE_2D_MULTISAMPLE,
an INVALID_ENUM error is generated if target is TEXTURE_2D_MULTISAMPLE,
and pname is any sampler state from table 20.11. An INVALID_OPERATION
error is generated if target is TEXTURE_2D_MULTISAMPLE, and pname
TEXTURE_BASE_LEVEL is set to a value other than zero.
BUG=angleproject:1590
TEST=angle_deqp_gles31_tests.exe --deqp-case=dEQP-GLES31.functional.texture.multisample.negative.texture*
Change-Id: I5d71731c11fb6e114a57e753e439e180695a7c79
Reviewed-on: https://chromium-review.googlesource.com/560607
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 8a32be2..5b2dc8e 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -5571,6 +5571,25 @@
break;
}
+ if (target == GL_TEXTURE_2D_MULTISAMPLE)
+ {
+ switch (pname)
+ {
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_MAG_FILTER:
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ case GL_TEXTURE_COMPARE_MODE:
+ case GL_TEXTURE_COMPARE_FUNC:
+ context->handleError(InvalidEnum()
+ << "Invalid parameter for 2D multisampled textures.");
+ return false;
+ }
+ }
+
switch (pname)
{
case GL_TEXTURE_WRAP_S:
@@ -5675,6 +5694,12 @@
<< "Base level must be 0 for external textures.");
return false;
}
+ if (target == GL_TEXTURE_2D_MULTISAMPLE && static_cast<GLuint>(params[0]) != 0)
+ {
+ context->handleError(InvalidOperation()
+ << "Base level must be 0 for multisampled textures.");
+ return false;
+ }
break;
case GL_TEXTURE_MAX_LEVEL: