iris: merge pack
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 8 Jan 2018 22:44:22 +0000 (14:44 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:04 +0000 (10:26 -0800)
this lets us merge dynamic and pre-baked state, also like anv

src/gallium/drivers/iris/iris_state.c

index 7da0e8956dd50765123c5e05af75b9d7265337ba..83f8125d9bf5f1cce4b4568ea34d8e051e9e8b3c 100644 (file)
@@ -76,6 +76,17 @@ __gen_combine_address(void *user_data, void *location,
    iris_require_command_space(batch, 4 * __genxml_cmd_length(cmd)); \
    iris_pack_command(cmd, batch->cmdbuf.map_next, name)
 
+#define iris_emit_merge(batch, dwords0, dwords1) \
+   do {                                                                 \
+      STATIC_ASSERT(ARRAY_SIZE(dwords0) == ARRAY_SIZE(dwords1));        \
+                                                                        \
+      iris_require_command_space(batch, ARRAY_SIZE(dwords0));           \
+      uint32_t *dw = batch->cmdbuf.map_next;                            \
+      for (uint32_t i = 0; i < ARRAY_SIZE(dwords0); i++)                \
+         dw[i] = (dwords0)[i] | (dwords1)[i];                           \
+      VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));   \
+   } while (0)
+
 #include "genxml/genX_pack.h"
 #include "genxml/gen_macros.h"