[Mesa-dev] [PATCH 6/6] st/mesa: add sampler/texture support for geometry shaders

Jose Fonseca jfonseca at vmware.com
Sun Aug 5 00:34:24 PDT 2012


Couldn't spot any problem. Seems like a nice cleanup.

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

Jose

----- Original Message -----
> ---
>  src/mesa/state_tracker/st_atom_sampler.c |    2 --
>  src/mesa/state_tracker/st_atom_texture.c |   24
>  ++++++++++++++++++++++++
>  src/mesa/state_tracker/st_context.c      |    5 +++++
>  src/mesa/state_tracker/st_context.h      |    8 ++++++--
>  4 files changed, 35 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_atom_sampler.c
> b/src/mesa/state_tracker/st_atom_sampler.c
> index 8dc45fd..04e7c4e 100644
> --- a/src/mesa/state_tracker/st_atom_sampler.c
> +++ b/src/mesa/state_tracker/st_atom_sampler.c
> @@ -267,14 +267,12 @@ update_samplers(struct st_context *st)
>  
>     if (ctx->Const.MaxGeometryTextureImageUnits > 0 &&
>         ctx->GeometryProgram._Current) {
> -/*
>        update_shader_samplers(st,
>                               PIPE_SHADER_GEOMETRY,
>                               &ctx->GeometryProgram._Current->Base,
>                               ctx->Const.MaxGeometryTextureImageUnits,
>                               st->state.geometry_samplers,
>                               &st->state.num_geometry_samplers);
> -*/
>     }
>  }
>  
> diff --git a/src/mesa/state_tracker/st_atom_texture.c
> b/src/mesa/state_tracker/st_atom_texture.c
> index e88675d..37e5277 100644
> --- a/src/mesa/state_tracker/st_atom_texture.c
> +++ b/src/mesa/state_tracker/st_atom_texture.c
> @@ -332,6 +332,20 @@ update_fragment_textures(struct st_context *st)
>  }
>  
>  
> +static void
> +update_geometry_textures(struct st_context *st)
> +{
> +   const struct gl_context *ctx = st->ctx;
> +
> +   update_textures(st,
> +                   PIPE_SHADER_GEOMETRY,
> +                   &ctx->GeometryProgram._Current->Base,
> +                   ctx->Const.MaxTextureImageUnits,
> +                   st->state.geometry_sampler_views,
> +                   &st->state.num_geometry_textures);
> +}
> +
> +
>  const struct st_tracked_state st_update_texture = {
>     "st_update_texture",					/* name */
>     {							/* dirty */
> @@ -352,6 +366,16 @@ const struct st_tracked_state
> st_update_vertex_texture = {
>  };
>  
>  
> +const struct st_tracked_state st_update_geometry_texture = {
> +   "st_update_geometry_texture",			/* name */
> +   {							/* dirty */
> +      _NEW_TEXTURE,					/* mesa */
> +      ST_NEW_GEOMETRY_PROGRAM,				/* st */
> +   },
> +   update_geometry_textures				/* update */
> +};
> +
> +
>  
>  static void
>  finalize_textures(struct st_context *st)
> diff --git a/src/mesa/state_tracker/st_context.c
> b/src/mesa/state_tracker/st_context.c
> index 2f95161..1b5703b 100644
> --- a/src/mesa/state_tracker/st_context.c
> +++ b/src/mesa/state_tracker/st_context.c
> @@ -258,6 +258,11 @@ static void st_destroy_context_priv( struct
> st_context *st )
>                                  &st->state.vertex_sampler_views[i]);
>     }
>  
> +   for (i = 0; i < Elements(st->state.geometry_sampler_views); i++)
> {
> +      pipe_sampler_view_release(st->pipe,
> +
>                                &st->state.geometry_sampler_views[i]);
> +   }
> +
>     if (st->default_texture) {
>        st->ctx->Driver.DeleteTexture(st->ctx, st->default_texture);
>        st->default_texture = NULL;
> diff --git a/src/mesa/state_tracker/st_context.h
> b/src/mesa/state_tracker/st_context.h
> index 0dfd81c..f8fb74c 100644
> --- a/src/mesa/state_tracker/st_context.h
> +++ b/src/mesa/state_tracker/st_context.h
> @@ -98,8 +98,9 @@ struct st_context
>        struct pipe_blend_state               blend;
>        struct pipe_depth_stencil_alpha_state depth_stencil;
>        struct pipe_rasterizer_state          rasterizer;
> -      struct pipe_sampler_state
>    fragment_samplers[PIPE_MAX_SAMPLERS];
> -      struct pipe_sampler_state
>    vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
> +      struct pipe_sampler_state
> fragment_samplers[PIPE_MAX_SAMPLERS];
> +      struct pipe_sampler_state
> vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
> +      struct pipe_sampler_state
> geometry_samplers[PIPE_MAX_GEOMETRY_SAMPLERS];
>        struct pipe_clip_state clip;
>        struct {
>           void *ptr;
> @@ -108,14 +109,17 @@ struct st_context
>        struct pipe_framebuffer_state framebuffer;
>        struct pipe_sampler_view
>        *fragment_sampler_views[PIPE_MAX_SAMPLERS];
>        struct pipe_sampler_view
>        *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
> +      struct pipe_sampler_view
> *geometry_sampler_views[PIPE_MAX_GEOMETRY_SAMPLERS];
>        struct pipe_scissor_state scissor;
>        struct pipe_viewport_state viewport;
>        unsigned sample_mask;
>  
>        GLuint num_fragment_samplers;
>        GLuint num_vertex_samplers;
> +      GLuint num_geometry_samplers;
>        GLuint num_fragment_textures;
>        GLuint num_vertex_textures;
> +      GLuint num_geometry_textures;
>  
>        GLuint poly_stipple[32];  /**< In OpenGL's bottom-to-top order
>        */
>  
> --
> 1.7.3.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list