return TGSI_TYPE_UNSIGNED;
if (src_idx == 1 &&
- opcode >= TGSI_OPCODE_ATOMUADD && opcode <= TGSI_OPCODE_ATOMIMAX)
+ ((opcode >= TGSI_OPCODE_ATOMUADD && opcode <= TGSI_OPCODE_ATOMIMAX) ||
+ opcode == TGSI_OPCODE_ATOMINC_WRAP || opcode == TGSI_OPCODE_ATOMDEC_WRAP))
return TGSI_TYPE_UNSIGNED;
switch (opcode) {
OPCODE(1, 2, COMP, U64MOD)
OPCODE(1, 2, COMP, DDIV)
OPCODE(1, 3, OTHR, LOD)
+OPCODE(1, 3, OTHR, ATOMINC_WRAP, .is_store = 1)
+OPCODE(1, 3, OTHR, ATOMDEC_WRAP, .is_store = 1)
case TGSI_OPCODE_ATOMIMIN:
case TGSI_OPCODE_ATOMIMAX:
case TGSI_OPCODE_ATOMFADD:
+ case TGSI_OPCODE_ATOMINC_WRAP:
+ case TGSI_OPCODE_ATOMDEC_WRAP:
if (tgsi_is_bindless_image_file(fullinst->Src[0].Register.File)) {
info->uses_bindless_images = true;
resource[offset] = (dst_x > src_x ? dst_x : src_x)
+.. opcode:: ATOMINC_WRAP - Atomic increment + wrap around
+
+ Syntax: ``ATOMINC_WRAP dst, resource, offset, src``
+
+ Example: ``ATOMINC_WRAP TEMP[0], BUFFER[0], TEMP[1], TEMP[2]``
+
+ The following operation is performed atomically:
+
+.. math::
+
+ dst_x = resource[offset] + 1
+
+ resource[offset] = dst_x < src_x ? dst_x : 0
+
+
+.. opcode:: ATOMDEC_WRAP - Atomic decrement + wrap around
+
+ Syntax: ``ATOMDEC_WRAP dst, resource, offset, src``
+
+ Example: ``ATOMDEC_WRAP TEMP[0], BUFFER[0], TEMP[1], TEMP[2]``
+
+ The following operation is performed atomically:
+
+.. math::
+
+ dst_x = resource[offset]
+
+ resource[offset] = (dst_x > 0 && dst_x < src_x) ? dst_x - 1 : 0
+
+
.. _interlaneopcodes:
Inter-lane opcodes
TGSI_OPCODE_LOD = 249,
- TGSI_OPCODE_LAST = 250,
+ TGSI_OPCODE_ATOMINC_WRAP = 250,
+ TGSI_OPCODE_ATOMDEC_WRAP = 251,
+
+ TGSI_OPCODE_LAST = 252,
};
case TGSI_OPCODE_ATOMIMAX:
case TGSI_OPCODE_ATOMFADD:
case TGSI_OPCODE_IMG2HND:
+ case TGSI_OPCODE_ATOMINC_WRAP:
+ case TGSI_OPCODE_ATOMDEC_WRAP:
for (i = num_src - 1; i >= 0; i--)
src[i + 1] = src[i];
num_src++;
case TGSI_OPCODE_ATOMIMIN:
case TGSI_OPCODE_ATOMIMAX:
case TGSI_OPCODE_ATOMFADD:
+ case TGSI_OPCODE_ATOMINC_WRAP:
+ case TGSI_OPCODE_ATOMDEC_WRAP:
case TGSI_OPCODE_IMG2HND:
return true;
default: