From: Jordan Justen Date: Mon, 18 Jan 2016 17:53:44 +0000 (-0800) Subject: nir: Add atomic operations on variables X-Git-Tag: upstream/17.1.0~11012^2~599 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a9a54b5c81d3e64a5e5fa2bf52b14b3acf28c2f;p=platform%2Fupstream%2Fmesa.git nir: Add atomic operations on variables This allows us to first generate atomic operations for shared variables using these opcodes, and then later we can lower those to the shared atomics intrinsics with nir_lower_io. Signed-off-by: Jordan Justen --- diff --git a/src/glsl/nir/nir_intrinsics.h b/src/glsl/nir/nir_intrinsics.h index 78c2570..b6996ee 100644 --- a/src/glsl/nir/nir_intrinsics.h +++ b/src/glsl/nir/nir_intrinsics.h @@ -195,6 +195,33 @@ INTRINSIC(vulkan_resource_index, 1, ARR(1), true, 1, 0, 3, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER) /* + * variable atomic intrinsics + * + * All of these variable atomic memory operations read a value from memory, + * compute a new value using one of the operations below, write the new value + * to memory, and return the original value read. + * + * All operations take 1 source except CompSwap that takes 2. These sources + * represent: + * + * 0: The data parameter to the atomic function (i.e. the value to add + * in shared_atomic_add, etc). + * 1: For CompSwap only: the second data parameter. + * + * All operations take 1 variable deref. + */ +INTRINSIC(var_atomic_add, 1, ARR(1), true, 1, 1, 0, 0) +INTRINSIC(var_atomic_imin, 1, ARR(1), true, 1, 1, 0, 0) +INTRINSIC(var_atomic_umin, 1, ARR(1), true, 1, 1, 0, 0) +INTRINSIC(var_atomic_imax, 1, ARR(1), true, 1, 1, 0, 0) +INTRINSIC(var_atomic_umax, 1, ARR(1), true, 1, 1, 0, 0) +INTRINSIC(var_atomic_and, 1, ARR(1), true, 1, 1, 0, 0) +INTRINSIC(var_atomic_or, 1, ARR(1), true, 1, 1, 0, 0) +INTRINSIC(var_atomic_xor, 1, ARR(1), true, 1, 1, 0, 0) +INTRINSIC(var_atomic_exchange, 1, ARR(1), true, 1, 1, 0, 0) +INTRINSIC(var_atomic_comp_swap, 2, ARR(1, 1), true, 1, 1, 0, 0) + +/* * SSBO atomic intrinsics * * All of the SSBO atomic memory operations read a value from memory,