intel_extensions.c revision 2d5c74fac3cc0f9d45a9e11b2fcdea1bc67928c4
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 "intel_chipset.h"
29#include "intel_context.h"
30#include "intel_extensions.h"
31
32
33#define need_GL_ARB_copy_buffer
34#define need_GL_ARB_framebuffer_object
35#define need_GL_ARB_map_buffer_range
36#define need_GL_ARB_occlusion_query
37#define need_GL_ARB_point_parameters
38#define need_GL_ARB_shader_objects
39#define need_GL_ARB_vertex_array_object
40#define need_GL_ARB_vertex_program
41#define need_GL_ARB_vertex_shader
42#define need_GL_ARB_window_pos
43#define need_GL_EXT_blend_color
44#define need_GL_EXT_blend_equation_separate
45#define need_GL_EXT_blend_func_separate
46#define need_GL_EXT_blend_minmax
47#define need_GL_EXT_cull_vertex
48#define need_GL_EXT_fog_coord
49#define need_GL_EXT_framebuffer_object
50#define need_GL_EXT_framebuffer_blit
51#define need_GL_EXT_gpu_program_parameters
52#define need_GL_EXT_point_parameters
53#define need_GL_EXT_provoking_vertex
54#define need_GL_EXT_secondary_color
55#define need_GL_EXT_stencil_two_side
56#define need_GL_APPLE_vertex_array_object
57#define need_GL_ATI_separate_stencil
58#define need_GL_ATI_envmap_bumpmap
59#define need_GL_NV_point_sprite
60#define need_GL_NV_vertex_program
61#define need_GL_VERSION_2_0
62#define need_GL_VERSION_2_1
63
64#include "extension_helper.h"
65
66
67/**
68 * Extension strings exported by the intel driver.
69 *
70 * Extensions supported by all chips supported by i830_dri, i915_dri, or
71 * i965_dri.
72 */
73static const struct dri_extension card_extensions[] = {
74   { "GL_ARB_copy_buffer",                GL_ARB_copy_buffer_functions },
75   { "GL_ARB_half_float_pixel",           NULL },
76   { "GL_ARB_map_buffer_range",           GL_ARB_map_buffer_range_functions },
77   { "GL_ARB_multitexture",               NULL },
78   { "GL_ARB_point_parameters",           GL_ARB_point_parameters_functions },
79   { "GL_ARB_point_sprite",               NULL },
80   { "GL_ARB_texture_border_clamp",       NULL },
81   { "GL_ARB_texture_cube_map",           NULL },
82   { "GL_ARB_texture_env_add",            NULL },
83   { "GL_ARB_texture_env_combine",        NULL },
84   { "GL_ARB_texture_env_crossbar",       NULL },
85   { "GL_ARB_texture_env_dot3",           NULL },
86   { "GL_ARB_texture_mirrored_repeat",    NULL },
87   { "GL_ARB_texture_rectangle",          NULL },
88   { "GL_ARB_vertex_array_object",        GL_ARB_vertex_array_object_functions},
89   { "GL_ARB_vertex_program",             GL_ARB_vertex_program_functions },
90   { "GL_ARB_window_pos",                 GL_ARB_window_pos_functions },
91   { "GL_EXT_blend_color",                GL_EXT_blend_color_functions },
92   { "GL_EXT_blend_equation_separate",    GL_EXT_blend_equation_separate_functions },
93   { "GL_EXT_blend_func_separate",        GL_EXT_blend_func_separate_functions },
94   { "GL_EXT_blend_minmax",               GL_EXT_blend_minmax_functions },
95   { "GL_EXT_blend_logic_op",             NULL },
96   { "GL_EXT_blend_subtract",             NULL },
97   { "GL_EXT_cull_vertex",                GL_EXT_cull_vertex_functions },
98   { "GL_EXT_fog_coord",                  GL_EXT_fog_coord_functions },
99   { "GL_EXT_gpu_program_parameters",     GL_EXT_gpu_program_parameters_functions },
100   { "GL_EXT_packed_depth_stencil",       NULL },
101   { "GL_EXT_provoking_vertex",           GL_EXT_provoking_vertex_functions },
102   { "GL_EXT_secondary_color",            GL_EXT_secondary_color_functions },
103   { "GL_EXT_stencil_wrap",               NULL },
104   { "GL_EXT_texture_edge_clamp",         NULL },
105   { "GL_EXT_texture_env_combine",        NULL },
106   { "GL_EXT_texture_env_dot3",           NULL },
107   { "GL_EXT_texture_filter_anisotropic", NULL },
108   { "GL_EXT_texture_lod_bias",           NULL },
109   { "GL_3DFX_texture_compression_FXT1",  NULL },
110   { "GL_APPLE_client_storage",           NULL },
111   { "GL_APPLE_vertex_array_object",      GL_APPLE_vertex_array_object_functions},
112   { "GL_MESA_pack_invert",               NULL },
113   { "GL_MESA_ycbcr_texture",             NULL },
114   { "GL_NV_blend_square",                NULL },
115   { "GL_NV_point_sprite",                GL_NV_point_sprite_functions },
116   { "GL_NV_vertex_program",              GL_NV_vertex_program_functions },
117   { "GL_NV_vertex_program1_1",           NULL },
118   { "GL_SGIS_generate_mipmap",           NULL },
119   { NULL, NULL }
120};
121
122
123/** i915 / i945-only extensions */
124static const struct dri_extension i915_extensions[] = {
125   { "GL_ARB_depth_texture",              NULL },
126   { "GL_ARB_fragment_program",           NULL },
127   { "GL_ARB_shadow",                     NULL },
128   { "GL_ARB_texture_non_power_of_two",   NULL },
129   { "GL_ATI_separate_stencil",           GL_ATI_separate_stencil_functions },
130   { "GL_ATI_texture_env_combine3",       NULL },
131   { "GL_EXT_shadow_funcs",               NULL },
132   { "GL_EXT_stencil_two_side",           GL_EXT_stencil_two_side_functions },
133   { "GL_NV_texture_env_combine4",        NULL },
134   { NULL,                                NULL }
135};
136
137
138/** i965-only extensions */
139static const struct dri_extension brw_extensions[] = {
140   { "GL_ARB_depth_texture",              NULL },
141   { "GL_ARB_fragment_program",           NULL },
142   { "GL_ARB_fragment_program_shadow",    NULL },
143   { "GL_ARB_fragment_shader",            NULL },
144   { "GL_ARB_framebuffer_object",         GL_ARB_framebuffer_object_functions},
145   { "GL_ARB_occlusion_query",            GL_ARB_occlusion_query_functions },
146   { "GL_ARB_point_sprite", 		  NULL },
147   { "GL_ARB_seamless_cube_map",          NULL },
148   { "GL_ARB_shader_objects",             GL_ARB_shader_objects_functions },
149   { "GL_ARB_shading_language_100",       GL_VERSION_2_0_functions },
150   { "GL_ARB_shading_language_120",       GL_VERSION_2_1_functions },
151   { "GL_ARB_shadow",                     NULL },
152   { "GL_MESA_texture_signed_rgba",       NULL },
153   { "GL_ARB_texture_non_power_of_two",   NULL },
154   { "GL_ARB_vertex_shader",              GL_ARB_vertex_shader_functions },
155   { "GL_EXT_shadow_funcs",               NULL },
156   { "GL_EXT_stencil_two_side",           GL_EXT_stencil_two_side_functions },
157   { "GL_EXT_texture_sRGB",		  NULL },
158   { "GL_EXT_texture_swizzle",		  NULL },
159   { "GL_EXT_vertex_array_bgra",	  NULL },
160   { "GL_ATI_envmap_bumpmap",             GL_ATI_envmap_bumpmap_functions },
161   { "GL_ATI_separate_stencil",           GL_ATI_separate_stencil_functions },
162   { "GL_ATI_texture_env_combine3",       NULL },
163   { "GL_NV_texture_env_combine4",        NULL },
164   { NULL,                                NULL }
165};
166
167
168static const struct dri_extension arb_oq_extensions[] = {
169   { NULL, NULL }
170};
171
172
173static const struct dri_extension ttm_extensions[] = {
174   { "GL_ARB_pixel_buffer_object",      NULL },
175   { "GL_EXT_framebuffer_blit",         GL_EXT_framebuffer_blit_functions },
176   { "GL_EXT_framebuffer_object",       GL_EXT_framebuffer_object_functions },
177   { NULL, NULL }
178};
179
180
181/**
182 * Initializes potential list of extensions if ctx == NULL, or actually enables
183 * extensions for a context.
184 */
185void
186intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging)
187{
188   struct intel_context *intel = ctx?intel_context(ctx):NULL;
189
190   /* Disable imaging extension until convolution is working in teximage paths.
191    */
192   enable_imaging = GL_FALSE;
193
194   driInitExtensions(ctx, card_extensions, enable_imaging);
195
196   if (intel == NULL || intel->ttm)
197      driInitExtensions(ctx, ttm_extensions, GL_FALSE);
198
199   if (intel == NULL || IS_965(intel->intelScreen->deviceID))
200      driInitExtensions(ctx, brw_extensions, GL_FALSE);
201
202   if (intel == NULL || IS_915(intel->intelScreen->deviceID)
203       || IS_945(intel->intelScreen->deviceID))
204      driInitExtensions(ctx, i915_extensions, GL_FALSE);
205}
206