GteDX11StructuredBuffer.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 and destruction.
20  virtual ~DX11StructuredBuffer();
21  DX11StructuredBuffer(ID3D11Device* device, StructuredBuffer const* sbuffer);
22  static std::shared_ptr<GEObject> Create(void* device, GraphicsObject const* object);
23 
24 public:
25  // Member access.
26  inline StructuredBuffer* GetStructuredBuffer() const;
27  inline ID3D11ShaderResourceView* GetSRView() const;
28  inline ID3D11UnorderedAccessView* GetUAView() const;
29  inline ID3D11Buffer* GetCounterStagingBuffer() const;
30 
31  // Copy of data between CPU and GPU.
32  virtual bool CopyGpuToCpu(ID3D11DeviceContext* context);
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(ID3D11DeviceContext* context);
39 
40  // Support for the DX11 debug layer; see comments in the file
41  // GteDX11GraphicsObject.h about usage.
42  virtual void SetName(std::string const& name);
43 
44 private:
45  // Support for construction.
46  void CreateSRView(ID3D11Device* device);
47  void CreateUAView(ID3D11Device* device);
48  void CreateCounterStaging(ID3D11Device* device);
49 
50  ID3D11ShaderResourceView* mSRView;
51  ID3D11UnorderedAccessView* mUAView;
52  ID3D11Buffer* mCounterStaging;
53 
54  // Mapping from StructuredBuffer::CounterType to D3D11_BUFFER_UAV_FLAG.
55  static unsigned int const msUAVFlag[];
56 };
57 
59 {
60  return static_cast<StructuredBuffer*>(mGTObject);
61 }
62 
63 inline ID3D11ShaderResourceView* DX11StructuredBuffer::GetSRView() const
64 {
65  return mSRView;
66 }
67 
68 inline ID3D11UnorderedAccessView* DX11StructuredBuffer::GetUAView() const
69 {
70  return mUAView;
71 }
72 
74 {
75  return mCounterStaging;
76 }
77 
78 }
StructuredBuffer * GetStructuredBuffer() const
ID3D11UnorderedAccessView * mUAView
ID3D11UnorderedAccessView * GetUAView() const
GLuint const GLchar * name
Definition: glcorearb.h:781
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
ID3D11ShaderResourceView * mSRView
ID3D11ShaderResourceView * GetSRView() const
ID3D11Buffer * GetCounterStagingBuffer() const
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:59