mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1271830 - Remove non-webgl2 exts from webgl2 and update tests to check webgl2 exts. - r=jrmuizel
This commit is contained in:
parent
8ba29d1473
commit
8cb78cdcf9
@ -112,8 +112,6 @@ WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
|
||||
switch (ext) {
|
||||
// In alphabetical order
|
||||
// EXT_
|
||||
case WebGLExtensionID::EXT_color_buffer_half_float:
|
||||
return WebGLExtensionColorBufferHalfFloat::IsSupported(this);
|
||||
case WebGLExtensionID::EXT_texture_filter_anisotropic:
|
||||
return gl->IsExtensionSupported(gl::GLContext::EXT_texture_filter_anisotropic);
|
||||
|
||||
@ -122,8 +120,6 @@ WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
|
||||
return gl->IsSupported(gl::GLFeature::texture_float_linear);
|
||||
|
||||
// WEBGL_
|
||||
case WebGLExtensionID::WEBGL_color_buffer_float:
|
||||
return WebGLExtensionColorBufferFloat::IsSupported(this);
|
||||
case WebGLExtensionID::WEBGL_compressed_texture_atc:
|
||||
return gl->IsExtensionSupported(gl::GLContext::AMD_compressed_ATC_texture);
|
||||
case WebGLExtensionID::WEBGL_compressed_texture_etc1:
|
||||
@ -171,6 +167,8 @@ WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
|
||||
// EXT_
|
||||
case WebGLExtensionID::EXT_blend_minmax:
|
||||
return WebGLExtensionBlendMinMax::IsSupported(this);
|
||||
case WebGLExtensionID::EXT_color_buffer_half_float:
|
||||
return WebGLExtensionColorBufferHalfFloat::IsSupported(this);
|
||||
case WebGLExtensionID::EXT_frag_depth:
|
||||
return WebGLExtensionFragDepth::IsSupported(this);
|
||||
case WebGLExtensionID::EXT_shader_texture_lod:
|
||||
@ -194,6 +192,8 @@ WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
|
||||
return true;
|
||||
|
||||
// WEBGL_
|
||||
case WebGLExtensionID::WEBGL_color_buffer_float:
|
||||
return WebGLExtensionColorBufferFloat::IsSupported(this);
|
||||
case WebGLExtensionID::WEBGL_depth_texture:
|
||||
// WEBGL_depth_texture supports DEPTH_STENCIL textures
|
||||
if (!gl->IsSupported(gl::GLFeature::packed_depth_stencil))
|
||||
|
@ -1,21 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
function EnsureExt(name, shouldBe = true) {
|
||||
var c = document.createElement('canvas');
|
||||
var gl = c.getContext('experimental-webgl');
|
||||
function EnsureExt(extName, shouldHave=true) {
|
||||
EnsureExtFor('webgl', extName, shouldHave);
|
||||
EnsureExtFor('webgl2', extName, shouldHave);
|
||||
}
|
||||
|
||||
if (shouldBe) {
|
||||
ok(gl.getExtension(name), 'Should have extension ' + name + '.');
|
||||
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(!gl.getExtension(name), 'Should not have extension ' + name + '.');
|
||||
ok(!ext, 'Should not' + haveText);
|
||||
}
|
||||
}
|
||||
|
||||
function EnsureDraftExt(name, shouldBe = true) {
|
||||
function Lastly_WithDraftExtsEnabled(func) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var fnEnsure = function() {
|
||||
EnsureExt(name, shouldBe);
|
||||
func();
|
||||
SimpleTest.finish();
|
||||
};
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureExt('ANGLE_instanced_arrays');
|
||||
EnsureExtFor('webgl', 'ANGLE_instanced_arrays');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureExt('EXT_blend_minmax');
|
||||
EnsureExtFor('webgl', 'EXT_blend_minmax');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureExt('EXT_color_buffer_half_float');
|
||||
EnsureExtFor('webgl', 'EXT_color_buffer_half_float');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -10,7 +10,9 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureDraftExt('EXT_disjoint_timer_query');
|
||||
Lastly_WithDraftExtsEnabled(function() {
|
||||
EnsureExt('EXT_disjoint_timer_query');
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureExt('EXT_frag_depth');
|
||||
EnsureExtFor('webgl', 'EXT_frag_depth');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureExt('EXT_sRGB');
|
||||
EnsureExtFor('webgl', 'EXT_sRGB');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureExt('EXT_shader_texture_lod');
|
||||
EnsureExtFor('webgl', 'EXT_shader_texture_lod');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureExt('OES_standard_derivatives');
|
||||
EnsureExtFor('webgl', 'OES_standard_derivatives');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureExt('WEBGL_color_buffer_float');
|
||||
EnsureExtFor('webgl', 'WEBGL_color_buffer_float');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -10,7 +10,9 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureDraftExt('WEBGL_compressed_texture_es3');
|
||||
Lastly_WithDraftExtsEnabled(function() {
|
||||
EnsureExt('WEBGL_compressed_texture_es3');
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureExt('WEBGL_depth_texture');
|
||||
EnsureExtFor('webgl', 'WEBGL_depth_texture');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
EnsureExt('WEBGL_draw_buffers');
|
||||
EnsureExtFor('webgl', 'WEBGL_draw_buffers');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
@ -4,71 +4,106 @@
|
||||
<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 c = document.createElement('canvas');
|
||||
var gl = c.getContext('experimental-webgl');
|
||||
var ENSURE = 'ENSURE'; // Works on all test machines.
|
||||
var FORBID = 'FORBID'; // Should not work on any test machine.
|
||||
var MACHINE_SPECIFIC = 'MACHINE_SPECIFIC';
|
||||
|
||||
function ensureExt(name) {
|
||||
ok(gl.getExtension(name), 'Should have extension ' + name + '.');
|
||||
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_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' , [FORBID , FORBID ]], // Complicated!
|
||||
['WEBGL_debug_shaders' , [FORBID , FORBID ]],
|
||||
['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_sRGB' , [MACHINE_SPECIFIC, FORBID ]],
|
||||
['WEBGL_color_buffer_float' , [MACHINE_SPECIFIC, FORBID ]],
|
||||
['WEBGL_compressed_texture_atc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
|
||||
['WEBGL_compressed_texture_etc1' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
|
||||
['WEBGL_compressed_texture_pvrtc', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
|
||||
];
|
||||
|
||||
var draftExts = [
|
||||
['EXT_disjoint_timer_query' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]], // TODO: Actually Community Approved now.
|
||||
['WEBGL_compressed_texture_es3', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
|
||||
];
|
||||
|
||||
var nonImplementedExts = [
|
||||
'OES_fbo_render_mipmap',
|
||||
'WEBGL_compressed_texture_astc',
|
||||
'WEBGL_security_sensitive_resources',
|
||||
'WEBGL_shared_resources',
|
||||
];
|
||||
|
||||
////////////////////
|
||||
|
||||
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 ensureNoExt(name) {
|
||||
ok(!gl.getExtension(name), 'Should not have extension ' + name + '.');
|
||||
function TestExt(extName, statusArr) {
|
||||
TestExtFor('webgl', extName, statusArr[0]);
|
||||
TestExtFor('webgl2', extName, statusArr[1]);
|
||||
}
|
||||
|
||||
do {
|
||||
if (!gl)
|
||||
break;
|
||||
////////////////////
|
||||
|
||||
// These aren't all guaranteed, but they're common to all our test slaves.
|
||||
// If you're adding a slave config that is missing one of these, comment the line out
|
||||
// and split it into its own test.
|
||||
defaultExts.forEach(function(x) {
|
||||
var extName = x[0];
|
||||
var statusArr = x[1];
|
||||
TestExt(extName, statusArr);
|
||||
});
|
||||
|
||||
// Implemented. (commented out if not test-slave-universal)
|
||||
//ensureExt('ANGLE_instanced_arrays');
|
||||
//ensureExt('EXT_blend_minmax');
|
||||
//ensureExt('EXT_color_buffer_half_float');
|
||||
//ensureExt('EXT_frag_depth');
|
||||
//ensureExt('EXT_shader_texture_lod');
|
||||
//ensureExt('EXT_sRGB');
|
||||
//ensureExt('EXT_texture_filter_anisotropic');
|
||||
ensureExt('OES_element_index_uint');
|
||||
//ensureExt('OES_standard_derivatives');
|
||||
ensureExt('OES_texture_float');
|
||||
ensureExt('OES_texture_float_linear');
|
||||
ensureExt('OES_texture_half_float');
|
||||
ensureExt('OES_texture_half_float_linear');
|
||||
ensureExt('OES_vertex_array_object');
|
||||
//ensureExt('WEBGL_color_buffer_float');
|
||||
//ensureExt('WEBGL_compressed_texture_atc');
|
||||
//ensureExt('WEBGL_compressed_texture_es3');
|
||||
//ensureExt('WEBGL_compressed_texture_etc1');
|
||||
//ensureExt('WEBGL_compressed_texture_pvrtc');
|
||||
//ensureExt('WEBGL_compressed_texture_s3tc');
|
||||
//ensureExt('WEBGL_depth_texture');
|
||||
//ensureExt('WEBGL_draw_buffers');
|
||||
ensureExt('WEBGL_lose_context');
|
||||
nonImplementedExts.forEach(function(extName) {
|
||||
EnsureExt(extName, false);
|
||||
});
|
||||
|
||||
// Draft extensions, which should not be exposed by default.
|
||||
ensureNoExt('EXT_disjoint_timer_query');
|
||||
ensureNoExt('WEBGL_compressed_texture_es3');
|
||||
draftExts.forEach(function(x) {
|
||||
var extName = x[0];
|
||||
EnsureExt(extName, false);
|
||||
});
|
||||
|
||||
// Not implemented.
|
||||
ensureNoExt('EXT_color_buffer_float');
|
||||
ensureNoExt('OES_fbo_render_mipmap');
|
||||
ensureNoExt('WEBGL_compressed_texture_astc');
|
||||
ensureNoExt('WEBGL_security_sensitive_resources');
|
||||
ensureNoExt('WEBGL_shared_resources');
|
||||
|
||||
// Privileged
|
||||
//ensureExt('WEBGL_debug_renderer_info');
|
||||
//ensureExt('WEBGL_debug_shaders');
|
||||
} while (false);
|
||||
Lastly_WithDraftExtsEnabled(function() {
|
||||
draftExts.forEach(function(x) {
|
||||
var extName = x[0];
|
||||
var statusArr = x[1];
|
||||
TestExt(extName, statusArr);
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user