From 00589be6c42501779e609b6c1e89a14d8536df08 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 6 Jun 2018 20:55:03 +0100 Subject: [PATCH] gallium: add new SAMP2HND and IMG2HND opcodes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This commit does not add support for the opcodes in gallivm or tgsi_to_nir.c Signed-off-by: Rhys Perry Reviewed-by: Marek Olšák Signed-off-by: Marek Olšák --- src/gallium/auxiliary/tgsi/tgsi_info.c | 2 ++ .../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 4aa658785cf..bbe1a21e432 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 1b2803cf3fe..c3787c2fbb2 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 9a13fa6684a..54a1ee15b68 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 9e956586c4c..7d4ebb62674 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 + + Syntax: ``SAMP2HND dst, sampler`` + + Example: ``SAMP2HND TEMP[0], SAMP[0]`` + + Sets 'dst' to a bindless handle for 'sampler'. + + .. _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 f4e45c25608..08ed08156e7 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.30.2