summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-04-18 14:25:03 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2016-04-20 14:54:09 -0700
commit64ad2d3bcd9bcbb49ef3840446f560e0f11a1f70 (patch)
treec2ae23e043a74c6da290ca559eb25537803a276c /src/intel
parentd30768025a2283d4cc57930b784798bf278969da (diff)
downloadexternal_mesa3d-64ad2d3bcd9bcbb49ef3840446f560e0f11a1f70.zip
external_mesa3d-64ad2d3bcd9bcbb49ef3840446f560e0f11a1f70.tar.gz
external_mesa3d-64ad2d3bcd9bcbb49ef3840446f560e0f11a1f70.tar.bz2
anv: Add a new block-based batch emit macro
This new macro uses a for loop to create an actual code block in which to place the macro setup code. One advantage of this is that you syntatically use braces instead of parentheses. Another is that the code in the block doesn't even get executed if anv_batch_emit_dwords fails. Acked-by: Kristian Høgsberg <krh@bitplanet.net>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_private.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 2840f98..63c207a 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -858,6 +858,15 @@ __gen_combine_address(struct anv_batch *batch, void *location,
VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));\
} while (0)
+#define anv_batch_emit_blk(batch, cmd, name) \
+ for (struct cmd name = { __anv_cmd_header(cmd) }, \
+ *_dst = anv_batch_emit_dwords(batch, __anv_cmd_length(cmd)); \
+ __builtin_expect(_dst != NULL, 1); \
+ ({ __anv_cmd_pack(cmd)(batch, _dst, &name); \
+ VG(VALGRIND_CHECK_MEM_IS_DEFINED(_dst, __anv_cmd_length(cmd) * 4)); \
+ _dst = NULL; \
+ }))
+
#define anv_state_pool_emit(pool, cmd, align, ...) ({ \
const uint32_t __size = __anv_cmd_length(cmd) * 4; \
struct anv_state __state = \