[Mesa-dev] [PATCH 10/29] anv/cmd_buffer: Add an anv_genX_call macro

Nanley Chery nanleychery at gmail.com
Wed Dec 13 19:41:07 UTC 2017


On Mon, Nov 27, 2017 at 07:06:00PM -0800, Jason Ekstrand wrote:
> This is copied and pasted from the similar macro we added to ISL.
> ---
>  src/intel/vulkan/anv_cmd_buffer.c | 40 ++++++++++++++++++++++++---------------
>  1 file changed, 25 insertions(+), 15 deletions(-)
> 

This patch is
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>

> diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
> index 69acafa..7e7580c 100644
> --- a/src/intel/vulkan/anv_cmd_buffer.c
> +++ b/src/intel/vulkan/anv_cmd_buffer.c
> @@ -323,24 +323,34 @@ VkResult anv_ResetCommandBuffer(
>     return anv_cmd_buffer_reset(cmd_buffer);
>  }
>  
> +#define anv_genX_call(devinfo, func, ...)          \
> +   switch ((devinfo)->gen) {                       \
> +   case 7:                                         \
> +      if ((devinfo)->is_haswell) {                 \
> +         gen75_##func(__VA_ARGS__);                \
> +      } else {                                     \
> +         gen7_##func(__VA_ARGS__);                 \
> +      }                                            \
> +      break;                                       \
> +   case 8:                                         \
> +      gen8_##func(__VA_ARGS__);                    \
> +      break;                                       \
> +   case 9:                                         \
> +      gen9_##func(__VA_ARGS__);                    \
> +      break;                                       \
> +   case 10:                                        \
> +      gen10_##func(__VA_ARGS__);                   \
> +      break;                                       \
> +   default:                                        \
> +      assert(!"Unknown hardware generation");      \
> +   }
> +
>  void
>  anv_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer)
>  {
> -   switch (cmd_buffer->device->info.gen) {
> -   case 7:
> -      if (cmd_buffer->device->info.is_haswell)
> -         return gen75_cmd_buffer_emit_state_base_address(cmd_buffer);
> -      else
> -         return gen7_cmd_buffer_emit_state_base_address(cmd_buffer);
> -   case 8:
> -      return gen8_cmd_buffer_emit_state_base_address(cmd_buffer);
> -   case 9:
> -      return gen9_cmd_buffer_emit_state_base_address(cmd_buffer);
> -   case 10:
> -      return gen10_cmd_buffer_emit_state_base_address(cmd_buffer);
> -   default:
> -      unreachable("unsupported gen\n");
> -   }
> +   anv_genX_call(&cmd_buffer->device->info,
> +                 cmd_buffer_emit_state_base_address,
> +                 cmd_buffer);
>  }
>  
>  void anv_CmdBindPipeline(
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list