From: José Fonseca Date: Thu, 11 Feb 2010 14:09:53 +0000 (+0000) Subject: svgadump: Several improvements to shader dumping. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ea8f7bd2e40dc69dbde079a29c169c5371244aef;p=mesa.git svgadump: Several improvements to shader dumping. --- diff --git a/src/gallium/drivers/svga/svgadump/svga_shader.h b/src/gallium/drivers/svga/svgadump/svga_shader.h index 9217af2dd99..5db64bf135b 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader.h +++ b/src/gallium/drivers/svga/svgadump/svga_shader.h @@ -98,21 +98,33 @@ struct sh_defi #define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE #define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME -struct ps_sampleinfo +struct sh_sampleinfo { unsigned unused:27; unsigned texture_type:4; unsigned is_reg:1; }; -struct vs_semantic +struct sh_semantic { - unsigned usage:5; - unsigned unused1:11; + unsigned usage:4; + unsigned unused1:12; unsigned usage_index:4; - unsigned unused2:12; + unsigned unused2:11; + unsigned is_reg:1; }; +#define SH_WRITEMASK_0 0x1 +#define SH_WRITEMASK_1 0x2 +#define SH_WRITEMASK_2 0x4 +#define SH_WRITEMASK_3 0x8 +#define SH_WRITEMASK_ALL 0xf + +#define SH_DSTMOD_NONE 0x0 +#define SH_DSTMOD_SATURATE 0x1 +#define SH_DSTMOD_PARTIALPRECISION 0x2 +#define SH_DSTMOD_MSAMPCENTROID 0x4 + struct sh_dstreg { unsigned number:11; @@ -136,17 +148,12 @@ struct sh_dcl { struct sh_op op; union { - struct { - struct ps_sampleinfo sampleinfo; - } ps; - struct { - struct vs_semantic semantic; - } vs; + struct sh_sampleinfo sampleinfo; + struct sh_semantic semantic; } u; struct sh_dstreg reg; }; - struct sh_srcreg { unsigned number:11; diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c index 70e27d86d30..d2bfb439f38 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c @@ -40,102 +40,139 @@ struct dump_info { - SVGA3dShaderVersion version; + uint32 version; boolean is_ps; + int indent; }; -static void dump_op( struct sh_op op, const char *mnemonic ) +#define DUMP_MAX_OP_SRC 4 + +struct dump_op { - assert( op.predicated == 0 ); - assert( op.is_reg == 0 ); + struct sh_op op; + struct sh_dstreg dst; + struct sh_srcreg dstind; + struct sh_srcreg src[DUMP_MAX_OP_SRC]; + struct sh_srcreg srcind[DUMP_MAX_OP_SRC]; + struct sh_srcreg p0; +}; - if (op.coissue) - _debug_printf( "+" ); - _debug_printf( "%s", mnemonic ); - switch (op.control) { - case 0: - break; - case SVGA3DOPCONT_PROJECT: - _debug_printf( "p" ); - break; - case SVGA3DOPCONT_BIAS: - _debug_printf( "b" ); - break; - default: - assert( 0 ); +static void +dump_indent(int indent) +{ + int i; + + for (i = 0; i < indent; ++i) { + _debug_printf(" "); } } - -static void dump_comp_op( struct sh_op op, const char *mnemonic ) +static void dump_op( struct sh_op op, const char *mnemonic ) { assert( op.is_reg == 0 ); + if (op.predicated) { + _debug_printf("(p0) "); + } if (op.coissue) _debug_printf( "+" ); _debug_printf( "%s", mnemonic ); - switch (op.control) { - case SVGA3DOPCOMP_RESERVED0: - break; - case SVGA3DOPCOMP_GT: - _debug_printf("_gt"); - break; - case SVGA3DOPCOMP_EQ: - _debug_printf("_eq"); - break; - case SVGA3DOPCOMP_GE: - _debug_printf("_ge"); - break; - case SVGA3DOPCOMP_LT: - _debug_printf("_lt"); - break; - case SVGA3DOPCOMPC_NE: - _debug_printf("_ne"); + + switch (op.opcode) { + case SVGA3DOP_TEX: + switch (op.control) { + case 0: + break; + case 1 /* PROJECT */: + _debug_printf("p"); + break; + case 2 /* BIAS */: + _debug_printf("b"); + break; + default: + assert(0); + } break; - case SVGA3DOPCOMP_LE: - _debug_printf("_le"); + + case SVGA3DOP_IFC: + case SVGA3DOP_BREAKC: + case SVGA3DOP_SETP: + switch (op.control) { + case SVGA3DOPCOMP_GT: + _debug_printf("_gt"); + break; + case SVGA3DOPCOMP_EQ: + _debug_printf("_eq"); + break; + case SVGA3DOPCOMP_GE: + _debug_printf("_ge"); + break; + case SVGA3DOPCOMP_LT: + _debug_printf("_lt"); + break; + case SVGA3DOPCOMPC_NE: + _debug_printf("_ne"); + break; + case SVGA3DOPCOMP_LE: + _debug_printf("_le"); + break; + default: + assert(0); + } break; - case SVGA3DOPCOMP_RESERVED1: + default: - assert( 0 ); + assert(op.control == 0); } } +static void +format_reg(const char *name, + const struct sh_reg reg, + const struct sh_srcreg *indreg) +{ + if (reg.relative) { + assert(indreg); + + if (sh_srcreg_type(*indreg) == SVGA3DREG_LOOP) { + _debug_printf("%s[aL+%u]", name, reg.number); + } else { + _debug_printf("%s[a%u.x+%u]", name, indreg->number, reg.number); + } + } else { + _debug_printf("%s%u", name, reg.number); + } +} static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct dump_info *di ) { - assert( sh_reg_type( reg ) == SVGA3DREG_CONST || reg.relative == 0 ); assert( reg.is_reg == 1 ); switch (sh_reg_type( reg )) { case SVGA3DREG_TEMP: - _debug_printf( "r%u", reg.number ); + format_reg("r", reg, NULL); break; case SVGA3DREG_INPUT: - _debug_printf( "v%u", reg.number ); + format_reg("v", reg, indreg); break; case SVGA3DREG_CONST: - if (reg.relative) { - if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP) - _debug_printf( "c[aL+%u]", reg.number ); - else - _debug_printf( "c[a%u.x+%u]", indreg->number, reg.number ); - } - else - _debug_printf( "c%u", reg.number ); + format_reg("c", reg, indreg); break; case SVGA3DREG_ADDR: /* VS */ /* SVGA3DREG_TEXTURE */ /* PS */ - if (di->is_ps) - _debug_printf( "t%u", reg.number ); - else - _debug_printf( "a%u", reg.number ); + assert(!reg.relative); + if (di->is_ps) { + format_reg("t", reg, NULL); + } else { + format_reg("a", reg, NULL); + } break; case SVGA3DREG_RASTOUT: + assert(!reg.relative); switch (reg.number) { case 0 /*POSITION*/: _debug_printf( "oPos" ); @@ -154,64 +191,69 @@ static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct case SVGA3DREG_ATTROUT: assert( reg.number < 2 ); - _debug_printf( "oD%u", reg.number ); + format_reg("oD", reg, NULL); break; - case SVGA3DREG_TEXCRDOUT: - /* SVGA3DREG_OUTPUT */ - _debug_printf( "oT%u", reg.number ); + case SVGA3DREG_TEXCRDOUT: /* VS */ + /* SVGA3DREG_OUTPUT */ /* VS3.0+ */ + if (!di->is_ps && di->version >= SVGA3D_VS_30) { + format_reg("o", reg, indreg); + } else { + format_reg("oT", reg, NULL); + } break; case SVGA3DREG_COLOROUT: - _debug_printf( "oC%u", reg.number ); + format_reg("oC", reg, NULL); break; case SVGA3DREG_DEPTHOUT: - _debug_printf( "oD%u", reg.number ); + assert(!reg.relative); + assert(reg.number == 0); + _debug_printf("oDepth"); break; case SVGA3DREG_SAMPLER: - _debug_printf( "s%u", reg.number ); + format_reg("s", reg, NULL); break; case SVGA3DREG_CONSTBOOL: - assert( !reg.relative ); - _debug_printf( "b%u", reg.number ); + format_reg("b", reg, NULL); break; case SVGA3DREG_CONSTINT: - assert( !reg.relative ); - _debug_printf( "i%u", reg.number ); + format_reg("i", reg, NULL); break; case SVGA3DREG_LOOP: + assert(!reg.relative); assert( reg.number == 0 ); _debug_printf( "aL" ); break; case SVGA3DREG_MISCTYPE: + assert(!reg.relative); switch (reg.number) { case SVGA3DMISCREG_POSITION: - _debug_printf( "vPos" ); + _debug_printf("vPos"); break; case SVGA3DMISCREG_FACE: - _debug_printf( "vFace" ); + _debug_printf("vFace"); break; default: assert(0); - break; + _debug_printf("???"); } break; case SVGA3DREG_LABEL: - _debug_printf( "l%u", reg.number ); + format_reg("l", reg, NULL); break; case SVGA3DREG_PREDICATE: - _debug_printf( "p%u", reg.number ); + format_reg("p", reg, NULL); break; - default: assert( 0 ); _debug_printf( "???" ); @@ -233,8 +275,11 @@ static void dump_bdata( boolean bdata ) _debug_printf( bdata ? "TRUE" : "FALSE" ); } -static void dump_sampleinfo( struct ps_sampleinfo sampleinfo ) +static void +dump_sampleinfo(struct sh_sampleinfo sampleinfo) { + assert( sampleinfo.is_reg == 1 ); + switch (sampleinfo.texture_type) { case SVGA3DSAMP_2D: _debug_printf( "_2d" ); @@ -250,63 +295,67 @@ static void dump_sampleinfo( struct ps_sampleinfo sampleinfo ) } } - -static void dump_usageinfo( struct vs_semantic semantic ) +static void +dump_semantic(uint usage, + uint usage_index) { - switch (semantic.usage) { + switch (usage) { case SVGA3D_DECLUSAGE_POSITION: - _debug_printf("_position" ); + _debug_printf("_position"); break; case SVGA3D_DECLUSAGE_BLENDWEIGHT: - _debug_printf("_blendweight" ); + _debug_printf("_blendweight"); break; case SVGA3D_DECLUSAGE_BLENDINDICES: - _debug_printf("_blendindices" ); + _debug_printf("_blendindices"); break; case SVGA3D_DECLUSAGE_NORMAL: - _debug_printf("_normal" ); + _debug_printf("_normal"); break; case SVGA3D_DECLUSAGE_PSIZE: - _debug_printf("_psize" ); + _debug_printf("_psize"); break; case SVGA3D_DECLUSAGE_TEXCOORD: _debug_printf("_texcoord"); break; case SVGA3D_DECLUSAGE_TANGENT: - _debug_printf("_tangent" ); + _debug_printf("_tangent"); break; case SVGA3D_DECLUSAGE_BINORMAL: - _debug_printf("_binormal" ); + _debug_printf("_binormal"); break; case SVGA3D_DECLUSAGE_TESSFACTOR: - _debug_printf("_tessfactor" ); + _debug_printf("_tessfactor"); break; case SVGA3D_DECLUSAGE_POSITIONT: - _debug_printf("_positiont" ); + _debug_printf("_positiont"); break; case SVGA3D_DECLUSAGE_COLOR: - _debug_printf("_color" ); + _debug_printf("_color"); break; case SVGA3D_DECLUSAGE_FOG: - _debug_printf("_fog" ); + _debug_printf("_fog"); break; case SVGA3D_DECLUSAGE_DEPTH: - _debug_printf("_depth" ); + _debug_printf("_depth"); break; case SVGA3D_DECLUSAGE_SAMPLE: _debug_printf("_sample"); break; default: - assert( 0 ); - return; + assert(!"Unknown usage"); + _debug_printf("_???"); } - if (semantic.usage_index != 0) { - _debug_printf("%d", semantic.usage_index ); + if (usage_index) { + _debug_printf("%u", usage_index); } } -static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) +static void +dump_dstreg(struct sh_dstreg dstreg, + struct sh_srcreg *indreg, + const struct dump_info *di) { union { struct sh_reg reg; @@ -346,7 +395,7 @@ static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) _debug_printf( " " ); u.dstreg = dstreg; - dump_reg( u.reg, NULL, di ); + dump_reg( u.reg, indreg, di); if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) { _debug_printf( "." ); if (dstreg.write_mask & SVGA3DWRITEMASK_0) @@ -362,23 +411,13 @@ static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, const struct dump_info *di ) { - union { - struct sh_reg reg; - struct sh_srcreg srcreg; - } u; - switch (srcreg.modifier) { case SVGA3DSRCMOD_NEG: case SVGA3DSRCMOD_BIASNEG: case SVGA3DSRCMOD_SIGNNEG: case SVGA3DSRCMOD_X2NEG: - _debug_printf( "-" ); - break; - case SVGA3DSRCMOD_ABS: - _debug_printf( "|" ); - break; case SVGA3DSRCMOD_ABSNEG: - _debug_printf( "-|" ); + _debug_printf( "-" ); break; case SVGA3DSRCMOD_COMP: _debug_printf( "1-" ); @@ -386,19 +425,13 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons case SVGA3DSRCMOD_NOT: _debug_printf( "!" ); } - - u.srcreg = srcreg; - dump_reg( u.reg, indreg, di ); + dump_reg( *(struct sh_reg *) &srcreg, indreg, di ); switch (srcreg.modifier) { case SVGA3DSRCMOD_NONE: case SVGA3DSRCMOD_NEG: case SVGA3DSRCMOD_COMP: case SVGA3DSRCMOD_NOT: break; - case SVGA3DSRCMOD_ABS: - case SVGA3DSRCMOD_ABSNEG: - _debug_printf( "|" ); - break; case SVGA3DSRCMOD_BIAS: case SVGA3DSRCMOD_BIASNEG: _debug_printf( "_bias" ); @@ -417,6 +450,10 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons case SVGA3DSRCMOD_DW: _debug_printf( "_dw" ); break; + case SVGA3DSRCMOD_ABS: + case SVGA3DSRCMOD_ABSNEG: + _debug_printf("_abs"); + break; default: assert( 0 ); } @@ -434,58 +471,132 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons } } +static void +parse_op(struct dump_info *di, + const uint **token, + struct dump_op *op, + uint num_dst, + uint num_src) +{ + uint i; + + assert(num_dst <= 1); + assert(num_src <= DUMP_MAX_OP_SRC); + + op->op = *(struct sh_op *)*token; + *token += sizeof(struct sh_op) / sizeof(uint); + + if (num_dst >= 1) { + op->dst = *(struct sh_dstreg *)*token; + *token += sizeof(struct sh_dstreg) / sizeof(uint); + if (op->dst.relative && + (!di->is_ps && di->version >= SVGA3D_VS_30)) { + op->dstind = *(struct sh_srcreg *)*token; + *token += sizeof(struct sh_srcreg) / sizeof(uint); + } + } + + if (op->op.predicated) { + op->p0 = *(struct sh_srcreg *)*token; + *token += sizeof(struct sh_srcreg) / sizeof(uint); + } + + for (i = 0; i < num_src; ++i) { + op->src[i] = *(struct sh_srcreg *)*token; + *token += sizeof(struct sh_srcreg) / sizeof(uint); + if (op->src[i].relative && + ((!di->is_ps && di->version >= SVGA3D_VS_20) || + (di->is_ps && di->version >= SVGA3D_PS_30))) { + op->srcind[i] = *(struct sh_srcreg *)*token; + *token += sizeof(struct sh_srcreg) / sizeof(uint); + } + } +} + +static void +dump_inst(struct dump_info *di, + const unsigned **assem, + struct sh_op op, + const struct sh_opcode_info *info) +{ + struct dump_op dop; + boolean not_first_arg = FALSE; + uint i; + + assert(info->num_dst <= 1); + + di->indent -= info->pre_dedent; + dump_indent(di->indent); + di->indent += info->post_indent; + + dump_op(op, info->mnemonic); + + parse_op(di, assem, &dop, info->num_dst, info->num_src); + if (info->num_dst > 0) { + dump_dstreg(dop.dst, &dop.dstind, di); + not_first_arg = TRUE; + } + + for (i = 0; i < info->num_src; i++) { + if (not_first_arg) { + _debug_printf(", "); + } else { + _debug_printf(" "); + } + dump_srcreg(dop.src[i], &dop.srcind[i], di); + not_first_arg = TRUE; + } + + _debug_printf("\n"); +} + void svga_shader_dump( const unsigned *assem, unsigned dwords, unsigned do_binary ) { - const unsigned *start = assem; boolean finished = FALSE; struct dump_info di; - unsigned i; - if (do_binary) { - for (i = 0; i < dwords; i++) - _debug_printf(" 0x%08x,\n", assem[i]); - - _debug_printf("\n\n"); - } - - di.version.value = *assem++; - di.is_ps = (di.version.type == SVGA3D_PS_TYPE); + di.version = *assem++; + di.is_ps = (di.version & 0xFFFF0000) == 0xFFFF0000; + di.indent = 0; _debug_printf( "%s_%u_%u\n", di.is_ps ? "ps" : "vs", - di.version.major, - di.version.minor ); + (di.version >> 8) & 0xff, + di.version & 0xff ); while (!finished) { struct sh_op op = *(struct sh_op *) assem; - if (assem - start >= dwords) { - _debug_printf("... ran off end of buffer\n"); - assert(0); - return; - } - switch (op.opcode) { case SVGA3DOP_DCL: { struct sh_dcl dcl = *(struct sh_dcl *) assem; _debug_printf( "dcl" ); - if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER) - dump_sampleinfo( dcl.u.ps.sampleinfo ); - else if (di.is_ps) { - if (di.version.major == 3 && - sh_dstreg_type( dcl.reg ) != SVGA3DREG_MISCTYPE) - dump_usageinfo( dcl.u.vs.semantic ); + switch (sh_dstreg_type(dcl.reg)) { + case SVGA3DREG_INPUT: + if ((di.is_ps && di.version >= SVGA3D_PS_30) || + (!di.is_ps && di.version >= SVGA3D_VS_30)) { + dump_semantic(dcl.u.semantic.usage, + dcl.u.semantic.usage_index); + } + break; + case SVGA3DREG_TEXCRDOUT: + if (!di.is_ps && di.version >= SVGA3D_VS_30) { + dump_semantic(dcl.u.semantic.usage, + dcl.u.semantic.usage_index); + } + break; + case SVGA3DREG_SAMPLER: + dump_sampleinfo( dcl.u.sampleinfo ); + break; } - else - dump_usageinfo( dcl.u.vs.semantic ); - dump_dstreg( dcl.reg, &di ); + dump_dstreg(dcl.reg, NULL, &di); _debug_printf( "\n" ); assem += sizeof( struct sh_dcl ) / sizeof( unsigned ); } @@ -518,54 +629,38 @@ svga_shader_dump( break; case SVGA3DOP_TEXCOORD: - assert( di.is_ps ); - dump_op( op, "texcoord" ); - if (0) { - struct sh_dstop dstop = *(struct sh_dstop *) assem; - dump_dstreg( dstop.dst, &di ); - assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); - } - else { - struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; - dump_dstreg( unaryop.dst, &di ); - _debug_printf( ", " ); - dump_srcreg( unaryop.src, NULL, &di ); - assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); + { + struct sh_opcode_info info = *svga_opcode_info(op.opcode); + + assert(di.is_ps); + if (di.version > SVGA3D_PS_13) { + assert(info.num_src == 0); + + info.num_src = 1; + } + + dump_inst(&di, &assem, op, &info); } - _debug_printf( "\n" ); break; case SVGA3DOP_TEX: - assert( di.is_ps ); - if (0) { - dump_op( op, "tex" ); - if (0) { - struct sh_dstop dstop = *(struct sh_dstop *) assem; - - dump_dstreg( dstop.dst, &di ); - assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); - } - else { - struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; + { + struct sh_opcode_info info = *svga_opcode_info(op.opcode); - dump_dstreg( unaryop.dst, &di ); - _debug_printf( ", " ); - dump_srcreg( unaryop.src, NULL, &di ); - assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); + assert(di.is_ps); + if (di.version > SVGA3D_PS_13) { + assert(info.num_src == 0); + + if (di.version > SVGA3D_PS_14) { + info.num_src = 2; + info.mnemonic = "texld"; + } else { + info.num_src = 1; + } } - } - else { - struct sh_binaryop binaryop = *(struct sh_binaryop *) assem; - dump_op( op, "texld" ); - dump_dstreg( binaryop.dst, &di ); - _debug_printf( ", " ); - dump_srcreg( binaryop.src0, NULL, &di ); - _debug_printf( ", " ); - dump_srcreg( binaryop.src1, NULL, &di ); - assem += sizeof( struct sh_binaryop ) / sizeof( unsigned ); + dump_inst(&di, &assem, op, &info); } - _debug_printf( "\n" ); break; case SVGA3DOP_DEF: @@ -581,6 +676,21 @@ svga_shader_dump( } break; + case SVGA3DOP_SINCOS: + { + struct sh_opcode_info info = *svga_opcode_info(op.opcode); + + if ((di.is_ps && di.version >= SVGA3D_PS_30) || + (!di.is_ps && di.version >= SVGA3D_VS_30)) { + assert(info.num_src == 3); + + info.num_src = 1; + } + + dump_inst(&di, &assem, op, &info); + } + break; + case SVGA3DOP_PHASE: _debug_printf( "phase\n" ); assem += sizeof( struct sh_op ) / sizeof( unsigned ); @@ -595,59 +705,15 @@ svga_shader_dump( } break; - case SVGA3DOP_RET: - _debug_printf( "ret\n" ); - assem += sizeof( struct sh_op ) / sizeof( unsigned ); - break; - case SVGA3DOP_END: - _debug_printf( "end\n" ); finished = TRUE; break; default: { - const struct sh_opcode_info *info = svga_opcode_info( op.opcode ); - uint i; - uint num_src = info->num_src + op.predicated; - boolean not_first_arg = FALSE; - - assert( info->num_dst <= 1 ); - - if (op.opcode == SVGA3DOP_SINCOS && di.version.major < 3) - num_src += 2; - - dump_comp_op( op, info->mnemonic ); - assem += sizeof( struct sh_op ) / sizeof( unsigned ); - - if (info->num_dst > 0) { - struct sh_dstreg dstreg = *(struct sh_dstreg *) assem; + const struct sh_opcode_info *info = svga_opcode_info(op.opcode); - dump_dstreg( dstreg, &di ); - assem += sizeof( struct sh_dstreg ) / sizeof( unsigned ); - not_first_arg = TRUE; - } - - for (i = 0; i < num_src; i++) { - struct sh_srcreg srcreg; - struct sh_srcreg indreg; - - srcreg = *(struct sh_srcreg *) assem; - assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); - if (srcreg.relative && !di.is_ps && di.version.major >= 2) { - indreg = *(struct sh_srcreg *) assem; - assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); - } - - if (not_first_arg) - _debug_printf( ", " ); - else - _debug_printf( " " ); - dump_srcreg( srcreg, &indreg, &di ); - not_first_arg = TRUE; - } - - _debug_printf( "\n" ); + dump_inst(&di, &assem, op, info); } } } diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.c b/src/gallium/drivers/svga/svgadump/svga_shader_op.c index 8343bfdaab4..95612a80063 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_op.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.c @@ -41,103 +41,103 @@ static struct sh_opcode_info opcode_info[] = { - { "nop", 0, 0, SVGA3DOP_NOP }, - { "mov", 1, 1, SVGA3DOP_MOV, }, - { "add", 1, 2, SVGA3DOP_ADD, }, - { "sub", 1, 2, SVGA3DOP_SUB, }, - { "mad", 1, 3, SVGA3DOP_MAD, }, - { "mul", 1, 2, SVGA3DOP_MUL, }, - { "rcp", 1, 1, SVGA3DOP_RCP, }, - { "rsq", 1, 1, SVGA3DOP_RSQ, }, - { "dp3", 1, 2, SVGA3DOP_DP3, }, - { "dp4", 1, 2, SVGA3DOP_DP4, }, - { "min", 1, 2, SVGA3DOP_MIN, }, - { "max", 1, 2, SVGA3DOP_MAX, }, - { "slt", 1, 2, SVGA3DOP_SLT, }, - { "sge", 1, 2, SVGA3DOP_SGE, }, - { "exp", 1, 1, SVGA3DOP_EXP, }, - { "log", 1, 1, SVGA3DOP_LOG, }, - { "lit", 1, 1, SVGA3DOP_LIT, }, - { "dst", 1, 2, SVGA3DOP_DST, }, - { "lrp", 1, 3, SVGA3DOP_LRP, }, - { "frc", 1, 1, SVGA3DOP_FRC, }, - { "m4x4", 1, 2, SVGA3DOP_M4x4, }, - { "m4x3", 1, 2, SVGA3DOP_M4x3, }, - { "m3x4", 1, 2, SVGA3DOP_M3x4, }, - { "m3x3", 1, 2, SVGA3DOP_M3x3, }, - { "m3x2", 1, 2, SVGA3DOP_M3x2, }, - { "call", 0, 1, SVGA3DOP_CALL, }, - { "callnz", 0, 2, SVGA3DOP_CALLNZ, }, - { "loop", 0, 2, SVGA3DOP_LOOP, }, - { "ret", 0, 0, SVGA3DOP_RET, }, - { "endloop", 0, 0, SVGA3DOP_ENDLOOP, }, - { "label", 0, 1, SVGA3DOP_LABEL, }, - { "dcl", 0, 0, SVGA3DOP_DCL, }, - { "pow", 1, 2, SVGA3DOP_POW, }, - { "crs", 1, 2, SVGA3DOP_CRS, }, - { "sgn", 1, 3, SVGA3DOP_SGN, }, - { "abs", 1, 1, SVGA3DOP_ABS, }, - { "nrm", 1, 1, SVGA3DOP_NRM, }, /* 3-componenet normalization */ - { "sincos", 1, 1, SVGA3DOP_SINCOS, }, - { "rep", 0, 1, SVGA3DOP_REP, }, - { "endrep", 0, 0, SVGA3DOP_ENDREP, }, - { "if", 0, 1, SVGA3DOP_IF, }, - { "ifc", 0, 2, SVGA3DOP_IFC, }, - { "else", 0, 0, SVGA3DOP_ELSE, }, - { "endif", 0, 0, SVGA3DOP_ENDIF, }, - { "break", 0, 0, SVGA3DOP_BREAK, }, - { "breakc", 0, 0, SVGA3DOP_BREAKC, }, - { "mova", 1, 1, SVGA3DOP_MOVA, }, - { "defb", 0, 0, SVGA3DOP_DEFB, }, - { "defi", 0, 0, SVGA3DOP_DEFI, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "texcoord", 0, 0, SVGA3DOP_TEXCOORD, }, - { "texkill", 1, 0, SVGA3DOP_TEXKILL, }, - { "tex", 0, 0, SVGA3DOP_TEX, }, - { "texbem", 1, 1, SVGA3DOP_TEXBEM, }, - { "texbeml", 1, 1, SVGA3DOP_TEXBEML, }, - { "texreg2ar", 1, 1, SVGA3DOP_TEXREG2AR, }, - { "texreg2gb", 1, 1, SVGA3DOP_TEXREG2GB, }, - { "texm3x2pad", 1, 1, SVGA3DOP_TEXM3x2PAD, }, - { "texm3x2tex", 1, 1, SVGA3DOP_TEXM3x2TEX, }, - { "texm3x3pad", 1, 1, SVGA3DOP_TEXM3x3PAD, }, - { "texm3x3tex", 1, 1, SVGA3DOP_TEXM3x3TEX, }, - { "reserved0", 0, 0, SVGA3DOP_RESERVED0, }, - { "texm3x3spec", 1, 2, SVGA3DOP_TEXM3x3SPEC, }, - { "texm3x3vspec", 1, 1, SVGA3DOP_TEXM3x3VSPEC,}, - { "expp", 1, 1, SVGA3DOP_EXPP, }, - { "logp", 1, 1, SVGA3DOP_LOGP, }, - { "cnd", 1, 3, SVGA3DOP_CND, }, - { "def", 0, 0, SVGA3DOP_DEF, }, - { "texreg2rgb", 1, 1, SVGA3DOP_TEXREG2RGB, }, - { "texdp3tex", 1, 1, SVGA3DOP_TEXDP3TEX, }, - { "texm3x2depth", 1, 1, SVGA3DOP_TEXM3x2DEPTH,}, - { "texdp3", 1, 1, SVGA3DOP_TEXDP3, }, - { "texm3x3", 1, 1, SVGA3DOP_TEXM3x3, }, - { "texdepth", 1, 0, SVGA3DOP_TEXDEPTH, }, - { "cmp", 1, 3, SVGA3DOP_CMP, }, - { "bem", 1, 2, SVGA3DOP_BEM, }, - { "dp2add", 1, 3, SVGA3DOP_DP2ADD, }, - { "dsx", 1, 1, SVGA3DOP_INVALID, }, - { "dsy", 1, 1, SVGA3DOP_INVALID, }, - { "texldd", 1, 1, SVGA3DOP_INVALID, }, - { "setp", 1, 2, SVGA3DOP_SETP, }, - { "texldl", 1, 1, SVGA3DOP_INVALID, }, - { "breakp", 1, 1, SVGA3DOP_INVALID, }, + { "nop", 0, 0, 0, 0, SVGA3DOP_NOP }, + { "mov", 1, 1, 0, 0, SVGA3DOP_MOV, }, + { "add", 1, 2, 0, 0, SVGA3DOP_ADD, }, + { "sub", 1, 2, 0, 0, SVGA3DOP_SUB, }, + { "mad", 1, 3, 0, 0, SVGA3DOP_MAD, }, + { "mul", 1, 2, 0, 0, SVGA3DOP_MUL, }, + { "rcp", 1, 1, 0, 0, SVGA3DOP_RCP, }, + { "rsq", 1, 1, 0, 0, SVGA3DOP_RSQ, }, + { "dp3", 1, 2, 0, 0, SVGA3DOP_DP3, }, + { "dp4", 1, 2, 0, 0, SVGA3DOP_DP4, }, + { "min", 1, 2, 0, 0, SVGA3DOP_MIN, }, + { "max", 1, 2, 0, 0, SVGA3DOP_MAX, }, + { "slt", 1, 2, 0, 0, SVGA3DOP_SLT, }, + { "sge", 1, 2, 0, 0, SVGA3DOP_SGE, }, + { "exp", 1, 1, 0, 0, SVGA3DOP_EXP, }, + { "log", 1, 1, 0, 0, SVGA3DOP_LOG, }, + { "lit", 1, 1, 0, 0, SVGA3DOP_LIT, }, + { "dst", 1, 2, 0, 0, SVGA3DOP_DST, }, + { "lrp", 1, 3, 0, 0, SVGA3DOP_LRP, }, + { "frc", 1, 1, 0, 0, SVGA3DOP_FRC, }, + { "m4x4", 1, 2, 0, 0, SVGA3DOP_M4x4, }, + { "m4x3", 1, 2, 0, 0, SVGA3DOP_M4x3, }, + { "m3x4", 1, 2, 0, 0, SVGA3DOP_M3x4, }, + { "m3x3", 1, 2, 0, 0, SVGA3DOP_M3x3, }, + { "m3x2", 1, 2, 0, 0, SVGA3DOP_M3x2, }, + { "call", 0, 1, 0, 0, SVGA3DOP_CALL, }, + { "callnz", 0, 2, 0, 0, SVGA3DOP_CALLNZ, }, + { "loop", 0, 2, 0, 1, SVGA3DOP_LOOP, }, + { "ret", 0, 0, 0, 0, SVGA3DOP_RET, }, + { "endloop", 0, 0, 1, 0, SVGA3DOP_ENDLOOP, }, + { "label", 0, 1, 0, 0, SVGA3DOP_LABEL, }, + { "dcl", 0, 0, 0, 0, SVGA3DOP_DCL, }, + { "pow", 1, 2, 0, 0, SVGA3DOP_POW, }, + { "crs", 1, 2, 0, 0, SVGA3DOP_CRS, }, + { "sgn", 1, 3, 0, 0, SVGA3DOP_SGN, }, + { "abs", 1, 1, 0, 0, SVGA3DOP_ABS, }, + { "nrm", 1, 1, 0, 0, SVGA3DOP_NRM, }, /* 3-componenet normalization */ + { "sincos", 1, 3, 0, 0, SVGA3DOP_SINCOS, }, + { "rep", 0, 1, 0, 1, SVGA3DOP_REP, }, + { "endrep", 0, 0, 1, 0, SVGA3DOP_ENDREP, }, + { "if", 0, 1, 0, 1, SVGA3DOP_IF, }, + { "ifc", 0, 2, 0, 1, SVGA3DOP_IFC, }, + { "else", 0, 0, 1, 1, SVGA3DOP_ELSE, }, + { "endif", 0, 0, 1, 0, SVGA3DOP_ENDIF, }, + { "break", 0, 0, 0, 0, SVGA3DOP_BREAK, }, + { "breakc", 0, 2, 0, 0, SVGA3DOP_BREAKC, }, + { "mova", 1, 1, 0, 0, SVGA3DOP_MOVA, }, + { "defb", 0, 0, 0, 0, SVGA3DOP_DEFB, }, + { "defi", 0, 0, 0, 0, SVGA3DOP_DEFI, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "texcoord", 1, 0, 0, 0, SVGA3DOP_TEXCOORD, }, + { "texkill", 1, 0, 0, 0, SVGA3DOP_TEXKILL, }, + { "tex", 1, 0, 0, 0, SVGA3DOP_TEX, }, + { "texbem", 1, 1, 0, 0, SVGA3DOP_TEXBEM, }, + { "texbeml", 1, 1, 0, 0, SVGA3DOP_TEXBEML, }, + { "texreg2ar", 1, 1, 0, 0, SVGA3DOP_TEXREG2AR, }, + { "texreg2gb", 1, 1, 0, 0, SVGA3DOP_TEXREG2GB, }, + { "texm3x2pad", 1, 1, 0, 0, SVGA3DOP_TEXM3x2PAD, }, + { "texm3x2tex", 1, 1, 0, 0, SVGA3DOP_TEXM3x2TEX, }, + { "texm3x3pad", 1, 1, 0, 0, SVGA3DOP_TEXM3x3PAD, }, + { "texm3x3tex", 1, 1, 0, 0, SVGA3DOP_TEXM3x3TEX, }, + { "reserved0", 0, 0, 0, 0, SVGA3DOP_RESERVED0, }, + { "texm3x3spec", 1, 2, 0, 0, SVGA3DOP_TEXM3x3SPEC, }, + { "texm3x3vspec", 1, 1, 0, 0, SVGA3DOP_TEXM3x3VSPEC,}, + { "expp", 1, 1, 0, 0, SVGA3DOP_EXPP, }, + { "logp", 1, 1, 0, 0, SVGA3DOP_LOGP, }, + { "cnd", 1, 3, 0, 0, SVGA3DOP_CND, }, + { "def", 0, 0, 0, 0, SVGA3DOP_DEF, }, + { "texreg2rgb", 1, 1, 0, 0, SVGA3DOP_TEXREG2RGB, }, + { "texdp3tex", 1, 1, 0, 0, SVGA3DOP_TEXDP3TEX, }, + { "texm3x2depth", 1, 1, 0, 0, SVGA3DOP_TEXM3x2DEPTH,}, + { "texdp3", 1, 1, 0, 0, SVGA3DOP_TEXDP3, }, + { "texm3x3", 1, 1, 0, 0, SVGA3DOP_TEXM3x3, }, + { "texdepth", 1, 0, 0, 0, SVGA3DOP_TEXDEPTH, }, + { "cmp", 1, 3, 0, 0, SVGA3DOP_CMP, }, + { "bem", 1, 2, 0, 0, SVGA3DOP_BEM, }, + { "dp2add", 1, 3, 0, 0, SVGA3DOP_DP2ADD, }, + { "dsx", 1, 1, 0, 0, SVGA3DOP_INVALID, }, + { "dsy", 1, 1, 0, 0, SVGA3DOP_INVALID, }, + { "texldd", 1, 4, 0, 0, SVGA3DOP_INVALID, }, + { "setp", 1, 2, 0, 0, SVGA3DOP_SETP, }, + { "texldl", 1, 2, 0, 0, SVGA3DOP_INVALID, }, + { "breakp", 0, 1, 0, 0, SVGA3DOP_INVALID, }, }; const struct sh_opcode_info *svga_opcode_info( uint op ) diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.h b/src/gallium/drivers/svga/svgadump/svga_shader_op.h index e558de02c53..a5ccae5ae58 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_op.h +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.h @@ -38,6 +38,8 @@ struct sh_opcode_info const char *mnemonic; unsigned num_dst:8; unsigned num_src:8; + unsigned pre_dedent:1; + unsigned post_indent:1; unsigned svga_opcode:16; };