Commit cbb8412a by Geoff Lang

Fix validation of LUMA formats in glGenerateMipmap.

BUG=angle:673 Change-Id: I6c106962d8a50ed8f69d208c537166a30e4f92c6 Reviewed-on: https://chromium-review.googlesource.com/203292Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 6195ef87
......@@ -1996,17 +1996,22 @@ void __stdcall glGenerateMipmap(GLenum target)
}
GLenum internalFormat = texture->getBaseLevelInternalFormat();
// Internally, all texture formats are sized so checking if the format
// is color renderable and filterable will not fail.
const gl::TextureCaps &formatCaps = context->getCaps().textureCaps.get(internalFormat);
bool validRenderable = (formatCaps.colorRendering ||
gl::IsSizedInternalFormat(internalFormat, context->getClientVersion()));
if (formatCaps.depthRendering || gl::IsFormatCompressed(internalFormat, context->getClientVersion()) ||
!formatCaps.filtering || !validRenderable)
// GenerateMipmap should not generate an INVALID_OPERATION for textures created with
// unsized formats or that are color renderable and filterable. Since we do not track if
// the texture was created with sized or unsized format (only sized formats are stored),
// it is not possible to make sure the the LUMA formats can generate mipmaps (they should
// be able to) because they aren't color renderable. Simply do a special case for LUMA
// textures since they're the only texture format that can be created with unsized formats
// that is not color renderable. New unsized formats are unlikely to be added, since ES2
// was the last version to use add them.
bool isLUMA = internalFormat == GL_LUMINANCE8_EXT ||
internalFormat == GL_LUMINANCE8_ALPHA8_EXT ||
internalFormat == GL_ALPHA8_EXT;
if (formatCaps.depthRendering || !formatCaps.filtering || (!formatCaps.colorRendering && !isLUMA) ||
gl::IsFormatCompressed(internalFormat, context->getClientVersion()))
{
return gl::error(GL_INVALID_OPERATION);
}
......
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