Bug 728354 - WebGL EXT_texture_filter_anisotropic: added the EXT suffix and adjusted conformance test - r=bjacob
authorFlorian Boesch <pyalot@gmail.com>
Sun, 26 Feb 2012 12:06:18 -0500
changeset 87761 f9e8468f70f09d4f2985ffc5ddcc2d8d8c2f03d8
parent 87760 9658d5eee1e951dfbdb5e4deb25882ffd60f4df3
child 87762 f09084db292c942dcb0b017b8e6ca88be9e546c3
push id22143
push userphilringnalda@gmail.com
push dateSun, 26 Feb 2012 23:12:35 +0000
treeherdermozilla-central@b98fc24ac54b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs728354
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 728354 - WebGL EXT_texture_filter_anisotropic: added the EXT suffix and adjusted conformance test - r=bjacob
content/canvas/test/webgl/conformance/extensions/ext-texture-filter-anisotropic.html
dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
--- a/content/canvas/test/webgl/conformance/extensions/ext-texture-filter-anisotropic.html
+++ b/content/canvas/test/webgl/conformance/extensions/ext-texture-filter-anisotropic.html
@@ -24,130 +24,150 @@ description("This test verifies the func
 
 debug("");
 
 var wtu = WebGLTestUtils;
 var canvas = document.getElementById("canvas");
 var gl = create3DContext(canvas);
 var ext = null;
 
+var getExtension = function(){
+    ext = gl.getExtension("MOZ_EXT_texture_filter_anisotropic");
+    if(ext) return;
+
+    ext = gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
+    if(ext) return;
+
+    ext = gl.getExtension("EXT_texture_filter_anisotropic");
+    if(ext) return;
+}
+
+var listsExtension = function(){
+    var supported = gl.getSupportedExtensions();
+    if(supported.indexOf("MOZ_EXT_texture_filter_anisotropic") >= 0) return true;
+    if(supported.indexOf("WEBKIT_EXT_texture_filter_anisotropic") >= 0) return true;
+    if(supported.indexOf("EXT_texture_filter_anisotropic") >= 0) return true;
+
+    return false;
+}
+
 if (!gl) {
     testFailed("WebGL context does not exist");
 } else {
     testPassed("WebGL context exists");
 
     // Run tests with extension disabled
     runHintTestDisabled();
 
     // Query the extension and store globally so shouldBe can access it
-    ext = gl.getExtension("MOZ_EXT_texture_filter_anisotropic");
+    getExtension();
+
     if (!ext) {
         testPassed("No EXT_texture_filter_anisotropic support -- this is legal");
 
         runSupportedTest(false);
     } else {
         testPassed("Successfully enabled EXT_texture_filter_anisotropic extension");
 
         runSupportedTest(true);
         runHintTestEnabled();
     }
 }
 
 function runSupportedTest(extensionEnabled) {
-    var supported = gl.getSupportedExtensions();
-    if (supported.indexOf("MOZ_EXT_texture_filter_anisotropic") >= 0) {
+    if (listsExtension()) {
         if (extensionEnabled) {
             testPassed("EXT_texture_filter_anisotropic listed as supported and getExtension succeeded");
         } else {
             testFailed("EXT_texture_filter_anisotropic listed as supported but getExtension failed");
         }
     } else {
         if (extensionEnabled) {
             testFailed("EXT_texture_filter_anisotropic not listed as supported but getExtension succeeded");
         } else {
-            testPassed("EXt_texture_filter_anisotropic not listed as supported and getExtension failed -- this is legal");
+            testPassed("EXT_texture_filter_anisotropic not listed as supported and getExtension failed -- this is legal");
         }
     }
 }
 
 function runHintTestDisabled() {
-    debug("Testing MAX_TEXTURE_MAX_ANISOTROPY with extension disabled");
+    debug("Testing MAX_TEXTURE_MAX_ANISOTROPY_EXT with extension disabled");
     
-    var MAX_TEXTURE_MAX_ANISOTROPY = 0x84FF;
-    gl.getParameter(MAX_TEXTURE_MAX_ANISOTROPY);
-    glErrorShouldBe(gl, gl.INVALID_ENUM, "MAX_TEXTURE_MAX_ANISOTROPY should not be queryable if extension is disabled");
+    var MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
+    gl.getParameter(MAX_TEXTURE_MAX_ANISOTROPY_EXT);
+    glErrorShouldBe(gl, gl.INVALID_ENUM, "MAX_TEXTURE_MAX_ANISOTROPY_EXT should not be queryable if extension is disabled");
     
-    debug("Testing TEXTURE_MAX_ANISOTROPY with extension disabled");
-    var TEXTURE_MAX_ANISOTROPY = 0x84FE;
+    debug("Testing TEXTURE_MAX_ANISOTROPY_EXT with extension disabled");
+    var TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
     var texture = gl.createTexture();
     gl.bindTexture(gl.TEXTURE_2D, texture);
    
-    gl.getTexParameter(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY);
-    glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY should not be queryable if extension is disabled");
+    gl.getTexParameter(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY_EXT);
+    glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY_EXT should not be queryable if extension is disabled");
 
-    gl.texParameterf(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY, 1);
-    glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY should not be settable if extension is disabled");
+    gl.texParameterf(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY_EXT, 1);
+    glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY_EXT should not be settable if extension is disabled");
     
-    gl.texParameteri(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY, 1);
-    glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY should not be settable if extension is disabled");
+    gl.texParameteri(gl.TEXTURE_2D, TEXTURE_MAX_ANISOTROPY_EXT, 1);
+    glErrorShouldBe(gl, gl.INVALID_ENUM, "TEXTURE_MAX_ANISOTROPY_EXT should not be settable if extension is disabled");
 
     gl.deleteTexture(texture);
 }
 
 function runHintTestEnabled() {
-    debug("Testing MAX_TEXTURE_MAX_ANISOTROPY with extension enabled");
+    debug("Testing MAX_TEXTURE_MAX_ANISOTROPY_EXT with extension enabled");
 
-    shouldBe("ext.MAX_TEXTURE_MAX_ANISOTROPY", "0x84FF");
+    shouldBe("ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT", "0x84FF");
 
-    var max_anisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY);
-    glErrorShouldBe(gl, gl.NO_ERROR, "MAX_TEXTURE_MAX_ANISOTROPY query should succeed if extension is enabled");
+    var max_anisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
+    glErrorShouldBe(gl, gl.NO_ERROR, "MAX_TEXTURE_MAX_ANISOTROPY_EXT query should succeed if extension is enabled");
 
     if(max_anisotropy >= 2){
-        testPassed("Minimum value of MAX_TEXTURE_MAX_ANISOTROPY is 2.0");
+        testPassed("Minimum value of MAX_TEXTURE_MAX_ANISOTROPY_EXT is 2.0");
     }
     else{
-        testFailed("Minimum value of MAX_TEXTURE_MAX_ANISOTROPY is 2.0, returned values was: " + max_anisotropy);
+        testFailed("Minimum value of MAX_TEXTURE_MAX_ANISOTROPY_EXT is 2.0, returned values was: " + max_anisotropy);
     }
     
     // TODO make a texture and verify initial value == 1 and setting to less than 1 is invalid value
 
-    debug("Testing TEXTURE_MAX_ANISOTROPY with extension disabled");
-    shouldBe("ext.TEXTURE_MAX_ANISOTROPY", "0x84FE");
+    debug("Testing TEXTURE_MAX_ANISOTROPY_EXT with extension disabled");
+    shouldBe("ext.TEXTURE_MAX_ANISOTROPY_EXT", "0x84FE");
 
     var texture = gl.createTexture();
     gl.bindTexture(gl.TEXTURE_2D, texture);
    
-    var queried_value = gl.getTexParameter(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY);
-    glErrorShouldBe(gl, gl.NO_ERROR, "TEXTURE_MAX_ANISOTROPY query should succeed if extension is enabled");
+    var queried_value = gl.getTexParameter(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT);
+    glErrorShouldBe(gl, gl.NO_ERROR, "TEXTURE_MAX_ANISOTROPY_EXT query should succeed if extension is enabled");
 
     if(queried_value == 1){
-        testPassed("Initial value of TEXTURE_MAX_ANISOTROPY is 1.0");
+        testPassed("Initial value of TEXTURE_MAX_ANISOTROPY_EXT is 1.0");
     }
     else{
-        testFailed("Initial value of TEXTURE_MAX_ANISOTROPY should be 1.0, returned value was: " + queried_value);
+        testFailed("Initial value of TEXTURE_MAX_ANISOTROPY_EXT should be 1.0, returned value was: " + queried_value);
     }
 
-    gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY, 0);
-    glErrorShouldBe(gl, gl.INVALID_VALUE, "texParameterf TEXTURE_MAX_ANISOTROPY set to < 1 should be an invalid value");
+    gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, 0);
+    glErrorShouldBe(gl, gl.INVALID_VALUE, "texParameterf TEXTURE_MAX_ANISOTROPY_EXT set to < 1 should be an invalid value");
     
-    gl.texParameteri(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY, 0);
-    glErrorShouldBe(gl, gl.INVALID_VALUE, "texParameteri TEXTURE_MAX_ANISOTROPY set to < 1 should be an invalid value");
+    gl.texParameteri(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, 0);
+    glErrorShouldBe(gl, gl.INVALID_VALUE, "texParameteri TEXTURE_MAX_ANISOTROPY_EXT set to < 1 should be an invalid value");
     
-    gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY, max_anisotropy);
-    glErrorShouldBe(gl, gl.NO_ERROR, "texParameterf TEXTURE_MAX_ANISOTROPY set to >= 2 should should succeed");
+    gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy);
+    glErrorShouldBe(gl, gl.NO_ERROR, "texParameterf TEXTURE_MAX_ANISOTROPY_EXT set to >= 2 should should succeed");
     
-    gl.texParameteri(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY, max_anisotropy);
-    glErrorShouldBe(gl, gl.NO_ERROR, "texParameteri TEXTURE_MAX_ANISOTROPY set to >= 2 should should succeed");
+    gl.texParameteri(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max_anisotropy);
+    glErrorShouldBe(gl, gl.NO_ERROR, "texParameteri TEXTURE_MAX_ANISOTROPY_EXT set to >= 2 should should succeed");
 
-    var queried_value = gl.getTexParameter(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY);
+    var queried_value = gl.getTexParameter(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT);
     if(queried_value == max_anisotropy){
-        testPassed("Set value of TEXTURE_MAX_ANISOTROPY matches expecation");
+        testPassed("Set value of TEXTURE_MAX_ANISOTROPY_EXT matches expecation");
     }
     else{
-        testFailed("Set value of TEXTURE_MAX_ANISOTROPY should be: " + max_anisotropy + " , returned value was: " + queried_value);
+        testFailed("Set value of TEXTURE_MAX_ANISOTROPY_EXT should be: " + max_anisotropy + " , returned value was: " + queried_value);
     }
 
     gl.deleteTexture(texture);
 }
 
 debug("");
 successfullyParsed = true;
 </script>
--- a/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
+++ b/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
@@ -166,18 +166,18 @@ interface nsIWebGLExtensionLoseContext :
 {
   void loseContext();
   void restoreContext();
 };
 
 [scriptable, uuid(73bfb64d-94bd-4a7a-9eab-6b6d32e57aa0)]
 interface nsIWebGLExtensionTextureFilterAnisotropic : nsIWebGLExtension
 {
-  const WebGLenum TEXTURE_MAX_ANISOTROPY = 0x84FE;
-  const WebGLenum MAX_TEXTURE_MAX_ANISOTROPY = 0x84FF;
+  const WebGLenum TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
+  const WebGLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
 };
 
 [scriptable, builtinclass, uuid(f000afac-11b3-4c06-a35f-8db411f1cf54)]
 interface nsIDOMWebGLRenderingContext : nsISupports
 {
   //
   //  CONSTANTS
   //