API Documentation
Buffer.h
1 // Buffer.h
3 //
5 
6 namespace nkGraphics
7 {
17  {
18  public :
19 
23  virtual ~Buffer () ;
24 
25  // Getters
29  unsigned int getElementByteSize () const ;
33  unsigned int getElementCount () const ;
37  unsigned int getTotalByteSize () const ;
41  virtual BUFFER_USAGE getUsage () const = 0 ;
45  virtual BUFFER_BIND_FLAG getBindFlag () const = 0 ;
53  virtual RESOURCE_MISC_FLAG getMiscFlag () const = 0 ;
54 
55  // Setters
89  virtual void freeCpuData () ;
95  virtual void setElementByteSize (unsigned int value) ;
101  virtual void setElementCount (unsigned int value) ;
109  virtual void setUsage (BUFFER_USAGE value) = 0 ;
115  virtual void setBindFlag (BUFFER_BIND_FLAG value) = 0 ;
121  virtual void setCpuAccessFlag (BUFFER_CPU_ACCESS_FLAG value) = 0 ;
127  virtual void setMiscFlag (RESOURCE_MISC_FLAG value) = 0 ;
133  virtual void copyParams (const Buffer& other) ;
134 
135  // Mapping
146  virtual MapResult map (const MapRequestDescriptor& requestDesc) = 0 ;
152  virtual void unmap (const UnmapRequestDescriptor& requestDesc) = 0 ;
161  virtual void gpuCopyFrom (Buffer& other, const ResourceGpuCopyDescriptor& descriptor) = 0 ;
162 
163  // Usage declarations
170  virtual void prepareForShaderResourceUsage (bool value = true) ;
177  virtual void prepareForComputeResourceUsage (bool value = true) ;
184  virtual void prepareForOutputStreamUsage (bool value = true) ;
185 
186  // Operators
190  Buffer& operator= (const Buffer& other) = delete ;
191 
192  // Import export
193  virtual void exportClassToTree (nkExport::Node* rootNode) override ;
194  virtual void importClassFromTree (nkExport::Node* rootNode) override ;
195 
196  public :
197 
198  // Statics
206  static nkMemory::UniquePtr<Buffer> create (System* system = nullptr) ;
207  } ;
208 }
nkGraphics::MapResult
Contains all information of the result of a map operation on a resource.
Definition: MapResult.h:12
nkGraphics::RESOURCE_MISC_FLAG
RESOURCE_MISC_FLAG
Available misc flags for resources.
Definition: ResourceMiscFlag.h:12
nkGraphics::MapRequestDescriptor
A description of a request to map a resource.
Definition: MapRequestDescriptor.h:29
nkGraphics::Buffer::getUsage
virtual BUFFER_USAGE getUsage() const =0
nkGraphics::Buffer::prepareForShaderResourceUsage
virtual void prepareForShaderResourceUsage(bool value=true)
nkGraphics::Buffer::unmap
virtual void unmap(const UnmapRequestDescriptor &requestDesc)=0
nkGraphics::Buffer::setMiscFlag
virtual void setMiscFlag(RESOURCE_MISC_FLAG value)=0
nkGraphics::BUFFER_CPU_ACCESS_FLAG
BUFFER_CPU_ACCESS_FLAG
Available cpu access flags.
Definition: BufferCpuAccessFlag.h:12
nkExport::Exportable
An interface to define objects that can be exported using this component.
Definition: Exportable.h:15
nkGraphics::Buffer::gpuCopyFrom
virtual void gpuCopyFrom(Buffer &other, const ResourceGpuCopyDescriptor &descriptor)=0
nkMemory::BufferView
A view over data.
Definition: BufferView.h:18
nkGraphics::UnmapRequestDescriptor
Description of an unmap request.
Definition: UnmapRequestDescriptor.h:19
nkGraphics::Buffer::setCpuAccessFlag
virtual void setCpuAccessFlag(BUFFER_CPU_ACCESS_FLAG value)=0
nkGraphics::BUFFER_USAGE
BUFFER_USAGE
Available usage for buffers. Drives the memory used for hosting the data.
Definition: BufferUsage.h:12
nkGraphics::Buffer
A buffer that will reside on the GPU.
Definition: Buffer.h:17
nkGraphics::Buffer::getBindFlag
virtual BUFFER_BIND_FLAG getBindFlag() const =0
nkGraphics::Buffer::setElementCount
virtual void setElementCount(unsigned int value)
nkGraphics::Buffer::getElementByteSize
unsigned int getElementByteSize() const
nkGraphics::Buffer::prepareForComputeResourceUsage
virtual void prepareForComputeResourceUsage(bool value=true)
nkGraphics::Buffer::getCpuAccessFlag
virtual BUFFER_CPU_ACCESS_FLAG getCpuAccessFlag() const =0
nkGraphics::Buffer::exportClassToTree
virtual void exportClassToTree(nkExport::Node *rootNode) override
nkMemory::Buffer
A buffer holding binary data.
Definition: Buffer.h:32
nkGraphics::Buffer::setUsage
virtual void setUsage(BUFFER_USAGE value)=0
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkGraphics::Buffer::getMiscFlag
virtual RESOURCE_MISC_FLAG getMiscFlag() const =0
nkGraphics::Buffer::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkMemory::UniquePtr
Smart pointer owning the object instance it encapsulates.
Definition: UniquePtr.h:17
nkGraphics::Buffer::~Buffer
virtual ~Buffer()
nkGraphics::Buffer::setCpuDataCopy
void setCpuDataCopy(nkMemory::BufferView<> data)
nkGraphics::Buffer::getElementCount
unsigned int getElementCount() const
nkGraphics::Buffer::map
virtual MapResult map(const MapRequestDescriptor &requestDesc)=0
nkGraphics::Buffer::prepareForOutputStreamUsage
virtual void prepareForOutputStreamUsage(bool value=true)
nkGraphics::Buffer::setElementByteSize
virtual void setElementByteSize(unsigned int value)
nkGraphics::Buffer::setCpuData
void setCpuData(nkMemory::BufferView<> data)
nkGraphics::Buffer::setCpuDataForward
void setCpuDataForward(nkMemory::Buffer &&data)
nkGraphics::Buffer::copyParams
virtual void copyParams(const Buffer &other)
nkGraphics::Buffer::getTotalByteSize
unsigned int getTotalByteSize() const
nkGraphics::Buffer::freeCpuData
virtual void freeCpuData()
nkGraphics
Encompasses all API of component NilkinsGraphics.
Definition: BoundingBox.h:7
nkGraphics::Buffer::setBindFlag
virtual void setBindFlag(BUFFER_BIND_FLAG value)=0
nkGraphics::Buffer::create
static nkMemory::UniquePtr< Buffer > create(System *system=nullptr)
nkGraphics::ResourceGpuCopyDescriptor
Holds information about a resource copy happening on the GPU only.
Definition: ResourceGpuCopyDescriptor.h:12
nkGraphics::Buffer::operator=
Buffer & operator=(const Buffer &other)=delete
nkGraphics::BUFFER_BIND_FLAG
BUFFER_BIND_FLAG
Available binding flags for buffers.
Definition: BufferBindFlag.h:12
nkGraphics::ShaderResource
Base class for shader resources. Those are resources that can be fed to a Shader.
Definition: ShaderResource.h:12