X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fauxiliary%2Ftgsi%2Ftgsi_info.c;h=37e16cca4281e0d058018327d8a63b2370bf65ac;hb=c9af7701d1be791752fafcbe19169851bcdf1336;hp=5112826aafbfd980f4cb900a704f836620ffc988;hpb=2f7c55c23f5fabde3dd1d4c6b85850cfe0132b73;p=mesa.git diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 5112826aafb..37e16cca428 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -36,11 +36,11 @@ #define OTHR TGSI_OUTPUT_OTHER #define OPCODE(_num_dst, _num_src, _output_mode, name, ...) \ - { .mnemonic = #name, .opcode = TGSI_OPCODE_ ## name, \ + { .opcode = TGSI_OPCODE_ ## name, \ .output_mode = _output_mode, .num_dst = _num_dst, .num_src = _num_src, \ ##__VA_ARGS__ }, -#define OPCODE_GAP(opc) { .mnemonic = "", .opcode = opc }, +#define OPCODE_GAP(opc) { .opcode = opc }, static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { @@ -51,10 +51,14 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = #undef OPCODE_GAP const struct tgsi_opcode_info * -tgsi_get_opcode_info( uint opcode ) +tgsi_get_opcode_info(enum tgsi_opcode opcode) { static boolean firsttime = 1; + ASSERT_BITFIELD_SIZE(struct tgsi_opcode_info, opcode, TGSI_OPCODE_LAST - 1); + ASSERT_BITFIELD_SIZE(struct tgsi_opcode_info, output_mode, + TGSI_OUTPUT_OTHER); + if (firsttime) { unsigned i; firsttime = 0; @@ -69,17 +73,28 @@ tgsi_get_opcode_info( uint opcode ) return NULL; } +#define OPCODE(_num_dst, _num_src, _output_mode, name, ...) #name, +#define OPCODE_GAP(opc) "UNK" #opc, + +static const char * const opcode_names[TGSI_OPCODE_LAST] = +{ +#include "tgsi_info_opcodes.h" +}; + +#undef OPCODE +#undef OPCODE_GAP const char * -tgsi_get_opcode_name( uint opcode ) +tgsi_get_opcode_name(enum tgsi_opcode opcode) { - const struct tgsi_opcode_info *info = tgsi_get_opcode_info(opcode); - return info->mnemonic; + if (opcode >= ARRAY_SIZE(opcode_names)) + return "UNK_OOB"; + return opcode_names[opcode]; } const char * -tgsi_get_processor_name( uint processor ) +tgsi_get_processor_name(enum pipe_shader_type processor) { switch (processor) { case PIPE_SHADER_VERTEX: @@ -105,7 +120,7 @@ tgsi_get_processor_name( uint processor ) * MOV and UCMP is special so return VOID */ static inline enum tgsi_opcode_type -tgsi_opcode_infer_type( uint opcode ) +tgsi_opcode_infer_type(enum tgsi_opcode opcode) { switch (opcode) { case TGSI_OPCODE_MOV: @@ -135,9 +150,8 @@ tgsi_opcode_infer_type( uint opcode ) case TGSI_OPCODE_UBFE: case TGSI_OPCODE_BFI: case TGSI_OPCODE_BREV: - 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: @@ -171,6 +185,9 @@ tgsi_opcode_infer_type( uint opcode ) case TGSI_OPCODE_U64SGE: case TGSI_OPCODE_I64SLT: case TGSI_OPCODE_I64SGE: + case TGSI_OPCODE_LSB: + case TGSI_OPCODE_POPC: + case TGSI_OPCODE_UMSB: return TGSI_TYPE_SIGNED; case TGSI_OPCODE_DADD: case TGSI_OPCODE_DABS: @@ -231,8 +248,24 @@ tgsi_opcode_infer_type( uint opcode ) * infer the source type of a TGSI opcode. */ enum tgsi_opcode_type -tgsi_opcode_infer_src_type( uint opcode ) +tgsi_opcode_infer_src_type(enum tgsi_opcode opcode, uint src_idx) { + if (src_idx == 1 && + (opcode == TGSI_OPCODE_DLDEXP || opcode == TGSI_OPCODE_LDEXP)) + return TGSI_TYPE_SIGNED; + + if (src_idx == 1 && + (opcode == TGSI_OPCODE_LOAD)) + return TGSI_TYPE_UNSIGNED; + + if (src_idx == 0 && + (opcode == TGSI_OPCODE_STORE)) + return TGSI_TYPE_UNSIGNED; + + if (src_idx == 1 && + opcode >= TGSI_OPCODE_ATOMUADD && opcode <= TGSI_OPCODE_ATOMIMAX) + return TGSI_TYPE_UNSIGNED; + switch (opcode) { case TGSI_OPCODE_UIF: case TGSI_OPCODE_TXF: @@ -248,6 +281,7 @@ tgsi_opcode_infer_src_type( uint opcode ) case TGSI_OPCODE_UP2H: case TGSI_OPCODE_U2I64: case TGSI_OPCODE_MEMBAR: + case TGSI_OPCODE_UMSB: return TGSI_TYPE_UNSIGNED; case TGSI_OPCODE_IMUL_HI: case TGSI_OPCODE_I2F: @@ -298,7 +332,10 @@ tgsi_opcode_infer_src_type( uint opcode ) * infer the destination type of a TGSI opcode. */ enum tgsi_opcode_type -tgsi_opcode_infer_dst_type( uint opcode ) +tgsi_opcode_infer_dst_type(enum tgsi_opcode opcode, uint dst_idx) { + if (dst_idx == 1 && opcode == TGSI_OPCODE_DFRACEXP) + return TGSI_TYPE_SIGNED; + return tgsi_opcode_infer_type(opcode); }