diff options
author | Samuel Pitoiset <[email protected]> | 2016-09-07 18:00:16 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2016-10-07 00:18:57 +0200 |
commit | 590734fa0d2c97035eae33278cce6065c98b880f (patch) | |
tree | 4d7aabc1dda47faac632e1b0a1bbc58e74762d04 /src | |
parent | dfd7734cb785268acd914590733dcb5a30e873a1 (diff) |
st/mesa: expose ARB_compute_variable_group_size
This extension is only exposed if the underlying driver supports
ARB_compute_shader and if PIPE_COMPUTE_MAX_VARIABLE_THREADS_PER_BLOCK
is set.
v3: - initialize max_variable_threads_per_block to 0
v2: - expose the ext based on that new cap
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 2282dc7486e..b9befa1ac57 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1196,6 +1196,28 @@ void st_init_extensions(struct pipe_screen *screen, extensions->ARB_compute_shader = extensions->ARB_shader_image_load_store && extensions->ARB_shader_atomic_counters; + + if (extensions->ARB_compute_shader) { + uint64_t max_variable_threads_per_block = 0; + + screen->get_compute_param(screen, PIPE_SHADER_IR_TGSI, + PIPE_COMPUTE_CAP_MAX_VARIABLE_THREADS_PER_BLOCK, + &max_variable_threads_per_block); + + for (i = 0; i < 3; i++) { + /* Clamp the values to avoid having a local work group size + * greater than the maximum number of invocations. + */ + consts->MaxComputeVariableGroupSize[i] = + MIN2(consts->MaxComputeWorkGroupSize[i], + max_variable_threads_per_block); + } + consts->MaxComputeVariableGroupInvocations = + max_variable_threads_per_block; + + extensions->ARB_compute_variable_group_size = + max_variable_threads_per_block > 0; + } } } |