Commit baadf23a by Geoff Lang

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/210884Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent eb10f1c8
...@@ -222,7 +222,7 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, GLenum inter ...@@ -222,7 +222,7 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, GLenum inter
{ {
// Note: dEQP 2013.4 expects an INVALID_VALUE error for TexImage3D with an invalid // Note: dEQP 2013.4 expects an INVALID_VALUE error for TexImage3D with an invalid
// internal format. (dEQP-GLES3.functional.negative_api.texture.teximage3d) // 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())) if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{ {
return gl::error(GL_INVALID_ENUM, false); return gl::error(GL_INVALID_ENUM, false);
...@@ -239,14 +239,20 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, GLenum inter ...@@ -239,14 +239,20 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, GLenum inter
{ {
const gl::InternalFormat &info = gl::GetInternalFormatInfo(i->internalFormat); const gl::InternalFormat &info = gl::GetInternalFormatInfo(i->internalFormat);
bool supported = info.textureSupport(context->getClientVersion(), context->getExtensions()); bool supported = info.textureSupport(context->getClientVersion(), context->getExtensions());
if (supported && formatInfo.type == type) if (supported && i->type == type)
{ {
typeSupported = true; typeSupported = true;
} }
if (supported && formatInfo.format == format) if (supported && i->format == format)
{ {
formatSupported = true; formatSupported = true;
} }
// Early-out if both type and format are supported now
if (typeSupported && formatSupported)
{
break;
}
} }
} }
...@@ -439,7 +445,7 @@ bool ValidateES3TexImageParameters(gl::Context *context, GLenum target, GLint le ...@@ -439,7 +445,7 @@ bool ValidateES3TexImageParameters(gl::Context *context, GLenum target, GLint le
} }
else else
{ {
if (!ValidateTexImageFormatCombination(context, internalformat, format, type)) if (!ValidateTexImageFormatCombination(context, actualInternalFormat, format, type))
{ {
return false; return false;
} }
......
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