<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Aug 4, 2017 02:02, "Samuel Pitoiset" <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="elided-text"><br>
<br>
On 08/03/2017 07:36 PM, Ilia Mirkin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Aug 3, 2017 at 5:24 AM, Samuel Pitoiset<br>
<<a href="mailto:samuel.pitoiset@gmail.com" target="_blank">samuel.pitoiset@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Other ones are either unsupported or don't have any helper<br>
function checks.<br>
<br>
v4: - drop ARB suffix for shader_group_vote/arb_shader_a<wbr>tomic_counter_ops<br>
v3: - always add gl_BaseVertex & co when 460 is enabled<br>
v2: - fix ARB_shader_draw_parameters system value names<br>
<br>
Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com" target="_blank">samuel.pitoiset@gmail.com</a>><br>
---<br>
src/compiler/glsl/builtin_func<wbr>tions.cpp | 81 +++++++++++++++++++++++++++++-<wbr>---<br>
src/compiler/glsl/builtin_vari<wbr>ables.cpp | 5 ++<br>
2 files changed, 78 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/compiler/glsl/builtin_fu<wbr>nctions.cpp b/src/compiler/glsl/builtin_fu<wbr>nctions.cpp<br>
index 84833bdd7d..bbb60b4e64 100644<br>
--- a/src/compiler/glsl/builtin_fu<wbr>nctions.cpp<br>
+++ b/src/compiler/glsl/builtin_fu<wbr>nctions.cpp<br>
@@ -151,6 +151,12 @@ v130_desktop(const _mesa_glsl_parse_state *state)<br>
}<br>
<br>
static bool<br>
+v460_desktop(const _mesa_glsl_parse_state *state)<br>
+{<br>
+ return state->is_version(460, 0);<br>
+}<br>
+<br>
+static bool<br>
v130_fs_only(const _mesa_glsl_parse_state *state)<br>
{<br>
return state->is_version(130, 300) &&<br>
@@ -483,7 +489,7 @@ shader_atomic_counters(const _mesa_glsl_parse_state *state)<br>
static bool<br>
shader_atomic_counter_ops(cons<wbr>t _mesa_glsl_parse_state *state)<br>
{<br>
- return state->ARB_shader_atomic_count<wbr>er_ops_enable;<br>
+ return v460_desktop(state) || state->ARB_shader_atomic_count<wbr>er_ops_enable;<br>
}<br>
<br>
static bool<br>
@@ -606,7 +612,7 @@ barrier_supported(const _mesa_glsl_parse_state *state)<br>
static bool<br>
vote(const _mesa_glsl_parse_state *state)<br>
{<br>
- return state->ARB_shader_group_vote_e<wbr>nable;<br>
+ return v460_desktop(state) || state->ARB_shader_group_vote_e<wbr>nable;<br>
}<br>
<br>
static bool<br>
@@ -962,7 +968,8 @@ private:<br>
<br>
ir_function_signature *_vote_intrinsic(builtin_avail<wbr>able_predicate avail,<br>
enum ir_intrinsic_id id);<br>
- ir_function_signature *_vote(const char *intrinsic_name);<br>
+ ir_function_signature *_vote(const char *intrinsic_name,<br>
+ builtin_available_predicate avail);<br>
<br>
#undef B0<br>
#undef B1<br>
@@ -3031,6 +3038,43 @@ builtin_builder::create_builti<wbr>ns()<br>
shader_atomic_counter_ops),<br>
NULL);<br>
<br>
+ add_function("atomicCounterAd<wbr>d",<br>
+ _atomic_counter_op1("__intrins<wbr>ic_atomic_add",<br>
+ v460_desktop),<br>
+ NULL);<br>
+ add_function("atomicCounterSu<wbr>btract",<br>
+ _atomic_counter_op1("__intrins<wbr>ic_atomic_sub",<br>
+ v460_desktop),<br>
+ NULL);<br>
+ add_function("atomicCounterMi<wbr>n",<br>
+ _atomic_counter_op1("__intrins<wbr>ic_atomic_min",<br>
+ v460_desktop),<br>
+ NULL);<br>
+ add_function("atomicCounterMa<wbr>x",<br>
+ _atomic_counter_op1("__intrins<wbr>ic_atomic_max",<br>
+ v460_desktop),<br>
+ NULL);<br>
+ add_function("atomicCounterAn<wbr>d",<br>
+ _atomic_counter_op1("__intrins<wbr>ic_atomic_and",<br>
+ v460_desktop),<br>
+ NULL);<br>
+ add_function("<wbr>atomicCounterOr",<br>
+ _atomic_counter_op1("__intrins<wbr>ic_atomic_or",<br>
+ v460_desktop),<br>
+ NULL);<br>
+ add_function("atomicCounterXo<wbr>r",<br>
+ _atomic_counter_op1("__intrins<wbr>ic_atomic_xor",<br>
+ v460_desktop),<br>
+ NULL);<br>
+ add_function("atomicCounterEx<wbr>change",<br>
+ _atomic_counter_op1("__intrins<wbr>ic_atomic_exchange",<br>
+ v460_desktop),<br>
+ NULL);<br>
+ add_function("atomicCounterCo<wbr>mpSwap",<br>
+ _atomic_counter_op2("__intrins<wbr>ic_atomic_comp_swap",<br>
+ v460_desktop),<br>
+ NULL);<br>
+<br>
</blockquote>
<br>
So all of these reference the __intrinsic_atomic_max functions. Do<br>
those ned to be fixed up too? Specifically,<br>
<br>
add_function("__intrinsic_atom<wbr>ic_max",<br>
_atomic_intrinsic2(buffer_ato<wbr>mics_supported,<br>
glsl_type::uint_type,<br>
ir_intrinsic_generic_atomic_ma<wbr>x),<br>
_atomic_intrinsic2(buffer_ato<wbr>mics_supported,<br>
glsl_type::int_type,<br>
ir_intrinsic_generic_atomic_ma<wbr>x),<br>
_atomic_counter_intrinsic1(sh<wbr>ader_atomic_counter_ops,<br>
ir_intrinsic_atomic_counter_ma<wbr>x),<br>
NULL);<br>
<br>
I believe the latter one needs to have its availability function<br>
adjusted to be a||b.<br>
</blockquote>
<br></div>
Yes, but it's already adjusted in this patch:<div class="quoted-text"><br>
<br>
@@ -483,7 +489,7 @@ shader_atomic_counters(const _mesa_glsl_parse_state *state)<br>
static bool<br>
shader_atomic_counter_ops(con<wbr>st _mesa_glsl_parse_state *state)<br>
{<br>
- return state->ARB_shader_atomic_count<wbr>er_ops_enable;<br>
+ return v460_desktop(state) || state->ARB_shader_atomic_count<wbr>er_ops_enable;<br>
}<br></div></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Will that not make the suffixed functions available in plain #version 460 then?</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><div class="elided-text">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
add_function("atomicAdd",<br>
_atomic_op2("__intrinsic_atomi<wbr>c_add",<br>
buffer_atomics_supported,<br>
@@ -3220,9 +3264,29 @@ builtin_builder::create_builti<wbr>ns()<br>
glsl_type::uint64_t_type),<br>
NULL);<br>
<br>
- add_function("anyInvocationAR<wbr>B", _vote("__intrinsic_vote_any"), NULL);<br>
- add_function("allInvocationsA<wbr>RB", _vote("__intrinsic_vote_all"), NULL);<br>
- add_function("allInvocationsE<wbr>qualARB", _vote("__intrinsic_vote_eq"), NULL);<br>
+ add_function("anyInvocationAR<wbr>B",<br>
+ _vote("__intrinsic_vote_any", vote),<br>
+ NULL);<br>
+<br>
+ add_function("allInvocationsA<wbr>RB",<br>
+ _vote("__intrinsic_vote_all", vote),<br>
+ NULL);<br>
+<br>
+ add_function("allInvocationsE<wbr>qualARB",<br>
+ _vote("__intrinsic_vote_eq", vote),<br>
+ NULL);<br>
+<br>
+ add_function("anyInvocation",<br>
+ _vote("__intrinsic_vote_any", v460_desktop),<br>
+ NULL);<br>
+<br>
+ add_function("allInvocations"<wbr>,<br>
+ _vote("__intrinsic_vote_all", v460_desktop),<br>
+ NULL);<br>
+<br>
+ add_function("allInvocationsE<wbr>qual",<br>
+ _vote("__intrinsic_vote_eq", v460_desktop),<br>
+ NULL);<br>
<br>
add_function("__builtin_idiv6<wbr>4",<br>
generate_ir::idiv64(mem_ctx, integer_functions_supported),<br>
@@ -6163,11 +6227,12 @@ builtin_builder::_vote_intrins<wbr>ic(builtin_available_predicate avail,<br>
}<br>
<br>
ir_function_signature *<br>
-builtin_builder::_vote(const char *intrinsic_name)<br>
+builtin_builder::_vote(const char *intrinsic_name,<br>
+ builtin_available_predicate avail)<br>
{<br>
ir_variable *value = in_var(glsl_type::bool_type, "value");<br>
<br>
- MAKE_SIG(glsl_type::bool_<wbr>type, vote, 1, value);<br>
+ MAKE_SIG(glsl_type::bool_<wbr>type, avail, 1, value);<br>
<br>
ir_variable *retval = body.make_temp(glsl_type::bool<wbr>_type, "retval");<br>
<br>
diff --git a/src/compiler/glsl/builtin_va<wbr>riables.cpp b/src/compiler/glsl/builtin_va<wbr>riables.cpp<br>
index 19d427e4bc..ea2d897cc8 100644<br>
--- a/src/compiler/glsl/builtin_va<wbr>riables.cpp<br>
+++ b/src/compiler/glsl/builtin_va<wbr>riables.cpp<br>
@@ -1017,6 +1017,11 @@ builtin_variable_generator::ge<wbr>nerate_vs_special_vars()<br>
<br>
if (state->is_version(130, 300))<br>
add_system_value(SYSTEM_VALUE_<wbr>VERTEX_ID, int_t, "gl_VertexID");<br>
+ if (state->is_version(460, 0)) {<br>
+ add_system_value(SYSTEM_VALUE_<wbr>BASE_VERTEX, int_t, "gl_BaseVertex");<br>
+ add_system_value(SYSTEM_VALUE_<wbr>BASE_INSTANCE, int_t, "gl_BaseInstance");<br>
+ add_system_value(SYSTEM_VALUE_<wbr>DRAW_ID, int_t, "gl_DrawID");<br>
+ }<br>
if (state->ARB_draw_instanced_ena<wbr>ble)<br>
add_system_value(SYSTEM_VALUE_<wbr>INSTANCE_ID, int_t, "gl_InstanceIDARB");<br>
if (state->ARB_draw_instanced_ena<wbr>ble || state->is_version(140, 300))<br>
--<br>
2.13.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div></blockquote>
</blockquote></div><br></div></div></div>