Ocular Engine
D3D11StructuredBuffer.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_D3D11_GRAPHICS_STRUCTURED_BUFFER__H__
19 #define __H__OCULAR_D3D11_GRAPHICS_STRUCTURED_BUFFER__H__
20 
21 #include "Graphics/Shader/Buffer/GPUBuffer.hpp"
22 #include <d3d11.h>
23 
24 //------------------------------------------------------------------------------------------
25 
30 namespace Ocular
31 {
36  namespace Graphics
37  {
54  {
55  public:
56 
57  D3D11StructuredBuffer(GPUBufferDescriptor const& descriptor);
58  virtual ~D3D11StructuredBuffer();
59 
60  //------------------------------------------------------------
61 
62  virtual void bind() override;
63  virtual void unbind() override;
64 
65  virtual bool build(void const* source) override;
66 
67  virtual bool read(void* destination, uint32_t start, uint32_t size) override;
68  virtual bool write(void const* source, uint32_t start, uint32_t size) override;
69 
70  ID3D11Buffer* getD3DBuffer();
71  ID3D11ShaderResourceView* getD3DShaderResource();
72 
73  protected:
74 
75  bool getDevices();
76  void releaseResources();
77 
78  //------------------------------------------------------------
79 
80  ID3D11Device* m_D3DDevice;
81  ID3D11DeviceContext* m_D3DDeviceContext;
82 
83  ID3D11Buffer* m_D3DBuffer;
84  ID3D11ShaderResourceView* m_D3DSRV;
85 
86  private:
87  };
88  }
92 }
97 //------------------------------------------------------------------------------------------
98 
99 #endif
virtual void unbind() override
Definition: D3D11StructuredBuffer.cpp:78
virtual bool build(void const *source) override
Definition: D3D11StructuredBuffer.cpp:103
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
virtual void bind() override
Definition: D3D11StructuredBuffer.cpp:51
Definition: D3D11StructuredBuffer.hpp:53
A generic buffer that can be uploaded to the GPU.
Definition: GPUBuffer.hpp:81
Definition: GPUBuffer.hpp:62
virtual bool write(void const *source, uint32_t start, uint32_t size) override
Definition: D3D11StructuredBuffer.cpp:274
virtual bool read(void *destination, uint32_t start, uint32_t size) override
Definition: D3D11StructuredBuffer.cpp:211