{
enum pipe_format format = format_desc->format;
- if (format != PIPE_FORMAT_R32_UINT && format != PIPE_FORMAT_R32_SINT && format != PIPE_FORMAT_R32_FLOAT)
+ if (format != PIPE_FORMAT_R32_UINT && format != PIPE_FORMAT_R32_SINT && format != PIPE_FORMAT_R32_FLOAT) {
+ atomic_result[0] = lp_build_zero(gallivm, type);
return;
+ }
LLVMValueRef atom_res = lp_build_alloca(gallivm,
LLVMVectorType(LLVMInt32TypeInContext(gallivm->context), type.length), "");
lp_build_store_rgba_soa(gallivm, format_desc, params->type, params->exec_mask, base_ptr, offset, out_of_bounds,
params->indata);
} else {
- if (static_texture_state->format == PIPE_FORMAT_NONE)
+ if (static_texture_state->format == PIPE_FORMAT_NONE) {
+ /*
+ * For atomic operation just return 0 in the unbound case to avoid a crash.
+ */
+ LLVMValueRef zero = lp_build_zero(gallivm, params->type);
+ params->outdata[0] = zero;
return;
+ }
lp_build_do_atomic_soa(gallivm, format_desc, params->type, params->exec_mask, base_ptr, offset, out_of_bounds,
params->img_op, params->op, params->indata, params->indata2, params->outdata);
}