tgsi: add MEMBAR opcode to handle memoryBarrier* GLSL intrinsics

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1)
v1 -> v2: add defines for the various bits
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
Ilia Mirkin 2016-01-17 04:24:49 -05:00
parent 30fcf241e1
commit 2ccc42fd2c
3 changed files with 24 additions and 2 deletions

View File

@ -149,7 +149,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 2, 0, 0, 0, 0, 0, COMP, "FSGE", TGSI_OPCODE_FSGE },
{ 1, 2, 0, 0, 0, 0, 0, COMP, "FSLT", TGSI_OPCODE_FSLT },
{ 1, 2, 0, 0, 0, 0, 0, COMP, "FSNE", TGSI_OPCODE_FSNE },
{ 0, 1, 0, 0, 0, 0, 1, NONE, "", 112 }, /* removed */
{ 0, 1, 0, 0, 0, 0, 0, OTHR, "MEMBAR", TGSI_OPCODE_MEMBAR },
{ 0, 1, 0, 0, 0, 0, 0, NONE, "CALLNZ", TGSI_OPCODE_CALLNZ },
{ 0, 1, 0, 0, 0, 0, 0, NONE, "", 114 }, /* removed */
{ 0, 1, 0, 0, 0, 0, 0, NONE, "BREAKC", TGSI_OPCODE_BREAKC },

View File

@ -2372,6 +2372,23 @@ programs.
the program. Results are unspecified if any of the remaining
threads terminates or never reaches an executed BARRIER instruction.
.. opcode:: MEMBAR - Memory barrier
``MEMBAR type``
This opcode waits for the completion of all memory accesses based on
the type passed in. The type is an immediate bitfield with the following
meaning:
Bit 0: Shader storage buffers
Bit 1: Atomic buffers
Bit 2: Images
Bit 3: Shared memory
Bit 4: Thread group
These may be passed in in any combination. An implementation is free to not
distinguish between these as it sees fit. However these map to all the
possibilities made available by GLSL.
.. _atomopcodes:

View File

@ -420,7 +420,7 @@ struct tgsi_property_data {
#define TGSI_OPCODE_FSLT 110
#define TGSI_OPCODE_FSNE 111
/* gap */
#define TGSI_OPCODE_MEMBAR 112
#define TGSI_OPCODE_CALLNZ 113
/* gap */
#define TGSI_OPCODE_BREAKC 115
@ -744,6 +744,11 @@ struct tgsi_instruction_memory
unsigned Padding : 29;
};
#define TGSI_MEMBAR_SHADER_BUFFER (1 << 0)
#define TGSI_MEMBAR_ATOMIC_BUFFER (1 << 1)
#define TGSI_MEMBAR_SHADER_IMAGE (1 << 2)
#define TGSI_MEMBAR_SHARED (1 << 3)
#define TGSI_MEMBAR_THREAD_GROUP (1 << 4)
#ifdef __cplusplus
}