return;
ir_variable *var = ir->lhs->variable_referenced();
- if (!var || !var->is_in_buffer_block())
+ if (!var || !var->is_in_shader_storage_block())
return;
/* We have a write to a buffer variable, so declare a temporary and rewrite
sig->is_intrinsic = true;
char func_name[64];
- sprintf(func_name, "%s_internal", ir->callee_name());
+ sprintf(func_name, "%s_ssbo", ir->callee_name());
ir_function *f = new(mem_ctx) ir_function(func_name);
f->add_signature(sig);
ir_call *
lower_ubo_reference_visitor::check_for_ssbo_atomic_intrinsic(ir_call *ir)
{
+ exec_list& params = ir->actual_parameters;
+
+ if (params.length() < 2 || params.length() > 3)
+ return ir;
+
+ ir_rvalue *rvalue =
+ ((ir_instruction *) params.get_head())->as_rvalue();
+ if (!rvalue)
+ return ir;
+
+ ir_variable *var = rvalue->variable_referenced();
+ if (!var || !var->is_in_shader_storage_block())
+ return ir;
+
const char *callee = ir->callee_name();
- if (!strcmp("__intrinsic_ssbo_atomic_add", callee) ||
- !strcmp("__intrinsic_ssbo_atomic_min", callee) ||
- !strcmp("__intrinsic_ssbo_atomic_max", callee) ||
- !strcmp("__intrinsic_ssbo_atomic_and", callee) ||
- !strcmp("__intrinsic_ssbo_atomic_or", callee) ||
- !strcmp("__intrinsic_ssbo_atomic_xor", callee) ||
- !strcmp("__intrinsic_ssbo_atomic_exchange", callee) ||
- !strcmp("__intrinsic_ssbo_atomic_comp_swap", callee)) {
+ if (!strcmp("__intrinsic_atomic_add", callee) ||
+ !strcmp("__intrinsic_atomic_min", callee) ||
+ !strcmp("__intrinsic_atomic_max", callee) ||
+ !strcmp("__intrinsic_atomic_and", callee) ||
+ !strcmp("__intrinsic_atomic_or", callee) ||
+ !strcmp("__intrinsic_atomic_xor", callee) ||
+ !strcmp("__intrinsic_atomic_exchange", callee) ||
+ !strcmp("__intrinsic_atomic_comp_swap", callee)) {
return lower_ssbo_atomic_intrinsic(ir);
}