[Mesa-dev] [PATCH 2/5] gallium: add VOTE_* opcodes to implement GL_ARB_shader_group_vote

Ilia Mirkin imirkin at alum.mit.edu
Sun May 29 18:01:31 UTC 2016


Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 src/gallium/auxiliary/tgsi/tgsi_info.c     |  3 +++
 src/gallium/docs/source/tgsi.rst           | 17 +++++++++++++++++
 src/gallium/include/pipe/p_shader_tokens.h |  7 ++++++-
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 847d420..60e0f2c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -262,6 +262,9 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 1, 1, 0, 0, 0, 0, 0, COMP, "DFLR", TGSI_OPCODE_DFLR },
    { 1, 1, 0, 0, 0, 0, 0, COMP, "DROUND", TGSI_OPCODE_DROUND },
    { 1, 1, 0, 0, 0, 0, 0, COMP, "DSSG", TGSI_OPCODE_DSSG },
+   { 1, 1, 0, 0, 0, 0, 0, COMP, "VOTE_ANY", TGSI_OPCODE_VOTE_ANY },
+   { 1, 1, 0, 0, 0, 0, 0, COMP, "VOTE_ALL", TGSI_OPCODE_VOTE_ALL },
+   { 1, 1, 0, 0, 0, 0, 0, COMP, "VOTE_EQ", TGSI_OPCODE_VOTE_EQ },
 };
 
 const struct tgsi_opcode_info *
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index ab12490..bf09406 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -2557,6 +2557,23 @@ only be used with 32-bit integer image formats.
   resource[offset] = (dst_x > src_x ? dst_x : src_x)
 
 
+.. _voteopcodes:
+
+Vote opcodes
+^^^^^^^^^^^^
+
+These opcodes compare the given value across the shader invocations
+running in the current SIMD group. The details of exactly which
+invocations get compared are implementation-defined, and it would be a
+correct implementation to only ever consider the current thread's
+value. (i.e. SIMD group of 1). The argument is treated as a boolean.
+
+.. opcode:: VOTE_ANY - Value is set in any of the current invocations
+
+.. opcode:: VOTE_ALL - Value is set in all of the current invocations
+
+.. opcode:: VOTE_EQ - Value is the same in all of the current invocations
+
 
 Explanation of symbols used
 ------------------------------
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index b9d28fe..abf26d3 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -561,7 +561,12 @@ struct tgsi_property_data {
 #define TGSI_OPCODE_DFLR                220 /* nvc0 */
 #define TGSI_OPCODE_DROUND              221 /* nvc0 */
 #define TGSI_OPCODE_DSSG                222
-#define TGSI_OPCODE_LAST                223
+
+#define TGSI_OPCODE_VOTE_ANY            223
+#define TGSI_OPCODE_VOTE_ALL            224
+#define TGSI_OPCODE_VOTE_EQ             225
+
+#define TGSI_OPCODE_LAST                226
 
 /**
  * Opcode is the operation code to execute. A given operation defines the
-- 
2.7.3



More information about the mesa-dev mailing list