OpenCOVER
CudaGraphicsResource.h
Go to the documentation of this file.
1/* This file is part of COVISE.
2
3You can use it under the terms of the GNU Lesser General Public License
4version 2.1 or later, see lgpl-2.1.txt.
5
6* License: LGPL 2+ */
7
8#ifdef HAVE_CUDA
9
10#ifndef CUDAGRAPHICSRESOURCE_H
11#define CUDAGRAPHICSRESOURCE_H
12
13#include <cuda_runtime_api.h>
14
15#include <util/coExport.h>
16
17
18namespace opencover
19{
20
21class CudaGraphicsResource
22{
23public:
24
25 CudaGraphicsResource();
26 ~CudaGraphicsResource();
27
28 CudaGraphicsResource(CudaGraphicsResource&) = delete;
29 CudaGraphicsResource& operator=(CudaGraphicsResource&) = delete;
30
31 cudaGraphicsResource_t get() const;
32
33 cudaError_t register_buffer(unsigned buffer, cudaGraphicsRegisterFlags flags = cudaGraphicsRegisterFlagsNone);
34 cudaError_t register_image(unsigned image, unsigned target, cudaGraphicsRegisterFlags flags = cudaGraphicsRegisterFlagsNone);
35 cudaError_t unregister();
36
37 void* map(size_t* size);
38 void* map();
39 void unmap();
40
41 void* dev_ptr() const;
42
43private:
44 cudaGraphicsResource_t m_resource;
45 void* m_devPtr;
46
47};
48
49}
50
51#endif
52
53#endif
Definition: ARToolKit.h:33