<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 18, 2016 at 11:53 PM, Michael Schellenberger Costa <span dir="ltr"><<a href="mailto:mschellenbergercosta@googlemail.com" target="_blank">mschellenbergercosta@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jason,<br>
<br>
stupid optional nitpick , but could you go for anv_batch_emit_block?<br>
Normally abbreviations below 3 characters aren't really worth it.<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Given that the last two patches delete the old one and rename the new one to anv_batch_emit, I don't think it matters.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
Michael<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
Am 19/04/2016 um 02:10 schrieb Jason Ekstrand:<br>
> This new macro uses a for loop to create an actual code block in which to<br>
> place the macro setup code.  One advantage of this is that you syntatically<br>
> use braces instead of parentheses.  Another is that the code in the block<br>
> doesn't even get executed if anv_batch_emit_dwords fails.<br>
> ---<br>
>  src/intel/vulkan/anv_private.h | 9 +++++++++<br>
>  1 file changed, 9 insertions(+)<br>
><br>
> diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h<br>
> index ae2e08d..d59b7ed 100644<br>
> --- a/src/intel/vulkan/anv_private.h<br>
> +++ b/src/intel/vulkan/anv_private.h<br>
> @@ -861,6 +861,15 @@ __gen_combine_address(struct anv_batch *batch, void *location,<br>
>        VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));\<br>
>     } while (0)<br>
><br>
> +#define anv_batch_emit_blk(batch, cmd, name)                            \<br>
> +   for (struct cmd name = { __anv_cmd_header(cmd) },                    \<br>
> +        *_dst = anv_batch_emit_dwords(batch, __anv_cmd_length(cmd));    \<br>
> +        __builtin_expect(_dst != NULL, 1);                              \<br>
> +        ({ __anv_cmd_pack(cmd)(batch, _dst, &name);                     \<br>
> +           VG(VALGRIND_CHECK_MEM_IS_DEFINED(_dst, __anv_cmd_length(cmd) * 4)); \<br>
> +           _dst = NULL;                                                 \<br>
> +         }))<br>
> +<br>
>  #define anv_state_pool_emit(pool, cmd, align, ...) ({                   \<br>
>        const uint32_t __size = __anv_cmd_length(cmd) * 4;                \<br>
>        struct anv_state __state =                                        \<br>
><br>
</div></div></blockquote></div><br></div></div>