Brian Paul | 4006c5e | 2009-01-26 12:22:04 -0700 | [diff] [blame] | 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 | |
Brian Paul | e4394fb | 2011-09-29 16:29:30 -0600 | [diff] [blame] | 28 | #include "main/version.h" |
Vinson Lee | 45a56e4 | 2011-01-09 01:25:54 -0800 | [diff] [blame] | 29 | |
Brian Paul | 4006c5e | 2009-01-26 12:22:04 -0700 | [diff] [blame] | 30 | #include "intel_chipset.h" |
| 31 | #include "intel_context.h" |
| 32 | #include "intel_extensions.h" |
Eric Anholt | f015901 | 2012-07-18 10:18:26 -0700 | [diff] [blame] | 33 | #include "intel_reg.h" |
Chia-I Wu | 17ef1f6 | 2009-10-08 10:33:57 +0800 | [diff] [blame] | 34 | #include "utils.h" |
Brian Paul | 4006c5e | 2009-01-26 12:22:04 -0700 | [diff] [blame] | 35 | |
Brian Paul | 4006c5e | 2009-01-26 12:22:04 -0700 | [diff] [blame] | 36 | /** |
| 37 | * Initializes potential list of extensions if ctx == NULL, or actually enables |
| 38 | * extensions for a context. |
| 39 | */ |
| 40 | void |
Kristian Høgsberg | f9995b3 | 2010-10-12 12:26:10 -0400 | [diff] [blame] | 41 | intelInitExtensions(struct gl_context *ctx) |
Brian Paul | 4006c5e | 2009-01-26 12:22:04 -0700 | [diff] [blame] | 42 | { |
Ian Romanick | b6b753f | 2009-11-12 15:39:59 -0800 | [diff] [blame] | 43 | struct intel_context *intel = intel_context(ctx); |
Brian Paul | 4006c5e | 2009-01-26 12:22:04 -0700 | [diff] [blame] | 44 | |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 45 | assert(intel->gen >= 4); |
| 46 | |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 47 | ctx->Extensions.ARB_depth_buffer_float = true; |
| 48 | ctx->Extensions.ARB_depth_clamp = true; |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 49 | ctx->Extensions.ARB_depth_texture = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 50 | ctx->Extensions.ARB_draw_elements_base_vertex = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 51 | ctx->Extensions.ARB_draw_instanced = true; |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 52 | ctx->Extensions.ARB_ES2_compatibility = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 53 | ctx->Extensions.ARB_explicit_attrib_location = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 54 | ctx->Extensions.ARB_fragment_coord_conventions = true; |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 55 | ctx->Extensions.ARB_fragment_program = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 56 | ctx->Extensions.ARB_fragment_program_shadow = true; |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 57 | ctx->Extensions.ARB_fragment_shader = true; |
Ian Romanick | bdba4b3 | 2012-12-01 10:56:40 -0800 | [diff] [blame] | 58 | ctx->Extensions.ARB_framebuffer_object = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 59 | ctx->Extensions.ARB_half_float_pixel = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 60 | ctx->Extensions.ARB_half_float_vertex = true; |
| 61 | ctx->Extensions.ARB_instanced_arrays = true; |
Ian Romanick | 3c00a52 | 2012-12-01 11:06:31 -0800 | [diff] [blame] | 62 | ctx->Extensions.ARB_internalformat_query = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 63 | ctx->Extensions.ARB_map_buffer_range = true; |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 64 | ctx->Extensions.ARB_occlusion_query = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 65 | ctx->Extensions.ARB_occlusion_query2 = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 66 | ctx->Extensions.ARB_point_sprite = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 67 | ctx->Extensions.ARB_seamless_cube_map = true; |
| 68 | ctx->Extensions.ARB_shader_bit_encoding = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 69 | ctx->Extensions.ARB_shader_objects = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 70 | ctx->Extensions.ARB_shader_texture_lod = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 71 | ctx->Extensions.ARB_shading_language_100 = true; |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 72 | ctx->Extensions.ARB_shadow = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 73 | ctx->Extensions.ARB_sync = true; |
| 74 | ctx->Extensions.ARB_texture_border_clamp = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 75 | ctx->Extensions.ARB_texture_compression_rgtc = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 76 | ctx->Extensions.ARB_texture_cube_map = true; |
| 77 | ctx->Extensions.ARB_texture_env_combine = true; |
| 78 | ctx->Extensions.ARB_texture_env_crossbar = true; |
| 79 | ctx->Extensions.ARB_texture_env_dot3 = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 80 | ctx->Extensions.ARB_texture_float = true; |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 81 | ctx->Extensions.ARB_texture_non_power_of_two = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 82 | ctx->Extensions.ARB_texture_rg = true; |
| 83 | ctx->Extensions.ARB_texture_rgb10_a2ui = true; |
Ian Romanick | 9bcb9fa | 2012-08-10 21:31:57 -0700 | [diff] [blame] | 84 | ctx->Extensions.ARB_texture_storage = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 85 | ctx->Extensions.ARB_vertex_program = true; |
| 86 | ctx->Extensions.ARB_vertex_shader = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 87 | ctx->Extensions.ARB_vertex_type_2_10_10_10_rev = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 88 | ctx->Extensions.EXT_blend_color = true; |
| 89 | ctx->Extensions.EXT_blend_equation_separate = true; |
| 90 | ctx->Extensions.EXT_blend_func_separate = true; |
| 91 | ctx->Extensions.EXT_blend_minmax = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 92 | ctx->Extensions.EXT_draw_buffers2 = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 93 | ctx->Extensions.EXT_framebuffer_blit = true; |
| 94 | ctx->Extensions.EXT_framebuffer_object = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 95 | ctx->Extensions.EXT_fog_coord = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 96 | ctx->Extensions.EXT_framebuffer_sRGB = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 97 | ctx->Extensions.EXT_gpu_program_parameters = true; |
| 98 | ctx->Extensions.EXT_packed_depth_stencil = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 99 | ctx->Extensions.EXT_packed_float = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 100 | ctx->Extensions.EXT_pixel_buffer_object = true; |
| 101 | ctx->Extensions.EXT_point_parameters = true; |
| 102 | ctx->Extensions.EXT_provoking_vertex = true; |
| 103 | ctx->Extensions.EXT_secondary_color = true; |
| 104 | ctx->Extensions.EXT_separate_shader_objects = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 105 | ctx->Extensions.EXT_texture_array = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 106 | ctx->Extensions.EXT_texture_env_dot3 = true; |
| 107 | ctx->Extensions.EXT_texture_filter_anisotropic = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 108 | ctx->Extensions.EXT_texture_integer = true; |
| 109 | ctx->Extensions.EXT_texture_shared_exponent = true; |
| 110 | ctx->Extensions.EXT_texture_snorm = true; |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 111 | ctx->Extensions.EXT_texture_sRGB = true; |
| 112 | ctx->Extensions.EXT_texture_sRGB_decode = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 113 | ctx->Extensions.EXT_texture_swizzle = true; |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 114 | ctx->Extensions.EXT_shadow_funcs = true; |
| 115 | ctx->Extensions.EXT_stencil_two_side = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 116 | ctx->Extensions.EXT_vertex_array_bgra = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 117 | ctx->Extensions.APPLE_object_purgeable = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 118 | ctx->Extensions.ATI_envmap_bumpmap = true; |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 119 | ctx->Extensions.ATI_separate_stencil = true; |
| 120 | ctx->Extensions.ATI_texture_env_combine3 = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 121 | ctx->Extensions.MESA_pack_invert = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 122 | ctx->Extensions.MESA_texture_array = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 123 | ctx->Extensions.MESA_ycbcr_texture = true; |
| 124 | ctx->Extensions.NV_blend_square = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 125 | ctx->Extensions.NV_conditional_render = true; |
| 126 | ctx->Extensions.NV_primitive_restart = true; |
Ian Romanick | 4ed976f | 2013-06-27 18:20:15 -0700 | [diff] [blame] | 127 | ctx->Extensions.NV_texture_env_combine4 = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 128 | ctx->Extensions.NV_texture_rectangle = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 129 | ctx->Extensions.TDFX_texture_compression_FXT1 = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 130 | ctx->Extensions.OES_compressed_ETC1_RGB8_texture = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 131 | ctx->Extensions.OES_EGL_image = true; |
Kenneth Graunke | 8812851 | 2012-05-23 17:06:45 -0700 | [diff] [blame] | 132 | ctx->Extensions.OES_draw_texture = true; |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 133 | ctx->Extensions.OES_standard_derivatives = true; |
Chad Versace | a348179 | 2010-10-07 16:04:30 -0700 | [diff] [blame] | 134 | |
Eric Anholt | 8727807 | 2011-11-08 19:17:47 -0800 | [diff] [blame] | 135 | if (intel->gen >= 6) |
Marek Olšák | 0ac83a2 | 2012-12-08 22:48:47 +0100 | [diff] [blame] | 136 | ctx->Const.GLSLVersion = 140; |
Eric Anholt | 8727807 | 2011-11-08 19:17:47 -0800 | [diff] [blame] | 137 | else |
| 138 | ctx->Const.GLSLVersion = 120; |
Chad Versace | a1eff55 | 2011-09-27 13:53:11 -0700 | [diff] [blame] | 139 | _mesa_override_glsl_version(ctx); |
Kristian Høgsberg | b91dba4 | 2010-09-22 11:01:11 -0400 | [diff] [blame] | 140 | |
Eric Anholt | b7932e1 | 2012-04-25 13:19:28 -0700 | [diff] [blame] | 141 | if (intel->gen >= 6) { |
Paul Berry | dc92b2d | 2013-01-28 11:13:07 -0800 | [diff] [blame] | 142 | ctx->Extensions.EXT_framebuffer_multisample = true; |
Kenneth Graunke | 50e60bf | 2013-04-06 10:27:28 -0700 | [diff] [blame] | 143 | ctx->Extensions.EXT_transform_feedback = true; |
Kenneth Graunke | 0408943 | 2012-07-18 00:07:17 -0700 | [diff] [blame] | 144 | ctx->Extensions.ARB_blend_func_extended = !driQueryOptionb(&intel->optionCache, "disable_blend_func_extended"); |
Eric Anholt | b7932e1 | 2012-04-25 13:19:28 -0700 | [diff] [blame] | 145 | ctx->Extensions.ARB_draw_buffers_blend = true; |
Paul Berry | e4f661a | 2012-08-07 12:39:30 -0700 | [diff] [blame] | 146 | ctx->Extensions.ARB_ES3_compatibility = true; |
Eric Anholt | 4a07851 | 2012-06-27 13:46:26 -0700 | [diff] [blame] | 147 | ctx->Extensions.ARB_uniform_buffer_object = true; |
Marek Olšák | afa902a | 2012-12-08 22:53:23 +0100 | [diff] [blame] | 148 | ctx->Extensions.ARB_texture_buffer_object = true; |
Eric Anholt | 5e529d7 | 2013-01-10 14:53:12 -0800 | [diff] [blame] | 149 | ctx->Extensions.ARB_texture_buffer_object_rgb32 = true; |
Chris Forbes | 2f7f095 | 2012-11-22 19:24:22 +1300 | [diff] [blame] | 150 | ctx->Extensions.ARB_texture_cube_map_array = true; |
Ian Romanick | 285fe32 | 2013-01-18 15:44:38 -0800 | [diff] [blame] | 151 | ctx->Extensions.OES_depth_texture_cube_map = true; |
Matt Turner | 9aadc3a | 2013-01-22 21:06:12 -0800 | [diff] [blame] | 152 | ctx->Extensions.ARB_shading_language_packing = true; |
Chris Forbes | 1d4dbee | 2012-12-29 21:28:57 +1300 | [diff] [blame] | 153 | ctx->Extensions.ARB_texture_multisample = true; |
Chris Forbes | d25b4d5 | 2013-02-16 22:09:38 +1300 | [diff] [blame] | 154 | ctx->Extensions.ARB_texture_storage_multisample = true; |
Eric Anholt | b7932e1 | 2012-04-25 13:19:28 -0700 | [diff] [blame] | 155 | } |
| 156 | |
Matt Turner | ed6186f | 2013-03-06 14:54:27 -0800 | [diff] [blame] | 157 | if (intel->gen >= 5) { |
| 158 | ctx->Extensions.ARB_texture_query_lod = true; |
Ian Romanick | 71cecca | 2011-08-22 13:15:42 -0700 | [diff] [blame] | 159 | ctx->Extensions.EXT_timer_query = true; |
Matt Turner | ed6186f | 2013-03-06 14:54:27 -0800 | [diff] [blame] | 160 | } |
Eric Anholt | 3b68b6c | 2010-05-25 15:32:54 -0700 | [diff] [blame] | 161 | |
Eric Anholt | f015901 | 2012-07-18 10:18:26 -0700 | [diff] [blame] | 162 | if (intel->gen >= 6) { |
| 163 | uint64_t dummy; |
| 164 | /* Test if the kernel has the ioctl. */ |
| 165 | if (drm_intel_reg_read(intel->bufmgr, TIMESTAMP, &dummy) == 0) |
| 166 | ctx->Extensions.ARB_timer_query = true; |
| 167 | } |
| 168 | |
Ian Romanick | ae66a65 | 2013-06-27 18:20:16 -0700 | [diff] [blame^] | 169 | if (ctx->API == API_OPENGL_CORE) |
| 170 | ctx->Extensions.ARB_base_instance = true; |
| 171 | if (ctx->API != API_OPENGL_CORE) |
| 172 | ctx->Extensions.ARB_color_buffer_float = true; |
Ian Romanick | 425c803 | 2009-01-27 23:44:18 -0800 | [diff] [blame] | 173 | |
Ian Romanick | 5bd86b2 | 2012-08-21 15:33:04 -0700 | [diff] [blame] | 174 | if (intel->ctx.Mesa_DXTn |
| 175 | || driQueryOptionb(&intel->optionCache, "force_s3tc_enable")) |
Ian Romanick | 0a5478c | 2011-08-22 13:18:06 -0700 | [diff] [blame] | 176 | ctx->Extensions.EXT_texture_compression_s3tc = true; |
Ian Romanick | 5bd86b2 | 2012-08-21 15:33:04 -0700 | [diff] [blame] | 177 | |
| 178 | ctx->Extensions.ANGLE_texture_compression_dxt = true; |
Brian Paul | 4006c5e | 2009-01-26 12:22:04 -0700 | [diff] [blame] | 179 | } |