I'm afraid this page changes too much at one go. You should split it into separate pieces. For example:
I can break out some unrelated pieces of it as you point out, but once we start moving code around it seems like all of it should be moved in the right place, or the result wouldn't make any sense [ i.e if you process tokens at the beginning, then code that depends on looking at the individual tokens should go into the beginning ]. Does the patch cause a regression for you?
TRACE("Found opcode D3D:%s GL:%s, PARAMS:%d, \n",
curOpcode->name, curOpcode->glname, curOpcode->num_params);
curOpcode->name, curOpcode->glname, curOpcode->num_params - 1);
should be one patch. Btw why are you adding -1 here?
That's fixing a minor bug I introduced w/ last patch when I moved the trace. numParams includes the destination register, it seems better not to print it out, esp since later when we loop over the parameters we don't list it, so it looks like a parameter is missing.
This could be turned into one big patch that is no-op:
/* Cubemap textures will be more used than 3D ones. */
sprintf(tmpLine, "TEX T%lu, TMP, texture[%lu], CUBE;\n", reg, reg);
sprintf(tmpLine, "TEX T%lu, TMP, texture[%lu], CUBE;\n", output, output);
What was the question here?