tgsi: add ATOMICINC_WRAP/ATOMICDEC_WRAP opcode
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
1d8a71af57
commit
8b6bfed3d2
|
@ -263,7 +263,8 @@ tgsi_opcode_infer_src_type(enum tgsi_opcode opcode, uint src_idx)
|
|||
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) {
|
||||
|
|
|
@ -250,3 +250,5 @@ OPCODE(1, 2, COMP, I64MOD)
|
|||
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)
|
||||
|
|
|
@ -392,6 +392,8 @@ scan_instruction(struct tgsi_shader_info *info,
|
|||
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;
|
||||
|
||||
|
|
|
@ -2834,6 +2834,36 @@ These atomic operations may only be used with 32-bit integer image formats.
|
|||
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
|
||||
|
|
|
@ -612,7 +612,10 @@ enum tgsi_opcode {
|
|||
|
||||
TGSI_OPCODE_LOD = 249,
|
||||
|
||||
TGSI_OPCODE_LAST = 250,
|
||||
TGSI_OPCODE_ATOMINC_WRAP = 250,
|
||||
TGSI_OPCODE_ATOMDEC_WRAP = 251,
|
||||
|
||||
TGSI_OPCODE_LAST = 252,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -6241,6 +6241,8 @@ compile_tgsi_instruction(struct st_translate *t,
|
|||
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++;
|
||||
|
|
|
@ -182,6 +182,8 @@ is_resource_instruction(unsigned opcode)
|
|||
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:
|
||||
|
|
Loading…
Reference in New Issue