HxSL2 problem accessing more then 5 Float on input

46 views
Skip to first unread message

menat...@gmail.com

unread,
Sep 30, 2013, 7:39:42 PM9/30/13
to haxe...@googlegroups.com
I have a problem with my HxSL2 Shader after porting from HxSL, here is the code:

class ShaderSTLtextureBloccoColorize extends hxsl.Shader
{
static var SRC =
{
var input : {pos : Float3, uv : Float2, norm : Float3, luce : Float,};
var tuv : Float2;
var coloreTexture: Float4;

function vertex( offsetX : Float,
offsetY : Float,
offsetZ : Float,
rototraslazioni : M44,
mproj : M44,
coloreRosso : Float,
coloreVerde : Float,
coloreBlu : Float)
{
var coordinate: Float4;

coloreTexture = [coloreRosso, coloreVerde, coloreBlu, 0];
//----------------  assegnazione poligoni a seconda della posizione dell'STL e della camera..  ---------------------

//lettura coordinate
coordinate.x = input.pos.x + offsetX;
coordinate.y = input.pos.y + offsetY;
coordinate.z = input.pos.z + offsetZ;
coordinate.w = 1;

out = coordinate * rototraslazioni * mproj;

//----------------  assegnazione colore poligono a seconda della normale..  ---------------------

tuv = input.uv;
}
function fragment( tex : Texture )
{
out = tex.get(tuv, wrap) * coloreTexture; // * [1, 0, 0, 0];
}
}
}




If in any part of the function vertex() I access to variables "input.norm" or "input.luce" the program crash (it locks after 1 render).
That's even if I only copy their values on a variable.
What can I do?
Thanks,



Denny

menat...@gmail.com

unread,
Oct 1, 2013, 5:25:37 PM10/1/13
to haxe...@googlegroups.com
I found my mistake, since I used more Shaders I didn't use unbind to disconnect the first one before using bind on the second one (explaned in http://haxe.org/manual/hxsl )
Reply all
Reply to author
Forward
0 new messages