ncannasse / hxsl

Haxe Shader Language, a high level 3D shader language for Haxe
86 stars 10 forks source link

Problem with array M44<20> #18

Closed profelis closed 11 years ago

profelis commented 11 years ago

In hxsl 1 this shader worked ok, now strange problem

class Batch2DShader extends Shader
{
    static var SRC = {
        var input : {
            pos : Float2,
            uv: Float2,
            index:Float
        };

        var tuv:Float2;
        var cTrans:Float4;
        var pWrap:Param<Bool>;
        var pFilter:Param<Bool>;
        var pMipmap:Param<Bool>;

        function vertex(mproj:Matrix, mpos:M44<20>, cTransArr:Float4<20>, regions:Float4<20>)
        {
            // http://code.google.com/p/hxformat/issues/detail?id=28#c8
            //var i = input.pos.xyzw;
            //i.x = input.index.x * 4;
            //out = input.pos.xyzw * mpos[i.x] * mproj;
            out = input.pos.xyzw * mpos[input.index * 4] * mproj;

            var region = regions[input.index];
            tuv = input.uv * region.zw + region.xy;
            cTrans = cTransArr[input.index];
        }

        function fragment(tex:Texture)
        {
            out = tex.get(tuv, wrap=pWrap, filter=pFilter, mipmap=pMipmap) * cTrans;
        }
    };
}
profelis commented 11 years ago

errors list

C:\Motion-Twin\haxe\lib\hxsl/git/hxsl/ShaderMacros.hx:229: characters 27-40 : hx
sl.FixedArray<hxsl.Matrix, Unknown<0>> should be hxsl.FixedArray<hxsl.Vector, I2
0>
C:\Motion-Twin\haxe\lib\hxsl/git/hxsl/ShaderMacros.hx:229: characters 27-40 : Ar
ray<hxsl.Matrix> should be hxsl.FixedArray<hxsl.Vector, I20>
C:\Motion-Twin\haxe\lib\hxsl/git/hxsl/ShaderMacros.hx:229: characters 27-40 : Ar
ray<hxsl.Matrix> should be Array<hxsl.Vector>
C:\Motion-Twin\haxe\lib\hxsl/git/hxsl/ShaderMacros.hx:229: characters 27-40 : fl
ash.geom.Matrix3D should be hxsl.Vector
C:\Motion-Twin\haxe\lib\hxsl/git/hxsl/ShaderMacros.hx:229: characters 27-40 : fl
ash.geom.Matrix3D should be flash.geom.Vector3D
../dd/dd/src/deep/dd/material/Batch2DMaterial.hx:61: lines 61-94 : Defined in th
is class
C:\Motion-Twin\haxe\lib\hxsl/git/hxsl/ShaderMacros.hx:229: characters 27-40 : hx
sl.FixedArray<hxsl.Matrix, Unknown<0>> should be hxsl.FixedArray<hxsl.Vector, I2
0>
C:\Motion-Twin\haxe\lib\hxsl/git/hxsl/ShaderMacros.hx:229: characters 27-40 : Ar
ray<hxsl.Matrix> should be hxsl.FixedArray<hxsl.Vector, I20>
C:\Motion-Twin\haxe\lib\hxsl/git/hxsl/ShaderMacros.hx:229: characters 27-40 : Ar
ray<hxsl.Matrix> should be Array<hxsl.Vector>
C:\Motion-Twin\haxe\lib\hxsl/git/hxsl/ShaderMacros.hx:229: characters 27-40 : fl
ash.geom.Matrix3D should be hxsl.Vector
C:\Motion-Twin\haxe\lib\hxsl/git/hxsl/ShaderMacros.hx:229: characters 27-40 : fl
ash.geom.Matrix3D should be flash.geom.Vector3D
../dd/dd/src/deep/dd/material/Batch2DMaterial.hx:61: lines 61-94 : Defined in th
is class
profelis commented 11 years ago

UPD:

switched out calc to

var mp:M44 = mpos[input.index * 4];
out = input.pos.xyzw * mp * mproj;

Error: M44 should be Float4

profelis commented 11 years ago

now works correct