Fix up some validation bugs in Texture functions.
In several places we weren't handling certain errors, or were
returning the wrong error code. Several dEQP negative API
tests are affected in functional.negative_api.texture.
BUG=angle:571
Change-Id: I19d7250aab2c15d709fd591b8df90ce883f9ac60
Reviewed-on: https://chromium-review.googlesource.com/201250
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libGLESv2/validationES2.cpp b/src/libGLESv2/validationES2.cpp
index c76e271..a0ef855 100644
--- a/src/libGLESv2/validationES2.cpp
+++ b/src/libGLESv2/validationES2.cpp
@@ -108,6 +108,11 @@
GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
GLint border, GLenum format, GLenum type, const GLvoid *pixels)
{
+ if (!ValidTexture2DDestinationTarget(context, target))
+ {
+ return gl::error(GL_INVALID_ENUM, false);
+ }
+
if (!ValidImageSize(context, target, level, width, height, 1))
{
return gl::error(GL_INVALID_VALUE, false);