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