[Mesa-dev] st/mesa: small cleanup in st_extensions.c

Submitted by Marek Olšák on Aug. 11, 2015, 9:26 p.m.

Details

Message ID 1439328363-25517-1-git-send-email-maraeo@gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Marek Olšák Aug. 11, 2015, 9:26 p.m.
From: Marek Olšák <marek.olsak@amd.com>

---
 src/mesa/state_tracker/st_extensions.c | 40 ++++++++--------------------------
 1 file changed, 9 insertions(+), 31 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 5459891..77d6201 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -434,12 +434,14 @@  void st_init_extensions(struct pipe_screen *screen,
 
    static const struct st_extension_cap_mapping cap_mapping[] = {
       { o(ARB_base_instance),                PIPE_CAP_START_INSTANCE                   },
-      { o(ARB_buffer_storage),               PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT },
+      { o(ARB_buffer_storage),               PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT   },
+      { o(ARB_color_buffer_float),           PIPE_CAP_VERTEX_COLOR_UNCLAMPED           },
       { o(ARB_depth_clamp),                  PIPE_CAP_DEPTH_CLIP_DISABLE               },
       { o(ARB_depth_texture),                PIPE_CAP_TEXTURE_SHADOW_MAP               },
       { o(ARB_draw_buffers_blend),           PIPE_CAP_INDEP_BLEND_FUNC                 },
       { o(ARB_draw_instanced),               PIPE_CAP_TGSI_INSTANCEID                  },
       { o(ARB_fragment_program_shadow),      PIPE_CAP_TEXTURE_SHADOW_MAP               },
+      { o(ARB_framebuffer_object),           PIPE_CAP_MIXED_FRAMEBUFFER_SIZES          },
       { o(ARB_instanced_arrays),             PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR  },
       { o(ARB_occlusion_query),              PIPE_CAP_OCCLUSION_QUERY                  },
       { o(ARB_occlusion_query2),             PIPE_CAP_OCCLUSION_QUERY                  },
@@ -449,6 +451,8 @@  void st_init_extensions(struct pipe_screen *screen,
       { o(ARB_shader_stencil_export),        PIPE_CAP_SHADER_STENCIL_EXPORT            },
       { o(ARB_shader_texture_lod),           PIPE_CAP_SM3                              },
       { o(ARB_shadow),                       PIPE_CAP_TEXTURE_SHADOW_MAP               },
+      { o(ARB_texture_buffer_object),        PIPE_CAP_TEXTURE_BUFFER_OBJECTS           },
+      { o(ARB_texture_gather),               PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS    },
       { o(ARB_texture_mirror_clamp_to_edge), PIPE_CAP_TEXTURE_MIRROR_CLAMP             },
       { o(ARB_texture_non_power_of_two),     PIPE_CAP_NPOT_TEXTURES                    },
       { o(ARB_timer_query),                  PIPE_CAP_QUERY_TIMESTAMP                  },
@@ -469,6 +473,7 @@  void st_init_extensions(struct pipe_screen *screen,
       { o(ATI_separate_stencil),             PIPE_CAP_TWO_SIDED_STENCIL                },
       { o(ATI_texture_mirror_once),          PIPE_CAP_TEXTURE_MIRROR_CLAMP             },
       { o(NV_conditional_render),            PIPE_CAP_CONDITIONAL_RENDER               },
+      { o(NV_primitive_restart),             PIPE_CAP_PRIMITIVE_RESTART                },
       { o(NV_texture_barrier),               PIPE_CAP_TEXTURE_BARRIER                  },
       /* GL_NV_point_sprite is not supported by gallium because we don't
        * support the GL_POINT_SPRITE_R_MODE_NV option. */
@@ -579,7 +584,8 @@  void st_init_extensions(struct pipe_screen *screen,
           PIPE_FORMAT_R8G8B8A8_UNORM },
         GL_TRUE }, /* at least one format must be supported */
 
-      { { o(ARB_stencil_texturing) },
+      { { o(ARB_stencil_texturing),
+          o(ARB_texture_stencil8) },
         { PIPE_FORMAT_X24S8_UINT,
           PIPE_FORMAT_S8X24_UINT },
         GL_TRUE }, /* at least one format must be supported */
@@ -673,9 +679,6 @@  void st_init_extensions(struct pipe_screen *screen,
                           ARRAY_SIZE(vertex_mapping), PIPE_BUFFER,
                           PIPE_BIND_VERTEX_BUFFER);
 
-   if (extensions->ARB_stencil_texturing)
-      extensions->ARB_texture_stencil8 = GL_TRUE;
-
    if (screen->get_param(screen, PIPE_CAP_TEXTURE_FLOAT_LINEAR)) {
       extensions->OES_texture_float_linear = extensions->OES_texture_float;
       extensions->OES_texture_half_float_linear =
@@ -753,27 +756,11 @@  void st_init_extensions(struct pipe_screen *screen,
       extensions->ANGLE_texture_compression_dxt = GL_FALSE;
    }
 
-   if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY,
-                                PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) {
-#if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */
-      extensions->ARB_geometry_shader4 = GL_TRUE;
-#endif
-   }
-
    if (screen->get_shader_param(screen, PIPE_SHADER_TESS_CTRL,
                                 PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) {
       extensions->ARB_tessellation_shader = GL_TRUE;
    }
 
-   if (screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) {
-      extensions->NV_primitive_restart = GL_TRUE;
-   }
-
-   /* ARB_color_buffer_float. */
-   if (screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_UNCLAMPED)) {
-      extensions->ARB_color_buffer_float = GL_TRUE;
-   }
-
    if (screen->fence_finish) {
       extensions->ARB_sync = GL_TRUE;
    }
@@ -858,9 +845,7 @@  void st_init_extensions(struct pipe_screen *screen,
    consts->MinMapBufferAlignment =
       screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT);
 
-   if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) {
-      extensions->ARB_texture_buffer_object = GL_TRUE;
-
+   if (extensions->ARB_texture_buffer_object) {
       consts->MaxTextureBufferSize =
          _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE),
               (1u << 31) - 1);
@@ -875,10 +860,6 @@  void st_init_extensions(struct pipe_screen *screen,
                              PIPE_BIND_SAMPLER_VIEW);
    }
 
-   if (screen->get_param(screen, PIPE_CAP_MIXED_FRAMEBUFFER_SIZES)) {
-      extensions->ARB_framebuffer_object = GL_TRUE;
-   }
-
    /* Unpacking a varying in the fragment shader costs 1 texture indirection.
     * If the number of available texture indirections is very limited, then we
     * prefer to disable varying packing rather than run the risk of varying
@@ -903,9 +884,6 @@  void st_init_extensions(struct pipe_screen *screen,
          extensions->AMD_vertex_shader_viewport_index = GL_TRUE;
    }
 
-   if (consts->MaxProgramTextureGatherComponents > 0)
-      extensions->ARB_texture_gather = GL_TRUE;
-
    /* GL_ARB_ES3_compatibility.
     *
     * Assume that ES3 is supported if GLSL 3.30 is supported.

Comments

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>

On Tue, Aug 11, 2015 at 5:26 PM, Marek Olšák <maraeo@gmail.com> wrote:
> From: Marek Olšák <marek.olsak@amd.com>
>
> ---
>  src/mesa/state_tracker/st_extensions.c | 40 ++++++++--------------------------
>  1 file changed, 9 insertions(+), 31 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 5459891..77d6201 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -434,12 +434,14 @@ void st_init_extensions(struct pipe_screen *screen,
>
>     static const struct st_extension_cap_mapping cap_mapping[] = {
>        { o(ARB_base_instance),                PIPE_CAP_START_INSTANCE                   },
> -      { o(ARB_buffer_storage),               PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT },
> +      { o(ARB_buffer_storage),               PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT   },
> +      { o(ARB_color_buffer_float),           PIPE_CAP_VERTEX_COLOR_UNCLAMPED           },
>        { o(ARB_depth_clamp),                  PIPE_CAP_DEPTH_CLIP_DISABLE               },
>        { o(ARB_depth_texture),                PIPE_CAP_TEXTURE_SHADOW_MAP               },
>        { o(ARB_draw_buffers_blend),           PIPE_CAP_INDEP_BLEND_FUNC                 },
>        { o(ARB_draw_instanced),               PIPE_CAP_TGSI_INSTANCEID                  },
>        { o(ARB_fragment_program_shadow),      PIPE_CAP_TEXTURE_SHADOW_MAP               },
> +      { o(ARB_framebuffer_object),           PIPE_CAP_MIXED_FRAMEBUFFER_SIZES          },
>        { o(ARB_instanced_arrays),             PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR  },
>        { o(ARB_occlusion_query),              PIPE_CAP_OCCLUSION_QUERY                  },
>        { o(ARB_occlusion_query2),             PIPE_CAP_OCCLUSION_QUERY                  },
> @@ -449,6 +451,8 @@ void st_init_extensions(struct pipe_screen *screen,
>        { o(ARB_shader_stencil_export),        PIPE_CAP_SHADER_STENCIL_EXPORT            },
>        { o(ARB_shader_texture_lod),           PIPE_CAP_SM3                              },
>        { o(ARB_shadow),                       PIPE_CAP_TEXTURE_SHADOW_MAP               },
> +      { o(ARB_texture_buffer_object),        PIPE_CAP_TEXTURE_BUFFER_OBJECTS           },
> +      { o(ARB_texture_gather),               PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS    },
>        { o(ARB_texture_mirror_clamp_to_edge), PIPE_CAP_TEXTURE_MIRROR_CLAMP             },
>        { o(ARB_texture_non_power_of_two),     PIPE_CAP_NPOT_TEXTURES                    },
>        { o(ARB_timer_query),                  PIPE_CAP_QUERY_TIMESTAMP                  },
> @@ -469,6 +473,7 @@ void st_init_extensions(struct pipe_screen *screen,
>        { o(ATI_separate_stencil),             PIPE_CAP_TWO_SIDED_STENCIL                },
>        { o(ATI_texture_mirror_once),          PIPE_CAP_TEXTURE_MIRROR_CLAMP             },
>        { o(NV_conditional_render),            PIPE_CAP_CONDITIONAL_RENDER               },
> +      { o(NV_primitive_restart),             PIPE_CAP_PRIMITIVE_RESTART                },
>        { o(NV_texture_barrier),               PIPE_CAP_TEXTURE_BARRIER                  },
>        /* GL_NV_point_sprite is not supported by gallium because we don't
>         * support the GL_POINT_SPRITE_R_MODE_NV option. */
> @@ -579,7 +584,8 @@ void st_init_extensions(struct pipe_screen *screen,
>            PIPE_FORMAT_R8G8B8A8_UNORM },
>          GL_TRUE }, /* at least one format must be supported */
>
> -      { { o(ARB_stencil_texturing) },
> +      { { o(ARB_stencil_texturing),
> +          o(ARB_texture_stencil8) },
>          { PIPE_FORMAT_X24S8_UINT,
>            PIPE_FORMAT_S8X24_UINT },
>          GL_TRUE }, /* at least one format must be supported */
> @@ -673,9 +679,6 @@ void st_init_extensions(struct pipe_screen *screen,
>                            ARRAY_SIZE(vertex_mapping), PIPE_BUFFER,
>                            PIPE_BIND_VERTEX_BUFFER);
>
> -   if (extensions->ARB_stencil_texturing)
> -      extensions->ARB_texture_stencil8 = GL_TRUE;
> -
>     if (screen->get_param(screen, PIPE_CAP_TEXTURE_FLOAT_LINEAR)) {
>        extensions->OES_texture_float_linear = extensions->OES_texture_float;
>        extensions->OES_texture_half_float_linear =
> @@ -753,27 +756,11 @@ void st_init_extensions(struct pipe_screen *screen,
>        extensions->ANGLE_texture_compression_dxt = GL_FALSE;
>     }
>
> -   if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY,
> -                                PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) {
> -#if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */
> -      extensions->ARB_geometry_shader4 = GL_TRUE;
> -#endif
> -   }
> -
>     if (screen->get_shader_param(screen, PIPE_SHADER_TESS_CTRL,
>                                  PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) {
>        extensions->ARB_tessellation_shader = GL_TRUE;
>     }
>
> -   if (screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) {
> -      extensions->NV_primitive_restart = GL_TRUE;
> -   }
> -
> -   /* ARB_color_buffer_float. */
> -   if (screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_UNCLAMPED)) {
> -      extensions->ARB_color_buffer_float = GL_TRUE;
> -   }
> -
>     if (screen->fence_finish) {
>        extensions->ARB_sync = GL_TRUE;
>     }
> @@ -858,9 +845,7 @@ void st_init_extensions(struct pipe_screen *screen,
>     consts->MinMapBufferAlignment =
>        screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT);
>
> -   if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) {
> -      extensions->ARB_texture_buffer_object = GL_TRUE;
> -
> +   if (extensions->ARB_texture_buffer_object) {
>        consts->MaxTextureBufferSize =
>           _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE),
>                (1u << 31) - 1);
> @@ -875,10 +860,6 @@ void st_init_extensions(struct pipe_screen *screen,
>                               PIPE_BIND_SAMPLER_VIEW);
>     }
>
> -   if (screen->get_param(screen, PIPE_CAP_MIXED_FRAMEBUFFER_SIZES)) {
> -      extensions->ARB_framebuffer_object = GL_TRUE;
> -   }
> -
>     /* Unpacking a varying in the fragment shader costs 1 texture indirection.
>      * If the number of available texture indirections is very limited, then we
>      * prefer to disable varying packing rather than run the risk of varying
> @@ -903,9 +884,6 @@ void st_init_extensions(struct pipe_screen *screen,
>           extensions->AMD_vertex_shader_viewport_index = GL_TRUE;
>     }
>
> -   if (consts->MaxProgramTextureGatherComponents > 0)
> -      extensions->ARB_texture_gather = GL_TRUE;
> -
>     /* GL_ARB_ES3_compatibility.
>      *
>      * Assume that ES3 is supported if GLSL 3.30 is supported.
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Reviewed-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>