Commit 83b2f0e8 by James Darpinian Committed by Commit Bot

WebGL: Forbid GenerateMipmap on zero-size textures

This is a WebGL spec change: https://github.com/KhronosGroup/WebGL/commit/bfbe124a7bb92eed34ea7cc18694167ed66b1030 Fixes conformance2/textures/misc/tex-mipmap-levels.html Bug: chromium:898351 Change-Id: Ib20409e10bec598611be273577115a380a63b523 Reviewed-on: https://chromium-review.googlesource.com/c/1352385 Commit-Queue: James Darpinian <jdarpinian@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 3b7c9d09
......@@ -88,6 +88,7 @@ MSG kFramebufferTextureInvalidMipLevel = "Mip level invalid for framebuffer text
MSG kFramebufferTextureLayerIncorrectTextureType = "Texture is not a three-dimensional or two-dimensionsal array texture.";
MSG kGLES1Only = "GLES1-only function.";
MSG kGenerateMipmapNotAllowed = "Texture format does not support mipmap generation.";
MSG kGenerateMipmapZeroSize = "Cannot generate mipmaps for a zero-size texture in a WebGL context.";
MSG kGeometryShaderExtensionNotEnabled = "GL_EXT_geometry_shader extension not enabled.";
MSG kImmutableTextureBound = "The value of TEXTURE_IMMUTABLE_FORMAT for the texture currently bound to target on the active texture unit is true.";
MSG kIncompatibleDrawModeAgainstGeometryShader = "Primitive mode is incompatible with the input primitive type of the geometry shader.";
......
......@@ -6201,6 +6201,14 @@ bool ValidateGenerateMipmap(Context *context, TextureType target)
return false;
}
if (context->getExtensions().webglCompatibility &&
(texture->getWidth(baseTarget, effectiveBaseLevel) == 0 ||
texture->getHeight(baseTarget, effectiveBaseLevel) == 0))
{
context->validationError(GL_INVALID_OPERATION, kGenerateMipmapZeroSize);
return false;
}
return true;
}
......
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