[Mesa-dev] [PATCH v2 11/14] st/mesa: expose ARB_compute_variable_group_size
Samuel Pitoiset
samuel.pitoiset at gmail.com
Mon Sep 12 15:43:26 UTC 2016
On 09/12/2016 05:26 PM, Nicolai Hähnle wrote:
>
>
> On 11.09.2016 20:45, Samuel Pitoiset wrote:
>> This extension is only exposed if the underlying driver supports
>> ARB_compute_shader and if PIPE_COMPUTE_MAX_VARIABLE_THREADS_PER_BLOCK
>> is set.
>>
>> v2: - expose the ext based on that new cap
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>> src/mesa/state_tracker/st_extensions.c | 22 ++++++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>>
>> diff --git a/src/mesa/state_tracker/st_extensions.c
>> b/src/mesa/state_tracker/st_extensions.c
>> index 807fbfb..ad7c637 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;
>> +
>> + screen->get_compute_param(screen, PIPE_SHADER_IR_TGSI,
>> +
>> PIPE_COMPUTE_CAP_MAX_VARIABLE_THREADS_PER_BLOCK,
>> + &max_variable_threads_per_block);
>
> I think this should check the return value. Or, in the earlier patch,
> the handling in sp_screen.c needs to be changed. Not sure what the
> convention should be, but as-is, using this with softpipe will not
> initialize max_variable_threads_per_block.
I think we never check the return value of get_compute_param(). But
initializing max_variable_threads_per_block to 0 should actualy help,
what do you think?
>
> Nicolai
>
>> +
>> + 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;
>> + }
>> }
>> }
>>
>>
--
-Samuel
More information about the mesa-dev
mailing list