Fix incorrect validation of ES3 internal format/format/type combinations.
* Fix wrong internal format being passed to ValidateTexImageFormatCombination.
* Fix ValidateTexImageFormatCombination validating the format instead of
internal format for general support.
* Fix support checks for format and type comparing with wrong format and
type fields.
* Add an early-out in format and type check loop to reduce iterations.
BUG=angle:658
Change-Id: I05e1b9f58b2e5ac4b5e1c0fa5a45cf37fb6a4ccd
Reviewed-on: https://chromium-review.googlesource.com/210884
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/validationES3.cpp b/src/libGLESv2/validationES3.cpp
index 6c71003..66c41e6 100644
--- a/src/libGLESv2/validationES3.cpp
+++ b/src/libGLESv2/validationES3.cpp
@@ -222,7 +222,7 @@
{
// Note: dEQP 2013.4 expects an INVALID_VALUE error for TexImage3D with an invalid
// internal format. (dEQP-GLES3.functional.negative_api.texture.teximage3d)
- const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format);
+ const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat);
if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{
return gl::error(GL_INVALID_ENUM, false);
@@ -239,14 +239,20 @@
{
const gl::InternalFormat &info = gl::GetInternalFormatInfo(i->internalFormat);
bool supported = info.textureSupport(context->getClientVersion(), context->getExtensions());
- if (supported && formatInfo.type == type)
+ if (supported && i->type == type)
{
typeSupported = true;
}
- if (supported && formatInfo.format == format)
+ if (supported && i->format == format)
{
formatSupported = true;
}
+
+ // Early-out if both type and format are supported now
+ if (typeSupported && formatSupported)
+ {
+ break;
+ }
}
}
@@ -439,7 +445,7 @@
}
else
{
- if (!ValidateTexImageFormatCombination(context, internalformat, format, type))
+ if (!ValidateTexImageFormatCombination(context, actualInternalFormat, format, type))
{
return false;
}