Bug 896814 - GLContext add enum GLExtensionPackages. r=jgilbert
authorGuillaume Abadie <gabadie@mozilla.com>
Tue, 23 Jul 2013 17:33:51 -0400
changeset 152005 8e63acfcabfb4159b1f830c47f26dfdf58710d17
parent 152004 6375b4e77afed30531dbd851e1830b0c082c7c95
child 152006 34c79a7de41f99de2a4eb0db9984a64363b758c2
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs896814
milestone25.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 896814 - GLContext add enum GLExtensionPackages. r=jgilbert DONTBUILD
gfx/gl/GLContext.h
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -1079,20 +1079,83 @@ public:
         APPLE_vertex_array_object,
         ARB_draw_buffers,
         EXT_draw_buffers,
         EXT_gpu_shader4,
         EXT_blend_minmax,
         Extensions_Max
     };
 
+    /**
+     * This enum introduce the possibility to check if a extension is
+     * supported, regardless it is a ARB, EXT, OES, NV, AMD, APPLE, ANGLE ...
+     * Be sure that extensions specifications are exactly same !
+     * This enum should be sorted by name.
+     */
+    enum GLExtensionPackages {
+        XXX_draw_buffers,
+        XXX_framebuffer_blit,
+        XXX_framebuffer_multisample,
+        XXX_framebuffer_object,
+        XXX_texture_float,
+        XXX_texture_non_power_of_two,
+        XXX_robustness,
+        XXX_vertex_array_object,
+        ExtensionPackages_Max
+    };
+
     bool IsExtensionSupported(GLExtensions aKnownExtension) const {
         return mAvailableExtensions[aKnownExtension];
     }
 
+    bool IsExtensionSupported(GLExtensionPackages aKnownExtensionPackage) const
+    {
+        switch (aKnownExtensionPackage)
+        {
+        case XXX_draw_buffers:
+            return IsExtensionSupported(ARB_draw_buffers) ||
+                   IsExtensionSupported(EXT_draw_buffers);
+
+        case XXX_framebuffer_blit:
+            return IsExtensionSupported(EXT_framebuffer_blit) ||
+                   IsExtensionSupported(ANGLE_framebuffer_blit);
+
+        case XXX_framebuffer_multisample:
+            return IsExtensionSupported(EXT_framebuffer_multisample) ||
+                   IsExtensionSupported(ANGLE_framebuffer_multisample);
+
+        case XXX_framebuffer_object:
+            return IsExtensionSupported(ARB_framebuffer_object) ||
+                   IsExtensionSupported(EXT_framebuffer_object);
+
+        case XXX_texture_float:
+            return IsExtensionSupported(ARB_texture_float) ||
+                   IsExtensionSupported(OES_texture_float);
+
+        case XXX_robustness:
+            return IsExtensionSupported(ARB_robustness) ||
+                   IsExtensionSupported(EXT_robustness);
+
+        case XXX_texture_non_power_of_two:
+            return IsExtensionSupported(ARB_texture_non_power_of_two) ||
+                   IsExtensionSupported(OES_texture_npot);
+
+        case XXX_vertex_array_object:
+            return IsExtensionSupported(ARB_vertex_array_object) ||
+                   IsExtensionSupported(OES_vertex_array_object) ||
+                   IsExtensionSupported(APPLE_vertex_array_object);
+
+        default:
+            break;
+        }
+
+        MOZ_ASSERT(false, "GLContext::IsExtensionSupported : unknown <aKnownExtensionPackage>");
+        return false;
+    }
+
     void MarkExtensionUnsupported(GLExtensions aKnownExtension) {
         mAvailableExtensions[aKnownExtension] = 0;
     }
 
     void MarkExtensionSupported(GLExtensions aKnownExtension) {
         mAvailableExtensions[aKnownExtension] = 1;
     }