summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_context.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-11-01 14:30:13 +1000
committerDave Airlie <[email protected]>2017-11-10 08:39:35 +1000
commit9f1db21f287e76a9b36e0b240929aed4f59483e5 (patch)
tree34931b4e9808a816b2458d81a15a27fd0cd481e0 /src/mesa/state_tracker/st_context.c
parente0fb6de313f1a335fe628d057ad744872dab9446 (diff)
st/mesa: start adding support for hw atomics atom. (v2)
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 <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_context.c')
-rw-r--r--src/mesa/state_tracker/st_context.c9
1 files changed, 8 insertions, 1 deletions
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;