diff --git a/dom/canvas/WebGLContextExtensions.cpp b/dom/canvas/WebGLContextExtensions.cpp
index 257e5f01b59..c620e6beefe 100644
--- a/dom/canvas/WebGLContextExtensions.cpp
+++ b/dom/canvas/WebGLContextExtensions.cpp
@@ -116,7 +116,7 @@ WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
case WebGLExtensionID::EXT_frag_depth:
return WebGLExtensionFragDepth::IsSupported(this);
case WebGLExtensionID::EXT_shader_texture_lod:
- return gl->IsSupported(gl::GLFeature::shader_texture_lod);
+ return gl->IsExtensionSupported(gl::GLContext::EXT_shader_texture_lod);
case WebGLExtensionID::EXT_sRGB:
return WebGLExtensionSRGB::IsSupported(this);
case WebGLExtensionID::EXT_texture_filter_anisotropic:
diff --git a/dom/canvas/test/webgl-conformance/conformance/extensions/ext-shader-texture-lod.html b/dom/canvas/test/webgl-conformance/conformance/extensions/ext-shader-texture-lod.html
index 4600dea6244..e53e3527031 100644
--- a/dom/canvas/test/webgl-conformance/conformance/extensions/ext-shader-texture-lod.html
+++ b/dom/canvas/test/webgl-conformance/conformance/extensions/ext-shader-texture-lod.html
@@ -1,55 +1,32 @@
-
+
WebGL EXT_shader_texture_lod Conformance Tests
-
+
+
-
-
+
-
+
@@ -119,50 +96,37 @@ debug("");
var wtu = WebGLTestUtils;
var canvas = document.getElementById("canvas");
+
+shouldBe("canvas.width", "256");
+shouldBe("canvas.height", "256");
+
var gl = wtu.create3DContext(canvas);
var ext = null;
-// Run all tests once.
-runAllTests();
+if (!gl) {
+ testFailed("WebGL context does not exist");
+} else {
+ testPassed("WebGL context exists");
-// Run all tests against with a new context to test for any cache issues.
-debug("");
-debug("Testing new context to catch cache errors");
-var canvas2 = document.getElementById("canvas2");
-gl = wtu.create3DContext(canvas2);
-ext = null;
-runAllTests();
+ // Run tests with extension disabled
+ runShaderTests(false);
-function runAllTests() {
- if (!gl) {
- testFailed("WebGL context does not exist");
+ // Query the extension and store globally so shouldBe can access it
+ ext = gl.getExtension("EXT_shader_texture_lod");
+ if (!ext) {
+ testPassed("No EXT_shader_texture_lod support -- this is legal");
+
+ runSupportedTest(false);
} else {
- testPassed("WebGL context exists");
+ testPassed("Successfully enabled EXT_shader_texture_lod extension");
- // Run tests with extension disabled
- runShaderTests(false);
+ runSupportedTest(true);
- // Query the extension and store globally so shouldBe can access it
- ext = gl.getExtension("EXT_shader_texture_lod");
- if (!ext) {
- testPassed("No EXT_shader_texture_lod support -- this is legal");
-
- runSupportedTest(false);
- } else {
- testPassed("Successfully enabled EXT_shader_texture_lod extension");
-
- runSupportedTest(true);
-
- runShaderTests(true);
- runOutputTests();
- runUniqueObjectTest();
- runReferenceCycleTest();
-
- // Run deferred link tests.
- runDeferredLinkTests();
- }
+ runShaderTests(true);
+ runOutputTests();
+ runUniqueObjectTest();
+ runReferenceCycleTest();
}
-
}
function runSupportedTest(extensionEnabled) {
@@ -229,56 +193,63 @@ function runShaderTests(extensionEnabled) {
}
function runOutputTests() {
- debug("");
debug("Testing various draws for valid built-in function behavior");
+
+ canvas.width = 256; canvas.height = 256;
gl.viewport(0, 0, canvas.width, canvas.height);
var program = wtu.setupProgram(gl, ["outputVertexShader", "outputFragmentShader"], ['vPosition', 'texCoord0'], [0, 1]);
var quadParameters = wtu.setupUnitQuad(gl, 0, 1);
var colors = [
- {name: 'red', color:[255, 0, 0, 255]},
- {name: 'green', color:[0, 255, 0, 255]},
- {name: 'blue', color:[0, 0, 255, 255]},
- {name: 'yellow', color:[255, 255, 0, 255]},
- {name: 'magenta', color:[255, 0, 255, 255]},
- {name: 'cyan', color:[0, 255, 255, 255]},
- {name: 'pink', color:[255, 128, 128, 255]},
- {name: 'gray', color:[128, 128, 128, 255]},
- {name: 'light green', color:[128, 255, 128, 255]},
+ {name: 'red', color:[255, 0, 0, 255]},
+ {name: 'green', color:[0, 255, 0, 255]},
+ {name: 'blue', color:[0, 0, 255, 255]},
+ {name: 'yellow', color:[255, 255, 0, 255]},
+ {name: 'magenta', color:[255, 0, 255, 255]},
+ {name: 'cyan', color:[0, 255, 255, 255]},
+ {name: 'pink', color:[255, 128, 128, 255]},
+ {name: 'gray', color:[128, 128, 128, 255]},
+ {name: 'light green', color:[128, 255, 128, 255]},
];
+ if (colors.length != 9) {
+ testFailed("9 colors are needed (9 mips for 256x256 texture), only have " + colors.length);
+ } else {
+ testPassed("9 colors found (9 mips for 256x256 texture)");
+ }
+
var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_LINEAR);
+ gl.texParameteri(
+ gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);
for (var ii = 0; ii < colors.length; ++ii) {
- var color = colors[ii];
- var size = Math.pow(2, colors.length - ii - 1);
- wtu.fillTexture(gl, tex, size, size, color.color, ii);
+ var color = colors[ii];
+ var size = Math.pow(2, colors.length - ii - 1);
+ wtu.fillTexture(gl, tex, size, size, color.color, ii);
}
var loc = gl.getUniformLocation(program, "lod");
for (var ii = 0; ii < colors.length; ++ii) {
- gl.uniform1f(loc, ii);
- var color = colors[ii];
- wtu.drawUnitQuad(gl);
- wtu.checkCanvas(
- gl, color.color,
- "256x256 texture drawn to 256x256 dest with lod = " + ii +
- " should be " + color.name);
+ gl.uniform1f(loc, ii);
+ var color = colors[ii];
+ wtu.drawQuad(gl);
+ wtu.checkCanvas(
+ gl, color.color,
+ "256x256 texture drawn to 256x256 dest with lod = " + ii +
+ " should be " + color.name);
}
- wtu.glErrorShouldBe(gl, gl.NO_ERROR);
+ glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors.");
}
function runUniqueObjectTest()
{
- debug("");
debug("Testing that getExtension() returns the same object each time");
gl.getExtension("EXT_shader_texture_lod").myProperty = 2;
gc();
@@ -289,7 +260,7 @@ function runReferenceCycleTest()
{
// create some reference cycles. The goal is to see if they cause leaks. The point is that
// some browser test runners have instrumentation to detect leaked refcounted objects.
- debug("");
+
debug("Testing reference cycles between context and extension objects");
var ext = gl.getExtension("EXT_shader_texture_lod");
@@ -300,58 +271,6 @@ function runReferenceCycleTest()
ext.ext = ext;
}
-function runDeferredLinkTests() {
- debug("");
- debug("Testing deferred shader compilation tests.");
-
- // Test for compilation failures that are caused by missing extensions
- // do not succeed if extensions are enabled during linking. This would
- // only happen for deferred shader compilations.
-
- // First test if link succeeds with extension enabled.
- var glEnabled = wtu.create3DContext();
- var extEnabled = glEnabled.getExtension("EXT_shader_texture_lod");
- if (!extEnabled) {
- testFailed("Deferred link test expects the extension to be supported");
- }
-
- var vertexShader = wtu.loadShaderFromScript(glEnabled, "goodVertexShader");
- var fragmentShader = wtu.loadShaderFromScript(glEnabled, "macroFragmentShader");
-
- if (!vertexShader || !fragmentShader) {
- testFailed("Could not create good shaders.");
- return;
- }
-
- var program = wtu.setupProgram(glEnabled, [vertexShader, fragmentShader]);
-
- if (!program) {
- testFailed("Compilation with extension enabled failed.");
- return;
- }
-
- // Create new context to test link failure without extension enabled.
- var glDeferred = wtu.create3DContext();
-
- var vertexShader = wtu.loadShaderFromScript(glDeferred, "goodVertexShader", glDeferred.VERTEX_SHADER, undefined, undefined, true);
- var fragmentShader = wtu.loadShaderFromScript(glDeferred, "macroFragmentShader", glDeferred.FRAGMENT_SHADER, undefined, undefined, true);
-
- if (vertexShader == null || fragmentShader == null) {
- testFailed("Could not create shaders.");
- return;
- }
-
- // Shader compilations should have failed due to extensions not enabled.
- glDeferred.getExtension("EXT_shader_texture_lod");
- var program = wtu.setupProgram(glDeferred, [vertexShader, fragmentShader]);
- if (program) {
- testFailed("Compilation with extension disabled then linking with extension enabled should have failed.");
- return;
- }
-
- testPassed("Compilation with extension disabled then linking with extension enabled.");
-}
-
debug("");
successfullyParsed = true;
diff --git a/dom/canvas/test/webgl-conformance/conformance/resources/webgl-test-utils.js b/dom/canvas/test/webgl-conformance/conformance/resources/webgl-test-utils.js
index 6c61d7365de..48b834acc7d 100644
--- a/dom/canvas/test/webgl-conformance/conformance/resources/webgl-test-utils.js
+++ b/dom/canvas/test/webgl-conformance/conformance/resources/webgl-test-utils.js
@@ -999,18 +999,9 @@ var readFileList = function(url) {
* @param {string} shaderSource The shader source.
* @param {number} shaderType The type of shader.
* @param {function(string): void) opt_errorCallback callback for errors.
- * @param {boolean} opt_logShaders Whether to log shader source.
- * @param {string} opt_shaderLabel Label that identifies the shader source in
- * the log.
- * @param {string} opt_url URL from where the shader source was loaded from.
- * If opt_logShaders is set, then a link to the source file will also be
- * added.
- * @param {boolean} Skip compilation status check. Default = false.
* @return {!WebGLShader} The created shader.
*/
-var loadShader = function(
- gl, shaderSource, shaderType, opt_errorCallback, opt_logShaders,
- opt_shaderLabel, opt_url, opt_skipCompileStatus) {
+var loadShader = function(gl, shaderSource, shaderType, opt_errorCallback) {
var errFn = opt_errorCallback || error;
// Create the shader object
var shader = gl.createShader(shaderType);
@@ -1030,25 +1021,14 @@ var loadShader = function(
// Compile the shader
gl.compileShader(shader);
- if (opt_logShaders) {
- var label = shaderType == gl.VERTEX_SHADER ? 'vertex shader' : 'fragment_shader';
- if (opt_shaderLabel) {
- label = opt_shaderLabel + ' ' + label;
- }
- addShaderSources(
- gl, document.getElementById('console'), label, shader, shaderSource, opt_url);
- }
-
// Check the compile status
- if (!opt_skipCompileStatus) {
- var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
- if (!compiled) {
- // Something went wrong during compilation; get the error
- lastError = gl.getShaderInfoLog(shader);
- errFn("*** Error compiling " + glEnumToString(gl, shaderType) + " '" + shader + "':" + lastError);
- gl.deleteShader(shader);
- return null;
- }
+ var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
+ if (!compiled) {
+ // Something went wrong during compilation; get the error
+ lastError = gl.getShaderInfoLog(shader);
+ errFn("*** Error compiling shader '" + shader + "':" + lastError);
+ gl.deleteShader(shader);
+ return null;
}
return shader;
@@ -1085,13 +1065,12 @@ var getScript = function(scriptId) {
* @param {number} opt_shaderType The type of shader. If not passed in it will
* be derived from the type of the script tag.
* @param {function(string): void) opt_errorCallback callback for errors.
- * @param {boolean} opt_logShaders Whether to log shader source.
- * @param {boolean} Skip compilation status check. Default = false.
* @return {!WebGLShader} The created shader.
*/
var loadShaderFromScript = function(
- gl, scriptId, opt_shaderType, opt_errorCallback, opt_logShaders, opt_skipCompileStatus) {
+ gl, scriptId, opt_shaderType, opt_errorCallback) {
var shaderSource = "";
+ var shaderType;
var shaderScript = document.getElementById(scriptId);
if (!shaderScript) {
throw("*** Error: unknown script element " + scriptId);
@@ -1100,17 +1079,18 @@ var loadShaderFromScript = function(
if (!opt_shaderType) {
if (shaderScript.type == "x-shader/x-vertex") {
- opt_shaderType = gl.VERTEX_SHADER;
+ shaderType = gl.VERTEX_SHADER;
} else if (shaderScript.type == "x-shader/x-fragment") {
- opt_shaderType = gl.FRAGMENT_SHADER;
- } else {
+ shaderType = gl.FRAGMENT_SHADER;
+ } else if (shaderType != gl.VERTEX_SHADER && shaderType != gl.FRAGMENT_SHADER) {
throw("*** Error: unknown shader type");
return null;
}
}
- return loadShader(gl, shaderSource, opt_shaderType, opt_errorCallback,
- opt_logShaders, undefined, undefined, opt_skipCompileStatus);
+ return loadShader(
+ gl, shaderSource, opt_shaderType ? opt_shaderType : shaderType,
+ opt_errorCallback);
};
var loadStandardProgram = function(gl) {
diff --git a/dom/canvas/test/webgl-conformance/ext-shader-texture-lod-cherry-pick.patch b/dom/canvas/test/webgl-conformance/ext-shader-texture-lod-cherry-pick.patch
deleted file mode 100644
index d6380a4f0c4..00000000000
--- a/dom/canvas/test/webgl-conformance/ext-shader-texture-lod-cherry-pick.patch
+++ /dev/null
@@ -1,464 +0,0 @@
-# HG changeset patch
-# User Kearwood (Kip) Gilbert
-# Date 1441751266 25200
-# Tue Sep 08 15:27:46 2015 -0700
-# Node ID 43ba953a36814b5f276174afae234f68486f349f
-# Parent 1cbec4a92eae5d8d076072f4b8d27eb2c9dbb363
-Bug 1111689: Part 2 - Update ext-shader-texture-lod WebGL conformance test
-- Cherry picked minimal changes to support updated ext-shader-texture-lod
- webgl conformance test.
-
-diff --git a/dom/canvas/test/webgl-conformance/conformance/extensions/ext-shader-texture-lod.html b/dom/canvas/test/webgl-conformance/conformance/extensions/ext-shader-texture-lod.html
---- a/dom/canvas/test/webgl-conformance/conformance/extensions/ext-shader-texture-lod.html
-+++ b/dom/canvas/test/webgl-conformance/conformance/extensions/ext-shader-texture-lod.html
-@@ -1,37 +1,60 @@
--
-+
-
-
-
-
- WebGL EXT_shader_texture_lod Conformance Tests
-
--
-+
-
--
-
-
-
-
--
-+
-+
-
--
-+
-
-
-
-
-
-
-
-
-
-
-diff --git a/dom/canvas/test/webgl-conformance/conformance/resources/webgl-test-utils.js b/dom/canvas/test/webgl-conformance/conformance/resources/webgl-test-utils.js
---- a/dom/canvas/test/webgl-conformance/conformance/resources/webgl-test-utils.js
-+++ b/dom/canvas/test/webgl-conformance/conformance/resources/webgl-test-utils.js
-@@ -994,19 +994,28 @@ var readFileList = function(url) {
- };
-
- /**
- * Loads a shader.
- * @param {!WebGLContext} gl The WebGLContext to use.
- * @param {string} shaderSource The shader source.
- * @param {number} shaderType The type of shader.
- * @param {function(string): void) opt_errorCallback callback for errors.
-+ * @param {boolean} opt_logShaders Whether to log shader source.
-+ * @param {string} opt_shaderLabel Label that identifies the shader source in
-+ * the log.
-+ * @param {string} opt_url URL from where the shader source was loaded from.
-+ * If opt_logShaders is set, then a link to the source file will also be
-+ * added.
-+ * @param {boolean} Skip compilation status check. Default = false.
- * @return {!WebGLShader} The created shader.
- */
--var loadShader = function(gl, shaderSource, shaderType, opt_errorCallback) {
-+var loadShader = function(
-+ gl, shaderSource, shaderType, opt_errorCallback, opt_logShaders,
-+ opt_shaderLabel, opt_url, opt_skipCompileStatus) {
- var errFn = opt_errorCallback || error;
- // Create the shader object
- var shader = gl.createShader(shaderType);
- if (shader == null) {
- errFn("*** Error: unable to create shader '"+shaderSource+"'");
- return null;
- }
-
-@@ -1016,24 +1025,35 @@ var loadShader = function(gl, shaderSour
- if (err != gl.NO_ERROR) {
- errFn("*** Error loading shader '" + shader + "':" + glEnumToString(gl, err));
- return null;
- }
-
- // Compile the shader
- gl.compileShader(shader);
-
-+ if (opt_logShaders) {
-+ var label = shaderType == gl.VERTEX_SHADER ? 'vertex shader' : 'fragment_shader';
-+ if (opt_shaderLabel) {
-+ label = opt_shaderLabel + ' ' + label;
-+ }
-+ addShaderSources(
-+ gl, document.getElementById('console'), label, shader, shaderSource, opt_url);
-+ }
-+
- // Check the compile status
-- var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
-- if (!compiled) {
-- // Something went wrong during compilation; get the error
-- lastError = gl.getShaderInfoLog(shader);
-- errFn("*** Error compiling shader '" + shader + "':" + lastError);
-- gl.deleteShader(shader);
-- return null;
-+ if (!opt_skipCompileStatus) {
-+ var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
-+ if (!compiled) {
-+ // Something went wrong during compilation; get the error
-+ lastError = gl.getShaderInfoLog(shader);
-+ errFn("*** Error compiling " + glEnumToString(gl, shaderType) + " '" + shader + "':" + lastError);
-+ gl.deleteShader(shader);
-+ return null;
-+ }
- }
-
- return shader;
- }
-
- /**
- * Loads a shader from a URL.
- * @param {!WebGLContext} gl The WebGLContext to use.
-@@ -1060,42 +1080,42 @@ var getScript = function(scriptId) {
-
- /**
- * Loads a shader from a script tag.
- * @param {!WebGLContext} gl The WebGLContext to use.
- * @param {string} scriptId The id of the script tag.
- * @param {number} opt_shaderType The type of shader. If not passed in it will
- * be derived from the type of the script tag.
- * @param {function(string): void) opt_errorCallback callback for errors.
-+ * @param {boolean} opt_logShaders Whether to log shader source.
-+ * @param {boolean} Skip compilation status check. Default = false.
- * @return {!WebGLShader} The created shader.
- */
- var loadShaderFromScript = function(
-- gl, scriptId, opt_shaderType, opt_errorCallback) {
-+ gl, scriptId, opt_shaderType, opt_errorCallback, opt_logShaders, opt_skipCompileStatus) {
- var shaderSource = "";
-- var shaderType;
- var shaderScript = document.getElementById(scriptId);
- if (!shaderScript) {
- throw("*** Error: unknown script element " + scriptId);
- }
- shaderSource = shaderScript.text;
-
- if (!opt_shaderType) {
- if (shaderScript.type == "x-shader/x-vertex") {
-- shaderType = gl.VERTEX_SHADER;
-+ opt_shaderType = gl.VERTEX_SHADER;
- } else if (shaderScript.type == "x-shader/x-fragment") {
-- shaderType = gl.FRAGMENT_SHADER;
-- } else if (shaderType != gl.VERTEX_SHADER && shaderType != gl.FRAGMENT_SHADER) {
-+ opt_shaderType = gl.FRAGMENT_SHADER;
-+ } else {
- throw("*** Error: unknown shader type");
- return null;
- }
- }
-
-- return loadShader(
-- gl, shaderSource, opt_shaderType ? opt_shaderType : shaderType,
-- opt_errorCallback);
-+ return loadShader(gl, shaderSource, opt_shaderType, opt_errorCallback,
-+ opt_logShaders, undefined, undefined, opt_skipCompileStatus);
- };
-
- var loadStandardProgram = function(gl) {
- var program = gl.createProgram();
- gl.attachShader(program, loadStandardVertexShader(gl));
- gl.attachShader(program, loadStandardFragmentShader(gl));
- linkProgram(gl, program);
- return program;
diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp
index ef77451e83b..2031b832559 100644
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -99,7 +99,6 @@ static const char *sExtensionNames[] = {
"GL_ARB_pixel_buffer_object",
"GL_ARB_robustness",
"GL_ARB_sampler_objects",
- "GL_ARB_shader_texture_lod",
"GL_ARB_sync",
"GL_ARB_texture_compression",
"GL_ARB_texture_float",
diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h
index 994f15d34d0..a8636b1c6c1 100644
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -122,7 +122,6 @@ enum class GLFeature {
robustness,
sRGB_framebuffer,
sRGB_texture,
- shader_texture_lod,
sampler_objects,
standard_derivatives,
sync,
@@ -411,7 +410,6 @@ public:
ARB_pixel_buffer_object,
ARB_robustness,
ARB_sampler_objects,
- ARB_shader_texture_lod,
ARB_sync,
ARB_texture_compression,
ARB_texture_float,
diff --git a/gfx/gl/GLContextFeatures.cpp b/gfx/gl/GLContextFeatures.cpp
index 2820ff4fae3..780a9950169 100644
--- a/gfx/gl/GLContextFeatures.cpp
+++ b/gfx/gl/GLContextFeatures.cpp
@@ -538,17 +538,6 @@ static const FeatureInfo sFeatureInfoArr[] = {
GLContext::Extensions_End
}
},
- {
- "shader_texture_lod",
- GLVersion::NONE,
- GLESVersion::NONE,
- GLContext::Extension_None,
- {
- GLContext::ARB_shader_texture_lod,
- GLContext::EXT_shader_texture_lod,
- GLContext::Extensions_End
- }
- },
{
"sampler_objects",
GLVersion::GL3_3,