Ion
|
An IndexBuffer is a type of BufferObject that contains the element indices of an array, e.g., a vertex index array. More...
#include "indexbuffer.h"
Public Types | |
enum | Changes { kDataChanged = kNumBaseChanges, kSubDataChanged, kNumChanges } |
Changes that affect the resource. More... | |
enum | ComponentType { kInvalid, kByte, kUnsignedByte, kShort, kUnsignedShort, kInt, kUnsignedInt, kFloat, kFloatMatrixColumn2, kFloatMatrixColumn3, kFloatMatrixColumn4 } |
The type of the components of a spec. More... | |
enum | Target { kArrayBuffer, kElementBuffer, kCopyReadBuffer, kCopyWriteBuffer } |
enum | UsageMode { kDynamicDraw, kStaticDraw, kStreamDraw } |
enum | BaseChanges { kLabelChanged, kResourceChanged, kNumBaseChanges } |
All ResourceHolders derived from this should start their own change enums from kNumBaseChanges. More... | |
Public Member Functions | |
IndexBuffer () | |
Target | GetTarget () const |
Gets the buffer target. More... | |
size_t | AddSpec (const ComponentType type, const size_t component_count, const size_t byte_offset) |
Describes an element of an arbitrary datatype to the BufferObject. More... | |
const Spec & | GetSpec (const size_t spec_index) const |
Gets the Spec at index spec_index. More... | |
size_t | GetSpecCount () const |
Gets the number of Specs in the BufferObject. More... | |
void | SetData (const base::DataContainerPtr &data, const size_t struct_size, const size_t count, UsageMode usage) |
Sets data container, the size of the structure in bytes, and the number of structures. More... | |
const base::DataContainerPtr & | GetData () const |
Gets the data container. More... | |
void | SetSubData (const math::Range1ui &byte_range, const base::DataContainerPtr &data) |
Marks that the specified byte range of the BufferObject's data should be updated with the passed data. More... | |
void | CopySubData (const BufferObjectPtr &src, const math::Range1ui &dst_byte_range, uint32 read_offset) |
Adds a byte range of data that should be copied from src to this BufferObject. More... | |
void | ClearSubData () const |
Clears the vector of sub-data. More... | |
const base::AllocVector < BufferSubData > & | GetSubData () const |
Returns all sub-data ranges; may be an empty vector. More... | |
void * | GetMappedPointer () const |
Returns the mapped data pointer of the buffer, which will be NULL if the buffer has not been mapped with Renderer::MapBufferObjectData(Range)(). More... | |
size_t | GetStructSize () const |
Gets the size of one structure, in bytes. More... | |
size_t | GetCount () const |
Gets the number of structs in the buffer. More... | |
UsageMode | GetUsageMode () const |
Gets the usage mode of the data. More... | |
void | SetResource (size_t index, ResourceKey key, ResourceBase *resource) const |
Sets the resource at the passed index and key. More... | |
ResourceBase * | GetResource (size_t index, ResourceKey key) const |
Returns the Resource at the given index and key, or NULL if no resource was previously set at that location. More... | |
int | GetResourceCount () const |
Returns the number of resources that this holder holds. More... | |
size_t | GetGpuMemoryUsed () const |
Returns the total amount of GPU memory used by this Holder's resource. More... | |
const std::string & | GetLabel () const |
Returns/sets the label of this. More... | |
void | SetLabel (const std::string &label) |
void | AddReceiver (Notifier *receiver) |
Adds a Notifier to be notified. More... | |
void | RemoveReceiver (Notifier *receiver) |
Removes a Notifier to be notified. More... | |
size_t | GetReceiverCount () const |
Returns the number of Notifiers that will be notified. More... | |
const AllocatorPtr & | GetAllocator () const |
Returns the Allocator that was used for the instance. More... | |
const AllocatorPtr & | GetNonNullAllocator () const |
Return our allocator, or the default allocator if the instance was declared on the stack. More... | |
const AllocatorPtr & | GetAllocatorForLifetime (AllocationLifetime lifetime) const |
Convenience function that returns the Allocator to use to allocate an object with a specific lifetime. More... | |
void * | operator new (size_t size) |
The standard no-parameter new operator uses the default Allocator. More... | |
void * | operator new (size_t size, AllocationLifetime lifetime) |
This overloaded version of the new operator uses the AllocationManager's default Allocator for the specified lifetime. More... | |
void * | operator new (size_t size, const AllocatorPtr &allocator) |
This overloaded version of the new operator takes the Allocator to use directly as a parameter. More... | |
void * | operator new (size_t size, const AllocatorPtr &allocator, void *ptr) |
Special operator new for using placement new with Allocatables. More... | |
void * | operator new (size_t size, void *ptr) |
The placement new operator is defined conventionally. More... | |
void | operator delete (void *ptr) |
Define the delete operator to use specialized functions dealing with an Allocator. More... | |
void | operator delete (void *ptr, AllocationLifetime lifetime) |
Windows requires these (or it issues C4291 warnings). More... | |
void | operator delete (void *ptr, const AllocatorPtr &allocator) |
void | operator delete (void *ptr, void *ptr2) |
The placement delete operator does nothing, as usual. More... | |
int | GetRefCount () const |
GetRefCount() is part of the interface necessary for SharedPtr. More... | |
Protected Types | |
typedef WeakReferentPtr< Notifier > | NotifierPtr |
typedef AllocVector< NotifierPtr > | NotifierPtrVector |
Protected Member Functions | |
~IndexBuffer () override | |
The destructor is protected because all base::Referent classes must have protected or private destructors. More... | |
void | OnChanged (int bit) const |
Forwards OnChanged to all resources. More... | |
const NotifierPtrVector & | GetReceivers () const |
Returns the set of Notifiers that will be notified. More... | |
void | Notify () const |
Notifies all contained Notifiers by calling their OnNotify(). More... | |
An IndexBuffer is a type of BufferObject that contains the element indices of an array, e.g., a vertex index array.
Definition at line 28 of file indexbuffer.h.
|
protectedinherited |
Definition at line 49 of file notifier.h.
|
protectedinherited |
Definition at line 50 of file notifier.h.
|
inherited |
All ResourceHolders derived from this should start their own change enums from kNumBaseChanges.
Enumerator | |
---|---|
kLabelChanged | |
kResourceChanged | |
kNumBaseChanges |
Definition at line 56 of file resourceholder.h.
|
inherited |
Changes that affect the resource.
Enumerator | |
---|---|
kDataChanged | |
kSubDataChanged | |
kNumChanges |
Definition at line 70 of file bufferobject.h.
|
inherited |
The type of the components of a spec.
Definition at line 77 of file bufferobject.h.
|
inherited |
Enumerator | |
---|---|
kArrayBuffer | |
kElementBuffer | |
kCopyReadBuffer | |
kCopyWriteBuffer |
Definition at line 93 of file bufferobject.h.
|
inherited |
Enumerator | |
---|---|
kDynamicDraw | |
kStaticDraw | |
kStreamDraw |
Definition at line 100 of file bufferobject.h.
ion::gfx::IndexBuffer::IndexBuffer | ( | ) |
Definition at line 23 of file indexbuffer.cc.
|
overrideprotected |
The destructor is protected because all base::Referent classes must have protected or private destructors.
Definition at line 25 of file indexbuffer.cc.
|
inherited |
Adds a Notifier to be notified.
Does nothing if the receiver is NULL or is already in the receiver vector.
Definition at line 25 of file notifier.cc.
|
inherited |
Describes an element of an arbitrary datatype to the BufferObject.
An element is defined by its byte offset into the struct, its type, and the number of components it contains.
AddSpec() Returns a static index into the array of elements for this BufferObject. The returned value is a unique (for this BufferObject), static index into an array of Elements. The returned index is required by the Get() functions, below. If count is > 4, then returns an invalid index (base::kInvalidIndex). Since Specs are unique; attempting to add the same Spec twice has no effect and the original index of the identical Spec is returned.
Definition at line 46 of file bufferobject.cc.
References ion::port::ERROR, ion::base::kInvalidIndex, and LOG.
|
inlineinherited |
Clears the vector of sub-data.
Definition at line 240 of file bufferobject.h.
|
inlineinherited |
Adds a byte range of data that should be copied from src to this BufferObject.
read_offset specifies the byte offset within the src BufferObject data from which to copy the data. dst_byte_range specifies the destination range. The source and destination ranges should not overlap if src == this. Note that all subdatas in src are applied to to src before the copy to this BufferObject.
Definition at line 226 of file bufferobject.h.
References ion::base::SharedPtr< T >::Get().
|
inlineinherited |
Returns the Allocator that was used for the instance.
This will be NULL if the instance was declared on the stack or created with normal placement new.
Definition at line 68 of file allocatable.h.
References allocator_.
Referenced by ion::base::DataContainer::CreateAndCopy(), ion::text::DynamicFontImage::FindContainingImageDataIndex(), and ion::text::DynamicFontImage::FindImageDataIndex().
|
inlineinherited |
Convenience function that returns the Allocator to use to allocate an object with a specific lifetime.
Definition at line 78 of file allocatable.h.
References ion::base::Allocator::GetAllocatorForLifetime().
Referenced by ion::text::BasicBuilder::BuildVertexData(), ion::text::OutlineBuilder::BuildVertexData(), ion::gfxutils::ShaderManager::CreateShaderProgram(), ion::text::DynamicFontImage::FindContainingImageDataIndex(), ion::text::DynamicFontImage::FindImageDataIndex(), ion::gfx::Renderer::Renderer(), and ion::gfx::UpdateStateTable().
|
inlineinherited |
Gets the number of structs in the buffer.
Definition at line 257 of file bufferobject.h.
|
inlineinherited |
Gets the data container.
Definition at line 205 of file bufferobject.h.
References ion::base::SharedPtr< T >::Get().
Referenced by ion::gfx::BufferObject::~BufferObject().
|
inlineinherited |
Returns the total amount of GPU memory used by this Holder's resource.
Definition at line 78 of file resourceholder.h.
|
inlineinherited |
Returns/sets the label of this.
Definition at line 89 of file resourceholder.h.
|
inlineinherited |
Returns the mapped data pointer of the buffer, which will be NULL if the buffer has not been mapped with Renderer::MapBufferObjectData(Range)().
Definition at line 250 of file bufferobject.h.
|
inlineinherited |
Return our allocator, or the default allocator if the instance was declared on the stack.
Definition at line 72 of file allocatable.h.
References allocator_, and ion::base::AllocationManager::GetNonNullAllocator().
|
inherited |
Returns the number of Notifiers that will be notified.
Definition at line 71 of file notifier.cc.
|
protectedinherited |
Returns the set of Notifiers that will be notified.
Definition at line 77 of file notifier.cc.
|
inlineinherited |
GetRefCount() is part of the interface necessary for SharedPtr.
Definition at line 34 of file shareable.h.
Referenced by ion::base::Notifier::RemoveReceiver().
|
inherited |
Returns the Resource at the given index and key, or NULL if no resource was previously set at that location.
Definition at line 122 of file resourceholder.cc.
|
inlineinherited |
Returns the number of resources that this holder holds.
Note that this is not necessarily the number of indices that have non-NULL resources. This can be used as a fast trivial check to see if the holder has any resources.
Definition at line 73 of file resourceholder.h.
|
inherited |
Gets the Spec at index spec_index.
If spec_index is invalid, returns an InvalidReference.
Definition at line 69 of file bufferobject.cc.
References ion::port::ERROR, and LOG.
|
inlineinherited |
Gets the number of Specs in the BufferObject.
Definition at line 186 of file bufferobject.h.
|
inlineinherited |
Gets the size of one structure, in bytes.
Definition at line 255 of file bufferobject.h.
|
inlineinherited |
Returns all sub-data ranges; may be an empty vector.
Definition at line 244 of file bufferobject.h.
|
inlineinherited |
Gets the buffer target.
Definition at line 138 of file bufferobject.h.
|
inlineinherited |
Gets the usage mode of the data.
Definition at line 259 of file bufferobject.h.
|
protectedinherited |
Notifies all contained Notifiers by calling their OnNotify().
Any receivers that have been destroyed will be removed from the vector of receivers.
Definition at line 81 of file notifier.cc.
References ion::base::SharedPtr< T >::Get().
|
inlineprotectedinherited |
Forwards OnChanged to all resources.
Definition at line 326 of file resourceholder.h.
|
inlineinherited |
Define the delete operator to use specialized functions dealing with an Allocator.
Definition at line 109 of file allocatable.h.
|
inlineinherited |
Windows requires these (or it issues C4291 warnings).
Definition at line 112 of file allocatable.h.
|
inlineinherited |
Definition at line 113 of file allocatable.h.
|
inlineinherited |
The placement delete operator does nothing, as usual.
Definition at line 118 of file allocatable.h.
|
inlineinherited |
The standard no-parameter new operator uses the default Allocator.
Definition at line 84 of file allocatable.h.
|
inlineinherited |
This overloaded version of the new operator uses the AllocationManager's default Allocator for the specified lifetime.
Definition at line 88 of file allocatable.h.
|
inlineinherited |
This overloaded version of the new operator takes the Allocator to use directly as a parameter.
If the Allocator pointer is NULL, this uses the default Allocator.
Definition at line 95 of file allocatable.h.
|
inlineinherited |
Special operator new for using placement new with Allocatables.
Definition at line 100 of file allocatable.h.
|
inlineinherited |
The placement new operator is defined conventionally.
Definition at line 105 of file allocatable.h.
|
inherited |
Removes a Notifier to be notified.
Does nothing if the receiver is NULL or not in the set of receivers.
Definition at line 38 of file notifier.cc.
References ion::base::Shareable::GetRefCount().
Referenced by ion::gfx::AttributeArray::~AttributeArray().
|
inlineinherited |
Sets data container, the size of the structure in bytes, and the number of structures.
The DataContainer will only be destroyed when the last client ReferentPtr to the DataContainer goes away and the BufferObject is destroyed or a new DataContainer is set with SetData(). data may be NULL in which case the BufferObject is sized to struct_size * count, but its contents are undefined and it is expected that the BufferObject will be populated later with SetSubData().
Definition at line 195 of file bufferobject.h.
References ion::base::SharedPtr< T >::Get().
|
inlineinherited |
Definition at line 90 of file resourceholder.h.
|
inherited |
Sets the resource at the passed index and key.
The size of the internal vector is automatically managed so that it has the smallest possible size.
Definition at line 51 of file resourceholder.cc.
References DCHECK, DCHECK_EQ, ion::gfx::ResourceBase::GetKey(), and ion::gfx::ResourceBase::OnChanged().
|
inlineinherited |
Marks that the specified byte range of the BufferObject's data should be updated with the passed data.
This function is only meaningful if SetData() has already been used, and may be called multiple times to update multiple byte ranges.
Definition at line 211 of file bufferobject.h.
References ion::base::SharedPtr< T >::Get().