From 9f1db21f287e76a9b36e0b240929aed4f59483e5 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 1 Nov 2017 14:30:13 +1000 Subject: st/mesa: start adding support for hw atomics atom. (v2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a new atom that calls the new driver API to bind buffers containing hw atomics. v2: fixup bindings for sparse buffers. (mareko/nha) don't bind buffer atomics when hw atomics are enabled. use NewAtomicBuffer (mareko) Tested-By: Gert Wollny Reviewed-by: Marek Olšák Signed-off-by: Dave Airlie --- src/mesa/state_tracker/st_context.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/mesa/state_tracker/st_context.c') diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 5d8dd8b97ef..e82090b7e45 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -405,6 +405,10 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, st->has_multi_draw_indirect = screen->get_param(screen, PIPE_CAP_MULTI_DRAW_INDIRECT); + st->has_hw_atomics = + screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, + PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS) ? true : false; + /* GL limits and extensions */ st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions); st_init_extensions(pipe->screen, &ctx->Const, @@ -497,7 +501,10 @@ static void st_init_driver_flags(struct st_context *st) /* Shader resources */ f->NewTextureBuffer = ST_NEW_SAMPLER_VIEWS; - f->NewAtomicBuffer = ST_NEW_ATOMIC_BUFFER; + if (st->has_hw_atomics) + f->NewAtomicBuffer = ST_NEW_HW_ATOMICS; + else + f->NewAtomicBuffer = ST_NEW_ATOMIC_BUFFER; f->NewShaderStorageBuffer = ST_NEW_STORAGE_BUFFER; f->NewImageUnits = ST_NEW_IMAGE_UNITS; -- cgit v1.2.3