tgsi: add CLOCK opcode
authorIlia Mirkin <imirkin@alum.mit.edu>
Thu, 9 Feb 2017 23:37:48 +0000 (18:37 -0500)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 31 Mar 2017 05:56:26 +0000 (07:56 +0200)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/tgsi/tgsi_info.c
src/gallium/docs/source/tgsi.rst
src/gallium/include/pipe/p_shader_tokens.h

index ae6a4993249818159a27b0a0d9435c1801a4cc67..5a6a9bcdcd1e9f6f57b0e402a7988ac3eb330186 100644 (file)
@@ -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 },
index 9976875c7bd18e3d6c35a8aa10c2f55546b92d91..05b06ce6f1e4e0fcd434785918e68e036619bf8b 100644 (file)
@@ -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.
index 6a3fb9876b8c72a58b4705d5d0cb223a0eca62b4..8c08f27a34e975d9c2850546f3e48810b3b86c10 100644 (file)
@@ -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