From ea04ebebca561c57a102967b5f6e0189226f001a Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Wed, 3 Feb 2016 12:27:50 -0800 Subject: [PATCH] Bug 1233046 - Fix OES_texture_float on Mac and add tests for extensions. - r=jrmuizel --- dom/canvas/WebGLContext.cpp | 5 +- dom/canvas/WebGLContext.h | 3 +- dom/canvas/WebGLContextGL.cpp | 4 + dom/canvas/WebGLContextState.cpp | 138 +++++++++++++++--- dom/canvas/WebGLExtensionTextureFloat.cpp | 27 ++-- dom/canvas/WebGLExtensionTextureHalfFloat.cpp | 27 ++-- dom/canvas/moz.build | 2 +- dom/canvas/test/webgl-mochitest.ini | 41 ++++++ .../webgl-mochitest/ensure-exts/ensure-ext.js | 32 ++++ .../test_ANGLE_instanced_arrays.html | 17 +++ .../ensure-exts/test_EXT_blend_minmax.html | 17 +++ .../test_EXT_color_buffer_half_float.html | 17 +++ .../test_EXT_disjoint_timer_query.html | 17 +++ .../ensure-exts/test_EXT_frag_depth.html | 17 +++ .../ensure-exts/test_EXT_sRGB.html | 17 +++ .../test_EXT_shader_texture_lod.html | 17 +++ .../test_EXT_texture_filter_anisotropic.html | 17 +++ .../test_OES_standard_derivatives.html | 17 +++ .../test_WEBGL_color_buffer_float.html | 17 +++ .../test_WEBGL_compressed_texture_atc.html | 17 +++ .../test_WEBGL_compressed_texture_es3.html | 17 +++ .../test_WEBGL_compressed_texture_etc1.html | 17 +++ .../test_WEBGL_compressed_texture_pvrtc.html | 17 +++ .../test_WEBGL_compressed_texture_s3tc.html | 17 +++ .../ensure-exts/test_WEBGL_depth_texture.html | 17 +++ .../ensure-exts/test_WEBGL_draw_buffers.html | 17 +++ .../ensure-exts/test_common.html | 75 ++++++++++ .../test/webgl-mochitest/mochi-to-testcase.py | 7 +- 28 files changed, 600 insertions(+), 50 deletions(-) create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/ensure-ext.js create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_ANGLE_instanced_arrays.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_blend_minmax.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_color_buffer_half_float.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_disjoint_timer_query.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_frag_depth.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_sRGB.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_shader_texture_lod.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_filter_anisotropic.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_standard_derivatives.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_color_buffer_float.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_atc.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_es3.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc1.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_pvrtc.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_s3tc.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_depth_texture.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_draw_buffers.html create mode 100644 dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index 2d1989def2d3..5bb46165e195 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -1304,8 +1304,7 @@ WebGLContext::ClearScreen() const bool changeDrawBuffers = (mDefaultFB_DrawBuffer0 != LOCAL_GL_BACK); if (changeDrawBuffers) { - const GLenum back = LOCAL_GL_BACK; - gl->fDrawBuffers(1, &back); + gl->Screen()->SetDrawBuffer(LOCAL_GL_BACK); } GLbitfield bufferBits = LOCAL_GL_COLOR_BUFFER_BIT; @@ -1317,7 +1316,7 @@ WebGLContext::ClearScreen() ForceClearFramebufferWithDefaultValues(bufferBits, mNeedsFakeNoAlpha); if (changeDrawBuffers) { - gl->fDrawBuffers(1, &mDefaultFB_DrawBuffer0); + gl->Screen()->SetDrawBuffer(mDefaultFB_DrawBuffer0); } } diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h index a7eeba956f27..dafbe702306f 100644 --- a/dom/canvas/WebGLContext.h +++ b/dom/canvas/WebGLContext.h @@ -827,7 +827,8 @@ protected: public: void Disable(GLenum cap); void Enable(GLenum cap); - bool GetStencilBits(GLint* out_stencilBits); + bool GetStencilBits(GLint* const out_stencilBits); + bool GetChannelBits(const char* funcName, GLenum pname, GLint* const out_val); virtual JS::Value GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv); void GetParameter(JSContext* cx, GLenum pname, diff --git a/dom/canvas/WebGLContextGL.cpp b/dom/canvas/WebGLContextGL.cpp index ef3716142ae8..34543116fea2 100644 --- a/dom/canvas/WebGLContextGL.cpp +++ b/dom/canvas/WebGLContextGL.cpp @@ -994,6 +994,10 @@ WebGLContext::Hint(GLenum target, GLenum mode) switch (target) { case LOCAL_GL_GENERATE_MIPMAP_HINT: + // Deprecated and removed in desktop GL Core profiles. + if (gl->IsCoreProfile()) + return; + isValid = true; break; diff --git a/dom/canvas/WebGLContextState.cpp b/dom/canvas/WebGLContextState.cpp index 8f3563a0dcf2..ea818e4004f1 100644 --- a/dom/canvas/WebGLContextState.cpp +++ b/dom/canvas/WebGLContextState.cpp @@ -73,7 +73,7 @@ StringValue(JSContext* cx, const nsAString& str, ErrorResult& rv) } bool -WebGLContext::GetStencilBits(GLint* out_stencilBits) +WebGLContext::GetStencilBits(GLint* const out_stencilBits) { *out_stencilBits = 0; if (mBoundDrawFramebuffer) { @@ -97,9 +97,107 @@ WebGLContext::GetStencilBits(GLint* out_stencilBits) return true; } +bool +WebGLContext::GetChannelBits(const char* funcName, GLenum pname, GLint* const out_val) +{ + if (mBoundDrawFramebuffer) { + if (!mBoundDrawFramebuffer->ValidateAndInitAttachments(funcName)) + return false; + } + + if (!mBoundDrawFramebuffer) { + switch (pname) { + case LOCAL_GL_RED_BITS: + case LOCAL_GL_GREEN_BITS: + case LOCAL_GL_BLUE_BITS: + *out_val = 8; + break; + + case LOCAL_GL_ALPHA_BITS: + *out_val = (mOptions.alpha ? 8 : 0); + break; + + case LOCAL_GL_DEPTH_BITS: + if (mOptions.depth) { + const auto& glFormats = gl->GetGLFormats(); + + GLenum depthFormat = glFormats.depth; + if (mOptions.stencil && glFormats.depthStencil) { + depthFormat = glFormats.depthStencil; + } + + if (depthFormat == LOCAL_GL_DEPTH_COMPONENT16) { + *out_val = 16; + } else { + *out_val = 24; + } + } else { + *out_val = 0; + } + break; + + case LOCAL_GL_STENCIL_BITS: + *out_val = (mOptions.stencil ? 8 : 0); + break; + + default: + MOZ_CRASH("bad pname"); + } + return true; + } + + if (!gl->IsCoreProfile()) { + gl->fGetIntegerv(pname, out_val); + return true; + } + + GLenum fbAttachment = 0; + GLenum fbPName = 0; + switch (pname) { + case LOCAL_GL_RED_BITS: + fbAttachment = LOCAL_GL_COLOR_ATTACHMENT0; + fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE; + break; + + case LOCAL_GL_GREEN_BITS: + fbAttachment = LOCAL_GL_COLOR_ATTACHMENT0; + fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE; + break; + + case LOCAL_GL_BLUE_BITS: + fbAttachment = LOCAL_GL_COLOR_ATTACHMENT0; + fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE; + break; + + case LOCAL_GL_ALPHA_BITS: + fbAttachment = LOCAL_GL_COLOR_ATTACHMENT0; + fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE; + break; + + case LOCAL_GL_DEPTH_BITS: + fbAttachment = LOCAL_GL_DEPTH_ATTACHMENT; + fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE; + break; + + case LOCAL_GL_STENCIL_BITS: + fbAttachment = LOCAL_GL_STENCIL_ATTACHMENT; + fbPName = LOCAL_GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE; + break; + + default: + MOZ_CRASH("bad pname"); + } + + gl->fGetFramebufferAttachmentParameteriv(LOCAL_GL_DRAW_FRAMEBUFFER, fbAttachment, + fbPName, out_val); + return true; +} + JS::Value WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) { + const char funcName[] = "getParameter"; + if (IsContextLost()) return JS::NullValue(); @@ -356,11 +454,7 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) return JS::Int32Value(refValue & stencilMask); } - case LOCAL_GL_STENCIL_BITS: { - GLint stencilBits = 0; - GetStencilBits(&stencilBits); - return JS::Int32Value(stencilBits); - } + case LOCAL_GL_STENCIL_CLEAR_VALUE: case LOCAL_GL_UNPACK_ALIGNMENT: case LOCAL_GL_PACK_ALIGNMENT: @@ -370,28 +464,26 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) case LOCAL_GL_MAX_VERTEX_ATTRIBS: case LOCAL_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: case LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: - case LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS: - case LOCAL_GL_RED_BITS: - case LOCAL_GL_GREEN_BITS: - case LOCAL_GL_BLUE_BITS: { + case LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS: { GLint i = 0; gl->fGetIntegerv(pname, &i); return JS::Int32Value(i); } - case LOCAL_GL_DEPTH_BITS: { - GLint i = 0; - if (!mNeedsFakeNoDepth) { - gl->fGetIntegerv(pname, &i); - } - return JS::Int32Value(i); - } - case LOCAL_GL_ALPHA_BITS: { - GLint i = 0; - if (!mNeedsFakeNoAlpha) { - gl->fGetIntegerv(pname, &i); - } - return JS::Int32Value(i); + + case LOCAL_GL_RED_BITS: + case LOCAL_GL_GREEN_BITS: + case LOCAL_GL_BLUE_BITS: + case LOCAL_GL_ALPHA_BITS: + case LOCAL_GL_DEPTH_BITS: + case LOCAL_GL_STENCIL_BITS: { + // Deprecated and removed in GL Core profiles, so special handling required. + GLint val; + if (!GetChannelBits(funcName, pname, &val)) + return JS::NullValue(); + + return JS::Int32Value(val); } + case LOCAL_GL_MAX_TEXTURE_SIZE: return JS::Int32Value(mImplMaxTextureSize); diff --git a/dom/canvas/WebGLExtensionTextureFloat.cpp b/dom/canvas/WebGLExtensionTextureFloat.cpp index a7a58939ad1f..4568e994ee9d 100644 --- a/dom/canvas/WebGLExtensionTextureFloat.cpp +++ b/dom/canvas/WebGLExtensionTextureFloat.cpp @@ -32,15 +32,17 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl) fua->AllowUnsizedTexFormat(pi, usage); }; - const bool needSizedInternal = !gl->IsGLES(); - MOZ_ASSERT_IF(needSizedInternal, gl->IsSupported(gl::GLFeature::texture_swizzle)); + const bool needsSwizzle = gl->IsCoreProfile(); + MOZ_ASSERT_IF(needsSwizzle, gl->IsSupported(gl::GLFeature::texture_swizzle)); + + const bool needsSizedFormat = !gl->IsGLES(); //////////////// pi = {LOCAL_GL_RGBA, LOCAL_GL_FLOAT}; dui = {pi.format, pi.format, pi.type}; swizzle = nullptr; - if (needSizedInternal) { + if (needsSizedFormat) { dui.internalFormat = LOCAL_GL_RGBA32F; } fnAdd(webgl::EffectiveFormat::RGBA32F); @@ -50,7 +52,7 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl) pi = {LOCAL_GL_RGB, LOCAL_GL_FLOAT}; dui = {pi.format, pi.format, pi.type}; swizzle = nullptr; - if (needSizedInternal) { + if (needsSizedFormat) { dui.internalFormat = LOCAL_GL_RGB32F; } fnAdd(webgl::EffectiveFormat::RGB32F); @@ -60,9 +62,11 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl) pi = {LOCAL_GL_LUMINANCE, LOCAL_GL_FLOAT}; dui = {pi.format, pi.format, pi.type}; swizzle = nullptr; - if (needSizedInternal) { + if (needsSwizzle) { dui = {LOCAL_GL_R32F, LOCAL_GL_RED, LOCAL_GL_FLOAT}; swizzle = webgl::FormatUsageInfo::kLuminanceSwizzleRGBA; + } else if (needsSizedFormat) { + dui.internalFormat = LOCAL_GL_LUMINANCE32F_ARB; } fnAdd(webgl::EffectiveFormat::Luminance32F); @@ -71,9 +75,11 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl) pi = {LOCAL_GL_ALPHA, LOCAL_GL_FLOAT}; dui = {pi.format, pi.format, pi.type}; swizzle = nullptr; - if (needSizedInternal) { + if (needsSwizzle) { dui = {LOCAL_GL_R32F, LOCAL_GL_RED, LOCAL_GL_FLOAT}; swizzle = webgl::FormatUsageInfo::kAlphaSwizzleRGBA; + } else if (needsSizedFormat) { + dui.internalFormat = LOCAL_GL_ALPHA32F_ARB; } fnAdd(webgl::EffectiveFormat::Alpha32F); @@ -82,9 +88,11 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl) pi = {LOCAL_GL_LUMINANCE_ALPHA, LOCAL_GL_FLOAT}; dui = {pi.format, pi.format, pi.type}; swizzle = nullptr; - if (needSizedInternal) { + if (needsSwizzle) { dui = {LOCAL_GL_RG32F, LOCAL_GL_RG, LOCAL_GL_FLOAT}; swizzle = webgl::FormatUsageInfo::kLumAlphaSwizzleRGBA; + } else if (needsSizedFormat) { + dui.internalFormat = LOCAL_GL_LUMINANCE_ALPHA32F_ARB; } fnAdd(webgl::EffectiveFormat::Luminance32FAlpha32F); } @@ -101,10 +109,9 @@ WebGLExtensionTextureFloat::IsSupported(const WebGLContext* webgl) if (!gl->IsSupported(gl::GLFeature::texture_float)) return false; - const bool needSizedInternal = !gl->IsGLES(); + const bool needsSwizzle = gl->IsCoreProfile(); const bool hasSwizzle = gl->IsSupported(gl::GLFeature::texture_swizzle); - - if (needSizedInternal && !hasSwizzle) + if (needsSwizzle && !hasSwizzle) return false; return true; diff --git a/dom/canvas/WebGLExtensionTextureHalfFloat.cpp b/dom/canvas/WebGLExtensionTextureHalfFloat.cpp index a5770999d67c..e59f9b232ee9 100644 --- a/dom/canvas/WebGLExtensionTextureHalfFloat.cpp +++ b/dom/canvas/WebGLExtensionTextureHalfFloat.cpp @@ -30,8 +30,10 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(WebGLContext* web fua->AllowUnsizedTexFormat(pi, usage); }; - const bool needSizedInternal = !gl->IsGLES(); - MOZ_ASSERT_IF(needSizedInternal, gl->IsSupported(gl::GLFeature::texture_swizzle)); + const bool needsSwizzle = gl->IsCoreProfile(); + MOZ_ASSERT_IF(needsSwizzle, gl->IsSupported(gl::GLFeature::texture_swizzle)); + + const bool needsSizedFormat = !gl->IsGLES(); GLenum driverUnpackType = LOCAL_GL_HALF_FLOAT; if (!gl->IsSupported(gl::GLFeature::texture_half_float)) { @@ -44,7 +46,7 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(WebGLContext* web pi = {LOCAL_GL_RGBA, LOCAL_GL_HALF_FLOAT_OES}; dui = {pi.format, pi.format, driverUnpackType}; swizzle = nullptr; - if (needSizedInternal) { + if (needsSizedFormat) { dui.internalFormat = LOCAL_GL_RGBA16F; } fnAdd(webgl::EffectiveFormat::RGBA16F); @@ -54,7 +56,7 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(WebGLContext* web pi = {LOCAL_GL_RGB, LOCAL_GL_HALF_FLOAT_OES}; dui = {pi.format, pi.format, driverUnpackType}; swizzle = nullptr; - if (needSizedInternal) { + if (needsSizedFormat) { dui.internalFormat = LOCAL_GL_RGB16F; } fnAdd(webgl::EffectiveFormat::RGB16F); @@ -64,9 +66,11 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(WebGLContext* web pi = {LOCAL_GL_LUMINANCE, LOCAL_GL_HALF_FLOAT_OES}; dui = {pi.format, pi.format, driverUnpackType}; swizzle = nullptr; - if (needSizedInternal) { + if (needsSwizzle) { dui = {LOCAL_GL_R16F, LOCAL_GL_RED, driverUnpackType}; swizzle = webgl::FormatUsageInfo::kLuminanceSwizzleRGBA; + } else if (needsSizedFormat) { + dui.internalFormat = LOCAL_GL_LUMINANCE16F_ARB; } fnAdd(webgl::EffectiveFormat::Luminance16F); @@ -75,9 +79,11 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(WebGLContext* web pi = {LOCAL_GL_ALPHA, LOCAL_GL_HALF_FLOAT_OES}; dui = {pi.format, pi.format, driverUnpackType}; swizzle = nullptr; - if (needSizedInternal) { + if (needsSwizzle) { dui = {LOCAL_GL_R16F, LOCAL_GL_RED, driverUnpackType}; swizzle = webgl::FormatUsageInfo::kAlphaSwizzleRGBA; + } else if (needsSizedFormat) { + dui.internalFormat = LOCAL_GL_ALPHA16F_ARB; } fnAdd(webgl::EffectiveFormat::Alpha16F); @@ -86,9 +92,11 @@ WebGLExtensionTextureHalfFloat::WebGLExtensionTextureHalfFloat(WebGLContext* web pi = {LOCAL_GL_LUMINANCE_ALPHA, LOCAL_GL_HALF_FLOAT_OES}; dui = {pi.format, pi.format, driverUnpackType}; swizzle = nullptr; - if (needSizedInternal) { + if (needsSwizzle) { dui = {LOCAL_GL_RG16F, LOCAL_GL_RG, driverUnpackType}; swizzle = webgl::FormatUsageInfo::kLumAlphaSwizzleRGBA; + } else if (needsSizedFormat) { + dui.internalFormat = LOCAL_GL_LUMINANCE_ALPHA16F_ARB; } fnAdd(webgl::EffectiveFormat::Luminance16FAlpha16F); } @@ -108,10 +116,9 @@ WebGLExtensionTextureHalfFloat::IsSupported(const WebGLContext* webgl) return false; } - const bool needSizedInternal = !gl->IsGLES(); + const bool needsSwizzle = gl->IsCoreProfile(); const bool hasSwizzle = gl->IsSupported(gl::GLFeature::texture_swizzle); - - if (needSizedInternal && !hasSwizzle) + if (needsSwizzle && !hasSwizzle) return false; return true; diff --git a/dom/canvas/moz.build b/dom/canvas/moz.build index ffa942025cea..3bb346817521 100644 --- a/dom/canvas/moz.build +++ b/dom/canvas/moz.build @@ -7,7 +7,7 @@ TEST_DIRS += ['compiledtest'] # Number changes to this file to avoid bug 1081323 (clobber after changing a manifest): -# 3 +# 4 MOCHITEST_MANIFESTS += [ 'test/crossorigin/mochitest.ini', diff --git a/dom/canvas/test/webgl-mochitest.ini b/dom/canvas/test/webgl-mochitest.ini index d6cd17dd6b4e..2fe2009587ca 100644 --- a/dom/canvas/test/webgl-mochitest.ini +++ b/dom/canvas/test/webgl-mochitest.ini @@ -3,10 +3,51 @@ subsuite = webgl skip-if = ((os == 'linux') && (buildapp == 'b2g')) support-files = + webgl-mochitest/ensure-exts/ensure-ext.js webgl-mochitest/driver-info.js webgl-mochitest/es3-data.js webgl-mochitest/webgl-util.js +[webgl-mochitest/ensure-exts/test_ANGLE_instanced_arrays.html] +fail-if = (os == 'android') || (os == 'mac') +[webgl-mochitest/ensure-exts/test_EXT_blend_minmax.html] +fail-if = (os == 'android') +[webgl-mochitest/ensure-exts/test_EXT_color_buffer_half_float.html] +fail-if = (os == 'android') +[webgl-mochitest/ensure-exts/test_EXT_disjoint_timer_query.html] +fail-if = (os == 'android') || (os == 'linux') || (os == 'mac') || (os == 'win') +[webgl-mochitest/ensure-exts/test_EXT_frag_depth.html] +fail-if = (os == 'android') +[webgl-mochitest/ensure-exts/test_EXT_sRGB.html] +fail-if = (os == 'android') || (os == 'linux') || (os == 'mac') || (os == 'win') +[webgl-mochitest/ensure-exts/test_EXT_shader_texture_lod.html] +fail-if = (os == 'android') || (os == 'linux') || (os == 'mac') +[webgl-mochitest/ensure-exts/test_EXT_texture_filter_anisotropic.html] +fail-if = (os == 'android') || (os == 'linux') +[webgl-mochitest/ensure-exts/test_OES_standard_derivatives.html] +fail-if = (os == 'android') +[webgl-mochitest/ensure-exts/test_WEBGL_color_buffer_float.html] +fail-if = (os == 'android') +[webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_atc.html] +fail-if = (os == 'android') || (os == 'linux') || (os == 'mac') || (os == 'win') +[webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_es3.html] +fail-if = (os == 'android') || (os == 'linux') || (os == 'mac') || (os == 'win') +[webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc1.html] +# Win7 is 6.1 +fail-if = (os == 'linux') || (os == 'mac') || (os == 'win' && os_version == '6.1') +[webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_pvrtc.html] +fail-if = (os == 'android') || (os == 'linux') || (os == 'mac') || (os == 'win') +[webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_s3tc.html] +fail-if = (os == 'android') || (os == 'linux') +[webgl-mochitest/ensure-exts/test_WEBGL_depth_texture.html] +fail-if = (os == 'mac') +[webgl-mochitest/ensure-exts/test_WEBGL_draw_buffers.html] +# Win7 is 6.1 +fail-if = (os == 'android') || (os == 'win' && os_version == '6.1') + +[webgl-mochitest/ensure-exts/test_common.html] + + [webgl-mochitest/test_backbuffer_channels.html] fail-if = (os == 'b2g') [webgl-mochitest/test_depth_readpixels.html] diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/ensure-ext.js b/dom/canvas/test/webgl-mochitest/ensure-exts/ensure-ext.js new file mode 100644 index 000000000000..798067d5e423 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/ensure-ext.js @@ -0,0 +1,32 @@ +'use strict'; + +function EnsureExt(name, shouldBe = true) { + var c = document.createElement('canvas'); + var gl = c.getContext('experimental-webgl'); + + if (shouldBe) { + ok(gl.getExtension(name), 'Should have extension ' + name + '.'); + } else { + ok(!gl.getExtension(name), 'Should not have extension ' + name + '.'); + } +} + +function EnsureDraftExt(name, shouldBe = true) { + SimpleTest.waitForExplicitFinish(); + + var fnEnsure = function() { + EnsureExt(name, shouldBe); + SimpleTest.finish(); + }; + + if ('SpecialPowers' in window) { + var prefStateList = [ + ['webgl.enable-draft-extensions', true], + ]; + var prefEnv = {'set': prefStateList}; + SpecialPowers.pushPrefEnv(prefEnv, fnEnsure); + } else { + console.log('Couldn\'t use SpecialPowers to enable draft extensions.'); + fnEnsure(); + } +} diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_ANGLE_instanced_arrays.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_ANGLE_instanced_arrays.html new file mode 100644 index 000000000000..04b24d90c109 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_ANGLE_instanced_arrays.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_blend_minmax.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_blend_minmax.html new file mode 100644 index 000000000000..903269e6b663 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_blend_minmax.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_color_buffer_half_float.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_color_buffer_half_float.html new file mode 100644 index 000000000000..3ac21299c686 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_color_buffer_half_float.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_disjoint_timer_query.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_disjoint_timer_query.html new file mode 100644 index 000000000000..e0b90adbbb5b --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_disjoint_timer_query.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_frag_depth.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_frag_depth.html new file mode 100644 index 000000000000..3c7f38679178 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_frag_depth.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_sRGB.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_sRGB.html new file mode 100644 index 000000000000..da5aa0a3fbfb --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_sRGB.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_shader_texture_lod.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_shader_texture_lod.html new file mode 100644 index 000000000000..e64ff94848c5 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_shader_texture_lod.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_filter_anisotropic.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_filter_anisotropic.html new file mode 100644 index 000000000000..877c4440bf30 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_filter_anisotropic.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_standard_derivatives.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_standard_derivatives.html new file mode 100644 index 000000000000..3e7b7a396226 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_standard_derivatives.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_color_buffer_float.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_color_buffer_float.html new file mode 100644 index 000000000000..aeb8f271ea05 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_color_buffer_float.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_atc.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_atc.html new file mode 100644 index 000000000000..6d68f0b4e2b2 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_atc.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_es3.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_es3.html new file mode 100644 index 000000000000..21c824ad8546 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_es3.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc1.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc1.html new file mode 100644 index 000000000000..327625c01848 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc1.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_pvrtc.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_pvrtc.html new file mode 100644 index 000000000000..c95481398421 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_pvrtc.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_s3tc.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_s3tc.html new file mode 100644 index 000000000000..6ad800110648 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_s3tc.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_depth_texture.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_depth_texture.html new file mode 100644 index 000000000000..957171c160e3 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_depth_texture.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_draw_buffers.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_draw_buffers.html new file mode 100644 index 000000000000..18774d0d68a0 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_draw_buffers.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html new file mode 100644 index 000000000000..3b5907a8a886 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html @@ -0,0 +1,75 @@ + + + + + + + + + + + diff --git a/dom/canvas/test/webgl-mochitest/mochi-to-testcase.py b/dom/canvas/test/webgl-mochitest/mochi-to-testcase.py index bac482c3d739..919ba232804f 100644 --- a/dom/canvas/test/webgl-mochitest/mochi-to-testcase.py +++ b/dom/canvas/test/webgl-mochitest/mochi-to-testcase.py @@ -28,7 +28,8 @@ def ReadLocalFile(include): return data -kSimpleTestReplacement = '''\n +kSimpleTestReplacement = ''' +
-\n''' + +''' fin = open(mochiPath, 'rb') fout = open(testPath, 'wb')