[Mesa-dev] [PATCH 03/21] intel: Move OpenGL ES extension enable bits to intel_extensions.c
Chia-I Wu
olvaffe at gmail.com
Sat Aug 27 02:14:42 PDT 2011
On Sat, Aug 27, 2011 at 3:56 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> The core Mesa extension code is now smart enough to only expose the
> right extensions with the right APIs.
What would happen if an extension not available in an API is enabled,
say, GL_ARB_texture_rectangle is enabled for GLESv1? Does it make
GL_TEXTURE_RECTANGLE_ARB a valid target for glTexImage2D?
> ---
> src/mesa/drivers/dri/i915/Makefile | 1 -
> src/mesa/drivers/dri/i915/intel_extensions_es2.c | 1 -
> src/mesa/drivers/dri/i965/Makefile.sources | 1 -
> src/mesa/drivers/dri/i965/intel_extensions_es2.c | 1 -
> src/mesa/drivers/dri/intel/intel_context.c | 11 +--
> src/mesa/drivers/dri/intel/intel_extensions.c | 9 ++-
> src/mesa/drivers/dri/intel/intel_extensions_es2.c | 110 ---------------------
> 7 files changed, 9 insertions(+), 125 deletions(-)
> delete mode 120000 src/mesa/drivers/dri/i915/intel_extensions_es2.c
> delete mode 120000 src/mesa/drivers/dri/i965/intel_extensions_es2.c
> delete mode 100644 src/mesa/drivers/dri/intel/intel_extensions_es2.c
>
> diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile
> index 79e03f2..e5501c0 100644
> --- a/src/mesa/drivers/dri/i915/Makefile
> +++ b/src/mesa/drivers/dri/i915/Makefile
> @@ -18,7 +18,6 @@ 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
> deleted file mode 120000
> index 0ec1cee..0000000
> --- a/src/mesa/drivers/dri/i915/intel_extensions_es2.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -../intel/intel_extensions_es2.c
> \ No newline at end of file
> diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources
> index e9bd707..43f1f89 100644
> --- a/src/mesa/drivers/dri/i965/Makefile.sources
> +++ b/src/mesa/drivers/dri/i965/Makefile.sources
> @@ -11,7 +11,6 @@ i965_C_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
> deleted file mode 120000
> index 0ec1cee..0000000
> --- a/src/mesa/drivers/dri/i965/intel_extensions_es2.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -../intel/intel_extensions_es2.c
> \ No newline at end of file
> diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
> index 0f0fba2..57930d7 100644
> --- a/src/mesa/drivers/dri/intel/intel_context.c
> +++ b/src/mesa/drivers/dri/intel/intel_context.c
> @@ -836,16 +836,7 @@ intelInitContext(struct intel_context *intel,
>
> intel->RenderIndex = ~0;
>
> - switch (ctx->API) {
> - case API_OPENGL:
> - intelInitExtensions(ctx);
> - break;
> - case API_OPENGLES:
> - break;
> - case API_OPENGLES2:
> - intelInitExtensionsES2(ctx);
> - break;
> - }
> + intelInitExtensions(ctx);
>
> INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
> if (INTEL_DEBUG & DEBUG_BUFMGR)
> diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
> index 9fce737..080aa53 100644
> --- a/src/mesa/drivers/dri/intel/intel_extensions.c
> +++ b/src/mesa/drivers/dri/intel/intel_extensions.c
> @@ -100,6 +100,7 @@ intelInitExtensions(struct gl_context *ctx)
> ctx->Extensions.EXT_texture_env_combine = true;
> ctx->Extensions.EXT_texture_env_dot3 = true;
> ctx->Extensions.EXT_texture_filter_anisotropic = true;
> + ctx->Extensions.EXT_texture_format_BGRA8888 = true;
> ctx->Extensions.EXT_texture_lod_bias = true;
> ctx->Extensions.APPLE_client_storage = true;
> ctx->Extensions.APPLE_object_purgeable = true;
> @@ -160,11 +161,17 @@ intelInitExtensions(struct gl_context *ctx)
> ctx->Extensions.ATI_texture_env_combine3 = true;
> ctx->Extensions.NV_texture_env_combine4 = true;
>
> - if (driQueryOptionb(&intel->optionCache, "fragment_shader"))
> + if (driQueryOptionb(&intel->optionCache, "fragment_shader")
> + || ctx->API == API_OPENGLES2)
> ctx->Extensions.ARB_fragment_shader = true;
>
> if (driQueryOptionb(&intel->optionCache, "stub_occlusion_query"))
> ctx->Extensions.ARB_occlusion_query = true;
> +
> + /* i915-like hardware cannot do partial derivatives. Core Mesa enables
> + * this extension default, so it must be specificially disabled here.
> + */
> + ctx->Extensions.OES_standard_derivatives = intel->gen > 3;
> }
>
> if (intel->ctx.Mesa_DXTn) {
> diff --git a/src/mesa/drivers/dri/intel/intel_extensions_es2.c b/src/mesa/drivers/dri/intel/intel_extensions_es2.c
> deleted file mode 100644
> index 5ef6b05..0000000
> --- a/src/mesa/drivers/dri/intel/intel_extensions_es2.c
> +++ /dev/null
> @@ -1,110 +0,0 @@
> -/**************************************************************************
> - *
> - * 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 "main/mfeatures.h"
> -
> -#include "intel_extensions.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_framebuffer_blit",
> - "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",
> - "GL_NV_blend_square",
> -
> - /* Optional GLES2 */
> - "GL_ARB_framebuffer_object",
> - "GL_EXT_texture_filter_anisotropic",
> - "GL_ARB_depth_texture",
> - "GL_EXT_packed_depth_stencil",
> - "GL_EXT_framebuffer_object",
> - "GL_EXT_texture_format_BGRA8888",
> -
> -#if FEATURE_OES_EGL_image
> - "GL_OES_EGL_image",
> -#endif
> -
> - NULL,
> -};
> -
> -/**
> - * \brief Extensions to disable.
> - *
> - * These extensions must be manually disabled because they may have been
> - * enabled by default.
> - */
> -static const char* es2_extensions_disabled[] = {
> - "GL_OES_standard_derivatives",
> - NULL,
> -};
> -
> -/**
> - * Initializes potential list of extensions if ctx == NULL, or actually enables
> - * extensions for a context.
> - */
> -void
> -intelInitExtensionsES2(struct gl_context *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]);
> - for (i = 0; es2_extensions_disabled[i]; i++)
> - _mesa_disable_extension(ctx, es2_extensions_disabled[i]);
> -}
> --
> 1.7.4.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
--
olv at LunarG.com
More information about the mesa-dev
mailing list