Mesa (master): tgsi: add CLOCK opcode

Nicolai Hähnle nh at kemper.freedesktop.org
Fri Mar 31 05:57:02 UTC 2017


Module: Mesa
Branch: master
Commit: 94ec847cb00e7f5b7bc5a9d719d572cdc6affa44
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=94ec847cb00e7f5b7bc5a9d719d572cdc6affa44

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Thu Feb  9 18:37:48 2017 -0500

tgsi: add CLOCK opcode

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/auxiliary/tgsi/tgsi_info.c     |  2 +-
 src/gallium/docs/source/tgsi.rst           | 14 ++++++++++++++
 src/gallium/include/pipe/p_shader_tokens.h |  2 +-
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index ae6a499324..5a6a9bcdcd 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -70,7 +70,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 1, 2, 0, 0, 0, 0, 0, REPL, "POW", TGSI_OPCODE_POW },
    { 1, 2, 0, 0, 0, 0, 0, COMP, "XPD", TGSI_OPCODE_XPD },
    { 1, 1, 0, 0, 0, 0, 0, COMP, "U2I64", TGSI_OPCODE_U2I64 },
-   { 1, 1, 0, 0, 0, 0, 0, COMP, "", 33 }, /* removed */
+   { 1, 0, 0, 0, 0, 0, 0, OTHR, "CLOCK", TGSI_OPCODE_CLOCK },
    { 1, 1, 0, 0, 0, 0, 0, COMP, "I2I64", TGSI_OPCODE_I2I64 },
    { 1, 2, 0, 0, 0, 0, 0, REPL, "DPH", TGSI_OPCODE_DPH },
    { 1, 1, 0, 0, 0, 0, 0, REPL, "COS", TGSI_OPCODE_COS },
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index 9976875c7b..05b06ce6f1 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -1038,6 +1038,20 @@ XXX doesn't look like most of the opcodes really belong here.
 
    dst.xy = lodq(uint, coord);
 
+.. opcode:: CLOCK - retrieve the current shader time
+
+   Invoking this instruction multiple times in the same shader should
+   cause monotonically increasing values to be returned. The values
+   are implicitly 64-bit, so if fewer than 64 bits of precision are
+   available, to provide expected wraparound semantics, the value
+   should be shifted up so that the most significant bit of the time
+   is the most significant bit of the 64-bit value.
+
+.. math::
+
+   dst.xy = clock()
+
+
 Integer ISA
 ^^^^^^^^^^^^^^^^^^^^^^^^
 These opcodes are used for integer operations.
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 6a3fb9876b..8c08f27a34 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -362,7 +362,7 @@ struct tgsi_property_data {
 #define TGSI_OPCODE_POW                 30
 #define TGSI_OPCODE_XPD                 31
 #define TGSI_OPCODE_U2I64               32
-/* gap */
+#define TGSI_OPCODE_CLOCK               33
 #define TGSI_OPCODE_I2I64               34
 #define TGSI_OPCODE_DPH                 35
 #define TGSI_OPCODE_COS                 36




More information about the mesa-commit mailing list