1aa1a5c0c9e0de71ecd15e7190c121d6dd98471a6Ian Romanick/*
2877128505431adaf817dc8069172ebe4a1cdf5d8José Fonseca * Copyright 2003 VMware, Inc.
33dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * All Rights Reserved.
4a7bdd4cba8ddcab8dff59ecaaa7efbd436c6c307Kenneth Graunke *
53dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * Permission is hereby granted, free of charge, to any person obtaining a
63dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * copy of this software and associated documentation files (the
73dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * "Software"), to deal in the Software without restriction, including
83dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * without limitation the rights to use, copy, modify, merge, publish,
9284dcad20a9a55278c1d3dd98f53e45650b22896Ian Romanick * distribute, sublicense, and/or sell copies of the Software, and to
103dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * permit persons to whom the Software is furnished to do so, subject to
113dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * the following conditions:
12a7bdd4cba8ddcab8dff59ecaaa7efbd436c6c307Kenneth Graunke *
133dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * The above copyright notice and this permission notice (including the
143dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * next paragraph) shall be included in all copies or substantial portions
153dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * of the Software.
16a7bdd4cba8ddcab8dff59ecaaa7efbd436c6c307Kenneth Graunke *
173dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
183dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19284dcad20a9a55278c1d3dd98f53e45650b22896Ian Romanick * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20877128505431adaf817dc8069172ebe4a1cdf5d8José Fonseca * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
213dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
223dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
233dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24aa1a5c0c9e0de71ecd15e7190c121d6dd98471a6Ian Romanick */
253dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt
263dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt#include "main/version.h"
273dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt
28a69274454b6bde265a910ca5bd3199217431f5b5Kenneth Graunke#include "brw_context.h"
29949a89202621eb73e9f9d4c7b452d9bf9afbfd40Jason Ekstrand#include "brw_defines.h"
30129da5b1c87e4fd45b117a092e5d022ad7041e66Kenneth Graunke#include "intel_batchbuffer.h"
313dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt
323dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt/**
333dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * Initializes potential list of extensions if ctx == NULL, or actually enables
343dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt * extensions for a context.
353dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt */
363dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholtvoid
373dbba95b72262344b82fba018b7c2c1208754cd2Eric AnholtintelInitExtensions(struct gl_context *ctx)
383dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt{
39fbdd3891e1d08f388571c20db96516f39fe11898Kenneth Graunke   struct brw_context *brw = brw_context(ctx);
403dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt
4153631be4ebaa4fb13a7f129727c1cdd32fcc6f3dKenneth Graunke   assert(brw->gen >= 4);
424ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick
435b75dbd7be09fdc80eff8141ef47c63a6a913c98Timothy Arceri   ctx->Extensions.ARB_arrays_of_arrays = true;
442f879356b552ad75bebbafc8d4bc1c97834b8b79Eric Anholt   ctx->Extensions.ARB_buffer_storage = true;
450779f37e1589b0ba4f1443a889f34dd83607c117Neil Roberts   ctx->Extensions.ARB_clear_texture = true;
46fdd90fcb15c109f3dcbf5e46fa8a1f8284b9c266Mathias Fröhlich   ctx->Extensions.ARB_clip_control = true;
47410fea8dd9cc0b1b500477a8b6f68c950f7c895aJason Ekstrand   ctx->Extensions.ARB_copy_image = true;
48ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_depth_buffer_float = true;
49ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_depth_clamp = true;
504ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.ARB_depth_texture = true;
513dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_draw_elements_base_vertex = true;
52ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_draw_instanced = true;
534ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.ARB_ES2_compatibility = true;
543dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_explicit_attrib_location = true;
55f3750a2c8667961c0595f5813b15be1476d13079Tapani Pälli   ctx->Extensions.ARB_explicit_uniform_location = true;
56ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_fragment_coord_conventions = true;
574ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.ARB_fragment_program = true;
58ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_fragment_program_shadow = true;
594ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.ARB_fragment_shader = true;
603dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_framebuffer_object = true;
61ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_half_float_vertex = true;
62ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_instanced_arrays = true;
633dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_internalformat_query = true;
644f028bfcc048d7cbd7a7239e9f61b4d7b708aebbAntia Puentes   ctx->Extensions.ARB_internalformat_query2 = true;
653dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_map_buffer_range = true;
664ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.ARB_occlusion_query = true;
67ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_occlusion_query2 = true;
68e206785b5790c97743b7d3929563c21ad87aa765Ben Widawsky   ctx->Extensions.ARB_pipeline_statistics_query = true;
693dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_point_sprite = true;
70ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_seamless_cube_map = true;
71ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_shader_bit_encoding = true;
72cddfc2cefa93b884c40329dcb193fe4fb22143abKristian Høgsberg Kristensen   ctx->Extensions.ARB_shader_draw_parameters = true;
73ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_shader_texture_lod = true;
7426c7f04d4a55b694623a389a564c9516d91c0026Ian Romanick   ctx->Extensions.ARB_shading_language_packing = true;
754ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.ARB_shadow = true;
763dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_sync = true;
773dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_texture_border_clamp = true;
78ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_texture_compression_rgtc = true;
793dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_texture_cube_map = true;
803dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_texture_env_combine = true;
813dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_texture_env_crossbar = true;
823dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_texture_env_dot3 = true;
83ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_texture_float = true;
842d3282188e3f95c0a81aca01f01e0c4424127320Kenneth Graunke   ctx->Extensions.ARB_texture_mirror_clamp_to_edge = true;
854ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.ARB_texture_non_power_of_two = true;
86ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_texture_rg = true;
87ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_texture_rgb10_a2ui = true;
883dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_vertex_program = true;
893dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ARB_vertex_shader = true;
90ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.ARB_vertex_type_2_10_10_10_rev = true;
91351e13c5ad81757a15ab319f2ef521b3921a345cChris Forbes   ctx->Extensions.ARB_vertex_type_10f_11f_11f_rev = true;
923dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.EXT_blend_color = true;
933dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.EXT_blend_equation_separate = true;
943dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.EXT_blend_func_separate = true;
953dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.EXT_blend_minmax = true;
96ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.EXT_draw_buffers2 = true;
97ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.EXT_framebuffer_sRGB = true;
983dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.EXT_gpu_program_parameters = true;
99ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.EXT_packed_float = true;
1003dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.EXT_pixel_buffer_object = true;
1013dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.EXT_point_parameters = true;
102dbae576f7f25fef72ca0b9f6f4822e0fddf7d607Ilia Mirkin   ctx->Extensions.EXT_polygon_offset_clamp = true;
1033dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.EXT_provoking_vertex = true;
10451e3453785bc57087bb868dc93afbf620935b703Ian Romanick   ctx->Extensions.EXT_stencil_two_side = true;
105ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.EXT_texture_array = true;
1063dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.EXT_texture_env_dot3 = true;
1073dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.EXT_texture_filter_anisotropic = true;
108ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.EXT_texture_integer = true;
109ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.EXT_texture_shared_exponent = true;
110ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.EXT_texture_snorm = true;
1114ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.EXT_texture_sRGB = true;
1124ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.EXT_texture_sRGB_decode = true;
113ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.EXT_texture_swizzle = true;
114ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.EXT_vertex_array_bgra = true;
11585008db1d51f923113832394d7f8d6b1868be882Kristian Høgsberg Kristensen   ctx->Extensions.KHR_robustness = true;
1162937d704dcae4451b2baa7d02f97205e73b37c8cIan Romanick   ctx->Extensions.AMD_seamless_cubemap_per_texture = true;
1173dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.APPLE_object_purgeable = true;
1184ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.ATI_separate_stencil = true;
1194ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.ATI_texture_env_combine3 = true;
1203dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.MESA_pack_invert = true;
121ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.NV_conditional_render = true;
122ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.NV_primitive_restart = true;
12371e187430cdd1d82972554d7f9e994a41847bea1Ilia Mirkin   ctx->Extensions.NV_texture_barrier = true;
1244ed976f6b5866e69ea84fe19fb9143766cf08c5eIan Romanick   ctx->Extensions.NV_texture_env_combine4 = true;
1253dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.NV_texture_rectangle = true;
1263dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.TDFX_texture_compression_FXT1 = true;
127ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   ctx->Extensions.OES_compressed_ETC1_RGB8_texture = true;
1283dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.OES_draw_texture = true;
12951e3453785bc57087bb868dc93afbf620935b703Ian Romanick   ctx->Extensions.OES_EGL_image = true;
130f5947c2bc72a630d1abd2a12221d8dafd3a24be4Topi Pohjolainen   ctx->Extensions.OES_EGL_image_external = true;
13151e3453785bc57087bb868dc93afbf620935b703Ian Romanick   ctx->Extensions.OES_standard_derivatives = true;
13251e3453785bc57087bb868dc93afbf620935b703Ian Romanick   ctx->Extensions.OES_texture_float = true;
13351e3453785bc57087bb868dc93afbf620935b703Ian Romanick   ctx->Extensions.OES_texture_float_linear = true;
13451e3453785bc57087bb868dc93afbf620935b703Ian Romanick   ctx->Extensions.OES_texture_half_float = true;
13551e3453785bc57087bb868dc93afbf620935b703Ian Romanick   ctx->Extensions.OES_texture_half_float_linear = true;
1363dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt
13771465179fc45820dabf933146fb16f044a7363d7Iago Toral Quiroga   if (brw->gen >= 8)
13875128d6ffda9745161cb5c7ddd499422ad544d2cKenneth Graunke      ctx->Const.GLSLVersion = 450;
139e3123c8ca22e9a9337af6179dfd8383259f3ccc6Iago Toral Quiroga   else if (brw->is_haswell && can_do_pipelined_register_writes(brw->screen))
140d2590eb65ff28a9cbd592353d15d7e6cbd2c6fc6Kenneth Graunke      ctx->Const.GLSLVersion = 450;
14171465179fc45820dabf933146fb16f044a7363d7Iago Toral Quiroga   else if (brw->gen >= 6)
142567445e2b9f64cdb0a97ec883a9dfd5ed59d21fcKenneth Graunke      ctx->Const.GLSLVersion = 330;
1433dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   else
1443dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt      ctx->Const.GLSLVersion = 120;
145d9a6f4360a617fccfb3987f9ec276012a9a14b75Marek Olšák   _mesa_override_glsl_version(&ctx->Const);
1463dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt
1474b2b6d4d4d62985679f164eef7d02a552e221941Ian Romanick   ctx->Extensions.EXT_shader_integer_mix = ctx->Const.GLSLVersion >= 130;
1487cb49b1bd7f15d53e08d3716e9a835c42dc11c09Ian Romanick   ctx->Extensions.MESA_shader_integer_functions = ctx->Const.GLSLVersion >= 130;
1494b2b6d4d4d62985679f164eef7d02a552e221941Ian Romanick
150c2b10cabed6468b998a9c4d0ada7953d93311029Kenneth Graunke   if (brw->is_g4x || brw->gen >= 5) {
1518a2f19a7772c80fcac85d6bdfa8e588d6cea1bebFrancisco Jerez      ctx->Extensions.MESA_shader_framebuffer_fetch_non_coherent = true;
152c2b10cabed6468b998a9c4d0ada7953d93311029Kenneth Graunke      ctx->Extensions.KHR_blend_equation_advanced = true;
153c2b10cabed6468b998a9c4d0ada7953d93311029Kenneth Graunke   }
1548a2f19a7772c80fcac85d6bdfa8e588d6cea1bebFrancisco Jerez
15551e3453785bc57087bb868dc93afbf620935b703Ian Romanick   if (brw->gen >= 5) {
15651e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.ARB_texture_query_levels = ctx->Const.GLSLVersion >= 130;
15751e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.ARB_texture_query_lod = true;
15851e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.EXT_timer_query = true;
15951e3453785bc57087bb868dc93afbf620935b703Ian Romanick   }
16051e3453785bc57087bb868dc93afbf620935b703Ian Romanick
16153631be4ebaa4fb13a7f129727c1cdd32fcc6f3dKenneth Graunke   if (brw->gen >= 6) {
16251e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.ARB_blend_func_extended =
16351e3453785bc57087bb868dc93afbf620935b703Ian Romanick         !driQueryOptionb(&brw->optionCache, "disable_blend_func_extended");
16451e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.ARB_conditional_render_inverted = true;
165a88c5d7e556f6f0c1dfcb253b38c66241cc67f72Dave Airlie      ctx->Extensions.ARB_cull_distance = true;
1663dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt      ctx->Extensions.ARB_draw_buffers_blend = true;
1674ba9bd138a48bd61cbc24d546afef0986f2fd05aTimothy Arceri      ctx->Extensions.ARB_enhanced_layouts = true;
1683dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt      ctx->Extensions.ARB_ES3_compatibility = true;
1698c902a580a490181e7cde29073b11181db4614f8Kenneth Graunke      ctx->Extensions.ARB_fragment_layer_viewport = true;
17051e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.ARB_sample_shading = true;
17146d9baf3e3186078ca5a74f9d3e70ad493f899cbKenneth Graunke      ctx->Extensions.ARB_shading_language_420pack = true;
1723dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt      ctx->Extensions.ARB_texture_buffer_object = true;
1733dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt      ctx->Extensions.ARB_texture_buffer_object_rgb32 = true;
174a5e2e7f9a4bc813ce85f4a10bcd6086f21aa8a32Eric Anholt      ctx->Extensions.ARB_texture_buffer_range = true;
1753dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt      ctx->Extensions.ARB_texture_cube_map_array = true;
1760c14c5c62a1b4648381c05f024db730e4a0f90c5Chris Forbes      ctx->Extensions.ARB_texture_gather = true;
17751e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.ARB_texture_multisample = true;
17851e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.ARB_uniform_buffer_object = true;
17951e3453785bc57087bb868dc93afbf620935b703Ian Romanick
18074d7ff2efda8e33e097ed6e3f9853fc1c8d45618Samuel Iglesias Gonsálvez      ctx->Extensions.AMD_vertex_shader_layer = true;
18151e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.EXT_framebuffer_multisample = true;
18251e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = true;
18351e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.EXT_transform_feedback = true;
18451e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.OES_depth_texture_cube_map = true;
1859a1936d965e92c4b4aa682f96ef63362159f4fceKenneth Graunke      ctx->Extensions.OES_sample_variables = true;
1860b9398c74f0189b7d7904749e24934e08a0a4cfbIan Romanick
1879694b23f66f4c41407289fb7d3ff25321042ef49Kenneth Graunke      ctx->Extensions.ARB_timer_query = brw->screen->hw_has_timestamp;
1885fc23375e80dd2084f30700bdd3216082f662accChris Forbes
1895fc23375e80dd2084f30700bdd3216082f662accChris Forbes      /* Only enable this in core profile because other parts of Mesa behave
1905fc23375e80dd2084f30700bdd3216082f662accChris Forbes       * slightly differently when the extension is enabled.
1915fc23375e80dd2084f30700bdd3216082f662accChris Forbes       */
1925fc23375e80dd2084f30700bdd3216082f662accChris Forbes      if (ctx->API == API_OPENGL_CORE) {
19380511d176a49e754a18ce585bab413db7af63bf7Dave Airlie         ctx->Extensions.ARB_shader_subroutine = true;
194d4bf9baa43e2cf7b4b877141ee472779ced219bfDylan Baker         ctx->Extensions.ARB_shader_viewport_layer_array = true;
1955fc23375e80dd2084f30700bdd3216082f662accChris Forbes         ctx->Extensions.ARB_viewport_array = true;
1965fc23375e80dd2084f30700bdd3216082f662accChris Forbes         ctx->Extensions.AMD_vertex_shader_viewport_index = true;
1975fc23375e80dd2084f30700bdd3216082f662accChris Forbes      }
1983dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   }
1993dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt
200426023050d1d3cd1b5fc0b3508dd7e1ee3b061e7Neil Roberts   brw->predicate.supported = false;
201426023050d1d3cd1b5fc0b3508dd7e1ee3b061e7Neil Roberts
2027df985ad47df831f842843f2db9f7658b11d3df2Chris Forbes   if (brw->gen >= 7) {
2037ec46686967b8b8aab5a2ef36416e59e9d83d5fbChris Forbes      ctx->Extensions.ARB_conservative_depth = true;
20451e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.ARB_derivative_control = true;
20583199998310591b9162ab12e922ed79ee235b5c8Kevin Rogovin      ctx->Extensions.ARB_framebuffer_no_attachments = true;
206ff6ee39c19adc59225d1f0664695c669cd7e5a94Matt Turner      ctx->Extensions.ARB_gpu_shader5 = true;
207ff6ee39c19adc59225d1f0664695c669cd7e5a94Matt Turner      ctx->Extensions.ARB_shader_atomic_counters = true;
20840dd45d0c6aa4a9d727c09225967e9c3b1f45854Ian Romanick      ctx->Extensions.ARB_shader_atomic_counter_ops = true;
20960418a28ea11b3e1d9365acfc168a8f8f5b41965Emil Velikov      ctx->Extensions.ARB_shader_clock = true;
210d03c65793a5ee31f1138cbd0fba6fac6cd942428Francisco Jerez      ctx->Extensions.ARB_shader_image_load_store = true;
211e5851cff45169f4e635299da4ed5b41aeb0d2f83Martin Peres      ctx->Extensions.ARB_shader_image_size = true;
212bfc5ace5bda6510d4dd3893a3b8c677a1c85e23eIlia Mirkin      ctx->Extensions.ARB_shader_texture_image_samples = true;
213381a89cf2a0c1e7babb0f134a3b5b662045092a2Kenneth Graunke      ctx->Extensions.ARB_tessellation_shader = true;
21451e3453785bc57087bb868dc93afbf620935b703Ian Romanick      ctx->Extensions.ARB_texture_compression_bptc = true;
215ecfc418b68d3368df0f72116adad153c19d8c6d8Kenneth Graunke      ctx->Extensions.ARB_texture_view = true;
216614b5307fd485a62205b0ceb05657dd862c1f036Samuel Iglesias Gonsálvez      ctx->Extensions.ARB_shader_storage_buffer_object = true;
21799840eb983f74cd447546f7205c8c9f505ef82c8Ian Romanick      ctx->Extensions.EXT_shader_samples_identical = true;
218a0b1260fe0577e504c8ef31c07e13025324af8f8Ilia Mirkin      ctx->Extensions.OES_primitive_bounding_box = true;
219875543e270de67e99ce049ca01b6cde8ac6911e1Ilia Mirkin      ctx->Extensions.OES_texture_buffer = true;
22051e3453785bc57087bb868dc93afbf620935b703Ian Romanick
2211f1b8def48f5e4015d15e6cde42b1b7705459f17Iago Toral Quiroga      if (can_do_pipelined_register_writes(brw->screen)) {
22251e3453785bc57087bb868dc93afbf620935b703Ian Romanick         ctx->Extensions.ARB_draw_indirect = true;
223129da5b1c87e4fd45b117a092e5d022ad7041e66Kenneth Graunke         ctx->Extensions.ARB_transform_feedback2 = true;
224c4ec0ad8a90c2023cb77e578d39dddb0cddeada9Kenneth Graunke         ctx->Extensions.ARB_transform_feedback3 = true;
2250eeaf11edf72bbd2943a4b9bffa5f8d5bfe77dd5Kenneth Graunke         ctx->Extensions.ARB_transform_feedback_instanced = true;
226426023050d1d3cd1b5fc0b3508dd7e1ee3b061e7Neil Roberts
227a98f2e53e1c669dee3114badcce261e564748af4Iago Toral Quiroga         if (can_do_compute_dispatch(brw->screen) &&
22832b1c0b694bf660d48054a6e859deaa8f9556efeKenneth Graunke             ctx->Const.MaxComputeWorkGroupSize[0] >= 1024) {
229bd21b54607615605b6335282029687bb0885f4adKenneth Graunke            ctx->Extensions.ARB_compute_shader = true;
2305e76baa2ad261c72f96a3df42ace4773a1c7daa9Jordan Justen            ctx->Extensions.ARB_ES3_1_compatibility =
2315e76baa2ad261c72f96a3df42ace4773a1c7daa9Jordan Justen               brw->gen >= 8 || brw->is_haswell;
23232b1c0b694bf660d48054a6e859deaa8f9556efeKenneth Graunke         }
233bd21b54607615605b6335282029687bb0885f4adKenneth Graunke
234a98f2e53e1c669dee3114badcce261e564748af4Iago Toral Quiroga         if (can_do_predicate_writes(brw->screen))
235426023050d1d3cd1b5fc0b3508dd7e1ee3b061e7Neil Roberts            brw->predicate.supported = true;
236129da5b1c87e4fd45b117a092e5d022ad7041e66Kenneth Graunke      }
2377df985ad47df831f842843f2db9f7658b11d3df2Chris Forbes   }
2387df985ad47df831f842843f2db9f7658b11d3df2Chris Forbes
239f20f616324a79b8be91b84b6d965a0bc0096789cJordan Justen   if (brw->gen >= 8 || brw->is_haswell) {
2401d1ddbaa562fb3a60c4c612e1b6a8d0e2e402d0aSamuel Iglesias Gonsálvez      ctx->Extensions.ARB_gpu_shader_fp64 = true;
24177077986eb281f7537b77b91445778b7d75a81d7Samuel Iglesias Gonsálvez      ctx->Extensions.ARB_shader_precision = true;
242f20f616324a79b8be91b84b6d965a0bc0096789cJordan Justen      ctx->Extensions.ARB_stencil_texturing = true;
243116b6e12d4d6f08d1c86475f5a2655d074804d6fJordan Justen      ctx->Extensions.ARB_texture_stencil8 = true;
2441d1ddbaa562fb3a60c4c612e1b6a8d0e2e402d0aSamuel Iglesias Gonsálvez      ctx->Extensions.ARB_vertex_attrib_64bit = true;
2451472ff35914fb50c8b49a4f8678c76327e7da75cIan Romanick      ctx->Extensions.OES_geometry_shader = true;
2461472ff35914fb50c8b49a4f8678c76327e7da75cIan Romanick      ctx->Extensions.OES_texture_cube_map_array = true;
2471472ff35914fb50c8b49a4f8678c76327e7da75cIan Romanick      ctx->Extensions.OES_viewport_array = true;
248f20f616324a79b8be91b84b6d965a0bc0096789cJordan Justen   }
249f20f616324a79b8be91b84b6d965a0bc0096789cJordan Justen
25075d10dff0bda6de2a31e26eb8e950adc5fd3994eJason Ekstrand   if (brw->gen >= 8 || brw->is_haswell || brw->is_baytrail) {
25175d10dff0bda6de2a31e26eb8e950adc5fd3994eJason Ekstrand      ctx->Extensions.ARB_robust_buffer_access_behavior = true;
25275d10dff0bda6de2a31e26eb8e950adc5fd3994eJason Ekstrand   }
25375d10dff0bda6de2a31e26eb8e950adc5fd3994eJason Ekstrand
254a98f2e53e1c669dee3114badcce261e564748af4Iago Toral Quiroga   if (can_do_mi_math_and_lrr(brw->screen)) {
255f00c399bae7376bad2257d085fe754adfaa11cc8Jordan Justen      ctx->Extensions.ARB_query_buffer_object = true;
256f00c399bae7376bad2257d085fe754adfaa11cc8Jordan Justen   }
257f00c399bae7376bad2257d085fe754adfaa11cc8Jordan Justen
2580f0f357b77123544ecc6c3cf50ac87b68e798d43Kenneth Graunke   if (brw->gen >= 8 || brw->is_baytrail) {
2590f0f357b77123544ecc6c3cf50ac87b68e798d43Kenneth Graunke      /* For now, we only enable OES_copy_image on platforms that support
2600f0f357b77123544ecc6c3cf50ac87b68e798d43Kenneth Graunke       * ETC2 natively in hardware.  We would need more hacks to support it
2610f0f357b77123544ecc6c3cf50ac87b68e798d43Kenneth Graunke       * elsewhere.
2620f0f357b77123544ecc6c3cf50ac87b68e798d43Kenneth Graunke       */
2630f0f357b77123544ecc6c3cf50ac87b68e798d43Kenneth Graunke      ctx->Extensions.OES_copy_image = true;
2640f0f357b77123544ecc6c3cf50ac87b68e798d43Kenneth Graunke   }
2650f0f357b77123544ecc6c3cf50ac87b68e798d43Kenneth Graunke
266dfa1ab0e52dde185c80f83b8e354a821f46c2949Kenneth Graunke   if (brw->gen >= 8) {
2679fec15a7e047eda52beb0cc71d7605656d91f685Ilia Mirkin      ctx->Extensions.ARB_ES3_2_compatibility = true;
268dfa1ab0e52dde185c80f83b8e354a821f46c2949Kenneth Graunke   }
269dfa1ab0e52dde185c80f83b8e354a821f46c2949Kenneth Graunke
270f3a483069a6f0d38c10cec88417ae2b5b5aa3392Nanley Chery   if (brw->gen >= 9) {
2714246986dec11f292520fbfec1ff842b90231337eIan Romanick      ctx->Extensions.ANDROID_extension_pack_es31a = true;
2724246986dec11f292520fbfec1ff842b90231337eIan Romanick      ctx->Extensions.ARB_shader_stencil_export = true;
273219a451497d1138c12f927139c6e8aa94a116e53Kenneth Graunke      ctx->Extensions.KHR_blend_equation_advanced_coherent = true;
274f3a483069a6f0d38c10cec88417ae2b5b5aa3392Nanley Chery      ctx->Extensions.KHR_texture_compression_astc_ldr = true;
275ac0eb36d8e82abc5590773d045c6b63d9be6949aAnuj Phogat      ctx->Extensions.KHR_texture_compression_astc_sliced_3d = true;
276e9f17e9fb06a4389588f47be8c766b07e8d8b89fLionel Landwerlin      ctx->Extensions.INTEL_conservative_rasterization = true;
277da85b5a9f1b22a8f6cae1a3b335dc5f31011bcb1Francisco Jerez      ctx->Extensions.MESA_shader_framebuffer_fetch = true;
2780ff74a8990d9fe37365beb35ed8abacfbf3ed567Plamena Manolova      ctx->Extensions.ARB_post_depth_coverage = true;
279f3a483069a6f0d38c10cec88417ae2b5b5aa3392Nanley Chery   }
280f3a483069a6f0d38c10cec88417ae2b5b5aa3392Nanley Chery
281ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   if (ctx->API == API_OPENGL_CORE)
282ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick      ctx->Extensions.ARB_base_instance = true;
283ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick   if (ctx->API != API_OPENGL_CORE)
284ae66a656fd3e205d81284f45bbc0422c7e198da6Ian Romanick      ctx->Extensions.ARB_color_buffer_float = true;
2853dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt
286e3c2bb1eb4ef73c1c9576f0d5b747605b5de47efKenneth Graunke   if (ctx->Mesa_DXTn || driQueryOptionb(&brw->optionCache, "force_s3tc_enable"))
2873dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt      ctx->Extensions.EXT_texture_compression_s3tc = true;
2883dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt
2893dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt   ctx->Extensions.ANGLE_texture_compression_dxt = true;
2903dbba95b72262344b82fba018b7c2c1208754cd2Eric Anholt}
291