AGX Dynamics  2.37.3.2
ClGlShareHandle.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 
18 #ifndef AGX_CL_GL_SHARE_HANDLE_H
19 #define AGX_CL_GL_SHARE_HANDLE_H
20 
21 #if 0 // Not used right now.
22 
23 #include <agx/config/AGX_USE_OPENCL.h>
24 #include <agx/config/AGX_USE_OPENGL.h>
25 #include <agx/config.h>
26 
27 #if AGX_USE_OPENCL() && AGX_USE_OPENGL()
28 
29 #include <agx/agxCore_export.h>
30 
31 #include <agxGL/OpenGL.h>
32 #include <agxCL/OpenCL.h>
33 #include <agxData/Buffer.h>
34 #include <agxData/ShareHandle.h>
35 
36 
37 namespace agxData
38 {
39  class AGXCORE_EXPORT ClGlShareHandle : public ShareHandle
40  {
41  public:
42 
43  // Creating a sharing between an OpenCL and an OpenGL buffer will discard the OpenCL content.
44  ClGlShareHandle(agxData::Buffer* buffer1, agxData::Buffer* buffer2);
45 
46  virtual void acquire(const agxData::Buffer* buffer);
47  virtual bool isAcquired(const agxData::Buffer* buffer);
48  virtual agxData::Buffer* other(const agxData::Buffer* buffer);
49 
50  void acquireOpenCL();
51  void acquireOpenGL();
52 
53  private:
54  bool assignBuffers(agxData::Buffer* buffer1, agxData::Buffer* buffer2);
55  void passMemoryToOpenCL();
56 
57  private:
58  friend class agxCL::Buffer;
59  friend class agxGL::Buffer;
60  agxGL::BufferRef m_glBuffer;
61  agxCL::BufferRef m_clBuffer;
62  CurrentHolder m_holder;
63 
64  };
65 }
66 
67 #endif // OPENCL & OPENGL
68 
69 #endif
70 
71 #endif // _CL_GL_SHARE_HANDLE_H_
agx::ref_ptr< Buffer > BufferRef
Definition: Buffer.h:47
Abstract representation of a data buffer.
Definition: Buffer.h:55
Contains classes for low level data storage for AGX.
Definition: Container.h:23
#define AGXCORE_EXPORT