Make DeviceContext into a proper class
[alexxy/gromacs.git] / src / gromacs / gpu_utils / devicebuffer_ocl.h
index 40f1e12941c5f40d010459abb4394d8ccdf22458..ee1adc1cce89e48958309aa55d4d01c0436a9899 100644 (file)
@@ -45,6 +45,7 @@
  *  \inlibraryapi
  */
 
+#include "gromacs/gpu_utils/device_context.h"
 #include "gromacs/gpu_utils/devicebuffer_datatype.h"
 #include "gromacs/gpu_utils/gpu_utils.h" //only for GpuApiCallBehavior
 #include "gromacs/gpu_utils/gputraits_ocl.h"
  * \param[in]     deviceContext        The buffer's device context-to-be.
  */
 template<typename ValueType>
-void allocateDeviceBuffer(DeviceBuffer<ValueType>* buffer, size_t numValues, DeviceContext deviceContext)
+void allocateDeviceBuffer(DeviceBuffer<ValueType>* buffer, size_t numValues, const DeviceContext& deviceContext)
 {
     GMX_ASSERT(buffer, "needs a buffer pointer");
     void*  hostPtr = nullptr;
     cl_int clError;
-    *buffer = clCreateBuffer(deviceContext, CL_MEM_READ_WRITE, numValues * sizeof(ValueType),
-                             hostPtr, &clError);
+    *buffer = clCreateBuffer(deviceContext.context(), CL_MEM_READ_WRITE,
+                             numValues * sizeof(ValueType), hostPtr, &clError);
     GMX_RELEASE_ASSERT(clError == CL_SUCCESS,
                        gmx::formatString("clCreateBuffer failure (OpenCL error %d: %s)", clError,
                                          ocl_get_error_string(clError).c_str())