From 5732da956761fd46e2778b4757a9dc4d6e7334f1 Mon Sep 17 00:00:00 2001 From: Anatoly Baksheev Date: Mon, 26 Jul 2010 15:08:43 +0000 Subject: [PATCH] fixed bug with loading to constant memory --- modules/gpu/src/cuda/matrix_operations.cu | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/gpu/src/cuda/matrix_operations.cu b/modules/gpu/src/cuda/matrix_operations.cu index 64ac7c2c3f..6906b63f17 100644 --- a/modules/gpu/src/cuda/matrix_operations.cu +++ b/modules/gpu/src/cuda/matrix_operations.cu @@ -325,7 +325,12 @@ namespace cv extern "C" void set_to_without_mask(DevMem2D mat, int depth, const double *scalar, int channels, const cudaStream_t & stream) { - cudaSafeCall( cudaMemcpyToSymbol(mat_operators::scalar_d, &scalar, sizeof(double) * 4)); + double data[4]; + data[0] = scalar[0]; + data[1] = scalar[1]; + data[2] = scalar[2]; + data[3] = scalar[3]; + cudaSafeCall( cudaMemcpyToSymbol(mat_operators::scalar_d, &data, sizeof(data))); static SetToFunc_without_mask tab[8] = { @@ -348,9 +353,14 @@ namespace cv } - extern "C" void set_to_with_mask(DevMem2D mat, int depth, const double *scalar, const DevMem2D& mask, int channels, const cudaStream_t & stream) - { - cudaSafeCall( cudaMemcpyToSymbol(mat_operators::scalar_d, &scalar, sizeof(double) * 4)); + extern "C" void set_to_with_mask(DevMem2D mat, int depth, const double * scalar, const DevMem2D& mask, int channels, const cudaStream_t & stream) + { + double data[4]; + data[0] = scalar[0]; + data[1] = scalar[1]; + data[2] = scalar[2]; + data[3] = scalar[3]; + cudaSafeCall( cudaMemcpyToSymbol(mat_operators::scalar_d, &data, sizeof(data))); static SetToFunc_with_mask tab[8] = {