summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/builtin_functions.cpp111
-rw-r--r--src/compiler/glsl/builtin_variables.cpp5
2 files changed, 99 insertions, 17 deletions
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 84833bdd7d5..a63f545b791 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) &&
@@ -487,6 +493,12 @@ shader_atomic_counter_ops(const _mesa_glsl_parse_state *state)
}
static bool
+shader_atomic_counter_ops_or_v460_desktop(const _mesa_glsl_parse_state *state)
+{
+ return state->ARB_shader_atomic_counter_ops_enable || v460_desktop(state);
+}
+
+static bool
shader_ballot(const _mesa_glsl_parse_state *state)
{
return state->ARB_shader_ballot_enable;
@@ -610,6 +622,12 @@ vote(const _mesa_glsl_parse_state *state)
}
static bool
+vote_or_v460_desktop(const _mesa_glsl_parse_state *state)
+{
+ return state->ARB_shader_group_vote_enable || v460_desktop(state);
+}
+
+static bool
integer_functions_supported(const _mesa_glsl_parse_state *state)
{
return state->extensions->MESA_shader_integer_functions;
@@ -962,7 +980,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
@@ -1090,7 +1109,7 @@ builtin_builder::create_intrinsics()
_atomic_intrinsic2(buffer_atomics_supported,
glsl_type::int_type,
ir_intrinsic_generic_atomic_add),
- _atomic_counter_intrinsic1(shader_atomic_counter_ops,
+ _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop,
ir_intrinsic_atomic_counter_add),
NULL);
add_function("__intrinsic_atomic_min",
@@ -1100,7 +1119,7 @@ builtin_builder::create_intrinsics()
_atomic_intrinsic2(buffer_atomics_supported,
glsl_type::int_type,
ir_intrinsic_generic_atomic_min),
- _atomic_counter_intrinsic1(shader_atomic_counter_ops,
+ _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop,
ir_intrinsic_atomic_counter_min),
NULL);
add_function("__intrinsic_atomic_max",
@@ -1110,7 +1129,7 @@ builtin_builder::create_intrinsics()
_atomic_intrinsic2(buffer_atomics_supported,
glsl_type::int_type,
ir_intrinsic_generic_atomic_max),
- _atomic_counter_intrinsic1(shader_atomic_counter_ops,
+ _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop,
ir_intrinsic_atomic_counter_max),
NULL);
add_function("__intrinsic_atomic_and",
@@ -1120,7 +1139,7 @@ builtin_builder::create_intrinsics()
_atomic_intrinsic2(buffer_atomics_supported,
glsl_type::int_type,
ir_intrinsic_generic_atomic_and),
- _atomic_counter_intrinsic1(shader_atomic_counter_ops,
+ _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop,
ir_intrinsic_atomic_counter_and),
NULL);
add_function("__intrinsic_atomic_or",
@@ -1130,7 +1149,7 @@ builtin_builder::create_intrinsics()
_atomic_intrinsic2(buffer_atomics_supported,
glsl_type::int_type,
ir_intrinsic_generic_atomic_or),
- _atomic_counter_intrinsic1(shader_atomic_counter_ops,
+ _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop,
ir_intrinsic_atomic_counter_or),
NULL);
add_function("__intrinsic_atomic_xor",
@@ -1140,7 +1159,7 @@ builtin_builder::create_intrinsics()
_atomic_intrinsic2(buffer_atomics_supported,
glsl_type::int_type,
ir_intrinsic_generic_atomic_xor),
- _atomic_counter_intrinsic1(shader_atomic_counter_ops,
+ _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop,
ir_intrinsic_atomic_counter_xor),
NULL);
add_function("__intrinsic_atomic_exchange",
@@ -1150,7 +1169,7 @@ builtin_builder::create_intrinsics()
_atomic_intrinsic2(buffer_atomics_supported,
glsl_type::int_type,
ir_intrinsic_generic_atomic_exchange),
- _atomic_counter_intrinsic1(shader_atomic_counter_ops,
+ _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop,
ir_intrinsic_atomic_counter_exchange),
NULL);
add_function("__intrinsic_atomic_comp_swap",
@@ -1160,7 +1179,7 @@ builtin_builder::create_intrinsics()
_atomic_intrinsic3(buffer_atomics_supported,
glsl_type::int_type,
ir_intrinsic_generic_atomic_comp_swap),
- _atomic_counter_intrinsic2(shader_atomic_counter_ops,
+ _atomic_counter_intrinsic2(shader_atomic_counter_ops_or_v460_desktop,
ir_intrinsic_atomic_counter_comp_swap),
NULL);
@@ -1197,13 +1216,13 @@ builtin_builder::create_intrinsics()
NULL);
add_function("__intrinsic_vote_all",
- _vote_intrinsic(vote, ir_intrinsic_vote_all),
+ _vote_intrinsic(vote_or_v460_desktop, ir_intrinsic_vote_all),
NULL);
add_function("__intrinsic_vote_any",
- _vote_intrinsic(vote, ir_intrinsic_vote_any),
+ _vote_intrinsic(vote_or_v460_desktop, ir_intrinsic_vote_any),
NULL);
add_function("__intrinsic_vote_eq",
- _vote_intrinsic(vote, ir_intrinsic_vote_eq),
+ _vote_intrinsic(vote_or_v460_desktop, ir_intrinsic_vote_eq),
NULL);
add_function("__intrinsic_ballot", _ballot_intrinsic(), NULL);
@@ -3031,6 +3050,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);
+
add_function("atomicAdd",
_atomic_op2("__intrinsic_atomic_add",
buffer_atomics_supported,
@@ -3220,9 +3276,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 +6239,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 19d427e4bc0..ea2d897cc8e 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -1017,6 +1017,11 @@ builtin_variable_generator::generate_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))