Posted on Mar 05 2011
This is a short list of changes and improvements that were made :
- register allocation : both vertex and fragment shaders only allow 8 Float4 temporary registers, which are quite a scarce resource. I added some algorithm to perform liveness analysis and it is actually able to store several variables into the same register (for instance if you have 4 Float temporaries, they might be stored into
A first pass try to output the most compact/efficient code, and if too much registers were allocated a second pass will try to pack registers even more agressively.
- write mask limits : I found during my experiments with register allocation that AGAL (Adobe shader assembler) does compile but not execute correctly exotic write masks such as
.zw, which seems conform to shaders 1.3 profile limitations. Right now I have restricted their usage but I might end-up emulating them in HxSL by splitting into several opcodes or using additional
- matrixes : added support for
M34matrix, matrix row access with
mas well as matrix
transposeoperation, improved matrix transposition inference
- unbind/draw : the
format.hxsl.Shadernow have an
unbind()method that will clear the stream and textures, as well as a
draw(vbuf,ibuf)method that will bind, draw triangles then unbind.
- for : added support for Haxe
for( x in a...b )loops : it will only work if both
bare constant integers and will unroll the loop by repeating the loop block and replacing the
- if : added support of
dst = if( color > 0.5 ) a else b(also works with
?:operator), which compiles to
dst = (color > 0.5) * a + (color <= 0.5) * b(since the comparison operators are returning 0 or 1, this is the way branches are merged in shaders)
- ... and some other minor changes and bug fixes
The HxSL documentation has been updated accordingly.