intel: Only register ES2 extensions for ES2 contexts
authorKristian Høgsberg <krh@bitplanet.net>
Tue, 27 Apr 2010 18:57:51 +0000 (14:57 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 28 Apr 2010 18:36:45 +0000 (14:36 -0400)
src/mesa/drivers/dri/i915/Makefile
src/mesa/drivers/dri/i915/intel_extensions_es2.c [new symlink]
src/mesa/drivers/dri/i965/Makefile
src/mesa/drivers/dri/i965/intel_extensions_es2.c [new symlink]
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_extensions.h
src/mesa/drivers/dri/intel/intel_extensions_es2.c [new file with mode: 0644]

index 5b49d0c77c6208cb10c8b5c4e10fae959c6db51f..71ee753748c25441f88bc1da00efd7725ff69f1d 100644 (file)
@@ -16,6 +16,7 @@ DRIVER_SOURCES = \
        intel_batchbuffer.c \
        intel_clear.c \
        intel_extensions.c \
+       intel_extensions_es2.c \
        intel_mipmap_tree.c \
        intel_tex_layout.c \
        intel_tex_image.c \
diff --git a/src/mesa/drivers/dri/i915/intel_extensions_es2.c b/src/mesa/drivers/dri/i915/intel_extensions_es2.c
new file mode 120000 (symlink)
index 0000000..0ec1cee
--- /dev/null
@@ -0,0 +1 @@
+../intel/intel_extensions_es2.c
\ No newline at end of file
index 842d4b7aa104c52e51f5e736e028cc06ffe7c9f0..a0039e800d2a94fa10b867f7037cf90bc11ca76f 100644 (file)
@@ -13,6 +13,7 @@ DRIVER_SOURCES = \
        intel_context.c \
        intel_decode.c \
        intel_extensions.c \
+       intel_extensions_es2.c \
        intel_fbo.c \
        intel_mipmap_tree.c \
        intel_regions.c \
diff --git a/src/mesa/drivers/dri/i965/intel_extensions_es2.c b/src/mesa/drivers/dri/i965/intel_extensions_es2.c
new file mode 120000 (symlink)
index 0000000..0ec1cee
--- /dev/null
@@ -0,0 +1 @@
+../intel/intel_extensions_es2.c
\ No newline at end of file
index 8922d574c11538f3cfe081d8dcd7688cb44e83e3..8ee9a292a1b593a87354414115f6878ae292b679 100644 (file)
@@ -737,7 +737,16 @@ intelInitContext(struct intel_context *intel,
 
    intel->RenderIndex = ~0;
 
-   intelInitExtensions(ctx);
+   switch (ctx->API) {
+   case API_OPENGL:
+      intelInitExtensions(ctx);
+      break;
+   case API_OPENGLES:
+      break;
+   case API_OPENGLES2:
+      intelInitExtensionsES2(ctx);
+      break;
+   }
 
    INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
    if (INTEL_DEBUG & DEBUG_BUFMGR)
index e78e07356e7e187238a5fd0466111e726b179db7..236442a4d66e7190aa7179a86621b798d15709ec 100644 (file)
@@ -33,7 +33,7 @@ extern void
 intelInitExtensions(GLcontext *ctx);
 
 extern void
-intelFlushDrawable(__DRIdrawable *drawable);
+intelInitExtensionsES2(GLcontext *ctx);
 
 
 #endif
diff --git a/src/mesa/drivers/dri/intel/intel_extensions_es2.c b/src/mesa/drivers/dri/intel/intel_extensions_es2.c
new file mode 100644 (file)
index 0000000..8a6c15f
--- /dev/null
@@ -0,0 +1,93 @@
+/**************************************************************************
+ * 
+ * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#include "main/extensions.h"
+
+#include "intel_extensions.h"
+#include "utils.h"
+
+static const char *es2_extensions[] = {
+   /* Used by mesa internally (cf all_mesa_extensions in ../common/utils.c) */
+   "GL_ARB_draw_buffers",
+   "GL_ARB_multisample",
+   "GL_ARB_texture_compression",
+   "GL_ARB_transpose_matrix",
+   "GL_ARB_vertex_buffer_object",
+   "GL_ARB_window_pos",
+   "GL_EXT_blend_func_separate",
+   "GL_EXT_compiled_vertex_array",
+   "GL_EXT_multi_draw_arrays",
+   "GL_EXT_polygon_offset",
+   "GL_EXT_texture_object",
+   "GL_EXT_vertex_array",
+   "GL_IBM_multimode_draw_arrays",
+   "GL_MESA_window_pos",
+   "GL_NV_vertex_program",
+
+   /* Required by GLES2 */
+   "GL_ARB_fragment_program",
+   "GL_ARB_fragment_shader",
+   "GL_ARB_multitexture",
+   "GL_ARB_shader_objects",
+   "GL_ARB_texture_cube_map",
+   "GL_ARB_texture_mirrored_repeat",
+   "GL_ARB_texture_non_power_of_two",
+   "GL_ARB_vertex_shader",
+   "GL_EXT_blend_color",
+   "GL_EXT_blend_equation_separate",
+   "GL_EXT_blend_minmax",
+   "GL_EXT_blend_subtract",
+   "GL_EXT_stencil_wrap",
+
+   /* Optional GLES2 */
+   "GL_ARB_framebuffer_object",
+   "GL_EXT_texture_filter_anisotropic",
+   "GL_ARB_depth_texture",
+   "GL_EXT_packed_depth_stencil",
+
+#if FEATURE_OES_EGL_image
+   "GL_OES_EGL_image",
+#endif
+
+   NULL,
+};
+
+/**
+ * Initializes potential list of extensions if ctx == NULL, or actually enables
+ * extensions for a context.
+ */
+void
+intelInitExtensionsES2(GLcontext *ctx)
+{
+   int i;
+
+   /* Can't use driInitExtensions() since it uses extensions from
+    * main/remap_helper.h when called the first time. */
+
+   for (i = 0; es2_extensions[i]; i++)
+      _mesa_enable_extension(ctx, es2_extensions[i]);
+}