[Mesa-dev] [PATCH 1/6] gallium: add new SAMP2HND and IMG2HND opcodes
Ilia Mirkin
imirkin at alum.mit.edu
Wed Jun 6 22:42:40 UTC 2018
On Wed, Jun 6, 2018 at 3:55 PM, Rhys Perry <pendingchaos02 at gmail.com> wrote:
> This commit does not add support for the opcodes in gallivm or tgsi_to_nir.c
>
> Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
> ---
> src/gallium/auxiliary/tgsi/tgsi_info.c | 2 ++
> src/gallium/auxiliary/tgsi/tgsi_info_opcodes.h | 4 ++--
> src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h | 3 +++
> src/gallium/docs/source/tgsi.rst | 25 +++++++++++++++++++++++++
> src/gallium/include/pipe/p_shader_tokens.h | 2 ++
> 5 files changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
> index 4aa658785c..bbe1a21e43 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_info.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
> @@ -153,6 +153,8 @@ tgsi_opcode_infer_type(enum tgsi_opcode opcode)
> case TGSI_OPCODE_POPC:
> case TGSI_OPCODE_LSB:
> case TGSI_OPCODE_UMSB:
> + case TGSI_OPCODE_IMG2HND:
> + case TGSI_OPCODE_SAMP2HND:
> return TGSI_TYPE_UNSIGNED;
> case TGSI_OPCODE_ARL:
> case TGSI_OPCODE_ARR:
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_info_opcodes.h b/src/gallium/auxiliary/tgsi/tgsi_info_opcodes.h
> index 1b2803cf3f..c3787c2fbb 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_info_opcodes.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_info_opcodes.h
> @@ -162,8 +162,8 @@ OPCODE(1, 1, COMP, IABS)
> OPCODE(1, 1, COMP, ISSG)
> OPCODE(1, 2, OTHR, LOAD)
> OPCODE(1, 2, OTHR, STORE, .is_store = 1)
> -OPCODE_GAP(163) /* removed */
> -OPCODE_GAP(164) /* removed */
> +OPCODE(1, 1, OTHR, IMG2HND)
> +OPCODE(1, 1, OTHR, SAMP2HND, .is_tex = 1)
> OPCODE_GAP(165) /* removed */
> OPCODE(0, 0, OTHR, BARRIER)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
> index 9a13fa6684..54a1ee15b6 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
> @@ -160,6 +160,9 @@ OP13(UCMP)
> OP11(IABS)
> OP11(ISSG)
>
> +OP11(IMG2HND)
> +OP11(SAMP2HND)
> +
> OP12(IMUL_HI)
> OP12(UMUL_HI)
>
> diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
> index 9e956586c4..a4a78e6267 100644
> --- a/src/gallium/docs/source/tgsi.rst
> +++ b/src/gallium/docs/source/tgsi.rst
> @@ -2592,6 +2592,31 @@ For these opcodes, the resource can be a BUFFER, IMAGE, or MEMORY.
> barrier in between.
>
>
> +.. _bindlessopcodes:
> +
> +Bindless Opcodes
> +^^^^^^^^^^^^^^^^
> +
> +These opcodes are for working with bindless sampler or image handles and
> +require PIPE_CAP_BINDLESS_TEXTURE.
> +
> +.. opcode:: IMG2HND - Get a bindless handle for a image
> +
> + Syntax: ``IMG2HND dst, image``
> +
> + Example: ``IMG2HND TEMP[0], IMAGE[0]``
> +
> + Sets 'dst' to a bindless handle for 'image'.
> +
> +.. opcode:: SAMP2HND - Get a bindless handle for a sampler view
> +
> + Syntax: ``SAMP2HND dst, sampler``
> +
> + Example: ``SAMP2HND TEMP[0], SVIEW[0]``
> +
> + Sets 'dst' to a bindless handle for 'sampler'.
You want SAMP[0] here, not SVIEW[0].
Handles are defined to be 64-bit, so you should mention that only the
first 2 channels are set, the yw channels are set to zero. (Or
undefined ... although I prefer less undefined stuff.)
> +
> +
> .. _threadsyncopcodes:
>
> Inter-thread synchronization opcodes
> diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
> index f4e45c2560..08ed08156e 100644
> --- a/src/gallium/include/pipe/p_shader_tokens.h
> +++ b/src/gallium/include/pipe/p_shader_tokens.h
> @@ -506,6 +506,8 @@ enum tgsi_opcode {
>
> TGSI_OPCODE_LOAD = 161,
> TGSI_OPCODE_STORE = 162,
> + TGSI_OPCODE_IMG2HND = 163,
> + TGSI_OPCODE_SAMP2HND = 164,
> /* gap */
> TGSI_OPCODE_BARRIER = 166,
>
> --
> 2.14.4
>
> _______________________________________________
> 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