[Mesa-dev] ARB_copy_image support in Gallium

Marek Olšák maraeo at gmail.com
Sat Aug 15 15:58:10 PDT 2015


Sounds good to me.

Marek

On Sat, Aug 15, 2015 at 5:04 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Let me put this another way... if anyone is strongly opposed to this
> plan, please speak up now. Otherwise I'll push this before the
> branchpoint (again, without actually enabling the ext).
>
> On Wed, Aug 12, 2015 at 3:17 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> As I'm guessing that it's unlikely that the VMWare implementation will
>> get upstreamed before the Mesa 11.0 branch point, how do people feel
>> about including the below implementation *without* the extension
>> enable? That way people will still be able to run bioshock infinite
>> without resorting to patching (by adding the ext override) while we
>> wait for a proper implementation.
>>
>> Thoughts?
>>
>>   -ilia
>>
>>
>> On Mon, Jul 20, 2015 at 3:19 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>> On Mon, Jul 20, 2015 at 2:44 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>>> Hi Brian,
>>>>
>>>> You marked off ARB_copy_image (and ARB_clear_texture) as in-progress
>>>> by VMware some months ago -- has there been any movement on that? It
>>>> appears that Bioshock Infinite requires ARB_copy_image so might be
>>>> nice to get that added in.
>>>>
>>>> The complication in implementing ARB_copy_image was that st/mesa will
>>>> pick potentially different PIPE_FORMAT enums for the same internal
>>>> format, depending on the parameters to the glTexImage call. A
>>>> developer (irc handle Leftmost, I forget his real name, sorry) tried
>>>> to wrestle with the issues this presents, but as I recall ended up
>>>> coming up short.
>>>>
>>>> The final implementation probably needs some combination of
>>>> resource_copy_region and blit. I think resource_copy_region currently
>>>> is spec'd to require identical formats in src and dst, but that could
>>>> be relaxed.
>>>>
>>>> Anyways, would be interested in hearing whether you guys have made any
>>>> progress, or if you had thoughts on proper implementation.
>>>>
>>>> Cheers,
>>>>
>>>>   -ilia
>>>
>>> As an aside, here's a very naive implementation of the ext, which
>>> fails for lots of reasons not the least of which is that we default to
>>> BGRA instead of RGBA. Perhaps we could create a resource_copy_region
>>> version that also takes (or knows about) swizzles... that should also
>>> cover many (all?) of the situations I think.
>>>
>>>   -ilia
>>>
>>> diff --git a/src/mesa/state_tracker/st_cb_texture.c
>>> b/src/mesa/state_tracker/st_cb_texture.c
>>> index 7ea3846..b6b0081 100644
>>> --- a/src/mesa/state_tracker/st_cb_texture.c
>>> +++ b/src/mesa/state_tracker/st_cb_texture.c
>>> @@ -1864,6 +1864,28 @@ st_TextureView(struct gl_context *ctx,
>>>     return GL_TRUE;
>>>  }
>>>
>>> +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)
>>> @@ -1896,4 +1918,6 @@ st_init_texture_functions(struct
>>> dd_function_table *functions)
>>>
>>>     functions->AllocTextureStorage = st_AllocTextureStorage;
>>>     functions->TextureView = st_TextureView;
>>> +
>>> +   functions->CopyImageSubData = st_CopyImageSubData;
>>>  }
>>> diff --git a/src/mesa/state_tracker/st_extensions.c
>>> b/src/mesa/state_tracker/st_extensions.c
>>> index b1057f3..9bff7b4 100644
>>> --- a/src/mesa/state_tracker/st_extensions.c
>>> +++ b/src/mesa/state_tracker/st_extensions.c
>>> @@ -589,6 +589,7 @@ void st_init_extensions(struct pipe_screen *screen,
>>>      * Extensions that are supported by all Gallium drivers:
>>>      */
>>>     extensions->ARB_ES2_compatibility = GL_TRUE;
>>> +   extensions->ARB_copy_image = GL_TRUE;
>>>     extensions->ARB_draw_elements_base_vertex = GL_TRUE;
>>>     extensions->ARB_explicit_attrib_location = GL_TRUE;
>>>     extensions->ARB_explicit_uniform_location = GL_TRUE;
> _______________________________________________
> 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