I’m currently trying to integrate CUDA 2.1 into my DX3D10 application, and I’m having some troubles. The example “simpleD3D10Texture” does pretty much the same and works fine, so I’m a bit lost here…
Here is the pseudocode:
ID3D10Resource *res = /* get resource from texture */; void *data; size_t size; cudaD3D10RegisterResource(res, cudaD3D10RegisterFlagsNone); cudaD3D10ResourceSetMapFlags(res, cudaD3D10MapFlagsNone); cudaD3D10MapResources(1, &res); cudaD3D10ResourceGetMappedPointer(&data, res, 0); cudaD3D10ResourceGetMappedSize(&size, res, 0); cudaMemset(data, 0, size); cudaD3D10UnmapResources(1, &res);
The actual code has lots of debugging stuff inbetween (calling cudaThreadSynchronize() and checking the result code of everything between all the lines above). The code seems to work fine up until cudaD3D10UnmapResources() is called, the next call to cudaThreadSynchronize() returns cudaErrorUnknown.
The docs say that this error is returned when the resource isn’t mapped, but that doesn’t make any sense at all. Additionally, the next call to cudaD3D10MapResources() also returns cudaErrorUnknown, which – according to the docs – means that the resource is already mapped, which does make sense.
Maybe that error result has some other meaning as well? Has anybody ever encountered something like this?