Commit cc507aa0 by Geoff Lang Committed by Commit Bot

Make the NPOT extension requestable. Fix NPOT validation in CopyTexImage.

BUG=angleproject:1523 BUG=668223 TEST=conformance/more/functions/copyTexImage2DBadArgs.html Change-Id: I5fbf4f99fa941c356ecb57d67dd47a33741ce189 Reviewed-on: https://chromium-review.googlesource.com/418944Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 36fd100d
......@@ -578,7 +578,7 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_ANGLE_depth_texture"] = esOnlyExtension(&Extensions::depthTextures);
map["GL_OES_depth32"] = esOnlyExtension(&Extensions::depth32);
map["GL_EXT_texture_storage"] = esOnlyExtension(&Extensions::textureStorage);
map["GL_OES_texture_npot"] = esOnlyExtension(&Extensions::textureNPOT);
map["GL_OES_texture_npot"] = enableableExtension(&Extensions::textureNPOT);
map["GL_EXT_draw_buffers"] = esOnlyExtension(&Extensions::drawBuffers);
map["GL_EXT_texture_filter_anisotropic"] = esOnlyExtension(&Extensions::textureFilterAnisotropic);
map["GL_EXT_occlusion_query_boolean"] = esOnlyExtension(&Extensions::occlusionQueryBoolean);
......
......@@ -1494,7 +1494,7 @@ bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level)
return level <= gl::log2(static_cast<int>(maxDimension));
}
bool ValidImageSizeParameters(const Context *context,
bool ValidImageSizeParameters(const ValidationContext *context,
GLenum target,
GLint level,
GLsizei width,
......@@ -1509,7 +1509,9 @@ bool ValidImageSizeParameters(const Context *context,
// TexSubImage parameters can be NPOT without textureNPOT extension,
// as long as the destination texture is POT.
if (!isSubImage && !context->getExtensions().textureNPOT &&
bool hasNPOTSupport =
context->getExtensions().textureNPOT && context->getClientVersion() >= Version(3, 0);
if (!isSubImage && !hasNPOTSupport &&
(level != 0 && (!gl::isPow2(width) || !gl::isPow2(height) || !gl::isPow2(depth))))
{
return false;
......
......@@ -39,7 +39,7 @@ bool ValidFramebufferTarget(GLenum target);
bool ValidBufferTarget(const ValidationContext *context, GLenum target);
bool ValidBufferParameter(const ValidationContext *context, GLenum pname, GLsizei *numParams);
bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level);
bool ValidImageSizeParameters(const Context *context,
bool ValidImageSizeParameters(const ValidationContext *context,
GLenum target,
GLint level,
GLsizei width,
......
......@@ -740,6 +740,12 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
return false;
}
if (!ValidImageSizeParameters(context, target, level, width, height, 1, isSubImage))
{
context->handleError(Error(GL_INVALID_VALUE, "Invalid texture dimensions."));
return false;
}
Format textureFormat = Format::Invalid();
if (!ValidateCopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
xoffset, yoffset, 0, x, y, width, height, border,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment