Add NPOT validation to copyTextureCHROMIUM
copyTextureCHROMIUM should generate INVALID_VALUE when using a NPOT
texture and level not equal to zero, so we should add
validation to catch this case.
BUG=angleproject:2380
Change-Id: I7ca2e657287c11d560db0ad296f8e87ed0c19798
Reviewed-on: https://chromium-review.googlesource.com/956018
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index b35dbdf..7b261d1 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -371,13 +371,19 @@
TextureType type,
GLint level,
GLsizei width,
- GLsizei height)
+ GLsizei height,
+ bool isSubImage)
{
if (!ValidMipLevel(context, type, level))
{
return false;
}
+ if (!ValidImageSizeParameters(context, type, level, width, height, 1, isSubImage))
+ {
+ return false;
+ }
+
const Caps &caps = context->getCaps();
switch (type)
{
@@ -3916,7 +3922,7 @@
}
if (!IsValidCopyTextureDestinationLevel(context, dest->getType(), destLevel, sourceWidth,
- sourceHeight))
+ sourceHeight, false))
{
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel);
return false;
@@ -4044,7 +4050,8 @@
return false;
}
- if (!IsValidCopyTextureDestinationLevel(context, dest->getType(), destLevel, width, height))
+ if (!IsValidCopyTextureDestinationLevel(context, dest->getType(), destLevel, width, height,
+ true))
{
context->handleError(InvalidValue() << "Destination texture level is not valid.");
return false;