[Mesa-dev] [PATCH 2/3] st/mesa: implement ARB_clear_texture

Marek Olšák maraeo at gmail.com
Tue Nov 10 12:57:59 PST 2015


Patches 1-2:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Mon, Nov 9, 2015 at 7:40 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/mesa/state_tracker/st_cb_texture.c | 29 +++++++++++++++++++++++++++++
>  src/mesa/state_tracker/st_extensions.c |  1 +
>  2 files changed, 30 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index d4c916e..62f149a 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -1873,6 +1873,34 @@ st_TextureView(struct gl_context *ctx,
>     return GL_TRUE;
>  }
>
> +static void
> +st_ClearTexSubImage(struct gl_context *ctx,
> +                    struct gl_texture_image *texImage,
> +                    GLint xoffset, GLint yoffset, GLint zoffset,
> +                    GLsizei width, GLsizei height, GLsizei depth,
> +                    const GLvoid *clearValue)
> +{
> +   static const char zeros[16] = {0};
> +   struct st_texture_image *stImage = st_texture_image(texImage);
> +   struct pipe_resource *pt = stImage->pt;
> +   struct st_context *st = st_context(ctx);
> +   struct pipe_context *pipe = st->pipe;
> +   unsigned level = texImage->Level;
> +   struct pipe_box box;
> +
> +   if (!pt)
> +      return;
> +
> +   u_box_3d(xoffset, yoffset, zoffset + texImage->Face,
> +            width, height, depth, &box);
> +   if (texImage->TexObject->Immutable) {
> +      level += texImage->TexObject->MinLevel;
> +      box.z += texImage->TexObject->MinLayer;
> +   }
> +
> +   pipe->clear_texture(pipe, pt, level, &box, clearValue ? clearValue : zeros);
> +}
> +
>  void
>  st_init_texture_functions(struct dd_function_table *functions)
>  {
> @@ -1904,4 +1932,5 @@ st_init_texture_functions(struct dd_function_table *functions)
>
>     functions->AllocTextureStorage = st_AllocTextureStorage;
>     functions->TextureView = st_TextureView;
> +   functions->ClearTexSubImage = st_ClearTexSubImage;
>  }
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 03b4b97..315082b 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -455,6 +455,7 @@ 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_clear_texture),                PIPE_CAP_CLEAR_TEXTURE                    },
>        { o(ARB_color_buffer_float),           PIPE_CAP_VERTEX_COLOR_UNCLAMPED           },
>        { o(ARB_copy_image),                   PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS },
>        { o(ARB_depth_clamp),                  PIPE_CAP_DEPTH_CLIP_DISABLE               },
> --
> 2.4.10
>
> _______________________________________________
> 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