Merge pull request #22963 from cudawarped:replace_texture_ref_with_texture_obj

Replace all instances of CUDA texture references with texture objects
This commit is contained in:
Alexander Smorkalov 2022-12-20 15:07:10 +03:00 committed by GitHub
commit 279e2be56b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,6 +98,12 @@ namespace cv { namespace cuda
return (total + grain - 1) / grain; return (total + grain - 1) / grain;
} }
#if (CUDART_VERSION >= 12000)
template<class T> inline void bindTexture(const textureReference* tex, const PtrStepSz<T>& img) { CV_Error(cv::Error::GpuNotSupported, "Function removed in CUDA SDK 12"); }
template<class T> inline void createTextureObjectPitch2D(cudaTextureObject_t* tex, PtrStepSz<T>& img, const cudaTextureDesc& texDesc) {
CV_Error(cv::Error::GpuNotSupported, "Function removed in CUDA SDK 12"); }
#else
//TODO: remove from OpenCV 5.x
template<class T> inline void bindTexture(const textureReference* tex, const PtrStepSz<T>& img) template<class T> inline void bindTexture(const textureReference* tex, const PtrStepSz<T>& img)
{ {
cudaChannelFormatDesc desc = cudaCreateChannelDesc<T>(); cudaChannelFormatDesc desc = cudaCreateChannelDesc<T>();
@ -118,6 +124,7 @@ namespace cv { namespace cuda
cudaSafeCall( cudaCreateTextureObject(tex, &resDesc, &texDesc, NULL) ); cudaSafeCall( cudaCreateTextureObject(tex, &resDesc, &texDesc, NULL) );
} }
} }
#endif
}} }}
//! @endcond //! @endcond