It loops fine, however after some time it randomly freezes on cudaStreamSynchronize
call after calling cudaGraphicsMapResources
on my texture. Here’s my code:
cudaArray_t cuda_array;
cuda_assert(cudaGraphicsMapResources(1, &cudaTexture, stream));
cuda_assert(cudaGraphicsSubResourceGetMappedArray(&cuda_array, cudaTexture, 0, 0));
cudaResourceDesc resDesc {};
resDesc.resType = cudaResourceTypeArray;
resDesc.res.array.array = cuda_array;
cudaSurfaceObject_t surface;
cuda_assert(cudaCreateSurfaceObject(&surface, &resDesc));
render<<<map.countChunks(), dim3(CHUNK_SIZE, CHUNK_SIZE), 0, stream>>>(surface, map.getChunks(), step, minX, minY, maxX, maxY);
cuda_assert(cudaPeekAtLastError());
cuda_assert(cudaDestroySurfaceObject(surface));
cuda_assert(cudaGraphicsUnmapResources(1, &cudaTexture, stream));
cuda_assert(cudaStreamSynchronize(stream));