Overte C++ Documentation
gpu::PageManager Struct Reference

#include <PageManager.h>

Public Member Functions

bool operator() (uint8 desiredFlags) const
 Check for given flags in this page manager. More...
 
void markPage (Size index, uint8 markFlags=DIRTY)
 Add given flag fot a page. More...
 
void markRegion (Size offset, Size bytes, uint8 markFlags=DIRTY)
 Mark memory area in page manager with a desired flag. More...
 
Size getPageCount (uint8_t desiredFlags=DIRTY) const
 
Size getSize (uint8_t desiredFlags=DIRTY) const
 
void setPageCount (Size count)
 Resizes page manager to a specified number of pages. More...
 
Size getRequiredPageCount (Size size) const
 
Size getRequiredSize (Size size) const
 
Size accommodate (Size size)
 
Pages getMarkedPages (uint8_t desiredFlags=DIRTY, bool clear=true)
 
bool getNextTransferBlock (Size &outOffset, Size &outSize, Size &currentPage)
 Gets a block of data that needs to be transferred to the GPU. More...
 

Detailed Description

Used for partial updates of buffers. Divides memory into pages, and then only pages that changed need to be updated on the GPU.

Member Function Documentation

◆ accommodate()

Size PageManager::accommodate ( Size  size)

Resize the page manager to fir the given number of bytes of data.

Parameters
sizeRequested size in bytes.
Returns
New size. May be higher than requested, because requested size is rounded up to a page size.

◆ getMarkedPages()

PageManager::Pages PageManager::getMarkedPages ( uint8_t  desiredFlags = DIRTY,
bool  clear = true 
)

Get pages with at least one of the specified flags, optionally clearing the flags as we go.

Parameters
desiredFlagsBitwise and of flags for pages to be retrieved.
clearShould the flags be cleared.
Returns
Indices of pages that have at least one of the desired flags.

◆ getNextTransferBlock()

bool PageManager::getNextTransferBlock ( Size &  outOffset,
Size &  outSize,
Size &  currentPage 
)

Gets a block of data that needs to be transferred to the GPU.

Parameters
outOffsetCurrent offset in bytes is written to this variable.
outSizeSize of the requested block is written to this variable.
currentPageBefore first call should be initialized to 0. Incremented on each call.
Returns
true if new transfer block is available.

◆ getPageCount()

Size PageManager::getPageCount ( uint8_t  desiredFlags = DIRTY) const
Parameters
desiredFlagsBitwise and of flags to be checked for.
Returns
Number of pages tagged with at least one of the desired flags.

◆ getRequiredPageCount()

Size PageManager::getRequiredPageCount ( Size  size) const
Parameters
sizeData size in bytes.
Returns
Number of pages required to store given number of bytes of data.

◆ getRequiredSize()

Size PageManager::getRequiredSize ( Size  size) const

Since whole pages are required to be allocated, amount of space required to store data is often higher than data size.

Parameters
sizeData size in bytes.
Returns
Number of bytes required to store given number of bytes of data.

◆ getSize()

Size PageManager::getSize ( uint8_t  desiredFlags = DIRTY) const
Parameters
desiredFlagsBitwise and of flags to be checked for.
Returns
Size in bytes of the pages tagged with at least one of the desired flag.

◆ markPage()

void PageManager::markPage ( Size  index,
uint8  markFlags = DIRTY 
)

Add given flag fot a page.

The function also toggles the flag in object-wide flags property.

Parameters
indexIndex of the page that needs to be flagged.
markFlagsA bitwise and operation of flags that need to be added.

◆ markRegion()

void PageManager::markRegion ( Size  offset,
Size  bytes,
uint8  markFlags = DIRTY 
)

Mark memory area in page manager with a desired flag.

Parameters
offsetStart of the memory area in bytes.
bytesSize in bytes of the area.
markFlagsA bitwise and operation of flags that need to be added.

◆ operator()()

bool PageManager::operator() ( uint8  desiredFlags) const

Check for given flags in this page manager.

Parameters
desiredFlagsBitwise and of flags to be checked for.
Returns
true if at least one of the desired flags is on for this page manager.

◆ setPageCount()

void PageManager::setPageCount ( Size  count)

Resizes page manager to a specified number of pages.

Parameters
countNumber of pages to resize to.

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