[Mesa-dev] [PATCH v4] glsl: update the extensions that are enabled for 460
Ilia Mirkin
imirkin at alum.mit.edu
Fri Aug 4 14:27:55 UTC 2017
On Aug 4, 2017 02:02, "Samuel Pitoiset" <samuel.pitoiset at gmail.com> wrote:
On 08/03/2017 07:36 PM, Ilia Mirkin wrote:
> On Thu, Aug 3, 2017 at 5:24 AM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>
>> Other ones are either unsupported or don't have any helper
>> function checks.
>>
>> v4: - drop ARB suffix for shader_group_vote/arb_shader_atomic_counter_ops
>> v3: - always add gl_BaseVertex & co when 460 is enabled
>> v2: - fix ARB_shader_draw_parameters system value names
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>> src/compiler/glsl/builtin_functions.cpp | 81
>> +++++++++++++++++++++++++++++----
>> src/compiler/glsl/builtin_variables.cpp | 5 ++
>> 2 files changed, 78 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/compiler/glsl/builtin_functions.cpp
>> b/src/compiler/glsl/builtin_functions.cpp
>> index 84833bdd7d..bbb60b4e64 100644
>> --- a/src/compiler/glsl/builtin_functions.cpp
>> +++ b/src/compiler/glsl/builtin_functions.cpp
>> @@ -151,6 +151,12 @@ v130_desktop(const _mesa_glsl_parse_state *state)
>> }
>>
>> static bool
>> +v460_desktop(const _mesa_glsl_parse_state *state)
>> +{
>> + return state->is_version(460, 0);
>> +}
>> +
>> +static bool
>> v130_fs_only(const _mesa_glsl_parse_state *state)
>> {
>> return state->is_version(130, 300) &&
>> @@ -483,7 +489,7 @@ shader_atomic_counters(const _mesa_glsl_parse_state
>> *state)
>> static bool
>> shader_atomic_counter_ops(const _mesa_glsl_parse_state *state)
>> {
>> - return state->ARB_shader_atomic_counter_ops_enable;
>> + return v460_desktop(state) || state->ARB_shader_atomic_count
>> er_ops_enable;
>> }
>>
>> static bool
>> @@ -606,7 +612,7 @@ barrier_supported(const _mesa_glsl_parse_state *state)
>> static bool
>> vote(const _mesa_glsl_parse_state *state)
>> {
>> - return state->ARB_shader_group_vote_enable;
>> + return v460_desktop(state) || state->ARB_shader_group_vote_enable;
>> }
>>
>> static bool
>> @@ -962,7 +968,8 @@ private:
>>
>> ir_function_signature *_vote_intrinsic(builtin_available_predicate
>> avail,
>> enum ir_intrinsic_id id);
>> - ir_function_signature *_vote(const char *intrinsic_name);
>> + ir_function_signature *_vote(const char *intrinsic_name,
>> + builtin_available_predicate avail);
>>
>> #undef B0
>> #undef B1
>> @@ -3031,6 +3038,43 @@ builtin_builder::create_builtins()
>> shader_atomic_counter_ops),
>> NULL);
>>
>> + add_function("atomicCounterAdd",
>> + _atomic_counter_op1("__intrinsic_atomic_add",
>> + v460_desktop),
>> + NULL);
>> + add_function("atomicCounterSubtract",
>> + _atomic_counter_op1("__intrinsic_atomic_sub",
>> + v460_desktop),
>> + NULL);
>> + add_function("atomicCounterMin",
>> + _atomic_counter_op1("__intrinsic_atomic_min",
>> + v460_desktop),
>> + NULL);
>> + add_function("atomicCounterMax",
>> + _atomic_counter_op1("__intrinsic_atomic_max",
>> + v460_desktop),
>> + NULL);
>> + add_function("atomicCounterAnd",
>> + _atomic_counter_op1("__intrinsic_atomic_and",
>> + v460_desktop),
>> + NULL);
>> + add_function("atomicCounterOr",
>> + _atomic_counter_op1("__intrinsic_atomic_or",
>> + v460_desktop),
>> + NULL);
>> + add_function("atomicCounterXor",
>> + _atomic_counter_op1("__intrinsic_atomic_xor",
>> + v460_desktop),
>> + NULL);
>> + add_function("atomicCounterExchange",
>> + _atomic_counter_op1("__intrinsic_atomic_exchange",
>> + v460_desktop),
>> + NULL);
>> + add_function("atomicCounterCompSwap",
>> + _atomic_counter_op2("__intrinsic_atomic_comp_swap",
>> + v460_desktop),
>> + NULL);
>> +
>>
>
> So all of these reference the __intrinsic_atomic_max functions. Do
> those ned to be fixed up too? Specifically,
>
> add_function("__intrinsic_atomic_max",
> _atomic_intrinsic2(buffer_atomics_supported,
> glsl_type::uint_type,
> ir_intrinsic_generic_atomic_max),
> _atomic_intrinsic2(buffer_atomics_supported,
> glsl_type::int_type,
> ir_intrinsic_generic_atomic_max),
> _atomic_counter_intrinsic1(shader_atomic_counter_ops,
> ir_intrinsic_atomic_counter_ma
> x),
> NULL);
>
> I believe the latter one needs to have its availability function
> adjusted to be a||b.
>
Yes, but it's already adjusted in this patch:
@@ -483,7 +489,7 @@ shader_atomic_counters(const _mesa_glsl_parse_state
*state)
static bool
shader_atomic_counter_ops(const _mesa_glsl_parse_state *state)
{
- return state->ARB_shader_atomic_counter_ops_enable;
+ return v460_desktop(state) || state->ARB_shader_atomic_count
er_ops_enable;
}
Will that not make the suffixed functions available in plain #version 460
then?
> add_function("atomicAdd",
>> _atomic_op2("__intrinsic_atomic_add",
>> buffer_atomics_supported,
>> @@ -3220,9 +3264,29 @@ builtin_builder::create_builtins()
>> glsl_type::uint64_t_type),
>> NULL);
>>
>> - add_function("anyInvocationARB", _vote("__intrinsic_vote_any"),
>> NULL);
>> - add_function("allInvocationsARB", _vote("__intrinsic_vote_all"),
>> NULL);
>> - add_function("allInvocationsEqualARB", _vote("__intrinsic_vote_eq"),
>> NULL);
>> + add_function("anyInvocationARB",
>> + _vote("__intrinsic_vote_any", vote),
>> + NULL);
>> +
>> + add_function("allInvocationsARB",
>> + _vote("__intrinsic_vote_all", vote),
>> + NULL);
>> +
>> + add_function("allInvocationsEqualARB",
>> + _vote("__intrinsic_vote_eq", vote),
>> + NULL);
>> +
>> + add_function("anyInvocation",
>> + _vote("__intrinsic_vote_any", v460_desktop),
>> + NULL);
>> +
>> + add_function("allInvocations",
>> + _vote("__intrinsic_vote_all", v460_desktop),
>> + NULL);
>> +
>> + add_function("allInvocationsEqual",
>> + _vote("__intrinsic_vote_eq", v460_desktop),
>> + NULL);
>>
>> add_function("__builtin_idiv64",
>> generate_ir::idiv64(mem_ctx,
>> integer_functions_supported),
>> @@ -6163,11 +6227,12 @@ builtin_builder::_vote_intrinsic(builtin_available_predicate
>> avail,
>> }
>>
>> ir_function_signature *
>> -builtin_builder::_vote(const char *intrinsic_name)
>> +builtin_builder::_vote(const char *intrinsic_name,
>> + builtin_available_predicate avail)
>> {
>> ir_variable *value = in_var(glsl_type::bool_type, "value");
>>
>> - MAKE_SIG(glsl_type::bool_type, vote, 1, value);
>> + MAKE_SIG(glsl_type::bool_type, avail, 1, value);
>>
>> ir_variable *retval = body.make_temp(glsl_type::bool_type,
>> "retval");
>>
>> diff --git a/src/compiler/glsl/builtin_variables.cpp
>> b/src/compiler/glsl/builtin_variables.cpp
>> index 19d427e4bc..ea2d897cc8 100644
>> --- a/src/compiler/glsl/builtin_variables.cpp
>> +++ b/src/compiler/glsl/builtin_variables.cpp
>> @@ -1017,6 +1017,11 @@ builtin_variable_generator::ge
>> nerate_vs_special_vars()
>>
>> if (state->is_version(130, 300))
>> add_system_value(SYSTEM_VALUE_VERTEX_ID, int_t, "gl_VertexID");
>> + if (state->is_version(460, 0)) {
>> + add_system_value(SYSTEM_VALUE_BASE_VERTEX, int_t,
>> "gl_BaseVertex");
>> + add_system_value(SYSTEM_VALUE_BASE_INSTANCE, int_t,
>> "gl_BaseInstance");
>> + add_system_value(SYSTEM_VALUE_DRAW_ID, int_t, "gl_DrawID");
>> + }
>> if (state->ARB_draw_instanced_enable)
>> add_system_value(SYSTEM_VALUE_INSTANCE_ID, int_t,
>> "gl_InstanceIDARB");
>> if (state->ARB_draw_instanced_enable || state->is_version(140, 300))
>> --
>> 2.13.3
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170804/7adabcc2/attachment-0001.html>
More information about the mesa-dev
mailing list