[Mesa-dev] [PATCH] gallium: pass the robust buffer access context flag to drivers
Nicolai Hähnle
nhaehnle at gmail.com
Mon Feb 8 15:01:18 UTC 2016
On 06.02.2016 16:26, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> radeonsi will not do bounds checking for loads if this is not set.
> ---
> src/gallium/include/pipe/p_defines.h | 6 ++++++
> src/mesa/state_tracker/st_manager.c | 6 +++++-
> 2 files changed, 11 insertions(+), 1 deletion(-)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index 800f16c..b01f6ea 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -349,6 +349,12 @@ enum pipe_flush_flags
> #define PIPE_CONTEXT_DEBUG (1 << 1)
>
> /**
> + * Whether out-of-bounds shader loads must return zero and out-of-bounds
> + * shader stores must be dropped.
> + */
> +#define PIPE_CONTEXT_ROBUST_BUFFER_ACCESS (1 << 2)
> +
> +/**
> * Flags for pipe_context::memory_barrier.
> */
> #define PIPE_BARRIER_MAPPED_BUFFER (1 << 0)
> diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
> index 385e26b..162810f 100644
> --- a/src/mesa/state_tracker/st_manager.c
> +++ b/src/mesa/state_tracker/st_manager.c
> @@ -635,6 +635,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
> struct pipe_context *pipe;
> struct gl_config mode;
> gl_api api;
> + unsigned ctx_flags = 0;
>
> if (!(stapi->profile_mask & (1 << attribs->profile)))
> return NULL;
> @@ -658,7 +659,10 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
> break;
> }
>
> - pipe = smapi->screen->context_create(smapi->screen, NULL, 0);
> + if (attribs->flags & ST_CONTEXT_FLAG_ROBUST_ACCESS)
> + ctx_flags |= PIPE_CONTEXT_ROBUST_BUFFER_ACCESS;
> +
> + pipe = smapi->screen->context_create(smapi->screen, NULL, ctx_flags);
> if (!pipe) {
> *error = ST_CONTEXT_ERROR_NO_MEMORY;
> return NULL;
>
More information about the mesa-dev
mailing list