summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtin_functions.cpp
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2015-10-09 15:55:34 -0700
committerJordan Justen <[email protected]>2015-12-09 23:50:38 -0800
commita108e14d1c11140def8e2207ce42d8b54660607b (patch)
tree201dd3065e05c579853aa7df343d01279ae778db /src/glsl/builtin_functions.cpp
parent23da6aeb17a1f55c667537d9af12d6b1e4c550d7 (diff)
glsl: Replace atomic_ssbo and ssbo_atomic with atomic
The atomic functions can also be used with shared variables in compute shaders. When lowering the intrinsic in lower_ubo_reference, we still create an SSBO specific intrinsic since SSBO accesses can be indirectly addressed, whereas all compute shader shared variable live in a single shared variable area. v2: * Also remove the _internal suffix from ssbo atomic intrinsic names (Iago) Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/glsl/builtin_functions.cpp')
-rw-r--r--src/glsl/builtin_functions.cpp230
1 files changed, 115 insertions, 115 deletions
diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 88f9a713368..4462bfd2324 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -774,16 +774,16 @@ private:
ir_function_signature *_atomic_counter_op(const char *intrinsic,
builtin_available_predicate avail);
- ir_function_signature *_atomic_ssbo_intrinsic2(builtin_available_predicate avail,
- const glsl_type *type);
- ir_function_signature *_atomic_ssbo_op2(const char *intrinsic,
- builtin_available_predicate avail,
- const glsl_type *type);
- ir_function_signature *_atomic_ssbo_intrinsic3(builtin_available_predicate avail,
- const glsl_type *type);
- ir_function_signature *_atomic_ssbo_op3(const char *intrinsic,
- builtin_available_predicate avail,
- const glsl_type *type);
+ ir_function_signature *_atomic_intrinsic2(builtin_available_predicate avail,
+ const glsl_type *type);
+ ir_function_signature *_atomic_op2(const char *intrinsic,
+ builtin_available_predicate avail,
+ const glsl_type *type);
+ ir_function_signature *_atomic_intrinsic3(builtin_available_predicate avail,
+ const glsl_type *type);
+ ir_function_signature *_atomic_op3(const char *intrinsic,
+ builtin_available_predicate avail,
+ const glsl_type *type);
B1(min3)
B1(max3)
@@ -930,53 +930,53 @@ builtin_builder::create_intrinsics()
_atomic_counter_intrinsic(shader_atomic_counters),
NULL);
- add_function("__intrinsic_ssbo_atomic_add",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_min",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_max",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_and",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_or",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_xor",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_exchange",
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic2(shader_storage_buffer_object,
- glsl_type::int_type),
- NULL);
- add_function("__intrinsic_ssbo_atomic_comp_swap",
- _atomic_ssbo_intrinsic3(shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_intrinsic3(shader_storage_buffer_object,
- glsl_type::int_type),
+ add_function("__intrinsic_atomic_add",
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_min",
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_max",
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_and",
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_or",
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_xor",
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_exchange",
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_intrinsic2(shader_storage_buffer_object,
+ glsl_type::int_type),
+ NULL);
+ add_function("__intrinsic_atomic_comp_swap",
+ _atomic_intrinsic3(shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_intrinsic3(shader_storage_buffer_object,
+ glsl_type::int_type),
NULL);
add_image_functions(false);
@@ -2682,68 +2682,68 @@ builtin_builder::create_builtins()
NULL);
add_function("atomicAdd",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_add",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_add",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_add",
+ shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_add",
+ shader_storage_buffer_object,
+ glsl_type::int_type),
NULL);
add_function("atomicMin",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_min",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_min",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_min",
+ shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_min",
+ shader_storage_buffer_object,
+ glsl_type::int_type),
NULL);
add_function("atomicMax",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_max",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_max",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_max",
+ shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_max",
+ shader_storage_buffer_object,
+ glsl_type::int_type),
NULL);
add_function("atomicAnd",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_and",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_and",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_and",
+ shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_and",
+ shader_storage_buffer_object,
+ glsl_type::int_type),
NULL);
add_function("atomicOr",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_or",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_or",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_or",
+ shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_or",
+ shader_storage_buffer_object,
+ glsl_type::int_type),
NULL);
add_function("atomicXor",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_xor",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_xor",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_xor",
+ shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_xor",
+ shader_storage_buffer_object,
+ glsl_type::int_type),
NULL);
add_function("atomicExchange",
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_exchange",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op2("__intrinsic_ssbo_atomic_exchange",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op2("__intrinsic_atomic_exchange",
+ shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_op2("__intrinsic_atomic_exchange",
+ shader_storage_buffer_object,
+ glsl_type::int_type),
NULL);
add_function("atomicCompSwap",
- _atomic_ssbo_op3("__intrinsic_ssbo_atomic_comp_swap",
- shader_storage_buffer_object,
- glsl_type::uint_type),
- _atomic_ssbo_op3("__intrinsic_ssbo_atomic_comp_swap",
- shader_storage_buffer_object,
- glsl_type::int_type),
+ _atomic_op3("__intrinsic_atomic_comp_swap",
+ shader_storage_buffer_object,
+ glsl_type::uint_type),
+ _atomic_op3("__intrinsic_atomic_comp_swap",
+ shader_storage_buffer_object,
+ glsl_type::int_type),
NULL);
add_function("min3",
@@ -5097,8 +5097,8 @@ builtin_builder::_atomic_counter_intrinsic(builtin_available_predicate avail)
}
ir_function_signature *
-builtin_builder::_atomic_ssbo_intrinsic2(builtin_available_predicate avail,
- const glsl_type *type)
+builtin_builder::_atomic_intrinsic2(builtin_available_predicate avail,
+ const glsl_type *type)
{
ir_variable *atomic = in_var(type, "atomic");
ir_variable *data = in_var(type, "data");
@@ -5107,8 +5107,8 @@ builtin_builder::_atomic_ssbo_intrinsic2(builtin_available_predicate avail,
}
ir_function_signature *
-builtin_builder::_atomic_ssbo_intrinsic3(builtin_available_predicate avail,
- const glsl_type *type)
+builtin_builder::_atomic_intrinsic3(builtin_available_predicate avail,
+ const glsl_type *type)
{
ir_variable *atomic = in_var(type, "atomic");
ir_variable *data1 = in_var(type, "data1");
@@ -5132,9 +5132,9 @@ builtin_builder::_atomic_counter_op(const char *intrinsic,
}
ir_function_signature *
-builtin_builder::_atomic_ssbo_op2(const char *intrinsic,
- builtin_available_predicate avail,
- const glsl_type *type)
+builtin_builder::_atomic_op2(const char *intrinsic,
+ builtin_available_predicate avail,
+ const glsl_type *type)
{
ir_variable *atomic = in_var(type, "atomic_var");
ir_variable *data = in_var(type, "atomic_data");
@@ -5148,9 +5148,9 @@ builtin_builder::_atomic_ssbo_op2(const char *intrinsic,
}
ir_function_signature *
-builtin_builder::_atomic_ssbo_op3(const char *intrinsic,
- builtin_available_predicate avail,
- const glsl_type *type)
+builtin_builder::_atomic_op3(const char *intrinsic,
+ builtin_available_predicate avail,
+ const glsl_type *type)
{
ir_variable *atomic = in_var(type, "atomic_var");
ir_variable *data1 = in_var(type, "atomic_data1");