fixed indexing of shared memory sample buffer in cuda