void bindTexture(texture<Type, Dim, readMode> &tex) const { CUDA_STATIC_ASSERT(Dim <= 2); //CUDA_STATIC_ASSERT(Dim <= 3); if (Dim == 1) { CUDA_CHECK(cudaBindTexture(0, tex, this->buffer, this->size[0] * sizeof(Type))); } else if(Dim == 2) { cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc<Type>(); CUDA_CHECK(cudaBindTexture2D(0, tex, this->buffer, channelDesc, this->size[0], this->size[1], this->getPitch())); } else if(Dim == 3) { throw std::invalid_argument("DeviceMemory::bindTexture binding of 3D memory data is not yet supported, " "must use 3d Cuda::Array or hack via 2d textures"); //cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc<Type>(); //CUDA_CHECK(cudaBindTexture3D(0, tex, this->buffer, channelDesc, // this->size[0], this->size[1], this->size[3], this->getPitch())); } else { throw std::invalid_argument("DeviceMemory::bindTexture received unexpected arguments"); } return; }
void bindTexture(const textureReference* tex, const void* devPtr, const cudaChannelFormatDesc* desc, size_t* offset, size_t size) { if (Ctx->isCreated() && tex && devPtr && desc) { checkCudaError(cudaBindTexture(offset, tex, devPtr, desc, size)); } }
TextureBinder(const PtrSz<T>& arr, const struct texture<T, 1, readMode> &tex) : texref(&tex) { cudaChannelFormatDesc desc = cudaCreateChannelDesc<T>(); cudaSafeCall( cudaBindTexture(0, tex, arr.data, desc, arr.size * arr.elemSize()) ); }
/** * bind CUDA texture to device memory array */ void bind(cuda::vector<T> const& array) const { CUDA_CALL(cudaBindTexture(NULL, ptr_, array.data(), &desc_)); }
cudaError_t WINAPI wine_cudaBindTexture( size_t *offset, const struct textureReference *texref, const void *devPtr, const struct cudaChannelFormatDesc *desc, size_t size ) { WINE_TRACE("\n"); return cudaBindTexture( offset, texref, devPtr, desc, size ); }