intel_extensions.c revision 71ceccad7e36f23e33d340fa0da157e2e0d2b6ac
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/mfeatures.h"
29
30#include "intel_chipset.h"
31#include "intel_context.h"
32#include "intel_extensions.h"
33#include "utils.h"
34
35/**
36 * \brief Get GLSL version from the environment.
37 *
38 * If the environment variable INTEL_GLSL_VERSION is set, convert its value
39 * to an integer and return it. Otherwise, return the default version, 120.
40 */
41static GLuint
42get_glsl_version()
43{
44    const char * s = getenv("INTEL_GLSL_VERSION");
45    if (s == NULL)
46        return 120;
47    else
48        return (GLuint) atoi(s);
49}
50
51/**
52 * Initializes potential list of extensions if ctx == NULL, or actually enables
53 * extensions for a context.
54 */
55void
56intelInitExtensions(struct gl_context *ctx)
57{
58   struct intel_context *intel = intel_context(ctx);
59
60   ctx->Extensions.ARB_draw_elements_base_vertex = true;
61   ctx->Extensions.ARB_explicit_attrib_location = true;
62   ctx->Extensions.ARB_framebuffer_object = true;
63   ctx->Extensions.ARB_half_float_pixel = true;
64   ctx->Extensions.ARB_map_buffer_range = true;
65   ctx->Extensions.ARB_multitexture = true;
66   ctx->Extensions.ARB_point_sprite = true;
67   ctx->Extensions.ARB_sampler_objects = true;
68   ctx->Extensions.ARB_shader_objects = true;
69   ctx->Extensions.ARB_shading_language_100 = true;
70   ctx->Extensions.ARB_sync = true;
71   ctx->Extensions.ARB_texture_border_clamp = true;
72   ctx->Extensions.ARB_texture_cube_map = true;
73   ctx->Extensions.ARB_texture_env_combine = true;
74   ctx->Extensions.ARB_texture_env_crossbar = true;
75   ctx->Extensions.ARB_texture_env_dot3 = true;
76   ctx->Extensions.ARB_texture_mirrored_repeat = true;
77   ctx->Extensions.ARB_vertex_array_object = true;
78   ctx->Extensions.ARB_vertex_program = true;
79   ctx->Extensions.ARB_vertex_shader = true;
80   ctx->Extensions.ARB_window_pos = true;
81   ctx->Extensions.EXT_blend_color = true;
82   ctx->Extensions.EXT_blend_equation_separate = true;
83   ctx->Extensions.EXT_blend_func_separate = true;
84   ctx->Extensions.EXT_blend_minmax = true;
85   ctx->Extensions.EXT_blend_subtract = true;
86   ctx->Extensions.EXT_framebuffer_blit = true;
87   ctx->Extensions.EXT_framebuffer_object = true;
88   ctx->Extensions.EXT_framebuffer_multisample = true;
89   ctx->Extensions.EXT_fog_coord = true;
90   ctx->Extensions.EXT_gpu_program_parameters = true;
91   ctx->Extensions.EXT_packed_depth_stencil = true;
92   ctx->Extensions.EXT_pixel_buffer_object = true;
93   ctx->Extensions.EXT_point_parameters = true;
94   ctx->Extensions.EXT_provoking_vertex = true;
95   ctx->Extensions.EXT_secondary_color = true;
96   ctx->Extensions.EXT_separate_shader_objects = true;
97   ctx->Extensions.EXT_stencil_wrap = true;
98   ctx->Extensions.EXT_texture_env_add = true;
99   ctx->Extensions.EXT_texture_env_combine = true;
100   ctx->Extensions.EXT_texture_env_dot3 = true;
101   ctx->Extensions.EXT_texture_filter_anisotropic = true;
102   ctx->Extensions.EXT_texture_lod_bias = true;
103   ctx->Extensions.APPLE_client_storage = true;
104   ctx->Extensions.APPLE_object_purgeable = true;
105   ctx->Extensions.APPLE_vertex_array_object = true;
106   ctx->Extensions.MESA_pack_invert = true;
107   ctx->Extensions.MESA_ycbcr_texture = true;
108   ctx->Extensions.NV_blend_square = true;
109   ctx->Extensions.NV_texture_rectangle = true;
110   ctx->Extensions.NV_vertex_program = true;
111   ctx->Extensions.NV_vertex_program1_1 = true;
112   ctx->Extensions.SGIS_texture_edge_clamp = true;
113   ctx->Extensions.TDFX_texture_compression_FXT1 = true;
114#if FEATURE_OES_EGL_image
115   ctx->Extensions.OES_EGL_image = true;
116#endif
117
118   ctx->Const.GLSLVersion = get_glsl_version();
119
120   if (intel->gen >= 5)
121      ctx->Extensions.EXT_timer_query = true;
122
123   if (intel->gen >= 4) {
124      ctx->Extensions.ARB_color_buffer_float = true;
125      ctx->Extensions.ARB_depth_clamp = true;
126      ctx->Extensions.ARB_fragment_coord_conventions = true;
127      ctx->Extensions.ARB_fragment_program_shadow = true;
128      ctx->Extensions.ARB_fragment_shader = true;
129      ctx->Extensions.ARB_half_float_vertex = true;
130      ctx->Extensions.ARB_occlusion_query = true;
131      ctx->Extensions.ARB_point_sprite = true;
132      ctx->Extensions.ARB_seamless_cube_map = true;
133      ctx->Extensions.ARB_shader_texture_lod = true;
134#ifdef TEXTURE_FLOAT_ENABLED
135      ctx->Extensions.ARB_texture_float = true;
136#endif
137      ctx->Extensions.ARB_texture_compression_rgtc = true;
138      ctx->Extensions.ARB_texture_rg = true;
139      ctx->Extensions.EXT_draw_buffers2 = true;
140      ctx->Extensions.EXT_framebuffer_sRGB = true;
141      ctx->Extensions.EXT_texture_snorm = true;
142      ctx->Extensions.EXT_texture_sRGB = true;
143      ctx->Extensions.EXT_texture_sRGB_decode = true;
144      ctx->Extensions.EXT_texture_swizzle = true;
145      ctx->Extensions.EXT_vertex_array_bgra = true;
146      ctx->Extensions.ATI_envmap_bumpmap = true;
147      ctx->Extensions.NV_conditional_render = true;
148   }
149
150   if (intel->gen >= 3) {
151      ctx->Extensions.ARB_ES2_compatibility = true;
152      ctx->Extensions.ARB_depth_texture = true;
153      ctx->Extensions.ARB_fragment_program = true;
154      ctx->Extensions.ARB_shadow = true;
155      ctx->Extensions.ARB_texture_non_power_of_two = true;
156      ctx->Extensions.EXT_shadow_funcs = true;
157      ctx->Extensions.EXT_stencil_two_side = true;
158      ctx->Extensions.ATI_separate_stencil = true;
159      ctx->Extensions.ATI_texture_env_combine3 = true;
160      ctx->Extensions.NV_texture_env_combine4 = true;
161
162      if (driQueryOptionb(&intel->optionCache, "fragment_shader"))
163	 ctx->Extensions.ARB_fragment_shader = true;
164
165      if (driQueryOptionb(&intel->optionCache, "stub_occlusion_query"))
166	 ctx->Extensions.ARB_occlusion_query = true;
167   }
168}
169