I bumped in a lot of small problems, and I don't know why and how to evoid them:
I have some structures:
typedef struct Material
typedef struct Voxel
If I try to do :
some of the fields don't copy correctly (new_voxel.m.densitate differs from old_voxel.m.densitate)
Copying the fields one by one works.
So I decided to make a function CopyVoxel(voxel *dest, voxel source); which copies the fields one by one. Which curiously, it seamed to work (even thou source is sent by value...). Which leads to the second problem:
2) The copy function doesn't always work, sometimes it works and sometimes it doesn't and I have to copy the fields inside my code, which isn't very nice. Using 'inline' before the copy function doesn't work either (but I understand it is implicit so that's why it works ... sometimes).
3)I have another struct 'raza' which has a float member 'dim'. whenever I try to do as_uchar4(raza->dim), at runtime, the program crashes (llc.exe has stopped working). I have to do: cl_int temp=raza->dim*100; as_uchar4(temp); and /100 the rez to save some decimals. (doesn't seam to work with float directly either)
Any idea, the struct part is important, because I can't get it to work and I don't know which of them is the problem.