Handle correctly gl.generateMipmap(gl.TEXTURE_CUBE_MAP) in WebGL.
Particularly this conformance test
third_party/webgl_conformance/conformance/textures/texture-size.html
caused Chrome to crash in Debug builds, now passes successfuly.
BUG=166016
Review URL: https://chromiumcodereview.appspot.com/11577014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173116 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 3fc39c6..1c5843e 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -3734,9 +3734,19 @@
return;
}
- if (!texture_manager()->ClearTextureLevel(this, info, target, 0)) {
- SetGLError(GL_OUT_OF_MEMORY, "glGenerateMipmaps", "dimensions too big");
- return;
+ if (target == GL_TEXTURE_CUBE_MAP) {
+ for (int i = 0; i < 6; ++i) {
+ GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i;
+ if (!texture_manager()->ClearTextureLevel(this, info, face, 0)) {
+ SetGLError(GL_OUT_OF_MEMORY, "glGenerateMipmaps", "dimensions too big");
+ return;
+ }
+ }
+ } else {
+ if (!texture_manager()->ClearTextureLevel(this, info, target, 0)) {
+ SetGLError(GL_OUT_OF_MEMORY, "glGenerateMipmaps", "dimensions too big");
+ return;
+ }
}
CopyRealGLErrorsToWrapper();