tgsi_iterate.c File Reference

Include dependency graph for tgsi_iterate.c:

Go to the source code of this file.

Functions

boolean tgsi_iterate_shader (const struct tgsi_token *tokens, struct tgsi_iterate_context *ctx)


Function Documentation

boolean tgsi_iterate_shader ( const struct tgsi_token tokens,
struct tgsi_iterate_context ctx 
)

Definition at line 32 of file tgsi_iterate.c.

References assert, tgsi_iterate_context::epilog, FALSE, tgsi_full_token::FullDeclaration, tgsi_parse_context::FullHeader, tgsi_full_token::FullImmediate, tgsi_full_token::FullInstruction, tgsi_parse_context::FullToken, tgsi_parse_context::FullVersion, tgsi_iterate_context::iterate_declaration, tgsi_iterate_context::iterate_immediate, tgsi_iterate_context::iterate_instruction, tgsi_full_header::Processor, tgsi_iterate_context::processor, tgsi_iterate_context::prolog, tgsi_parse_end_of_tokens(), tgsi_parse_free(), tgsi_parse_init(), TGSI_PARSE_OK, tgsi_parse_token(), TGSI_TOKEN_TYPE_DECLARATION, TGSI_TOKEN_TYPE_IMMEDIATE, TGSI_TOKEN_TYPE_INSTRUCTION, tgsi_full_token::Token, TRUE, tgsi_token::Type, tgsi_full_version::Version, and tgsi_iterate_context::version.

00035 {
00036    struct tgsi_parse_context parse;
00037 
00038    if (tgsi_parse_init( &parse, tokens ) != TGSI_PARSE_OK)
00039       return FALSE;
00040 
00041    ctx->processor = parse.FullHeader.Processor;
00042    ctx->version = parse.FullVersion.Version;
00043 
00044    if (ctx->prolog)
00045       if (!ctx->prolog( ctx ))
00046          goto fail;
00047 
00048    while (!tgsi_parse_end_of_tokens( &parse )) {
00049       tgsi_parse_token( &parse );
00050 
00051       switch (parse.FullToken.Token.Type) {
00052       case TGSI_TOKEN_TYPE_INSTRUCTION:
00053          if (ctx->iterate_instruction)
00054             if (!ctx->iterate_instruction( ctx, &parse.FullToken.FullInstruction ))
00055                goto fail;
00056          break;
00057 
00058       case TGSI_TOKEN_TYPE_DECLARATION:
00059          if (ctx->iterate_declaration)
00060             if (!ctx->iterate_declaration( ctx, &parse.FullToken.FullDeclaration ))
00061                goto fail;
00062          break;
00063 
00064       case TGSI_TOKEN_TYPE_IMMEDIATE:
00065          if (ctx->iterate_immediate)
00066             if (!ctx->iterate_immediate( ctx, &parse.FullToken.FullImmediate ))
00067                goto fail;
00068          break;
00069 
00070       default:
00071          assert( 0 );
00072       }
00073    }
00074 
00075    if (ctx->epilog)
00076       if (!ctx->epilog( ctx ))
00077          goto fail;
00078 
00079    tgsi_parse_free( &parse );
00080    return TRUE;
00081 
00082 fail:
00083    tgsi_parse_free( &parse );
00084    return FALSE;
00085 }


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