Commit 5f319a4b by Geoff Lang Committed by Commit Bot

Fix incorrect NPOT availability check.

Add tests for enabling NPOT extensions. BUG=angleproject:1678 Change-Id: Ibcbfc1192bceb634deb2904dbb9644902471e3fd Reviewed-on: https://chromium-review.googlesource.com/425713Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 037340d7
......@@ -1535,7 +1535,7 @@ bool ValidImageSizeParameters(const ValidationContext *context,
// TexSubImage parameters can be NPOT without textureNPOT extension,
// as long as the destination texture is POT.
bool hasNPOTSupport =
context->getExtensions().textureNPOT && context->getClientVersion() >= Version(3, 0);
context->getExtensions().textureNPOT || context->getClientVersion() >= Version(3, 0);
if (!isSubImage && !hasNPOTSupport &&
(level != 0 && (!gl::isPow2(width) || !gl::isPow2(height) || !gl::isPow2(depth))))
{
......
......@@ -361,6 +361,39 @@ TEST_P(WebGLCompatibilityTest, DrawArraysBufferOutOfBoundsNonInstanced)
ASSERT_GL_NO_ERROR();
}
// Tests that NPOT is not enabled by default in WebGL 1 and that it can be enabled
TEST_P(WebGLCompatibilityTest, NPOT)
{
EXPECT_FALSE(extensionEnabled("GL_OES_texture_npot"));
// Create a texture and set an NPOT mip 0, should always be acceptable.
GLTexture texture;
glBindTexture(GL_TEXTURE_2D, texture.get());
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 10, 10, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
ASSERT_GL_NO_ERROR();
// Try setting an NPOT mip 1 and verify the error if WebGL 1
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 5, 5, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
if (getClientMajorVersion() < 3)
{
ASSERT_GL_ERROR(GL_INVALID_VALUE);
}
else
{
ASSERT_GL_NO_ERROR();
}
if (extensionRequestable("GL_OES_texture_npot"))
{
glRequestExtensionANGLE("GL_OES_texture_npot");
ASSERT_GL_NO_ERROR();
// Try again to set NPOT mip 1
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 5, 5, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
ASSERT_GL_NO_ERROR();
}
}
// Test the checks for OOB reads in the vertex buffers, instanced version
TEST_P(WebGL2CompatibilityTest, DrawArraysBufferOutOfBoundsInstanced)
{
......
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