Kernel function cannot handle file-scope arguments

Private: Q&AKernel function cannot handle file-scope arguments
sdonn asked 8 years ago

When I pass some file-scope arguments to a kernel function call (using parallel_do), two file-scope vec4 variables appear to become zero when read in by the kernel function:

lidx=[0,0,1,1]
lsign=[1,-1,1,-1]

function [] = main()
image = zeros(640,640,3)
function [] = __kernel__ fillimage(lidx:vec,lsign:vec,pos:ivec2)
image[pos[0],pos[1],0..2] = [lsign[2],lidx[2],lidx[0]]
end
parallel_do([640,640],lidx,lsign,fillimage)
imshow(image)
end

which shows a black image where I want a yellow image.