cv::cuda: Replace all instances of texture references/objects with texture objects...
authorcudawarped <12133430+cudawarped@users.noreply.github.com>
Thu, 15 Dec 2022 06:55:31 +0000 (08:55 +0200)
committercudawarped <12133430+cudawarped@users.noreply.github.com>
Mon, 19 Dec 2022 17:28:15 +0000 (19:28 +0200)
Fixes bugs in cv::cuda::demosaicing, cv::cuda::resize and cv::cuda::HoughSegmentDetector.

modules/core/include/opencv2/core/cuda/common.hpp

index b36b3d1..348bdf1 100644 (file)
@@ -98,6 +98,12 @@ namespace cv { namespace cuda
             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)
         {
             cudaChannelFormatDesc desc = cudaCreateChannelDesc<T>();
@@ -118,6 +124,7 @@ namespace cv { namespace cuda
             cudaSafeCall( cudaCreateTextureObject(tex, &resDesc, &texDesc, NULL) );
         }
     }
+#endif
 }}
 
 //! @endcond