[Mesa-dev] [PATCH 03/10] nir: Get rid of *_indirect variants of input/output load/store intrinsics

Kenneth Graunke kenneth at whitecape.org
Wed Dec 2 00:07:43 PST 2015


On Wednesday, November 25, 2015 08:55:55 PM Jason Ekstrand wrote:
> There is some special-casing needed in a competent back-end.  However, they
> can do their special-casing easily enough based on whether or not the
> offset is a constant.  In the mean time, having the *_indirect variants
> adds special cases a number of places where they don't need to be and, in
> general, only complicates things.  To complicate matters, NIR had no way to
> convdert an indirect load/store to a direct one in the case that the
> indirect was a constant so we would still not really get what the back-ends
> wanted.  The best solution seems to be to get rid of the *_indirect
> variants entirely.
> ---
>  src/glsl/nir/nir_intrinsics.h           | 64 ++++++++++++++++-----------------
>  src/glsl/nir/nir_lower_phis_to_scalar.c |  4 ---
>  src/glsl/nir/nir_print.c                | 19 +++++-----
>  3 files changed, 38 insertions(+), 49 deletions(-)
> 
> diff --git a/src/glsl/nir/nir_intrinsics.h b/src/glsl/nir/nir_intrinsics.h
> index b2565c5..0fa5a27 100644
> --- a/src/glsl/nir/nir_intrinsics.h
> +++ b/src/glsl/nir/nir_intrinsics.h
> @@ -228,54 +228,50 @@ SYSTEM_VALUE(num_work_groups, 3, 0)
>  SYSTEM_VALUE(helper_invocation, 1, 0)
>  
>  /*
> - * The format of the indices depends on the type of the load.  For uniforms,
> - * the first index is the base address and the second index is an offset that
> - * should be added to the base address.  (This way you can determine in the
> - * back-end which variable is being accessed even in an array.)  For inputs,
> - * the one and only index corresponds to the attribute slot.  UBO loads also
> - * have a single index which is the base address to load from.
> + * All load operations have a source specifying an offset which may or may
> + * not be constant.  If the shader is still in SSA or partial SSA form, then
> + * determining whether or not the offset is constant is trivial.  This is
> + * always the last source in the intrinsic.
>   *
> - * UBO loads have a (possibly constant) source which is the UBO buffer index.
> - * For each type of load, the _indirect variant has one additional source
> - * (the second in the case of UBO's) that is the is an indirect to be added to
> - * the constant address or base offset to compute the final offset.
> + * Uniforms have a constant index that provides a secondary base offset that
> + * should be added to the offset from the source.  This allows back-ends to
> + * determine which uniform variable is being accessed.
>   *
> - * For vector backends, the address is in terms of one vec4, and so each array
> - * element is +4 scalar components from the previous array element. For scalar
> - * backends, the address is in terms of a single 4-byte float/int and arrays
> - * elements begin immediately after the previous array element.
> + * UBO and SSBO loads have a (possibly constant) source which is the UBO
> + * buffer index.  The pervertex_input intrinsic has a source which specifies

"The per_vertex intrinsics have a..."

(We have per_vertex_output intrinsics now too.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151202/85aa6859/attachment.sig>


More information about the mesa-dev mailing list