[Mesa-dev] [PATCH v2 53/64] radeonsi: add all resident buffers to the current CS
Marek Olšák
maraeo at gmail.com
Wed Jun 7 13:46:13 UTC 2017
On Tue, May 30, 2017 at 10:36 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Resident buffers have to be added to every new command stream.
> Though, this could be slightly improved when current shaders
> don't use any bindless textures/images but usually applications
> tend to use bindless for almost every draw call, and the winsys
> thread might help when buffers are added early.
>
> v2: - store pipe_sampler_view instead of si_sampler_view
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/gallium/drivers/radeonsi/si_descriptors.c | 50 +++++++++++++++++++++++++++
> src/gallium/drivers/radeonsi/si_hw_context.c | 1 +
> src/gallium/drivers/radeonsi/si_state.h | 1 +
> 3 files changed, 52 insertions(+)
>
> diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
> index 238cca4561..769ce778cf 100644
> --- a/src/gallium/drivers/radeonsi/si_descriptors.c
> +++ b/src/gallium/drivers/radeonsi/si_descriptors.c
> @@ -2373,6 +2373,56 @@ static void si_make_image_handle_resident(struct pipe_context *ctx,
> }
>
>
> +void si_all_resident_buffers_begin_new_cs(struct si_context *sctx)
> +{
> + unsigned num_resident_tex_handles, num_resident_img_handles;
> + unsigned num_bindless_descriptors;
> + unsigned i;
> +
> + num_resident_tex_handles = sctx->resident_tex_handles.size /
> + sizeof(struct si_texture_handle *);
> + num_resident_img_handles = sctx->resident_img_handles.size /
> + sizeof(struct si_image_handle *);
> + num_bindless_descriptors = sctx->bindless_descriptors.size /
> + sizeof(struct r600_resource *);
> +
> + /* Add all bindless descriptors. */
> + for (i = 0; i < num_bindless_descriptors; i++) {
> + struct r600_resource *desc =
> + *util_dynarray_element(&sctx->bindless_descriptors,
> + struct r600_resource *, i);
> +
> + radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx, desc,
> + RADEON_USAGE_READ,
This should be RADEON_USAGE_READWRITE, because patch 16 uses
WRITE_DATA to write to it.
Marek
More information about the mesa-dev
mailing list