26
26
**************************************************************************/
28
28
#include "main/mfeatures.h"
29
#include "main/version.h"
30
31
#include "intel_chipset.h"
31
32
#include "intel_context.h"
32
33
#include "intel_extensions.h"
36
#define need_GL_ARB_ES2_compatibility
37
#define need_GL_ARB_draw_elements_base_vertex
38
#define need_GL_ARB_framebuffer_object
39
#define need_GL_ARB_map_buffer_range
40
#define need_GL_ARB_occlusion_query
41
#define need_GL_ARB_point_parameters
42
#define need_GL_ARB_shader_objects
43
#define need_GL_ARB_sync
44
#define need_GL_ARB_vertex_array_object
45
#define need_GL_ARB_vertex_program
46
#define need_GL_ARB_vertex_shader
47
#define need_GL_ARB_window_pos
48
#define need_GL_EXT_blend_color
49
#define need_GL_EXT_blend_equation_separate
50
#define need_GL_EXT_blend_func_separate
51
#define need_GL_EXT_blend_minmax
52
#define need_GL_EXT_draw_buffers2
53
#define need_GL_EXT_fog_coord
54
#define need_GL_EXT_framebuffer_blit
55
#define need_GL_EXT_framebuffer_multisample
56
#define need_GL_EXT_framebuffer_object
57
#define need_GL_EXT_gpu_program_parameters
58
#define need_GL_EXT_point_parameters
59
#define need_GL_EXT_provoking_vertex
60
#define need_GL_EXT_secondary_color
61
#define need_GL_EXT_separate_shader_objects
62
#define need_GL_EXT_stencil_two_side
63
#define need_GL_EXT_timer_query
64
#define need_GL_APPLE_vertex_array_object
65
#define need_GL_APPLE_object_purgeable
66
#define need_GL_ATI_separate_stencil
67
#define need_GL_ATI_envmap_bumpmap
68
#define need_GL_NV_point_sprite
69
#define need_GL_NV_vertex_program
70
#define need_GL_OES_EGL_image
71
#define need_GL_VERSION_2_0
72
#define need_GL_VERSION_2_1
74
#include "main/remap_helper.h"
78
* Extension strings exported by the intel driver.
80
* Extensions supported by all chips supported by i830_dri, i915_dri, or
83
static const struct dri_extension card_extensions[] = {
84
{ "GL_ARB_ES2_compatibility", GL_ARB_ES2_compatibility_functions },
85
{ "GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions },
86
{ "GL_ARB_explicit_attrib_location", NULL },
87
{ "GL_ARB_framebuffer_object", GL_ARB_framebuffer_object_functions},
88
{ "GL_ARB_half_float_pixel", NULL },
89
{ "GL_ARB_map_buffer_range", GL_ARB_map_buffer_range_functions },
90
{ "GL_ARB_multitexture", NULL },
91
{ "GL_ARB_pixel_buffer_object", NULL },
92
{ "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
93
{ "GL_ARB_point_sprite", NULL },
94
{ "GL_ARB_sampler_objects", NULL },
95
{ "GL_ARB_shader_objects", GL_ARB_shader_objects_functions },
96
{ "GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
97
{ "GL_ARB_sync", GL_ARB_sync_functions },
98
{ "GL_ARB_texture_border_clamp", NULL },
99
{ "GL_ARB_texture_cube_map", NULL },
100
{ "GL_ARB_texture_env_add", NULL },
101
{ "GL_ARB_texture_env_combine", NULL },
102
{ "GL_ARB_texture_env_crossbar", NULL },
103
{ "GL_ARB_texture_env_dot3", NULL },
104
{ "GL_ARB_texture_mirrored_repeat", NULL },
105
{ "GL_ARB_texture_rectangle", NULL },
106
{ "GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions},
107
{ "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
108
{ "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions },
109
{ "GL_ARB_window_pos", GL_ARB_window_pos_functions },
110
{ "GL_EXT_blend_color", GL_EXT_blend_color_functions },
111
{ "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions },
112
{ "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions },
113
{ "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions },
114
{ "GL_EXT_blend_logic_op", NULL },
115
{ "GL_EXT_blend_subtract", NULL },
116
{ "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions },
117
{ "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
118
{ "GL_EXT_framebuffer_multisample", GL_EXT_framebuffer_multisample_functions },
119
{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
120
{ "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions },
121
{ "GL_EXT_packed_depth_stencil", NULL },
122
{ "GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions },
123
{ "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
124
{ "GL_EXT_separate_shader_objects", GL_EXT_separate_shader_objects_functions },
125
{ "GL_EXT_stencil_wrap", NULL },
126
{ "GL_EXT_texture_edge_clamp", NULL },
127
{ "GL_EXT_texture_env_combine", NULL },
128
{ "GL_EXT_texture_env_dot3", NULL },
129
{ "GL_EXT_texture_filter_anisotropic", NULL },
130
{ "GL_EXT_texture_lod_bias", NULL },
131
{ "GL_3DFX_texture_compression_FXT1", NULL },
132
{ "GL_APPLE_client_storage", NULL },
133
{ "GL_APPLE_object_purgeable", GL_APPLE_object_purgeable_functions },
134
{ "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions},
135
{ "GL_MESA_pack_invert", NULL },
136
{ "GL_MESA_ycbcr_texture", NULL },
137
{ "GL_NV_blend_square", NULL },
138
{ "GL_NV_vertex_program", GL_NV_vertex_program_functions },
139
{ "GL_NV_vertex_program1_1", NULL },
140
#if FEATURE_OES_EGL_image
141
{ "GL_OES_EGL_image", GL_OES_EGL_image_functions },
147
/** i915 / i945-only extensions */
148
static const struct dri_extension i915_extensions[] = {
149
{ "GL_ARB_depth_texture", NULL },
150
{ "GL_ARB_fragment_program", NULL },
151
{ "GL_ARB_shadow", NULL },
152
{ "GL_ARB_texture_non_power_of_two", NULL },
153
{ "GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions },
154
{ "GL_ATI_texture_env_combine3", NULL },
155
{ "GL_EXT_shadow_funcs", NULL },
156
{ "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions },
157
{ "GL_NV_texture_env_combine4", NULL },
162
/** i965-only extensions */
163
static const struct dri_extension brw_extensions[] = {
164
{ "GL_ARB_color_buffer_float", NULL },
165
{ "GL_ARB_depth_clamp", NULL },
166
{ "GL_ARB_depth_texture", NULL },
167
{ "GL_ARB_fragment_coord_conventions", NULL },
168
{ "GL_ARB_fragment_program", NULL },
169
{ "GL_ARB_fragment_program_shadow", NULL },
170
{ "GL_ARB_fragment_shader", NULL },
171
{ "GL_ARB_half_float_vertex", NULL },
172
{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions },
173
{ "GL_ARB_point_sprite", NULL },
174
{ "GL_ARB_seamless_cube_map", NULL },
175
{ "GL_ARB_shader_texture_lod", NULL },
176
{ "GL_ARB_shadow", NULL },
177
#ifdef TEXTURE_FLOAT_ENABLED
178
{ "GL_ARB_texture_float", NULL },
180
{ "GL_MESA_texture_signed_rgba", NULL },
181
{ "GL_ARB_texture_compression_rgtc", NULL },
182
{ "GL_ARB_texture_non_power_of_two", NULL },
183
{ "GL_ARB_texture_rg", NULL },
184
{ "GL_EXT_draw_buffers2", GL_EXT_draw_buffers2_functions },
185
{ "GL_EXT_framebuffer_sRGB", NULL },
186
{ "GL_EXT_shadow_funcs", NULL },
187
{ "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions },
188
{ "GL_EXT_texture_sRGB", NULL },
189
{ "GL_EXT_texture_sRGB_decode", NULL },
190
{ "GL_EXT_texture_swizzle", NULL },
191
{ "GL_EXT_vertex_array_bgra", NULL },
192
{ "GL_ATI_envmap_bumpmap", GL_ATI_envmap_bumpmap_functions },
193
{ "GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions },
194
{ "GL_ATI_texture_env_combine3", NULL },
195
{ "GL_NV_conditional_render", NULL },
196
{ "GL_NV_texture_env_combine4", NULL },
200
static const struct dri_extension ironlake_extensions[] = {
201
{ "GL_EXT_timer_query", GL_EXT_timer_query_functions },
204
static const struct dri_extension arb_oq_extensions[] = {
205
{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions },
210
static const struct dri_extension fragment_shader_extensions[] = {
211
{ "GL_ARB_fragment_shader", NULL },
216
* \brief Get GLSL version from the environment.
218
* If the environment variable INTEL_GLSL_VERSION is set, convert its value
219
* to an integer and return it. Otherwise, return the default version, 120.
224
const char * s = getenv("INTEL_GLSL_VERSION");
228
return (GLuint) atoi(s);
232
37
* Initializes potential list of extensions if ctx == NULL, or actually enables
233
38
* extensions for a context.
238
43
struct intel_context *intel = intel_context(ctx);
240
driInitExtensions(ctx, card_extensions, GL_FALSE);
242
_mesa_map_function_array(GL_VERSION_2_1_functions);
244
ctx->Const.GLSLVersion = get_glsl_version();
45
ctx->Extensions.ARB_draw_elements_base_vertex = true;
46
ctx->Extensions.ARB_explicit_attrib_location = true;
47
ctx->Extensions.ARB_framebuffer_object = true;
48
ctx->Extensions.ARB_half_float_pixel = true;
49
ctx->Extensions.ARB_map_buffer_range = true;
50
ctx->Extensions.ARB_point_sprite = true;
51
ctx->Extensions.ARB_sampler_objects = true;
52
ctx->Extensions.ARB_shader_objects = true;
53
ctx->Extensions.ARB_shading_language_100 = 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_array_object = true;
61
ctx->Extensions.ARB_vertex_program = true;
62
ctx->Extensions.ARB_vertex_shader = true;
63
ctx->Extensions.EXT_blend_color = true;
64
ctx->Extensions.EXT_blend_equation_separate = true;
65
ctx->Extensions.EXT_blend_func_separate = true;
66
ctx->Extensions.EXT_blend_minmax = true;
67
ctx->Extensions.EXT_framebuffer_blit = true;
68
ctx->Extensions.EXT_framebuffer_object = true;
69
ctx->Extensions.EXT_framebuffer_multisample = true;
70
ctx->Extensions.EXT_fog_coord = true;
71
ctx->Extensions.EXT_gpu_program_parameters = true;
72
ctx->Extensions.EXT_packed_depth_stencil = true;
73
ctx->Extensions.EXT_pixel_buffer_object = true;
74
ctx->Extensions.EXT_point_parameters = true;
75
ctx->Extensions.EXT_provoking_vertex = true;
76
ctx->Extensions.EXT_secondary_color = true;
77
ctx->Extensions.EXT_separate_shader_objects = true;
78
ctx->Extensions.EXT_texture_env_dot3 = true;
79
ctx->Extensions.EXT_texture_filter_anisotropic = true;
80
ctx->Extensions.APPLE_object_purgeable = true;
81
ctx->Extensions.APPLE_vertex_array_object = true;
82
ctx->Extensions.MESA_pack_invert = true;
83
ctx->Extensions.MESA_ycbcr_texture = true;
84
ctx->Extensions.NV_blend_square = true;
85
ctx->Extensions.NV_texture_rectangle = true;
86
ctx->Extensions.NV_vertex_program = true;
87
ctx->Extensions.NV_vertex_program1_1 = true;
88
ctx->Extensions.TDFX_texture_compression_FXT1 = true;
89
#if FEATURE_OES_EGL_image
90
ctx->Extensions.OES_EGL_image = true;
94
ctx->Const.GLSLVersion = 130;
96
ctx->Const.GLSLVersion = 120;
97
_mesa_override_glsl_version(ctx);
99
if (intel->gen == 6 ||
100
(intel->gen == 7 && intel->intelScreen->kernel_has_gen7_sol_reset))
101
ctx->Extensions.EXT_transform_feedback = true;
246
103
if (intel->gen >= 5)
247
driInitExtensions(ctx, ironlake_extensions, GL_FALSE);
250
driInitExtensions(ctx, brw_extensions, GL_FALSE);
252
if (intel->gen == 3) {
253
driInitExtensions(ctx, i915_extensions, GL_FALSE);
104
ctx->Extensions.EXT_timer_query = true;
106
if (intel->gen >= 4) {
107
ctx->Extensions.ARB_color_buffer_float = true;
108
ctx->Extensions.ARB_depth_buffer_float = true;
109
ctx->Extensions.ARB_depth_clamp = true;
110
ctx->Extensions.ARB_fragment_coord_conventions = true;
111
ctx->Extensions.ARB_fragment_program_shadow = true;
112
ctx->Extensions.ARB_fragment_shader = true;
113
ctx->Extensions.ARB_half_float_vertex = true;
114
ctx->Extensions.ARB_occlusion_query = true;
115
ctx->Extensions.ARB_point_sprite = true;
116
ctx->Extensions.ARB_seamless_cube_map = true;
117
ctx->Extensions.ARB_shader_texture_lod = true;
118
#ifdef TEXTURE_FLOAT_ENABLED
119
ctx->Extensions.ARB_texture_float = true;
120
ctx->Extensions.EXT_texture_shared_exponent = true;
121
ctx->Extensions.EXT_packed_float = true;
123
ctx->Extensions.ARB_texture_compression_rgtc = true;
124
ctx->Extensions.ARB_texture_rg = true;
125
ctx->Extensions.EXT_draw_buffers2 = true;
126
ctx->Extensions.EXT_framebuffer_sRGB = true;
127
ctx->Extensions.EXT_texture_array = true;
128
ctx->Extensions.EXT_texture_integer = true;
129
ctx->Extensions.EXT_texture_snorm = true;
130
ctx->Extensions.EXT_texture_sRGB = true;
131
ctx->Extensions.EXT_texture_sRGB_decode = true;
132
ctx->Extensions.EXT_texture_swizzle = true;
133
ctx->Extensions.EXT_vertex_array_bgra = true;
134
ctx->Extensions.ATI_envmap_bumpmap = true;
135
ctx->Extensions.MESA_texture_array = true;
136
ctx->Extensions.NV_conditional_render = true;
139
if (intel->gen >= 3) {
140
ctx->Extensions.ARB_ES2_compatibility = true;
141
ctx->Extensions.ARB_depth_texture = true;
142
ctx->Extensions.ARB_fragment_program = true;
143
ctx->Extensions.ARB_shadow = true;
144
ctx->Extensions.ARB_texture_non_power_of_two = true;
145
ctx->Extensions.EXT_shadow_funcs = true;
146
ctx->Extensions.EXT_stencil_two_side = true;
147
ctx->Extensions.ATI_separate_stencil = true;
148
ctx->Extensions.ATI_texture_env_combine3 = true;
149
ctx->Extensions.NV_texture_env_combine4 = true;
255
151
if (driQueryOptionb(&intel->optionCache, "fragment_shader"))
256
driInitExtensions(ctx, fragment_shader_extensions, GL_FALSE);
152
ctx->Extensions.ARB_fragment_shader = true;
258
154
if (driQueryOptionb(&intel->optionCache, "stub_occlusion_query"))
259
driInitExtensions(ctx, arb_oq_extensions, GL_FALSE);
155
ctx->Extensions.ARB_occlusion_query = true;
158
if (intel->ctx.Mesa_DXTn) {
159
ctx->Extensions.EXT_texture_compression_s3tc = true;
160
ctx->Extensions.S3_s3tc = true;
162
else if (driQueryOptionb(&intel->optionCache, "force_s3tc_enable")) {
163
ctx->Extensions.EXT_texture_compression_s3tc = true;