[Mesa-dev] [RFC PATCH 28/65] tc: add ARB_bindless_texture support

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue May 23 12:17:15 UTC 2017



On 05/22/2017 07:01 PM, Marek Olšák wrote:
> On Fri, May 19, 2017 at 6:52 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>   src/gallium/auxiliary/util/u_threaded_context.c    | 147 +++++++++++++++++++++
>>   .../auxiliary/util/u_threaded_context_calls.h      |   4 +
>>   2 files changed, 151 insertions(+)
>>
>> diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
>> index 8ea7f8aa26..36c2e4ed46 100644
>> --- a/src/gallium/auxiliary/util/u_threaded_context.c
>> +++ b/src/gallium/auxiliary/util/u_threaded_context.c
>> @@ -1086,6 +1086,147 @@ tc_stream_output_target_destroy(struct pipe_context *_pipe,
>>
>>
>>   /********************************************************************
>> + * bindless
>> + */
>> +
>> +static uint64_t
>> +tc_create_texture_handle(struct pipe_context *_pipe,
>> +                         struct pipe_resource *res,
>> +                         struct pipe_sampler_view *view,
>> +                         const struct pipe_sampler_state *state)
>> +{
>> +   struct threaded_context *tc = threaded_context(_pipe);
>> +   struct pipe_context *pipe = tc->pipe;
>> +
>> +   tc_sync(tc);
>> +   return pipe->create_texture_handle(pipe, res, view, state);
>> +}
>> +
>> +struct tc_delete_texture_handle
>> +{
>> +   uint64_t handle;
>> +};
> 
> You can just add uint64_t handle into union tc_payload directly,
> remove tc_payload::__use_8_bytes, and use tc_add_small_call instead.

Fixed locally, for both texture and image handles.

> 
>> +
>> +static void
>> +tc_call_delete_texture_handle(struct pipe_context *pipe,
>> +                              union tc_payload *payload)
>> +{
>> +   struct tc_delete_texture_handle *p =
>> +      (struct tc_delete_texture_handle *)payload;
>> +
>> +   pipe->delete_texture_handle(pipe, p->handle);
>> +}
>> +
>> +static void
>> +tc_delete_texture_handle(struct pipe_context *_pipe, uint64_t handle)
>> +{
>> +   struct threaded_context *tc = threaded_context(_pipe);
>> +   struct tc_delete_texture_handle *p =
>> +      tc_add_struct_typed_call(tc, TC_CALL_delete_texture_handle,
>> +                               tc_delete_texture_handle);
>> +
>> +   p->handle = handle;
>> +}
>> +
>> +struct tc_make_texture_handle_resident
>> +{
>> +   uint64_t handle;
>> +   bool resident;
>> +};
>> +
>> +static void
>> +tc_call_make_texture_handle_resident(struct pipe_context *pipe,
>> +                                     union tc_payload *payload)
>> +{
>> +   struct tc_make_texture_handle_resident *p =
>> +      (struct tc_make_texture_handle_resident *)payload;
>> +
>> +   pipe->make_texture_handle_resident(pipe, p->handle, p->resident);
>> +}
>> +
>> +static void
>> +tc_make_texture_handle_resident(struct pipe_context *_pipe, uint64_t handle,
>> +                                bool resident)
>> +{
>> +   struct threaded_context *tc = threaded_context(_pipe);
>> +   struct tc_make_texture_handle_resident *p =
>> +      tc_add_struct_typed_call(tc, TC_CALL_make_texture_handle_resident,
>> +                               tc_make_texture_handle_resident);
>> +
>> +   p->handle = handle;
>> +   p->resident = resident;
>> +}
>> +
>> +static uint64_t
>> +tc_create_image_handle(struct pipe_context *_pipe,
>> +                       const struct pipe_image_view *image)
>> +{
>> +   struct threaded_context *tc = threaded_context(_pipe);
>> +   struct pipe_context *pipe = tc->pipe;
>> +
>> +   tc_sync(tc);
>> +   return pipe->create_image_handle(pipe, image);
>> +}
>> +
>> +struct tc_delete_image_handle
>> +{
>> +   uint64_t handle;
>> +};
> 
> Same here.
> 
> Marek
> 
>> +
>> +static void
>> +tc_call_delete_image_handle(struct pipe_context *pipe,
>> +                            union tc_payload *payload)
>> +{
>> +   struct tc_delete_image_handle *p =
>> +      (struct tc_delete_image_handle *)payload;
>> +
>> +   pipe->delete_image_handle(pipe, p->handle);
>> +}
>> +
>> +static void
>> +tc_delete_image_handle(struct pipe_context *_pipe, uint64_t handle)
>> +{
>> +   struct threaded_context *tc = threaded_context(_pipe);
>> +   struct tc_delete_image_handle *p =
>> +      tc_add_struct_typed_call(tc, TC_CALL_delete_image_handle,
>> +                               tc_delete_image_handle);
>> +
>> +   p->handle = handle;
>> +}


More information about the mesa-dev mailing list