mojoshader.c
changeset 1162 de0613aa8f07
parent 1161 6085abb2edaa
child 1163 c73c39a59dd4
equal deleted inserted replaced
1161:6085abb2edaa 1162:de0613aa8f07
 12048                                                       MOJOSHADER_malloc m,
 12048                                                       MOJOSHADER_malloc m,
 12049                                                       MOJOSHADER_free f,
 12049                                                       MOJOSHADER_free f,
 12050                                                       void *d)
 12050                                                       void *d)
 12051 {
 12051 {
 12052     // !!! FIXME: This is copypasta ripped from parse_preshader -flibit
 12052     // !!! FIXME: This is copypasta ripped from parse_preshader -flibit
 12053     int i;
 12053     unsigned int i;
 12054 
 12054 
 12055     // All sections of a preshader are packed into separate comment tokens,
 12055     // All sections of a preshader are packed into separate comment tokens,
 12056     //  inside the containing comment token block. Find them all before
 12056     //  inside the containing comment token block. Find them all before
 12057     //  we start, so we don't care about the order they appear in the file.
 12057     //  we start, so we don't care about the order they appear in the file.
 12058     PreshaderBlockInfo ctab = { 0, 0, 0 };
 12058     PreshaderBlockInfo ctab = { 0, 0, 0 };
 12059     PreshaderBlockInfo prsi = { 0, 0, 0 };
 12059     PreshaderBlockInfo prsi = { 0, 0, 0 };
 12060     PreshaderBlockInfo fxlc = { 0, 0, 0 };
 12060     PreshaderBlockInfo fxlc = { 0, 0, 0 };
 12061     PreshaderBlockInfo clit = { 0, 0, 0 };
 12061     PreshaderBlockInfo clit = { 0, 0, 0 };
       
 12062 
       
 12063     CtabData ctabdata = { 0, 0, 0 };
 12062 
 12064 
 12063     const uint32 *tokens = (const uint32 *) buf;
 12065     const uint32 *tokens = (const uint32 *) buf;
 12064     uint32 tokcount = _len / 4;
 12066     uint32 tokcount = _len / 4;
 12065 
 12067 
 12066     // !!! FIXME: This is stupid. -flibit
 12068     // !!! FIXME: This is stupid. -flibit
 12188 
 12190 
 12189         output_map = prsi.tokens;
 12191         output_map = prsi.tokens;
 12190     }
 12192     }
 12191 
 12193 
 12192     // Now we'll figure out the CTAB...
 12194     // Now we'll figure out the CTAB...
 12193     CtabData ctabdata = { 0, 0, 0 };
       
 12194     parse_constant_table(&fillerContext, ctab.tokens - 1, ctab.tokcount * 4,
 12195     parse_constant_table(&fillerContext, ctab.tokens - 1, ctab.tokcount * 4,
 12195                          version, 0, &ctabdata);
 12196                          version, 0, &ctabdata);
 12196 
 12197 
 12197     // preshader owns this now. Don't free it in this function.
 12198     // preshader owns this now. Don't free it in this function.
 12198     preshader->symbol_count = ctabdata.symbol_count;
 12199     preshader->symbol_count = ctabdata.symbol_count;
 12295                 } // case
 12296                 } // case
 12296 
 12297 
 12297                 case 2:  // item from ctabdata.
 12298                 case 2:  // item from ctabdata.
 12298                 {
 12299                 {
 12299                     MOJOSHADER_symbol *sym = ctabdata.symbols;
 12300                     MOJOSHADER_symbol *sym = ctabdata.symbols;
 12300                     for (i = 0; i < ctabdata.symbol_count; i++, sym++)
 12301                     for (i = 0; i < (unsigned int) ctabdata.symbol_count; i++, sym++)
 12301                     {
 12302                     {
 12302                         const uint32 base = sym->register_index * 4;
 12303                         const uint32 base = sym->register_index * 4;
 12303                         const uint32 count = sym->register_count * 4;
 12304                         const uint32 count = sym->register_count * 4;
 12304                         assert(sym->register_set==MOJOSHADER_SYMREGSET_FLOAT4);
 12305                         assert(sym->register_set==MOJOSHADER_SYMREGSET_FLOAT4);
 12305                         if ( (base <= item) && ((base + count) >= (item + inst->element_count)) )
 12306                         if ( (base <= item) && ((base + count) >= (item + inst->element_count)) )