[Mesa-dev] [PATCH 02/13] glsl: Add built-in functions for NV_shader_atomic_float

Ian Romanick idr at freedesktop.org
Mon Aug 20 22:19:37 UTC 2018


On 08/20/2018 12:10 PM, Caio Marcelo de Oliveira Filho wrote:
> Hi,
> 
>> @@ -1133,6 +1159,9 @@ builtin_builder::create_intrinsics()
>>                  _atomic_intrinsic2(buffer_atomics_supported,
>>                                     glsl_type::int_type,
>>                                     ir_intrinsic_generic_atomic_add),
>> +                _atomic_intrinsic2(NV_shader_atomic_float_supported,
>> +                                   glsl_type::float_type,
>> +                                   ir_intrinsic_generic_atomic_add),
>>                  _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop,
>>                                             ir_intrinsic_atomic_counter_add),
>>                  NULL);
> 
> (...)
> 
>> @@ -3185,6 +3220,9 @@ builtin_builder::create_builtins()
>>                  _atomic_op2("__intrinsic_atomic_exchange",
>>                              buffer_atomics_supported,
>>                              glsl_type::int_type),
>> +                _atomic_op2("__intrinsic_atomic_exchange",
>> +                            shader_atomic_float_exchange,
>> +                            glsl_type::float_type),
>>                  NULL);
>>     add_function("atomicCompSwap",
>>                  _atomic_op3("__intrinsic_atomic_comp_swap",
> 
> Question: why some builtins care about "supported" while other care
> about the extension being "enabled"?

There are actually two different things happening.  In the cases where
we only care about the extension being supported, we're creating a
hidden intrinsic function.  These are used internally by the compiler to
implement various features.  In the cases where we care about the
extension being enabled, we're creating the user-visible function.
Usually the user-visible function will is implemented by calling the
intrinsic.  This two level approach is used so that we can more cleanly
support cases where multiple extensions have functions with slightly
different names that do the same thing.  atomicCounterMaxARB and
atomicCounterMax, for example, are both implemented using
__intrinsic_atomic_max.

> Thanks,
> Caio


More information about the mesa-dev mailing list