void fill_data( Image2D& _data ) { double* data; CALuint pitch; unsigned size; data = (double*)_queue.mapMemObject(_data,pitch); size = 2*_data.getWidth()*_data.getHeight(); for(unsigned i=0;i<size;i+=2) { *(data + 0) = i+1; *(data + 1) = i+1; data+=2; } _queue.unmapMemObject(_data); }
void print_data( Image2D& _data ) { double* data; CALuint pitch; unsigned size; data = (double*)_queue.mapMemObject(_data,pitch); size = 2*_data.getWidth()*_data.getHeight(); for(unsigned i=0;i<size;i+=2) { std::cout << boost::format("(%.3f,%.3f)") % *data % *(data+1); if( *data == *(data+1) ) std::cout << " OK\n"; else std::cout << " INVALID RESULT\n"; data+=2; } _queue.unmapMemObject(_data); }