GteGL4StructuredBuffer.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
12 
13 namespace gte
14 {
15 
17 {
18 public:
19  // Construction.
20  GL4StructuredBuffer(StructuredBuffer const* cbuffer);
21  static std::shared_ptr<GEObject> Create(void* unused, GraphicsObject const* object);
22 
23  // Member access.
24  inline StructuredBuffer* GetStructuredBuffer() const;
25 
26  // Bind the structured buffer data to the specified shader
27  // storage buffer unit.
28  void AttachToUnit(GLint shaderStorageBufferUnit);
29 
30  // Copy the counter value to/from another buffer.
31  bool CopyCounterValueToBuffer(GL4Buffer* targetBuffer, GLint offset);
32  bool CopyCounterValueFromBuffer(GL4Buffer* sourceBuffer, GLint offset);
33 
34  // The number of active elements is read from GPU and stored in the
35  // StructuredBuffer object (of type CT_APPEND_CONSUME or CT_COUNTER).
36  // The result can be accessed from this object via its member function
37  // GetNumActiveElements().
38  bool GetNumActiveElements();
39 
40  // The number of active elements is written to GPU from the StructuredBuffer
41  // object (of type CT_APPEND_CONSUME or CT_COUNTER). The number of active
42  // elements can be changed in the StructuredBuffer object via its member
43  // function SetNumActiveElements.
44  bool SetNumActiveElements();
45 
46  // Override needed to handle case of a counter attached so that
47  // counter value can be updated first to know how many elements
48  // to copy back from GPU.
49  virtual bool CopyGpuToCpu() override;
50 
51 protected:
52  // Must be called by constructor.
53  virtual void Initialize() override;
54 
55 private:
57 };
58 
60 {
61  return static_cast<StructuredBuffer*>(mGTObject);
62 }
63 
64 }
int GLint
Definition: glcorearb.h:85
GLintptr offset
Definition: glcorearb.h:660
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63
StructuredBuffer * GetStructuredBuffer() const


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:00