I'm sending a new version of the shader assembler, which tries to address the caveats and suggestions previously given by Henri Verbeet (http://www.winehq.org/pipermail/wine-devel/2009-July/077428.html for reference) and has a few other changes, such as making the parser reentrant and matching more faithfully native behavior in handling errors in shader programs. One point of discussion could be the internal transformations done to shaders version 1.x and 2.x, towards a sm 3.0-type representation. This is not really necessary for the assembler (which could naively keep the original instruction opcode and register type), but I think it can be useful looking at a reuse of the bytecode writer in the shader compiler: this way the compiler could be somewhat simplified, having to deal just with sm 3.0 registers and conventions, while it would be writer's responsibility to convert to the destination format (e.g. transforming some mov to texcoord in <= ps 1.3). Anyway, if this is not considered useful, it could be removed. As usual, reviews, comments and suggestions are much appreciated.
Regards, Matteo Bruni.