brw_shader_info.c

Go to the documentation of this file.
00001 
00002 #include "brw_context.h"
00003 #include "brw_state.h"
00004 #include "util/u_memory.h"
00005 #include "pipe/p_shader_tokens.h"
00006 #include "tgsi/tgsi_parse.h"
00007 
00008 
00012 void brw_shader_info(const struct tgsi_token *tokens,
00013                      struct brw_shader_info *info )
00014 {
00015    struct tgsi_parse_context parse;
00016    int done = 0;
00017 
00018    tgsi_parse_init( &parse, tokens );
00019 
00020    while( !done &&
00021           !tgsi_parse_end_of_tokens( &parse ) ) 
00022    {
00023       tgsi_parse_token( &parse );
00024 
00025       switch( parse.FullToken.Token.Type ) {
00026       case TGSI_TOKEN_TYPE_DECLARATION:
00027       {
00028          const struct tgsi_full_declaration *decl = &parse.FullToken.FullDeclaration;
00029          unsigned last = decl->DeclarationRange.Last;
00030       
00031          // Broken by crazy wpos init:
00032          //assert( info->nr_regs[decl->Declaration.File] <= last);
00033 
00034          info->nr_regs[decl->Declaration.File] = MAX2(info->nr_regs[decl->Declaration.File],
00035                                                       last+1);
00036          break;
00037       }
00038       case TGSI_TOKEN_TYPE_IMMEDIATE:
00039       case TGSI_TOKEN_TYPE_INSTRUCTION:
00040       default:
00041          done = 1;
00042          break;
00043       }
00044    }
00045 
00046    tgsi_parse_free (&parse);
00047    
00048 }

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