tgsi_dump_c.c

Go to the documentation of this file.
00001 /**************************************************************************
00002  * 
00003  * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
00004  * All Rights Reserved.
00005  * 
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation the rights to use, copy, modify, merge, publish,
00010  * distribute, sub license, and/or sell copies of the Software, and to
00011  * permit persons to whom the Software is furnished to do so, subject to
00012  * the following conditions:
00013  * 
00014  * The above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial portions
00016  * of the Software.
00017  * 
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
00021  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
00022  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00023  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00024  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00025  * 
00026  **************************************************************************/
00027 
00028 #include "pipe/p_debug.h"
00029 #include "util/u_string.h"
00030 #include "tgsi_dump_c.h"
00031 #include "tgsi_build.h"
00032 #include "tgsi_info.h"
00033 #include "tgsi_parse.h"
00034 
00035 static void
00036 dump_enum(
00037    const unsigned    e,
00038    const char        **enums,
00039    const unsigned    enums_count )
00040 {
00041    if (e >= enums_count) {
00042       debug_printf( "%u", e );
00043    }
00044    else {
00045       debug_printf( "%s", enums[e] );
00046    }
00047 }
00048 
00049 #define EOL()           debug_printf( "\n" )
00050 #define TXT(S)          debug_printf( "%s", S )
00051 #define CHR(C)          debug_printf( "%c", C )
00052 #define UIX(I)          debug_printf( "0x%x", I )
00053 #define UID(I)          debug_printf( "%u", I )
00054 #define SID(I)          debug_printf( "%d", I )
00055 #define FLT(F)          debug_printf( "%10.4f", F )
00056 #define ENM(E,ENUMS)    dump_enum( E, ENUMS, sizeof( ENUMS ) / sizeof( *ENUMS ) )
00057 
00058 static const char *TGSI_PROCESSOR_TYPES[] =
00059 {
00060    "PROCESSOR_FRAGMENT",
00061    "PROCESSOR_VERTEX",
00062    "PROCESSOR_GEOMETRY"
00063 };
00064 
00065 static const char *TGSI_TOKEN_TYPES[] =
00066 {
00067    "TOKEN_TYPE_DECLARATION",
00068    "TOKEN_TYPE_IMMEDIATE",
00069    "TOKEN_TYPE_INSTRUCTION"
00070 };
00071 
00072 static const char *TGSI_FILES[TGSI_FILE_COUNT] =
00073 {
00074    "FILE_NULL",
00075    "FILE_CONSTANT",
00076    "FILE_INPUT",
00077    "FILE_OUTPUT",
00078    "FILE_TEMPORARY",
00079    "FILE_SAMPLER",
00080    "FILE_ADDRESS",
00081    "FILE_IMMEDIATE",
00082    "FILE_LOOP"
00083 };
00084 
00085 static const char *TGSI_INTERPOLATES[] =
00086 {
00087    "INTERPOLATE_CONSTANT",
00088    "INTERPOLATE_LINEAR",
00089    "INTERPOLATE_PERSPECTIVE"
00090 };
00091 
00092 static const char *TGSI_SEMANTICS[] =
00093 {
00094    "SEMANTIC_POSITION",
00095    "SEMANTIC_COLOR",
00096    "SEMANTIC_BCOLOR",
00097    "SEMANTIC_FOG",
00098    "SEMANTIC_PSIZE",
00099    "SEMANTIC_GENERIC",
00100    "SEMANTIC_NORMAL"
00101 };
00102 
00103 static const char *TGSI_IMMS[] =
00104 {
00105    "IMM_FLOAT32"
00106 };
00107 
00108 static const char *TGSI_SATS[] =
00109 {
00110    "SAT_NONE",
00111    "SAT_ZERO_ONE",
00112    "SAT_MINUS_PLUS_ONE"
00113 };
00114 
00115 static const char *TGSI_INSTRUCTION_EXTS[] =
00116 {
00117    "INSTRUCTION_EXT_TYPE_NV",
00118    "INSTRUCTION_EXT_TYPE_LABEL",
00119    "INSTRUCTION_EXT_TYPE_TEXTURE"
00120 };
00121 
00122 static const char *TGSI_PRECISIONS[] =
00123 {
00124    "PRECISION_DEFAULT",
00125    "PRECISION_FLOAT32",
00126    "PRECISION_FLOAT16",
00127    "PRECISION_FIXED12"
00128 };
00129 
00130 static const char *TGSI_CCS[] =
00131 {
00132    "CC_GT",
00133    "CC_EQ",
00134    "CC_LT",
00135    "CC_UN",
00136    "CC_GE",
00137    "CC_LE",
00138    "CC_NE",
00139    "CC_TR",
00140    "CC_FL"
00141 };
00142 
00143 static const char *TGSI_SWIZZLES[] =
00144 {
00145    "SWIZZLE_X",
00146    "SWIZZLE_Y",
00147    "SWIZZLE_Z",
00148    "SWIZZLE_W"
00149 };
00150 
00151 static const char *TGSI_TEXTURES[] =
00152 {
00153    "TEXTURE_UNKNOWN",
00154    "TEXTURE_1D",
00155    "TEXTURE_2D",
00156    "TEXTURE_3D",
00157    "TEXTURE_CUBE",
00158    "TEXTURE_RECT",
00159    "TEXTURE_SHADOW1D",
00160    "TEXTURE_SHADOW2D",
00161    "TEXTURE_SHADOWRECT"
00162 };
00163 
00164 static const char *TGSI_SRC_REGISTER_EXTS[] =
00165 {
00166    "SRC_REGISTER_EXT_TYPE_SWZ",
00167    "SRC_REGISTER_EXT_TYPE_MOD"
00168 };
00169 
00170 static const char *TGSI_EXTSWIZZLES[] =
00171 {
00172    "EXTSWIZZLE_X",
00173    "EXTSWIZZLE_Y",
00174    "EXTSWIZZLE_Z",
00175    "EXTSWIZZLE_W",
00176    "EXTSWIZZLE_ZERO",
00177    "EXTSWIZZLE_ONE"
00178 };
00179 
00180 static const char *TGSI_WRITEMASKS[] =
00181 {
00182    "0",
00183    "WRITEMASK_X",
00184    "WRITEMASK_Y",
00185    "WRITEMASK_XY",
00186    "WRITEMASK_Z",
00187    "WRITEMASK_XZ",
00188    "WRITEMASK_YZ",
00189    "WRITEMASK_XYZ",
00190    "WRITEMASK_W",
00191    "WRITEMASK_XW",
00192    "WRITEMASK_YW",
00193    "WRITEMASK_XYW",
00194    "WRITEMASK_ZW",
00195    "WRITEMASK_XZW",
00196    "WRITEMASK_YZW",
00197    "WRITEMASK_XYZW"
00198 };
00199 
00200 static const char *TGSI_DST_REGISTER_EXTS[] =
00201 {
00202    "DST_REGISTER_EXT_TYPE_CONDCODE",
00203    "DST_REGISTER_EXT_TYPE_MODULATE"
00204 };
00205 
00206 static const char *TGSI_MODULATES[] =
00207 {
00208    "MODULATE_1X",
00209    "MODULATE_2X",
00210    "MODULATE_4X",
00211    "MODULATE_8X",
00212    "MODULATE_HALF",
00213    "MODULATE_QUARTER",
00214    "MODULATE_EIGHTH"
00215 };
00216 
00217 static void
00218 dump_declaration_verbose(
00219    struct tgsi_full_declaration  *decl,
00220    unsigned                      ignored,
00221    unsigned                      deflt,
00222    struct tgsi_full_declaration  *fd )
00223 {
00224    TXT( "\nFile       : " );
00225    ENM( decl->Declaration.File, TGSI_FILES );
00226    if( deflt || fd->Declaration.UsageMask != decl->Declaration.UsageMask ) {
00227       TXT( "\nUsageMask  : " );
00228       if( decl->Declaration.UsageMask & TGSI_WRITEMASK_X ) {
00229          CHR( 'X' );
00230       }
00231       if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Y ) {
00232          CHR( 'Y' );
00233       }
00234       if( decl->Declaration.UsageMask & TGSI_WRITEMASK_Z ) {
00235          CHR( 'Z' );
00236       }
00237       if( decl->Declaration.UsageMask & TGSI_WRITEMASK_W ) {
00238          CHR( 'W' );
00239       }
00240    }
00241    if( deflt || fd->Declaration.Interpolate != decl->Declaration.Interpolate ) {
00242       TXT( "\nInterpolate: " );
00243       ENM( decl->Declaration.Interpolate, TGSI_INTERPOLATES );
00244    }
00245    if( deflt || fd->Declaration.Semantic != decl->Declaration.Semantic ) {
00246       TXT( "\nSemantic   : " );
00247       UID( decl->Declaration.Semantic );
00248    }
00249    if( ignored ) {
00250       TXT( "\nPadding    : " );
00251       UIX( decl->Declaration.Padding );
00252    }
00253 
00254    EOL();
00255    TXT( "\nFirst: " );
00256    UID( decl->DeclarationRange.First );
00257    TXT( "\nLast : " );
00258    UID( decl->DeclarationRange.Last );
00259 
00260    if( decl->Declaration.Semantic ) {
00261       EOL();
00262       TXT( "\nSemanticName : " );
00263       ENM( decl->Semantic.SemanticName, TGSI_SEMANTICS );
00264       TXT( "\nSemanticIndex: " );
00265       UID( decl->Semantic.SemanticIndex );
00266       if( ignored ) {
00267          TXT( "\nPadding      : " );
00268          UIX( decl->Semantic.Padding );
00269       }
00270    }
00271 }
00272 
00273 static void
00274 dump_immediate_verbose(
00275    struct tgsi_full_immediate *imm,
00276    unsigned                   ignored )
00277 {
00278    unsigned i;
00279 
00280    TXT( "\nDataType   : " );
00281    ENM( imm->Immediate.DataType, TGSI_IMMS );
00282    if( ignored ) {
00283       TXT( "\nPadding    : " );
00284       UIX( imm->Immediate.Padding );
00285    }
00286 
00287    for( i = 0; i < imm->Immediate.Size - 1; i++ ) {
00288       EOL();
00289       switch( imm->Immediate.DataType ) {
00290       case TGSI_IMM_FLOAT32:
00291          TXT( "\nFloat: " );
00292          FLT( imm->u.ImmediateFloat32[i].Float );
00293          break;
00294 
00295       default:
00296          assert( 0 );
00297       }
00298    }
00299 }
00300 
00301 static void
00302 dump_instruction_verbose(
00303    struct tgsi_full_instruction  *inst,
00304    unsigned                      ignored,
00305    unsigned                      deflt,
00306    struct tgsi_full_instruction  *fi )
00307 {
00308    unsigned i;
00309 
00310    TXT( "\nOpcode     : OPCODE_" );
00311    TXT( tgsi_get_opcode_info( inst->Instruction.Opcode )->mnemonic );
00312    if( deflt || fi->Instruction.Saturate != inst->Instruction.Saturate ) {
00313       TXT( "\nSaturate   : " );
00314       ENM( inst->Instruction.Saturate, TGSI_SATS );
00315    }
00316    if( deflt || fi->Instruction.NumDstRegs != inst->Instruction.NumDstRegs ) {
00317       TXT( "\nNumDstRegs : " );
00318       UID( inst->Instruction.NumDstRegs );
00319    }
00320    if( deflt || fi->Instruction.NumSrcRegs != inst->Instruction.NumSrcRegs ) {
00321       TXT( "\nNumSrcRegs : " );
00322       UID( inst->Instruction.NumSrcRegs );
00323    }
00324    if( ignored ) {
00325       TXT( "\nPadding    : " );
00326       UIX( inst->Instruction.Padding );
00327    }
00328 
00329    if( deflt || tgsi_compare_instruction_ext_nv( inst->InstructionExtNv, fi->InstructionExtNv ) ) {
00330       EOL();
00331       TXT( "\nType          : " );
00332       ENM( inst->InstructionExtNv.Type, TGSI_INSTRUCTION_EXTS );
00333       if( deflt || fi->InstructionExtNv.Precision != inst->InstructionExtNv.Precision ) {
00334          TXT( "\nPrecision     : " );
00335          ENM( inst->InstructionExtNv.Precision, TGSI_PRECISIONS );
00336       }
00337       if( deflt || fi->InstructionExtNv.CondDstIndex != inst->InstructionExtNv.CondDstIndex ) {
00338          TXT( "\nCondDstIndex  : " );
00339          UID( inst->InstructionExtNv.CondDstIndex );
00340       }
00341       if( deflt || fi->InstructionExtNv.CondFlowIndex != inst->InstructionExtNv.CondFlowIndex ) {
00342          TXT( "\nCondFlowIndex : " );
00343          UID( inst->InstructionExtNv.CondFlowIndex );
00344       }
00345       if( deflt || fi->InstructionExtNv.CondMask != inst->InstructionExtNv.CondMask ) {
00346          TXT( "\nCondMask      : " );
00347          ENM( inst->InstructionExtNv.CondMask, TGSI_CCS );
00348       }
00349       if( deflt || fi->InstructionExtNv.CondSwizzleX != inst->InstructionExtNv.CondSwizzleX ) {
00350          TXT( "\nCondSwizzleX  : " );
00351          ENM( inst->InstructionExtNv.CondSwizzleX, TGSI_SWIZZLES );
00352       }
00353       if( deflt || fi->InstructionExtNv.CondSwizzleY != inst->InstructionExtNv.CondSwizzleY ) {
00354          TXT( "\nCondSwizzleY  : " );
00355          ENM( inst->InstructionExtNv.CondSwizzleY, TGSI_SWIZZLES );
00356       }
00357       if( deflt || fi->InstructionExtNv.CondSwizzleZ != inst->InstructionExtNv.CondSwizzleZ ) {
00358          TXT( "\nCondSwizzleZ  : " );
00359          ENM( inst->InstructionExtNv.CondSwizzleZ, TGSI_SWIZZLES );
00360       }
00361       if( deflt || fi->InstructionExtNv.CondSwizzleW != inst->InstructionExtNv.CondSwizzleW ) {
00362          TXT( "\nCondSwizzleW  : " );
00363          ENM( inst->InstructionExtNv.CondSwizzleW, TGSI_SWIZZLES );
00364       }
00365       if( deflt || fi->InstructionExtNv.CondDstUpdate != inst->InstructionExtNv.CondDstUpdate ) {
00366          TXT( "\nCondDstUpdate : " );
00367          UID( inst->InstructionExtNv.CondDstUpdate );
00368       }
00369       if( deflt || fi->InstructionExtNv.CondFlowEnable != inst->InstructionExtNv.CondFlowEnable ) {
00370          TXT( "\nCondFlowEnable: " );
00371          UID( inst->InstructionExtNv.CondFlowEnable );
00372       }
00373       if( ignored ) {
00374          TXT( "\nPadding       : " );
00375          UIX( inst->InstructionExtNv.Padding );
00376          if( deflt || fi->InstructionExtNv.Extended != inst->InstructionExtNv.Extended ) {
00377             TXT( "\nExtended      : " );
00378             UID( inst->InstructionExtNv.Extended );
00379          }
00380       }
00381    }
00382 
00383    if( deflt || tgsi_compare_instruction_ext_label( inst->InstructionExtLabel, fi->InstructionExtLabel ) ) {
00384       EOL();
00385       TXT( "\nType    : " );
00386       ENM( inst->InstructionExtLabel.Type, TGSI_INSTRUCTION_EXTS );
00387       if( deflt || fi->InstructionExtLabel.Label != inst->InstructionExtLabel.Label ) {
00388          TXT( "\nLabel   : " );
00389          UID( inst->InstructionExtLabel.Label );
00390       }
00391       if( ignored ) {
00392          TXT( "\nPadding : " );
00393          UIX( inst->InstructionExtLabel.Padding );
00394          if( deflt || fi->InstructionExtLabel.Extended != inst->InstructionExtLabel.Extended ) {
00395             TXT( "\nExtended: " );
00396             UID( inst->InstructionExtLabel.Extended );
00397          }
00398       }
00399    }
00400 
00401    if( deflt || tgsi_compare_instruction_ext_texture( inst->InstructionExtTexture, fi->InstructionExtTexture ) ) {
00402       EOL();
00403       TXT( "\nType    : " );
00404       ENM( inst->InstructionExtTexture.Type, TGSI_INSTRUCTION_EXTS );
00405       if( deflt || fi->InstructionExtTexture.Texture != inst->InstructionExtTexture.Texture ) {
00406          TXT( "\nTexture : " );
00407          ENM( inst->InstructionExtTexture.Texture, TGSI_TEXTURES );
00408       }
00409       if( ignored ) {
00410          TXT( "\nPadding : " );
00411          UIX( inst->InstructionExtTexture.Padding );
00412          if( deflt || fi->InstructionExtTexture.Extended != inst->InstructionExtTexture.Extended ) {
00413             TXT( "\nExtended: " );
00414             UID( inst->InstructionExtTexture.Extended );
00415          }
00416       }
00417    }
00418 
00419    for( i = 0; i < inst->Instruction.NumDstRegs; i++ ) {
00420       struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i];
00421       struct tgsi_full_dst_register *fd = &fi->FullDstRegisters[i];
00422 
00423       EOL();
00424       TXT( "\nFile     : " );
00425       ENM( dst->DstRegister.File, TGSI_FILES );
00426       if( deflt || fd->DstRegister.WriteMask != dst->DstRegister.WriteMask ) {
00427          TXT( "\nWriteMask: " );
00428          ENM( dst->DstRegister.WriteMask, TGSI_WRITEMASKS );
00429       }
00430       if( ignored ) {
00431          if( deflt || fd->DstRegister.Indirect != dst->DstRegister.Indirect ) {
00432             TXT( "\nIndirect : " );
00433             UID( dst->DstRegister.Indirect );
00434          }
00435          if( deflt || fd->DstRegister.Dimension != dst->DstRegister.Dimension ) {
00436             TXT( "\nDimension: " );
00437             UID( dst->DstRegister.Dimension );
00438          }
00439       }
00440       if( deflt || fd->DstRegister.Index != dst->DstRegister.Index ) {
00441          TXT( "\nIndex    : " );
00442          SID( dst->DstRegister.Index );
00443       }
00444       if( ignored ) {
00445          TXT( "\nPadding  : " );
00446          UIX( dst->DstRegister.Padding );
00447          if( deflt || fd->DstRegister.Extended != dst->DstRegister.Extended ) {
00448             TXT( "\nExtended : " );
00449             UID( dst->DstRegister.Extended );
00450          }
00451       }
00452 
00453       if( deflt || tgsi_compare_dst_register_ext_concode( dst->DstRegisterExtConcode, fd->DstRegisterExtConcode ) ) {
00454          EOL();
00455          TXT( "\nType        : " );
00456          ENM( dst->DstRegisterExtConcode.Type, TGSI_DST_REGISTER_EXTS );
00457          if( deflt || fd->DstRegisterExtConcode.CondMask != dst->DstRegisterExtConcode.CondMask ) {
00458             TXT( "\nCondMask    : " );
00459             ENM( dst->DstRegisterExtConcode.CondMask, TGSI_CCS );
00460          }
00461          if( deflt || fd->DstRegisterExtConcode.CondSwizzleX != dst->DstRegisterExtConcode.CondSwizzleX ) {
00462             TXT( "\nCondSwizzleX: " );
00463             ENM( dst->DstRegisterExtConcode.CondSwizzleX, TGSI_SWIZZLES );
00464          }
00465          if( deflt || fd->DstRegisterExtConcode.CondSwizzleY != dst->DstRegisterExtConcode.CondSwizzleY ) {
00466             TXT( "\nCondSwizzleY: " );
00467             ENM( dst->DstRegisterExtConcode.CondSwizzleY, TGSI_SWIZZLES );
00468          }
00469          if( deflt || fd->DstRegisterExtConcode.CondSwizzleZ != dst->DstRegisterExtConcode.CondSwizzleZ ) {
00470             TXT( "\nCondSwizzleZ: " );
00471             ENM( dst->DstRegisterExtConcode.CondSwizzleZ, TGSI_SWIZZLES );
00472          }
00473          if( deflt || fd->DstRegisterExtConcode.CondSwizzleW != dst->DstRegisterExtConcode.CondSwizzleW ) {
00474             TXT( "\nCondSwizzleW: " );
00475             ENM( dst->DstRegisterExtConcode.CondSwizzleW, TGSI_SWIZZLES );
00476          }
00477          if( deflt || fd->DstRegisterExtConcode.CondSrcIndex != dst->DstRegisterExtConcode.CondSrcIndex ) {
00478             TXT( "\nCondSrcIndex: " );
00479             UID( dst->DstRegisterExtConcode.CondSrcIndex );
00480          }
00481          if( ignored ) {
00482             TXT( "\nPadding     : " );
00483             UIX( dst->DstRegisterExtConcode.Padding );
00484             if( deflt || fd->DstRegisterExtConcode.Extended != dst->DstRegisterExtConcode.Extended ) {
00485                TXT( "\nExtended    : " );
00486                UID( dst->DstRegisterExtConcode.Extended );
00487             }
00488          }
00489       }
00490 
00491       if( deflt || tgsi_compare_dst_register_ext_modulate( dst->DstRegisterExtModulate, fd->DstRegisterExtModulate ) ) {
00492          EOL();
00493          TXT( "\nType    : " );
00494          ENM( dst->DstRegisterExtModulate.Type, TGSI_DST_REGISTER_EXTS );
00495          if( deflt || fd->DstRegisterExtModulate.Modulate != dst->DstRegisterExtModulate.Modulate ) {
00496             TXT( "\nModulate: " );
00497             ENM( dst->DstRegisterExtModulate.Modulate, TGSI_MODULATES );
00498          }
00499          if( ignored ) {
00500             TXT( "\nPadding : " );
00501             UIX( dst->DstRegisterExtModulate.Padding );
00502             if( deflt || fd->DstRegisterExtModulate.Extended != dst->DstRegisterExtModulate.Extended ) {
00503                TXT( "\nExtended: " );
00504                UID( dst->DstRegisterExtModulate.Extended );
00505             }
00506          }
00507       }
00508    }
00509 
00510    for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) {
00511       struct tgsi_full_src_register *src = &inst->FullSrcRegisters[i];
00512       struct tgsi_full_src_register *fs = &fi->FullSrcRegisters[i];
00513 
00514       EOL();
00515       TXT( "\nFile     : ");
00516       ENM( src->SrcRegister.File, TGSI_FILES );
00517       if( deflt || fs->SrcRegister.SwizzleX != src->SrcRegister.SwizzleX ) {
00518          TXT( "\nSwizzleX : " );
00519          ENM( src->SrcRegister.SwizzleX, TGSI_SWIZZLES );
00520       }
00521       if( deflt || fs->SrcRegister.SwizzleY != src->SrcRegister.SwizzleY ) {
00522          TXT( "\nSwizzleY : " );
00523          ENM( src->SrcRegister.SwizzleY, TGSI_SWIZZLES );
00524       }
00525       if( deflt || fs->SrcRegister.SwizzleZ != src->SrcRegister.SwizzleZ ) {
00526          TXT( "\nSwizzleZ : " );
00527          ENM( src->SrcRegister.SwizzleZ, TGSI_SWIZZLES );
00528       }
00529       if( deflt || fs->SrcRegister.SwizzleW != src->SrcRegister.SwizzleW ) {
00530          TXT( "\nSwizzleW : " );
00531          ENM( src->SrcRegister.SwizzleW, TGSI_SWIZZLES );
00532       }
00533       if( deflt || fs->SrcRegister.Negate != src->SrcRegister.Negate ) {
00534          TXT( "\nNegate   : " );
00535          UID( src->SrcRegister.Negate );
00536       }
00537       if( ignored ) {
00538          if( deflt || fs->SrcRegister.Indirect != src->SrcRegister.Indirect ) {
00539             TXT( "\nIndirect : " );
00540             UID( src->SrcRegister.Indirect );
00541          }
00542          if( deflt || fs->SrcRegister.Dimension != src->SrcRegister.Dimension ) {
00543             TXT( "\nDimension: " );
00544             UID( src->SrcRegister.Dimension );
00545          }
00546       }
00547       if( deflt || fs->SrcRegister.Index != src->SrcRegister.Index ) {
00548          TXT( "\nIndex    : " );
00549          SID( src->SrcRegister.Index );
00550       }
00551       if( ignored ) {
00552          if( deflt || fs->SrcRegister.Extended != src->SrcRegister.Extended ) {
00553             TXT( "\nExtended : " );
00554             UID( src->SrcRegister.Extended );
00555          }
00556       }
00557 
00558       if( deflt || tgsi_compare_src_register_ext_swz( src->SrcRegisterExtSwz, fs->SrcRegisterExtSwz ) ) {
00559          EOL();
00560          TXT( "\nType       : " );
00561          ENM( src->SrcRegisterExtSwz.Type, TGSI_SRC_REGISTER_EXTS );
00562          if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleX != src->SrcRegisterExtSwz.ExtSwizzleX ) {
00563             TXT( "\nExtSwizzleX: " );
00564             ENM( src->SrcRegisterExtSwz.ExtSwizzleX, TGSI_EXTSWIZZLES );
00565          }
00566          if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleY != src->SrcRegisterExtSwz.ExtSwizzleY ) {
00567             TXT( "\nExtSwizzleY: " );
00568             ENM( src->SrcRegisterExtSwz.ExtSwizzleY, TGSI_EXTSWIZZLES );
00569          }
00570          if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleZ != src->SrcRegisterExtSwz.ExtSwizzleZ ) {
00571             TXT( "\nExtSwizzleZ: " );
00572             ENM( src->SrcRegisterExtSwz.ExtSwizzleZ, TGSI_EXTSWIZZLES );
00573          }
00574          if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleW != src->SrcRegisterExtSwz.ExtSwizzleW ) {
00575             TXT( "\nExtSwizzleW: " );
00576             ENM( src->SrcRegisterExtSwz.ExtSwizzleW, TGSI_EXTSWIZZLES );
00577          }
00578          if( deflt || fs->SrcRegisterExtSwz.NegateX != src->SrcRegisterExtSwz.NegateX ) {
00579             TXT( "\nNegateX   : " );
00580             UID( src->SrcRegisterExtSwz.NegateX );
00581          }
00582          if( deflt || fs->SrcRegisterExtSwz.NegateY != src->SrcRegisterExtSwz.NegateY ) {
00583             TXT( "\nNegateY   : " );
00584             UID( src->SrcRegisterExtSwz.NegateY );
00585          }
00586          if( deflt || fs->SrcRegisterExtSwz.NegateZ != src->SrcRegisterExtSwz.NegateZ ) {
00587             TXT( "\nNegateZ   : " );
00588             UID( src->SrcRegisterExtSwz.NegateZ );
00589          }
00590          if( deflt || fs->SrcRegisterExtSwz.NegateW != src->SrcRegisterExtSwz.NegateW ) {
00591             TXT( "\nNegateW   : " );
00592             UID( src->SrcRegisterExtSwz.NegateW );
00593          }
00594          if( ignored ) {
00595             TXT( "\nPadding   : " );
00596             UIX( src->SrcRegisterExtSwz.Padding );
00597             if( deflt || fs->SrcRegisterExtSwz.Extended != src->SrcRegisterExtSwz.Extended ) {
00598                TXT( "\nExtended   : " );
00599                UID( src->SrcRegisterExtSwz.Extended );
00600             }
00601          }
00602       }
00603 
00604       if( deflt || tgsi_compare_src_register_ext_mod( src->SrcRegisterExtMod, fs->SrcRegisterExtMod ) ) {
00605          EOL();
00606          TXT( "\nType     : " );
00607          ENM( src->SrcRegisterExtMod.Type, TGSI_SRC_REGISTER_EXTS );
00608          if( deflt || fs->SrcRegisterExtMod.Complement != src->SrcRegisterExtMod.Complement ) {
00609             TXT( "\nComplement: " );
00610             UID( src->SrcRegisterExtMod.Complement );
00611          }
00612          if( deflt || fs->SrcRegisterExtMod.Bias != src->SrcRegisterExtMod.Bias ) {
00613             TXT( "\nBias     : " );
00614             UID( src->SrcRegisterExtMod.Bias );
00615          }
00616          if( deflt || fs->SrcRegisterExtMod.Scale2X != src->SrcRegisterExtMod.Scale2X ) {
00617             TXT( "\nScale2X   : " );
00618             UID( src->SrcRegisterExtMod.Scale2X );
00619          }
00620          if( deflt || fs->SrcRegisterExtMod.Absolute != src->SrcRegisterExtMod.Absolute ) {
00621             TXT( "\nAbsolute  : " );
00622             UID( src->SrcRegisterExtMod.Absolute );
00623          }
00624          if( deflt || fs->SrcRegisterExtMod.Negate != src->SrcRegisterExtMod.Negate ) {
00625             TXT( "\nNegate   : " );
00626             UID( src->SrcRegisterExtMod.Negate );
00627          }
00628          if( ignored ) {
00629             TXT( "\nPadding   : " );
00630             UIX( src->SrcRegisterExtMod.Padding );
00631             if( deflt || fs->SrcRegisterExtMod.Extended != src->SrcRegisterExtMod.Extended ) {
00632                TXT( "\nExtended  : " );
00633                UID( src->SrcRegisterExtMod.Extended );
00634             }
00635          }
00636       }
00637    }
00638 }
00639 
00640 void
00641 tgsi_dump_c(
00642    const struct tgsi_token *tokens,
00643    uint flags )
00644 {
00645    struct tgsi_parse_context parse;
00646    struct tgsi_full_instruction fi;
00647    struct tgsi_full_declaration fd;
00648    uint ignored = flags & TGSI_DUMP_C_IGNORED;
00649    uint deflt = flags & TGSI_DUMP_C_DEFAULT;
00650    uint instno = 0;
00651 
00652    tgsi_parse_init( &parse, tokens );
00653 
00654    TXT( "tgsi-dump begin -----------------" );
00655 
00656    TXT( "\nMajorVersion: " );
00657    UID( parse.FullVersion.Version.MajorVersion );
00658    TXT( "\nMinorVersion: " );
00659    UID( parse.FullVersion.Version.MinorVersion );
00660    EOL();
00661 
00662    TXT( "\nHeaderSize: " );
00663    UID( parse.FullHeader.Header.HeaderSize );
00664    TXT( "\nBodySize  : " );
00665    UID( parse.FullHeader.Header.BodySize );
00666    TXT( "\nProcessor : " );
00667    ENM( parse.FullHeader.Processor.Processor, TGSI_PROCESSOR_TYPES );
00668    EOL();
00669 
00670    fi = tgsi_default_full_instruction();
00671    fd = tgsi_default_full_declaration();
00672 
00673    while( !tgsi_parse_end_of_tokens( &parse ) ) {
00674       tgsi_parse_token( &parse );
00675 
00676       TXT( "\nType       : " );
00677       ENM( parse.FullToken.Token.Type, TGSI_TOKEN_TYPES );
00678       if( ignored ) {
00679          TXT( "\nSize       : " );
00680          UID( parse.FullToken.Token.Size );
00681          if( deflt || parse.FullToken.Token.Extended ) {
00682             TXT( "\nExtended   : " );
00683             UID( parse.FullToken.Token.Extended );
00684          }
00685       }
00686 
00687       switch( parse.FullToken.Token.Type ) {
00688       case TGSI_TOKEN_TYPE_DECLARATION:
00689          dump_declaration_verbose(
00690             &parse.FullToken.FullDeclaration,
00691             ignored,
00692             deflt,
00693             &fd );
00694          break;
00695 
00696       case TGSI_TOKEN_TYPE_IMMEDIATE:
00697          dump_immediate_verbose(
00698             &parse.FullToken.FullImmediate,
00699             ignored );
00700          break;
00701 
00702       case TGSI_TOKEN_TYPE_INSTRUCTION:
00703          dump_instruction_verbose(
00704             &parse.FullToken.FullInstruction,
00705             ignored,
00706             deflt,
00707             &fi );
00708          break;
00709 
00710       default:
00711          assert( 0 );
00712       }
00713 
00714       EOL();
00715    }
00716 
00717    TXT( "\ntgsi-dump end -------------------\n" );
00718 
00719    tgsi_parse_free( &parse );
00720 }

Generated on Tue Sep 29 06:25:15 2009 for Gallium3D by  doxygen 1.5.4