XII Release 0.1.0
Loading...
Searching...
No Matches
xiiGALBuffer Class Referenceabstract

Interface that defines methods to manipulate a buffer object. More...

#include <Buffer.h>

Inheritance diagram for xiiGALBuffer:
[legend]

Public Member Functions

XII_ALWAYS_INLINE const xiiGALBufferCreationDescriptionGetDescription () const
 This returns the creation description for this object.
 
XII_ALWAYS_INLINE xiiUInt64 GetSize () const
 This returns the buffer size.
 
virtual XII_ALWAYS_INLINE xiiUInt64 GetMemoryConsumption () const
 Returns the calculated memory consumption for buffer.
 
xiiSharedPtr< xiiGALBufferViewGetDefaultView (xiiEnum< xiiGALBufferViewType > viewType)
 This returns the handle of the default view.
 
XII_ALWAYS_INLINE xiiBitflags< xiiGALMemoryPropertyFlagsGetMemoryProperties () const
 This returns the buffer memory properties.
 
virtual void FlushMappedRange (xiiUInt64 uiStartOffset, xiiUInt64 uiSize)=0
 This flushes the specified range of non-coherent memory from the host cache to make it available to the GPU.
 
virtual void InvalidateMappedRange (xiiUInt64 uiStartOffset, xiiUInt64 uiSize)=0
 This invalidates the specified range of non-coherent memory modified by the GPU to make it visible to the CPU.
 
xiiSharedPtr< xiiGALBufferViewCreateView (xiiGALBufferViewCreationDescription &description)
 This creates a new buffer view.
 
virtual xiiGALSparseBufferProperties GetSparseProperties () const =0
 This returns the sparse buffer memory properties.
 
- Public Member Functions inherited from xiiGALResource
virtual void SetResourceState (xiiBitflags< xiiGALResourceStateFlags > stateFlags)
 This sets the buffer usage state.
 
virtual XII_ALWAYS_INLINE xiiBitflags< xiiGALResourceStateFlagsGetResourceState () const
 This returns the buffer state.
 
XII_ALWAYS_INLINE bool IsInKnownState () const
 This returns true if the resource is in known state by the engine.
 
XII_ALWAYS_INLINE bool CheckState (xiiBitflags< xiiGALResourceStateFlags > resourceState) const
 This returns true if the given resource state is set.
 
XII_ALWAYS_INLINE bool CheckAnyState (xiiBitflags< xiiGALResourceStateFlags > resourceState) const
 This returns true if any of the given resource state are set.
 
- Public Member Functions inherited from xiiGALDeviceObject
XII_ALWAYS_INLINE xiiSharedPtr< xiiGALDeviceGetDevice () const
 Returns the xiiGALDevice that created this resource.
 
- Public Member Functions inherited from xiiGALObject
XII_ALWAYS_INLINE xiiStringView GetDebugName () const
 Returns the debug name of this resource.
 
void SetDebugName (xiiStringView sDebugName) const
 Sets the debug name for this resource.
 
- Public Member Functions inherited from xiiReflectedClass
virtual const xiiRTTIGetDynamicRTTI () const
 
bool IsInstanceOf (const xiiRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T>
XII_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.
 
- Public Member Functions inherited from xiiRefCounted
virtual ~xiiRefCounted ()=default
 Adds a virtual destructor.
 
- Public Member Functions inherited from xiiRefCountingImpl
 xiiRefCountingImpl ()=default
 Constructor.
 
 xiiRefCountingImpl (const xiiRefCountingImpl &rhs)
 
void operator= (const xiiRefCountingImpl &rhs)
 
xiiUInt32 AddRef () const
 Increments the reference counter. Returns the new reference count.
 
xiiUInt32 ReleaseRef () const
 Decrements the reference counter. Returns the new reference count.
 
bool IsReferenced () const
 Returns true if the reference count is greater than 0, false otherwise.
 
xiiUInt32 GetRefCount () const
 Returns the current reference count.
 

Protected Member Functions

 xiiGALBuffer (xiiSharedPtr< xiiGALDevice > pDevice, const xiiGALBufferCreationDescription &creationDescription)
 
virtual xiiResult InitPlatform (const xiiGALBufferData *pInitialData)=0
 
virtual xiiInternal::NewInstance< xiiGALBufferViewCreateViewPlatform (const xiiGALBufferViewCreationDescription &description)=0
 
void VerifyFlushMappedRangeArguments (xiiUInt64 uiStartOffset, xiiUInt64 uiSize) const
 
void VerifyInvalidateMappedRangeArguments (xiiUInt64 uiStartOffset, xiiUInt64 uiSize) const
 
- Protected Member Functions inherited from xiiGALResource
 xiiGALResource (xiiSharedPtr< xiiGALDevice > pDevice)
 
- Protected Member Functions inherited from xiiGALDeviceObject
 xiiGALDeviceObject (xiiSharedPtr< xiiGALDevice > pDevice)
 
- Protected Member Functions inherited from xiiGALObject
virtual XII_ALWAYS_INLINE void SetDebugNamePlatform (xiiStringView sName) const
 

Protected Attributes

xiiGALBufferCreationDescription m_Description
 
xiiBitflags< xiiGALMemoryPropertyFlagsm_MemoryPropertyFlags
 
xiiSharedPtr< xiiGALBufferViewm_DefaultBufferViews [xiiGALBufferViewType::ENUM_COUNT]
 
- Protected Attributes inherited from xiiGALResource
xiiBitflags< xiiGALResourceStateFlagsm_ResourceState
 
- Protected Attributes inherited from xiiGALDeviceObject
xiiSharedPtr< xiiGALDevicem_pDevice
 

Friends

class xiiGALDevice
 
class xiiMemoryUtils
 

Additional Inherited Members

- Static Public Member Functions inherited from xiiNoBase
static const xiiRTTIGetStaticRTTI ()
 

Detailed Description

Interface that defines methods to manipulate a buffer object.

Member Function Documentation

◆ CreateView()

xiiSharedPtr< xiiGALBufferView > xiiGALBuffer::CreateView ( xiiGALBufferViewCreationDescription & description)
nodiscard

This creates a new buffer view.

Parameters
description- The buffer view description. See xiiGALBufferViewCreationDescription.
Returns
The reference-counted pointer to the buffer view.
Remarks
To create a view addressing the entire buffer, set only xiiGALBufferViewCreationDescription::m_ViewType member of the ViewDesc structure and leave all other members in their default values. The buffer view will contain strong reference to the buffer, so the buffer will not be destroyed until all views are released.

◆ FlushMappedRange()

virtual void xiiGALBuffer::FlushMappedRange ( xiiUInt64 uiStartOffset,
xiiUInt64 uiSize )
pure virtual

This flushes the specified range of non-coherent memory from the host cache to make it available to the GPU.

Parameters
uiStartOffset- The offset in bytes from the beginning of the buffer to the start of the memory range to flush.
uiSize- The size in bytes of the memory range to flush.

This method should only be used for persistently-mapped buffers that do not report the xiiGALMemoryProperties::HostCoherent property. After an application modifies a mapped memory range on the CPU, it must flush the range to make it available to the GPU.

Note
This method must not be called for Dynamic buffers. When a mapped buffer is unmapped, it is automatically flushed by the engine if necessary.

Implemented in xiiGALBufferVulkan.

◆ GetDefaultView()

xiiSharedPtr< xiiGALBufferView > xiiGALBuffer::GetDefaultView ( xiiEnum< xiiGALBufferViewType > viewType)
nodiscard

This returns the handle of the default view.

Parameters
viewType- The type of the requested view. See xiiGALBufferViewType.
Returns
The handle to the buffer view.
Remarks
Default views are only created for structured and raw buffers. As for formatted buffers the view format is unknown at buffer initialization time, no default views are created.
Note
The function does not increase the reference counter for the returned interface, so ReleaseRef() must NOT be called.

◆ GetMemoryProperties()

XII_ALWAYS_INLINE xiiBitflags< xiiGALMemoryPropertyFlags > xiiGALBuffer::GetMemoryProperties ( ) const
inlinenodiscard

This returns the buffer memory properties.

The memory properties are only relevant for persistently mapped buffers. In particular, if the memory is not coherent, an application must call xiiGALBuffer::FlushMappedRange() to make writes by the CPU available to the GPU, and call xiiGALBuffer::InvalidateMappedRange() to make writes by the GPU visible to the CPU.

◆ GetSparseProperties()

virtual xiiGALSparseBufferProperties xiiGALBuffer::GetSparseProperties ( ) const
nodiscardpure virtual

This returns the sparse buffer memory properties.

Implemented in xiiGALBufferVulkan.

◆ InitPlatform()

virtual xiiResult xiiGALBuffer::InitPlatform ( const xiiGALBufferData * pInitialData)
protectedpure virtual

Implemented in xiiGALBufferVulkan.

◆ InvalidateMappedRange()

virtual void xiiGALBuffer::InvalidateMappedRange ( xiiUInt64 uiStartOffset,
xiiUInt64 uiSize )
pure virtual

This invalidates the specified range of non-coherent memory modified by the GPU to make it visible to the CPU.

Parameters
uiStartOffset- The offset in bytes from the beginning of the buffer to the start of the memory to invalidate.
uiSize- The size in bytes of the memory range to invalidate.

This method should only be used for persistently-mapped buffers that do not report the xiiGALMemoryProperties::HostCoherent property. After an application modifies a mapped memory range on the CPU, it must invalidate the range to make it visible to the CPU.

Note
This method must not be called for Dynamic buffers. When a mapped buffer is unmapped, it is automatically flushed by the engine if necessary.

Implemented in xiiGALBufferVulkan.


The documentation for this class was generated from the following files: