31 #include "storage_buffer.h"
36 template<
typename Type>
46 : _buffer(
StorageBuffer::create(gc, size * sizeof(Type), sizeof(Type), usage))
51 :
StorageBuffer(gc, data, size * sizeof(Type), sizeof(Type), usage)
56 :
StorageBuffer(gc, data.empty() ? (Type*)0 : &data[0], data.size() * sizeof(Type), sizeof(Type), usage)
70 _buffer->upload_data(gc, data, size *
sizeof(Type));
76 _buffer->upload_data(gc, data.data(), data.size() *
sizeof(Type));
83 size = size *
sizeof(Type);
84 _buffer->copy_from(gc, buffer, dest_pos *
sizeof(Type), src_pos *
sizeof(Type), size);
91 size = size *
sizeof(Type);
92 _buffer->copy_to(gc, buffer, dest_pos *
sizeof(Type), src_pos *
sizeof(Type), size);
void upload_data(const GraphicContextPtr &gc, const Type *data, int size)
Uploads data to storage buffer.
Definition: storage_vector.h:68
Storage Buffer.
Definition: storage_buffer.h:42
const StorageBufferPtr & buffer() const
Returns the storage buffer used by the vector.
Definition: storage_vector.h:61
std::shared_ptr< StorageBuffer > StorageBufferPtr
Definition: graphic_context.h:65
BufferUsage
Array Buffer usage enum.
Definition: buffer_usage.h:35
StorageVector(const GraphicContextPtr &gc, const std::vector< Type > &data, BufferUsage usage=usage_static_draw)
Definition: storage_vector.h:55
Definition: buffer_usage.h:40
void copy_from(const GraphicContextPtr &gc, StagingVector< Type > &buffer, int dest_pos=0, int src_pos=0, int size=-1)
Copies data from transfer buffer.
Definition: storage_vector.h:80
StorageVector(const GraphicContextPtr &gc, Type *data, int size, BufferUsage usage=usage_static_draw)
Definition: storage_vector.h:50
StorageVector()
Definition: storage_vector.h:41
Typed access to a storage buffer.
Definition: storage_vector.h:37
std::shared_ptr< GraphicContext > GraphicContextPtr
Definition: d3d_target.h:49
Typed access to a transfer buffer.
Definition: staging_vector.h:37
void upload_data(const GraphicContextPtr &gc, const std::vector< Type > &data)
Uploads data to storage buffer.
Definition: storage_vector.h:74
Definition: Application/application.h:35
StorageVector(const GraphicContextPtr &gc, int size, BufferUsage usage=usage_static_draw)
Definition: storage_vector.h:45
void copy_to(const GraphicContextPtr &gc, StagingVector< Type > &buffer, int dest_pos=0, int src_pos=0, int size=-1)
Copies data to transfer buffer.
Definition: storage_vector.h:88