From: Bryan Cain Date: Sat, 10 Sep 2011 17:31:54 +0000 (-0500) Subject: gallium: add TGSI opcodes UARL and UCMP X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=324ac982d8e7c2693035342de2d24baff3042911;p=mesa.git gallium: add TGSI opcodes UARL and UCMP They are needed by glsl_to_tgsi for an efficient implementation using native integers. Reviewed-by: Brian Paul --- diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index d9de41bf826..ce6399c56b8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -3366,6 +3366,28 @@ micro_usne(union tgsi_exec_channel *dst, dst->u[3] = src0->u[3] != src1->u[3] ? ~0 : 0; } +static void +micro_uarl(union tgsi_exec_channel *dst, + const union tgsi_exec_channel *src) +{ + dst->i[0] = src->u[0]; + dst->i[1] = src->u[1]; + dst->i[2] = src->u[2]; + dst->i[3] = src->u[3]; +} + +static void +micro_ucmp(union tgsi_exec_channel *dst, + const union tgsi_exec_channel *src0, + const union tgsi_exec_channel *src1, + const union tgsi_exec_channel *src2) +{ + dst->u[0] = src0->u[0] ? src1->u[0] : src2->u[0]; + dst->u[1] = src0->u[1] ? src1->u[1] : src2->u[1]; + dst->u[2] = src0->u[2] ? src1->u[2] : src2->u[2]; + dst->u[3] = src0->u[3] ? src1->u[3] : src2->u[3]; +} + static void exec_instruction( struct tgsi_exec_machine *mach, @@ -4126,6 +4148,14 @@ exec_instruction( assert(0); break; + case TGSI_OPCODE_UARL: + exec_vector_unary(mach, inst, micro_uarl, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_UINT); + break; + + case TGSI_OPCODE_UCMP: + exec_vector_trinary(mach, inst, micro_ucmp, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_UINT); + break; + default: assert( 0 ); } diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 14ed56a1f6a..6cd580a7fe2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -189,6 +189,9 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 2, 0, 0, 0, 0, "RESINFO", TGSI_OPCODE_RESINFO }, { 1, 2, 0, 0, 0, 0, "SAMPLE_POS", TGSI_OPCODE_SAMPLE_POS }, { 1, 2, 0, 0, 0, 0, "SAMPLE_INFO", TGSI_OPCODE_SAMPLE_INFO }, + + { 1, 1, 0, 0, 0, 0, "UARL", TGSI_OPCODE_UARL }, + { 1, 3, 0, 0, 0, 0, "UCMP", TGSI_OPCODE_UCMP }, }; const struct tgsi_opcode_info * diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index 5cf08752e75..d7f50b1a6e8 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1013,6 +1013,25 @@ XXX so let's discuss it, yeah? dst.w = src0.w \oplus src1.w +.. opcode:: UCMP - Integer Conditional Move + +.. math:: + + dst.x = src0.x ? src1.x : src2.x + + dst.y = src0.y ? src1.y : src2.y + + dst.z = src0.z ? src1.z : src2.z + + dst.w = src0.w ? src1.w : src2.w + + +.. opcode:: UARL - Integer Address Register Load + + Moves the contents of the source register, assumed to be an integer, into the + destination register, which is assumed to be an address (ADDR) register. + + .. opcode:: SAD - Sum Of Absolute Differences .. math:: diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index b9e3dcf8858..7236c9220df 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -363,7 +363,10 @@ struct tgsi_property_data { #define TGSI_OPCODE_SAMPLE_POS 155 #define TGSI_OPCODE_SAMPLE_INFO 156 -#define TGSI_OPCODE_LAST 157 +#define TGSI_OPCODE_UARL 157 +#define TGSI_OPCODE_UCMP 158 + +#define TGSI_OPCODE_LAST 159 #define TGSI_SAT_NONE 0 /* do not saturate */ #define TGSI_SAT_ZERO_ONE 1 /* clamp to [0,1] */