1 /**************************************************************************
2  *
3  * Copyright 2003 VMware, Inc.
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 VMWARE 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/version.h"
29 
30 #include "intel_chipset.h"
31 #include "intel_context.h"
32 #include "intel_extensions.h"
33 #include "intel_reg.h"
34 #include "utils.h"
35 
36 /**
37  * Initializes potential list of extensions if ctx == NULL, or actually enables
38  * extensions for a context.
39  */
40 void
41 intelInitExtensions(struct gl_context *ctx)
42 {
43    struct intel_context *intel = intel_context(ctx);
44 
45    assert(intel->gen == 2 || intel->gen == 3);
46 
47    ctx->Extensions.ARB_draw_elements_base_vertex = true;
48    ctx->Extensions.ARB_explicit_attrib_location = true;
49    ctx->Extensions.ARB_explicit_uniform_location = true;
50    ctx->Extensions.ARB_framebuffer_object = true;
51    ctx->Extensions.ARB_internalformat_query = true;
52    ctx->Extensions.ARB_map_buffer_range = true;
53    ctx->Extensions.ARB_point_sprite = true;
54    ctx->Extensions.ARB_sync = true;
55    ctx->Extensions.ARB_texture_border_clamp = true;
56    ctx->Extensions.ARB_texture_cube_map = true;
57    ctx->Extensions.ARB_texture_env_combine = true;
58    ctx->Extensions.ARB_texture_env_crossbar = true;
59    ctx->Extensions.ARB_texture_env_dot3 = true;
60    ctx->Extensions.ARB_vertex_program = true;
61    ctx->Extensions.ARB_vertex_shader = true;
62    ctx->Extensions.EXT_blend_color = true;
63    ctx->Extensions.EXT_blend_equation_separate = true;
64    ctx->Extensions.EXT_blend_func_separate = true;
65    ctx->Extensions.EXT_blend_minmax = true;
66    ctx->Extensions.EXT_gpu_program_parameters = true;
67    ctx->Extensions.EXT_pixel_buffer_object = true;
68    ctx->Extensions.EXT_point_parameters = true;
69    ctx->Extensions.EXT_provoking_vertex = true;
70    ctx->Extensions.EXT_texture_env_dot3 = true;
71    ctx->Extensions.EXT_texture_filter_anisotropic = true;
72    ctx->Extensions.APPLE_object_purgeable = true;
73    ctx->Extensions.MESA_pack_invert = true;
74    ctx->Extensions.MESA_ycbcr_texture = true;
75    ctx->Extensions.NV_texture_rectangle = true;
76    ctx->Extensions.TDFX_texture_compression_FXT1 = true;
77    ctx->Extensions.OES_EGL_image = true;
78    ctx->Extensions.OES_draw_texture = true;
79 
80    ctx->Const.GLSLVersion = 120;
81    _mesa_override_glsl_version(&ctx->Const);
82 
83    if (intel->gen >= 3) {
84       ctx->Extensions.ARB_ES2_compatibility = true;
85       ctx->Extensions.ARB_depth_texture = true;
86       ctx->Extensions.ARB_fragment_program = true;
87       ctx->Extensions.ARB_shadow = true;
88       ctx->Extensions.ARB_texture_non_power_of_two = true;
89       ctx->Extensions.EXT_texture_sRGB = true;
90       ctx->Extensions.EXT_texture_sRGB_decode = true;
91       ctx->Extensions.EXT_stencil_two_side = true;
92       ctx->Extensions.ATI_separate_stencil = true;
93       ctx->Extensions.ATI_texture_env_combine3 = true;
94       ctx->Extensions.NV_texture_env_combine4 = true;
95       ctx->Extensions.ARB_fragment_shader = true;
96       ctx->Extensions.ARB_occlusion_query = true;
97    }
98 
99    if (intel->ctx.Mesa_DXTn
100        || driQueryOptionb(&intel->optionCache, "force_s3tc_enable"))
101       ctx->Extensions.EXT_texture_compression_s3tc = true;
102 
103    ctx->Extensions.ANGLE_texture_compression_dxt = true;
104 }
105