From 3484ce89e35202714647bc10f77ad4331f846a33 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 26 Feb 2014 10:23:18 -0500 Subject: [PATCH] Backed out changesets e4c29a3a002e and 896d64c59638 (bug 975824) for webgl conformance test failures. --- content/canvas/src/WebGLContextGL.cpp | 14 +--- content/canvas/src/WebGLContextValidate.cpp | 82 +++++-------------- .../conformance/extensions/00_test_list.txt | 4 +- 3 files changed, 25 insertions(+), 75 deletions(-) diff --git a/content/canvas/src/WebGLContextGL.cpp b/content/canvas/src/WebGLContextGL.cpp index b9c7ca9c32e..837b794c6ed 100644 --- a/content/canvas/src/WebGLContextGL.cpp +++ b/content/canvas/src/WebGLContextGL.cpp @@ -3342,12 +3342,6 @@ WebGLContext::CompressedTexImage2D(GLenum target, GLint level, GLenum internalfo return; } - if (!ValidateCompTexImageSize(target, level, internalformat, 0, 0, - width, height, width, height, func)) - { - return; - } - MakeContextCurrent(); gl->fCompressedTexImage2D(target, level, internalformat, width, height, border, byteLength, view.Data()); WebGLTexture* tex = activeBoundTextureForTarget(target); @@ -3382,10 +3376,6 @@ WebGLContext::CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, MOZ_ASSERT(tex); WebGLTexture::ImageInfo& levelInfo = tex->ImageInfoAt(target, level); - uint32_t byteLength = view.Length(); - if (!ValidateCompTexImageDataSize(target, format, width, height, byteLength, func)) - return; - if (!ValidateCompTexImageSize(target, level, format, xoffset, yoffset, width, height, @@ -3395,6 +3385,10 @@ WebGLContext::CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, return; } + uint32_t byteLength = view.Length(); + if (!ValidateCompTexImageDataSize(target, format, width, height, byteLength, func)) + return; + if (levelInfo.HasUninitializedImageData()) tex->DoDeferredImageInitialization(target, level); diff --git a/content/canvas/src/WebGLContextValidate.cpp b/content/canvas/src/WebGLContextValidate.cpp index 4df5a582b66..38ab5aac5db 100644 --- a/content/canvas/src/WebGLContextValidate.cpp +++ b/content/canvas/src/WebGLContextValidate.cpp @@ -776,54 +776,26 @@ WebGLContext::ValidateCompTexImageSize(GLenum target, GLint level, GLenum format /* The size must be a multiple of blockWidth and blockHeight, * or must be using offset+size that exactly hits the edge. - * Important for small mipmap levels. + * Important for small mipmap levels. (s3tc extension appears + * to have changed and old code that checks 1x1, 2x2 doesn't + * appear necessary anymore) */ - /* https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/ - * "When level equals zero width and height must be a multiple of 4. When - * level is greater than 0 width and height must be 0, 1, 2 or a multiple of 4. - * If they are not an INVALID_OPERATION error is generated." - */ - if (level == 0) { - if (width % blockWidth != 0) { - ErrorInvalidOperation("%s: width of level 0 must be multple of %d", - InfoFrom(func), blockWidth); - return false; - } - - if (height % blockHeight != 0) { - ErrorInvalidOperation("%s: height of level 0 must be multipel of %d", - InfoFrom(func), blockHeight); - return false; - } - } - else if (level > 0) { - if (width % blockWidth != 0 && width > 2) { - ErrorInvalidOperation("%s: width of level %d must be multiple" - " of %d or 0, 1, 2", - InfoFrom(func), level, blockWidth); - return false; - } - - if (height % blockHeight != 0 && height > 2) { - ErrorInvalidOperation("%s: height of level %d must be multiple" - " of %d or 0, 1, 2", - InfoFrom(func), level, blockHeight); - return false; - } + if ((width % blockWidth != 0) && + (xoffset + width != (GLint) levelWidth)) + { + ErrorInvalidOperation("%s: width must be multiple of %d or " + "xoffset + width must be %d", + InfoFrom(func), blockWidth, levelWidth); + return false; } - if (IsSubFunc(func)) { - if ((xoffset % blockWidth) != 0) { - ErrorInvalidOperation("%s: xoffset must be multiple of %d", - InfoFrom(func), blockWidth); - return false; - } - - if (yoffset % blockHeight != 0) { - ErrorInvalidOperation("%s: yoffset must be multiple of %d", - InfoFrom(func), blockHeight); - return false; - } + if ((height % blockHeight != 0) && + (yoffset + height != (GLint) levelHeight)) + { + ErrorInvalidOperation("%s: height must be multiple of %d or " + "yoffset + height must be %d", + InfoFrom(func), blockHeight, levelHeight); + return false; } } @@ -1181,26 +1153,10 @@ WebGLContext::ValidateTexImageFormatAndType(GLenum format, GLenum type, WebGLTex validCombo = (type == LOCAL_GL_UNSIGNED_INT_24_8); break; - case LOCAL_GL_ATC_RGB: - case LOCAL_GL_ATC_RGBA_EXPLICIT_ALPHA: - case LOCAL_GL_ATC_RGBA_INTERPOLATED_ALPHA: - case LOCAL_GL_COMPRESSED_RGB_PVRTC_2BPPV1: - case LOCAL_GL_COMPRESSED_RGB_PVRTC_4BPPV1: - case LOCAL_GL_COMPRESSED_RGBA_PVRTC_2BPPV1: - case LOCAL_GL_COMPRESSED_RGBA_PVRTC_4BPPV1: - case LOCAL_GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - validCombo = (type == LOCAL_GL_UNSIGNED_BYTE); - break; - default: // Only valid formats should be passed to the switch stmt. - MOZ_ASSERT(false, "Unexpected format and type combo. How'd this happen?"); - validCombo = false; - // Fall through to return an InvalidOperations. This will alert us to the - // unexpected case that needs fixing in builds without asserts. + MOZ_ASSERT("Invalid format"); + return false; } if (!validCombo) diff --git a/content/canvas/test/webgl/conformance/extensions/00_test_list.txt b/content/canvas/test/webgl/conformance/extensions/00_test_list.txt index a3b72b33e36..43f2224bb7e 100644 --- a/content/canvas/test/webgl/conformance/extensions/00_test_list.txt +++ b/content/canvas/test/webgl/conformance/extensions/00_test_list.txt @@ -4,6 +4,6 @@ oes-texture-float.html oes-vertex-array-object.html webgl-debug-renderer-info.html webgl-debug-shaders.html -webgl-compressed-texture-s3tc.html -webgl-depth-texture.html +--min-version 1.0.2 webgl-compressed-texture-s3tc.html +--min-version 1.0.2 webgl-depth-texture.html ext-sRGB.html