add more crash points
This commit is contained in:
+7
-6
@@ -51,7 +51,9 @@ public:
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
int32_t reload(size_t id,T* buf,cl::CommandQueue* queue){
|
int32_t reload(size_t id,T* buf,cl::CommandQueue* queue){
|
||||||
for(auto&& i:_buffers)if(i.second==id){
|
for(auto&& i:_buffers)if(i.second==id){
|
||||||
T* Map_buf=(T*)queue->enqueueMapBuffer(i.first.first,CL_TRUE,CL_MAP_WRITE,0,sizeof(T) * i.first.second);
|
cl_int error;
|
||||||
|
T* Map_buf=(T*)queue->enqueueMapBuffer(i.first.first,CL_TRUE,CL_MAP_WRITE,0,sizeof(T) * i.first.second,NULL,NULL,&error);
|
||||||
|
assert(error == CL_SUCCESS);
|
||||||
memcpy(Map_buf,buf,sizeof(T) * i.first.second);
|
memcpy(Map_buf,buf,sizeof(T) * i.first.second);
|
||||||
if(queue->enqueueUnmapMemObject(i.first.first,Map_buf)!=CL_SUCCESS)std::cerr<<"Reload buffer on GPU failed"<<'\n';
|
if(queue->enqueueUnmapMemObject(i.first.first,Map_buf)!=CL_SUCCESS)std::cerr<<"Reload buffer on GPU failed"<<'\n';
|
||||||
}
|
}
|
||||||
@@ -60,18 +62,17 @@ public:
|
|||||||
int32_t reload(size_t id,cv::Mat& buf,cl::Context* context){
|
int32_t reload(size_t id,cv::Mat& buf,cl::Context* context){
|
||||||
try{
|
try{
|
||||||
for(auto&& i:_images)if(i.second==id){
|
for(auto&& i:_images)if(i.second==id){
|
||||||
|
cl_int error;
|
||||||
i.first.setDestructorCallback((void (*)(_cl_mem *, void *))notify, NULL);
|
i.first.setDestructorCallback((void (*)(_cl_mem *, void *))notify, NULL);
|
||||||
i.first=cl::Image2D(*context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
|
i.first=cl::Image2D(*context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
|
||||||
cl::ImageFormat(CL_R, CL_UNSIGNED_INT8),
|
cl::ImageFormat(CL_R, CL_UNSIGNED_INT8),
|
||||||
buf.size().width,
|
buf.size().width,
|
||||||
buf.size().height,
|
buf.size().height,
|
||||||
0,
|
0,
|
||||||
reinterpret_cast<uchar*>(buf.data));
|
reinterpret_cast<uchar*>(buf.data),&error);
|
||||||
|
assert(error == CL_SUCCESS);
|
||||||
cl_int err=_kernel->setArg(id,i.first);
|
cl_int err=_kernel->setArg(id,i.first);
|
||||||
if(err!=0){
|
assert(err == CL_SUCCESS);
|
||||||
std::cerr<<"Error C:Kernel, F:write image, L:setArg ID:\t"<<id<<"\t"<<err<<'\n';
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}catch (std::exception& err){
|
}catch (std::exception& err){
|
||||||
|
|||||||
Reference in New Issue
Block a user