diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/canvas/test/webgl-mochitest/ensure-exts | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/canvas/test/webgl-mochitest/ensure-exts')
28 files changed, 735 insertions, 0 deletions
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 0000000000..850a27caaf --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/ensure-ext.js @@ -0,0 +1,42 @@ +"use strict"; + +function EnsureExt(extName, shouldHave = true) { + EnsureExtFor("webgl", extName, shouldHave); + EnsureExtFor("webgl2", extName, shouldHave); +} + +function EnsureExtFor(contextType, extName, shouldHave = true) { + var c = document.createElement("canvas"); + var gl = c.getContext(contextType); + + if (!gl) { + todo(false, "Failed to create context: " + contextType); + return; + } + + var ext = gl.getExtension(extName); + var haveText = " have " + contextType + " extension " + extName + "."; + if (shouldHave) { + ok(ext, "Should" + haveText); + } else { + ok(!ext, "Should not" + haveText); + } +} + +function Lastly_WithDraftExtsEnabled(func) { + SimpleTest.waitForExplicitFinish(); + + var fnEnsure = function () { + func(); + 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 0000000000..5905539a49 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_ANGLE_instanced_arrays.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'ANGLE_instanced_arrays'); + + </script> + </body> +</html> 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 0000000000..46b135b799 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_blend_minmax.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'EXT_blend_minmax'); + + </script> + </body> +</html> 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 0000000000..443c7ab70a --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_color_buffer_half_float.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'EXT_color_buffer_half_float'); + + </script> + </body> +</html> 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 0000000000..af94cbc658 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_disjoint_timer_query.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExt('EXT_disjoint_timer_query'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_float_blend.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_float_blend.html new file mode 100644 index 0000000000..9da0d761ab --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_float_blend.html @@ -0,0 +1,18 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; + +EnsureExt('EXT_float_blend'); + + </script> + </body> +</html> 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 0000000000..9dbac9881b --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_frag_depth.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'EXT_frag_depth'); + + </script> + </body> +</html> 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 0000000000..cbdde000ac --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_sRGB.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'EXT_sRGB'); + + </script> + </body> +</html> 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 0000000000..c3a51c0c9d --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_shader_texture_lod.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'EXT_shader_texture_lod'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_compression_bptc.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_compression_bptc.html new file mode 100644 index 0000000000..2323da591d --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_compression_bptc.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExt('EXT_texture_compression_bptc'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_compression_rgtc.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_compression_rgtc.html new file mode 100644 index 0000000000..dbba5382ce --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_compression_rgtc.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExt('EXT_texture_compression_rgtc'); + + </script> + </body> +</html> 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 0000000000..877c4440bf --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_filter_anisotropic.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExt('EXT_texture_filter_anisotropic'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_norm16.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_norm16.html new file mode 100644 index 0000000000..0a636dc674 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_EXT_texture_norm16.html @@ -0,0 +1,23 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'EXT_texture_norm16', false); +EnsureExtFor('webgl2', 'EXT_texture_norm16', false); + +Lastly_WithDraftExtsEnabled(() => { + EnsureExtFor('webgl', 'EXT_texture_norm16', false); + EnsureExtFor('webgl2', 'EXT_texture_norm16', true); +}); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_draw_buffers_indexed.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_draw_buffers_indexed.html new file mode 100644 index 0000000000..1d5b8b7341 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_draw_buffers_indexed.html @@ -0,0 +1,18 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'OES_draw_buffers_indexed', false); +EnsureExtFor('webgl2', 'OES_draw_buffers_indexed', true); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_fbo_render_mipmap.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_fbo_render_mipmap.html new file mode 100644 index 0000000000..e0439d3fa8 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_fbo_render_mipmap.html @@ -0,0 +1,18 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; + +EnsureExtFor('webgl', 'OES_fbo_render_mipmap'); + + </script> + </body> +</html> 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 0000000000..359726256a --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_OES_standard_derivatives.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'OES_standard_derivatives'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_OVR_multiview2.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_OVR_multiview2.html new file mode 100644 index 0000000000..4a44a20611 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_OVR_multiview2.html @@ -0,0 +1,18 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; + +EnsureExtFor('webgl2', 'OVR_multiview2'); + + </script> + </body> +</html> 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 0000000000..9a88b27712 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_color_buffer_float.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'WEBGL_color_buffer_float'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_astc.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_astc.html new file mode 100644 index 0000000000..6a9d720024 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_astc.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExt('WEBGL_compressed_texture_astc'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc.html new file mode 100644 index 0000000000..7adaafbc82 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExt('WEBGL_compressed_texture_etc'); + + </script> + </body> +</html> 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 0000000000..327625c018 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_etc1.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExt('WEBGL_compressed_texture_etc1'); + + </script> + </body> +</html> 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 0000000000..c954813984 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_pvrtc.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExt('WEBGL_compressed_texture_pvrtc'); + + </script> + </body> +</html> 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 0000000000..6ad8001106 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_compressed_texture_s3tc.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExt('WEBGL_compressed_texture_s3tc'); + + </script> + </body> +</html> 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 0000000000..6d8a864c00 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_depth_texture.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'WEBGL_depth_texture'); + + </script> + </body> +</html> 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 0000000000..0683516350 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_draw_buffers.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'WEBGL_draw_buffers'); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_provoking_vertex.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_provoking_vertex.html new file mode 100644 index 0000000000..76af23b87f --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_WEBGL_provoking_vertex.html @@ -0,0 +1,18 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; +EnsureExtFor('webgl', 'WEBGL_provoking_vertex'); +EnsureExtFor('webgl2', 'WEBGL_provoking_vertex'); + + </script> + </body> +</html> 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 0000000000..8620a66f83 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script> + +'use strict'; + +var ENSURE = 'ENSURE'; // Works on all test machines. +var FORBID = 'FORBID'; // Should not work on any test machine. +var MACHINE_SPECIFIC = 'MACHINE_SPECIFIC'; + +var defaultExts = [ + // Ratified + ['ANGLE_instanced_arrays' , [MACHINE_SPECIFIC, FORBID ]], + ['EXT_blend_minmax' , [MACHINE_SPECIFIC, FORBID ]], + ['EXT_frag_depth' , [MACHINE_SPECIFIC, FORBID ]], + ['EXT_shader_texture_lod' , [MACHINE_SPECIFIC, FORBID ]], + ['EXT_texture_filter_anisotropic', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['OES_element_index_uint' , [ENSURE , FORBID ]], + ['OES_fbo_render_mipmap' , [MACHINE_SPECIFIC, FORBID ]], + ['OES_standard_derivatives' , [MACHINE_SPECIFIC, FORBID ]], + ['OES_texture_float' , [ENSURE , FORBID ]], + ['OES_texture_float_linear' , [ENSURE , ENSURE ]], + ['OES_texture_half_float' , [ENSURE , FORBID ]], + ['OES_texture_half_float_linear' , [ENSURE , FORBID ]], + ['OES_vertex_array_object' , [ENSURE , FORBID ]], + ['WEBGL_compressed_texture_s3tc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['WEBGL_debug_renderer_info' , [ENSURE , ENSURE ]], + ['WEBGL_debug_shaders' , [ENSURE , ENSURE ]], + ['WEBGL_depth_texture' , [MACHINE_SPECIFIC, FORBID ]], + ['WEBGL_draw_buffers' , [MACHINE_SPECIFIC, FORBID ]], + ['WEBGL_lose_context' , [ENSURE , ENSURE ]], + + // Community Approved + ['EXT_color_buffer_float' , [FORBID , ENSURE ]], + ['EXT_color_buffer_half_float' , [MACHINE_SPECIFIC, FORBID ]], + ['EXT_disjoint_timer_query' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['EXT_float_blend' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['EXT_sRGB' , [MACHINE_SPECIFIC, FORBID ]], + ['EXT_texture_compression_bptc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['EXT_texture_compression_rgtc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['OES_draw_buffers_indexed' , [FORBID , MACHINE_SPECIFIC]], + ['OVR_multiview2' , [FORBID , MACHINE_SPECIFIC]], + ['WEBGL_color_buffer_float' , [MACHINE_SPECIFIC, FORBID ]], + ['WEBGL_compressed_texture_astc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['WEBGL_compressed_texture_atc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['WEBGL_compressed_texture_etc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['WEBGL_compressed_texture_etc1' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['WEBGL_compressed_texture_pvrtc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['WEBGL_compressed_texture_s3tc_srgb', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], + ['WEBGL_provoking_vertex' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], +]; + +var draftExts = [ + ['EXT_texture_norm16' , [FORBID , MACHINE_SPECIFIC]], + ['WEBGL_explicit_present' , [ENSURE , ENSURE ]], +]; + +//////////////////// +// Ensure that we never see any extensions that we haven't listed above! + +(function() { + const expectedExts = (defaultExts.concat(draftExts)).map(x => x[0]); + + ['webgl', 'webgl2'].forEach( contextType => { + const c = document.createElement('canvas'); + const gl = c.getContext(contextType); + if (!gl) return; + + const actualExts = gl.getSupportedExtensions(); + actualExts.forEach(actualExt => { + ok(expectedExts.includes(actualExt), 'Unexpected ext: ' + actualExt); + }); + }); +})(); + +//////////////////// + +function TestExtFor(contextType, extName, status) { + switch (status) { + case ENSURE: + EnsureExtFor(contextType, extName); + break; + + case FORBID: + EnsureExtFor(contextType, extName, false); + break; + + case MACHINE_SPECIFIC: + break; + } +} + +function TestExt(extName, statusArr) { + TestExtFor('webgl', extName, statusArr[0]); + TestExtFor('webgl2', extName, statusArr[1]); +} + +//////////////////// + +defaultExts.forEach(function(x) { + var extName = x[0]; + var statusArr = x[1]; + TestExt(extName, statusArr); +}); + +draftExts.forEach(function(x) { + var extName = x[0]; + EnsureExt(extName, false); +}); + +Lastly_WithDraftExtsEnabled(function() { + draftExts.forEach(function(x) { + var extName = x[0]; + var statusArr = x[1]; + TestExt(extName, statusArr); + }); +}); + + </script> + </body> +</html> diff --git a/dom/canvas/test/webgl-mochitest/ensure-exts/test_implicit.html b/dom/canvas/test/webgl-mochitest/ensure-exts/test_implicit.html new file mode 100644 index 0000000000..e3ce1ad130 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/ensure-exts/test_implicit.html @@ -0,0 +1,129 @@ +<!DOCTYPE HTML> +<html> + <head> + <meta charset='utf-8'/> + <script src='/tests/SimpleTest/SimpleTest.js'></script> + <link rel='stylesheet' href='/tests/SimpleTest/test.css'> + <script src='ensure-ext.js'></script> + </head> + <body> + <script id='g_vs' type='text/plain'> + +void main() { + gl_PointSize = 1.0; +} + + </script> + <script id='g_fs' type='text/plain'> + +void main() { + gl_FragColor = vec4(0); +} + + </script> + <script> + +'use strict'; + +let gl = null; + +function CheckTexFloatRenderable(rgbaInternal, type) { + const tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texImage2D(gl.TEXTURE_2D, 0, rgbaInternal, 1, 1, 0, gl.RGBA, type, null); + + const fb = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, fb); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0); + return gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE; +} + +function CheckRbFloatRenderable(format) { + const rb = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, rb); + gl.renderbufferStorage(gl.RENDERBUFFER, format, 1, 1); + + const fb = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, fb); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rb); + return gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE; +} + +function CheckBlending() { + function CompileShader(type, elem) { + const text = elem.innerHTML.trim(); + const s = gl.createShader(type); + gl.shaderSource(s, text); + gl.compileShader(s); + return s; + } + + const vs = CompileShader(gl.VERTEX_SHADER, g_vs); + const fs = CompileShader(gl.FRAGMENT_SHADER, g_fs); + const p = gl.createProgram(); + gl.attachShader(p, vs); + gl.attachShader(p, fs); + gl.linkProgram(p); + gl.useProgram(p); + + gl.drawArrays(gl.POINTS, 0, 1); + if (gl.getError()) throw new Error('Unexpected GL error,'); + + gl.enable(gl.BLEND); + gl.drawArrays(gl.POINTS, 0, 1); + return gl.getError() == 0; +} + +function ResetGl(type) { + if (gl) { + const ext = gl.getExtension('WEBGL_lose_context'); + ext.loseContext(); + gl = null; + } + const c = document.createElement('canvas'); + gl = c.getContext(type); + return !!gl; +} + +function HasExt(name) { + return gl.getSupportedExtensions().indexOf(name) != -1; +} + +ResetGl('webgl'); +if (HasExt('EXT_color_buffer_half_float')) { + const ext = gl.getExtension('OES_texture_half_float'); + const implicitEnabled = CheckTexFloatRenderable(gl.RGBA, ext.HALF_FLOAT_OES); + ok(implicitEnabled, 'OES_texture_half_float should implicitly enable EXT_color_buffer_half_float.'); +} + +ResetGl('webgl'); +if (HasExt('WEBGL_color_buffer_float')) { + const ext = gl.getExtension('OES_texture_float'); + const implicitEnabled = CheckTexFloatRenderable(gl.RGBA, gl.FLOAT); + ok(implicitEnabled, 'OES_texture_float should implicitly enable WEBGL_color_buffer_float.'); + + if (HasExt('EXT_float_blend')) { + ok(CheckBlending(), 'OES_texture_float should implicitly enable EXT_float_blend.'); + } +} + +ResetGl('webgl'); +if (HasExt('EXT_float_blend')) { + const ext = gl.getExtension('WEBGL_color_buffer_float'); + CheckRbFloatRenderable(ext.RGBA32F_EXT); + const implicitEnabled = CheckBlending(); + ok(implicitEnabled, 'WEBGL_color_buffer_float should implicitly enable EXT_float_blend.'); +} + +if (ResetGl('webgl2')) { + if (HasExt('EXT_float_blend')) { + const ext = gl.getExtension('EXT_color_buffer_float'); + CheckTexFloatRenderable(gl.RGBA32F, gl.FLOAT); + const implicitEnabled = CheckBlending(); + ok(implicitEnabled, 'EXT_color_buffer_float should implicitly enable EXT_float_blend.'); + } +} + + </script> + </body> +</html> |