Hi,
I’m trying to create a mipmapped array in cuda. This is the code:
#include "cuda_runtime.h"
#include <iostream>
void handleCudaError(cudaError_t error) {
if (error != cudaSuccess) std::cerr << "CUDA error: " << cudaGetErrorString(error) << std::endl;
}
int main() {
cudaMipmappedArray* mipArray;
cudaChannelFormatDesc desc = cudaCreateChannelDesc<uchar4>();
int mipLevelels = 1;
cudaExtent size = make_cudaExtent(512, 512, 5);
handleCudaError(cudaMallocMipmappedArray(&mipArray, &desc, size, mipLevelels, cudaArrayLayered));
cudaArray* level0;
handleCudaError(cudaGetMipmappedArrayLevel(&level0, mipArray, 0));
uchar4* h_data = new uchar4;
for (int i = 0; i < size.width * size.height * size.depth; i++) h_data[i] = make_uchar4(0, 0, 0, 0);
cudaMemcpy3DParms copyParams = { 0 };
copyParams.srcPtr = make_cudaPitchedPtr(h_data, 512 * sizeof(uchar4), 512, 512);
copyParams.dstArray = level0;
copyParams.extent = make_cudaExtent(512, 512, 5);
copyParams.dstPos = make_cudaPos(0, 0, 0);
copyParams.kind = cudaMemcpyHostToDevice;
handleCudaError(cudaMemcpy3D(©Params));
delete h_data;
return 0;
}
on line 27 I get the following:
CUDA error: unspecified launch failure
I’ve searched the forum, used google and browsed the samples, but I couldn’t make this code work. I intend to later pass that mipmapped array to cudaBindTextureToMipmappedArray and hope that i’ll be able to use tex2DLayeredLod.
edit:
provided compiling code