Tizen 2.0 Release
[profile/ivi/osmesa.git] / src / mesa / drivers / dri / intel / intel_extensions_es.c
1 /**************************************************************************
2  * 
3  * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
4  * All Rights Reserved.
5  * 
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  * 
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  * 
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  * 
26  **************************************************************************/
27
28 #include "main/extensions.h"
29 #include "main/mfeatures.h"
30
31 #include "intel_extensions.h"
32
33 static const char *common_extensions[] = {
34    /* Used by mesa internally (cf all_mesa_extensions in ../common/utils.c) */
35    "GL_ARB_draw_buffers",
36    "GL_ARB_multisample",
37    "GL_ARB_texture_compression",
38    "GL_ARB_transpose_matrix",
39    "GL_ARB_vertex_buffer_object",
40    "GL_ARB_window_pos",
41    "GL_EXT_blend_func_separate",
42    "GL_EXT_compiled_vertex_array",
43    "GL_EXT_framebuffer_blit",
44    "GL_EXT_multi_draw_arrays",
45    "GL_EXT_polygon_offset",
46    "GL_EXT_texture_object",
47    "GL_EXT_vertex_array",
48    "GL_IBM_multimode_draw_arrays",
49    "GL_MESA_window_pos",
50    "GL_NV_vertex_program",
51
52    /* Optional GLES1 or GLES2 */
53 #if FEATURE_OES_EGL_image
54    "GL_OES_EGL_image",
55 #endif
56    "GL_EXT_texture_filter_anisotropic",
57    "GL_EXT_packed_depth_stencil",
58    "GL_EXT_texture_format_BGRA8888",
59    "GL_EXT_blend_minmax",
60
61    NULL
62 };
63
64 static const char *es1_extensions[] = {
65    /* Required by GLES1 */
66    "GL_ARB_multitexture",
67    "GL_ARB_texture_env_add",
68    "GL_ARB_texture_env_combine",
69    "GL_ARB_texture_env_dot3",
70    "GL_ARB_point_parameters",
71
72    /* Optional GLES1 */
73    "GL_EXT_blend_equation_separate",
74    "GL_EXT_blend_func_separate",
75    "GL_EXT_blend_subtract",
76    "GL_ARB_framebuffer_object",
77    "GL_EXT_framebuffer_object",
78    "GL_ARB_point_sprite",
79    "GL_EXT_stencil_wrap",
80    "GL_ARB_texture_cube_map",
81    "GL_ARB_texture_env_crossbar",
82    "GL_ARB_texture_mirrored_repeat",
83    "GL_EXT_texture_lod_bias",
84
85    NULL
86 };
87
88 static const char *es2_extensions[] = {
89    /* Required by GLES2 */
90    "GL_ARB_fragment_program",
91    "GL_ARB_fragment_shader",
92    "GL_ARB_multitexture",
93    "GL_ARB_shader_objects",
94    "GL_ARB_texture_cube_map",
95    "GL_ARB_texture_mirrored_repeat",
96    "GL_ARB_texture_non_power_of_two",
97    "GL_ARB_vertex_shader",
98    "GL_EXT_blend_color",
99    "GL_EXT_blend_equation_separate",
100    "GL_EXT_blend_minmax",
101    "GL_EXT_blend_subtract",
102    "GL_EXT_stencil_wrap",
103    "GL_NV_blend_square",
104
105    /* Optional GLES2 */
106    "GL_ARB_framebuffer_object",
107    "GL_ARB_depth_texture",
108    "GL_EXT_framebuffer_object",
109
110    NULL,
111 };
112
113 void
114 intelInitExtensionsES1(struct gl_context *ctx)
115 {
116    int i;
117
118    /* Can't use driInitExtensions() since it uses extensions from
119     * main/remap_helper.h when called the first time. */
120
121    for (i = 0; common_extensions[i]; i++)
122       _mesa_enable_extension(ctx, common_extensions[i]);
123    for (i = 0; es1_extensions[i]; i++)
124       _mesa_enable_extension(ctx, es1_extensions[i]);
125 }
126
127 /**
128  * \brief Extensions to disable.
129  *
130  * These extensions must be manually disabled because they may have been
131  * enabled by default.
132  */
133 static const char* es2_extensions_disabled[] = {
134    "GL_OES_standard_derivatives",
135    NULL,
136 };
137
138 /**
139  * Initializes potential list of extensions if ctx == NULL, or actually enables
140  * extensions for a context.
141  */
142 void
143 intelInitExtensionsES2(struct gl_context *ctx)
144 {
145    int i;
146
147    /* Can't use driInitExtensions() since it uses extensions from
148     * main/remap_helper.h when called the first time. */
149
150    for (i = 0; common_extensions[i]; i++)
151       _mesa_enable_extension(ctx, common_extensions[i]);
152    for (i = 0; es2_extensions[i]; i++)
153       _mesa_enable_extension(ctx, es2_extensions[i]);
154    for (i = 0; es2_extensions_disabled[i]; i++)
155       _mesa_disable_extension(ctx, es2_extensions_disabled[i]);
156 }