[Mesa-dev] [PATCH] st/mesa: add fake ARB_copy_image support in Gallium

Marek Olšák maraeo at gmail.com
Tue Aug 18 10:01:31 PDT 2015


If this is all that's needed for Bioshock, it's okay with me.

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

Marek

On Tue, Aug 18, 2015 at 5:50 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> This support should be removed in favor of something that actually works
> in all the weird cases. However this is simple and is enough to allow
> Bioshock Infinite to render properly on nvc0.
>
> Since the functionality is not implemented correctly, the extension will
> not appear in the extension string and mesa will still return
> INVALID_OPERATION for any glCopyImageSubData calls. In order to make use
> of this functionality, run with
> MESA_EXTENSION_OVERRIDE=GL_ARB_copy_image
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/mesa/state_tracker/st_cb_texture.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index 4f2ef6b..40bc29e 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -1873,6 +1873,31 @@ st_TextureView(struct gl_context *ctx,
>     return GL_TRUE;
>  }
>
> +/* HACK: this is only enough for the most basic uses of CopyImage. Must fix
> + * before actually exposing the extension.
> + */
> +static void
> +st_CopyImageSubData(struct gl_context *ctx,
> +                    struct gl_texture_image *src_image,
> +                    int src_x, int src_y, int src_z,
> +                    struct gl_texture_image *dst_image,
> +                    int dst_x, int dst_y, int dst_z,
> +                    int src_width, int src_height)
> +{
> +   struct st_context *st = st_context(ctx);
> +   struct pipe_context *pipe = st->pipe;
> +   struct st_texture_image *src = st_texture_image(src_image);
> +   struct st_texture_image *dst = st_texture_image(dst_image);
> +
> +   struct pipe_box box;
> +
> +   u_box_2d_zslice(src_x, src_y, src_z, src_width, src_height, &box);
> +   pipe->resource_copy_region(pipe, dst->pt, dst_image->Level,
> +                              dst_x, dst_y, dst_z,
> +                              src->pt, src_image->Level,
> +                              &box);
> +}
> +
>
>  void
>  st_init_texture_functions(struct dd_function_table *functions)
> @@ -1905,4 +1930,6 @@ st_init_texture_functions(struct dd_function_table *functions)
>
>     functions->AllocTextureStorage = st_AllocTextureStorage;
>     functions->TextureView = st_TextureView;
> +
> +   functions->CopyImageSubData = st_CopyImageSubData;
>  }
> --
> 2.4.6
>
> _______________________________________________
> 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