Fix npot Texture level 0 validation.
We were rejecting npot textures for level 0, even though it is
valid in GLES 2 for non-mipped textures to have npot size.
BUG=381495
Change-Id: Iacc3ab50d6487ecba804fd8963aa0a2ada2f1cae
Reviewed-on: https://chromium-review.googlesource.com/205220
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <nicolascapens@chromium.org>
diff --git a/src/libGLESv2/validationES.cpp b/src/libGLESv2/validationES.cpp
index ddb03fa..5afe273 100644
--- a/src/libGLESv2/validationES.cpp
+++ b/src/libGLESv2/validationES.cpp
@@ -168,14 +168,16 @@
return level < maxLevel;
}
-bool ValidImageSize(const gl::Context *context, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth)
+bool ValidImageSize(const gl::Context *context, GLenum target, GLint level,
+ GLsizei width, GLsizei height, GLsizei depth)
{
if (level < 0 || width < 0 || height < 0 || depth < 0)
{
return false;
}
- if (!context->getCaps().extensions.textureNPOT && (level != 0 || !gl::isPow2(width) || !gl::isPow2(height) || !gl::isPow2(depth)))
+ if (!context->getCaps().extensions.textureNPOT &&
+ (level != 0 && (!gl::isPow2(width) || !gl::isPow2(height) || !gl::isPow2(depth))))
{
return false;
}