[Mesa-dev] [PATCH 02/13] nir: add load_param

Eric Anholt eric at anholt.net
Wed Feb 28 21:16:27 UTC 2018


Rob Clark <robdclark at gmail.com> writes:

> From: Karol Herbst <kherbst at redhat.com>
>
> OpenCL kernels have parameters (see pipe_grid_info::input), and so we
> need a way to access them.
>
> Signed-off-by: Rob Clark <robdclark at gmail.com>
>
> ---
>  src/compiler/nir/nir_intrinsics.h |  2 ++
>  src/compiler/nir/nir_lower_io.c   | 13 ++++++++++---
>  2 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/src/compiler/nir/nir_intrinsics.h b/src/compiler/nir/nir_intrinsics.h
> index ede29277876..0915c5e809f 100644
> --- a/src/compiler/nir/nir_intrinsics.h
> +++ b/src/compiler/nir/nir_intrinsics.h
> @@ -435,6 +435,8 @@ LOAD(ubo, 2, 0, xx, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REOR
>  LOAD(input, 1, 2, BASE, COMPONENT, xx, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
>  /* src[] = { vertex, offset }. const_index[] = { base, component } */
>  LOAD(per_vertex_input, 2, 2, BASE, COMPONENT, xx, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
> +/* src[] = { }. const_index[] = { base } */
> +LOAD(param, 0, 1, BASE, xx, xx, NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)

I know this is a new request compared to the existing pattern, but could
you put a comment describing what load_param does in the code as well as
the commit message?  Especially what the meaning of the base is.  We've
been bad at this in NIR, and it makes learning how to write a new NIR
backend more challenging than it should be.

Also, what makes these params different from UBOs or default uniforms?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180228/588ebd73/attachment.sig>


More information about the mesa-dev mailing list