st/mesa: add option to enable GLSL 1.40
[mesa.git] / src / mesa / state_tracker / st_extensions.c
index 5099acdb564f7bdd2d6208606b6e43614731688a..ca762cab4b27dcd9c90c1016fe7c4f4aaf78261f 100644 (file)
@@ -298,7 +298,8 @@ static void init_format_extensions(struct st_context *st,
 {
    struct pipe_screen *screen = st->pipe->screen;
    GLboolean *extensions = (GLboolean *) &st->ctx->Extensions;
-   int i, j;
+   unsigned i;
+   int j;
    int num_formats = Elements(mapping->format);
    int num_ext = Elements(mapping->extension_offset);
 
@@ -376,6 +377,9 @@ void st_init_extensions(struct st_context *st)
       /* GL_NV_point_sprite is not supported by gallium because we don't
        * support the GL_POINT_SPRITE_R_MODE_NV option. */
       { o(MESA_texture_array),               PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS         },
+
+      { o(OES_standard_derivatives),         PIPE_CAP_SM3                              },
+      { o(ARB_texture_cube_map_array),       PIPE_CAP_CUBE_MAP_ARRAY                   }
    };
 
    /* Required: render target and sampler support */
@@ -478,7 +482,6 @@ void st_init_extensions(struct st_context *st)
     * Extensions that are supported by all Gallium drivers:
     */
    ctx->Extensions.ARB_ES2_compatibility = GL_TRUE;
-   ctx->Extensions.ARB_copy_buffer = GL_TRUE;
    ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
    ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE;
    ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
@@ -487,7 +490,6 @@ void st_init_extensions(struct st_context *st)
    ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
    ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
    ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
-   ctx->Extensions.ARB_sampler_objects = GL_TRUE;
    ctx->Extensions.ARB_shader_objects = GL_TRUE;
    ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
    ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */
@@ -496,10 +498,8 @@ void st_init_extensions(struct st_context *st)
    ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
    ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
    ctx->Extensions.ARB_texture_storage = GL_TRUE;
-   ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
    ctx->Extensions.ARB_vertex_program = GL_TRUE;
    ctx->Extensions.ARB_vertex_shader = GL_TRUE;
-   ctx->Extensions.ARB_window_pos = GL_TRUE;
 
    ctx->Extensions.EXT_blend_color = GL_TRUE;
    ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
@@ -517,31 +517,19 @@ void st_init_extensions(struct st_context *st)
    ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
    ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE;
 
-   ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
-
    ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
 
    ctx->Extensions.MESA_pack_invert = GL_TRUE;
 
    ctx->Extensions.NV_blend_square = GL_TRUE;
    ctx->Extensions.NV_fog_distance = GL_TRUE;
-   ctx->Extensions.NV_texgen_reflection = GL_TRUE;
    ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
    ctx->Extensions.NV_texture_rectangle = GL_TRUE;
-#if 0
-   /* possibly could support the following two */
-   ctx->Extensions.NV_vertex_program = GL_TRUE;
-   ctx->Extensions.NV_vertex_program1_1 = GL_TRUE;
-#endif
 
-#if FEATURE_OES_EGL_image
    ctx->Extensions.OES_EGL_image = GL_TRUE;
-   if (ctx->API != API_OPENGL)
+   if (ctx->API != API_OPENGL_COMPAT)
       ctx->Extensions.OES_EGL_image_external = GL_TRUE;
-#endif
-#if FEATURE_OES_draw_texture
    ctx->Extensions.OES_draw_texture = GL_TRUE;
-#endif
 
    /* Expose the extensions which directly correspond to gallium caps. */
    for (i = 0; i < Elements(cap_mapping); i++) {
@@ -565,7 +553,12 @@ void st_init_extensions(struct st_context *st)
    /* Figure out GLSL support. */
    glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL);
 
-   if (glsl_feature_level >= 130) {
+   if (glsl_feature_level >= 140) {
+      if (ctx->API == API_OPENGL_CORE)
+         ctx->Const.GLSLVersion = 140;
+      else
+         ctx->Const.GLSLVersion = 130;
+   } else if (glsl_feature_level >= 130) {
       ctx->Const.GLSLVersion = 130;
    } else {
       ctx->Const.GLSLVersion = 120;
@@ -647,4 +640,14 @@ void st_init_extensions(struct st_context *st)
        ctx->Extensions.ARB_draw_instanced) {
       ctx->Extensions.ARB_transform_feedback_instanced = GL_TRUE;
    }
+   if (st->options.force_glsl_extensions_warn)
+          ctx->Const.ForceGLSLExtensionsWarn = 1;
+
+   ctx->Const.MinMapBufferAlignment =
+      screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT);
+   if (ctx->Const.MinMapBufferAlignment >= 64) {
+      ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE;
+   }
+   if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS))
+      ctx->Extensions.ARB_texture_buffer_object = GL_TRUE;
 }