![]() |
OGRE-Next 4.0.0unstable
Object-Oriented Graphics Rendering Engine
|
In Ogre 2.2 reading data from GPU back to CPU is asynchronous. More...
#include <OgreAsyncTextureTicket.h>
Classes | |
struct | DelayedDownload |
Public Types | |
enum | Status { Ready , Downloading , Mapped } |
![]() | |
enum | Reason { Unknown , FromStorageToSysRam , FromSysRamToStorage , GainedResidency , LostResidency , PoolTextureSlotChanged , ResidentToSysRamSync , MetadataCacheOutOfDate , ExceptionThrown , FsaaSettingAlteredByApi , ReadyForRendering , Deleted } |
In Ogre 2.2 reading data from GPU back to CPU is asynchronous.
See TextureGpuManager::createAsyncTextureTicket to generate a ticket. While the async transfer is being performed, you should be doing something else.
Ogre::AsyncTextureTicket::AsyncTextureTicket | ( | uint32 | width, |
uint32 | height, | ||
uint32 | depthOrSlices, | ||
TextureTypes::TextureTypes | textureType, | ||
PixelFormatGpu | pixelFormatFamily | ||
) |
|
override |
See Image2::convertFromTexture for an example of how to use AyncTextureTicket.
void Ogre::AsyncTextureTicket::download | ( | TextureGpu * | textureSrc, |
uint8 | mipLevel, | ||
bool | accurateTracking, | ||
TextureBox * | srcBox = 0 , |
||
bool | bImmediate = false |
||
) |
Downloads textureSrc into this ticket.
The size (resolution) of this ticket must match exactly of the region to download.
textureSrc | Texture to download from. Must be resident. |
mipLevel | Mip level to download. |
accurateTracking | When false, you will be mapping this texture much further along (i.e. after 2-3 frames) Useful when constantly streaming GPU content to the CPU with 3 frames delay. When true, we will accurately track the status of this transfer, which has higher driver overhead. |
srcBox | When nullptr, we'll download the whole texture (its selected mip level) When not nullptr, we'll download the region within the texture. This region must resolution must match exactly that of this ticket (e.g. bytesPerRow may be much bigger than you expect!) |
bImmediate | When bImmediate is true, we will download from the GPU if texture is currently resident and ready; even if there are pending residency changes. If it's not ready, we'll listen for when it is. |
size_t Ogre::AsyncTextureTicket::getBytesPerImage | ( | ) | const |
uint32 Ogre::AsyncTextureTicket::getBytesPerRow | ( | ) | const |
uint32 Ogre::AsyncTextureTicket::getDepth | ( | ) | const |
For TypeCube & TypeCubeArray, this value returns 1.
uint32 Ogre::AsyncTextureTicket::getDepthOrSlices | ( | ) | const |
uint32 Ogre::AsyncTextureTicket::getHeight | ( | ) | const |
uint32 Ogre::AsyncTextureTicket::getNumSlices | ( | ) | const |
For TypeCube this value returns 6.
For TypeCubeArray, value returns numSlices * 6u.
PixelFormatGpu Ogre::AsyncTextureTicket::getPixelFormatFamily | ( | ) | const |
uint32 Ogre::AsyncTextureTicket::getWidth | ( | ) | const |
TextureBox Ogre::AsyncTextureTicket::map | ( | uint32 | slice | ) |
Maps the buffer for CPU access.
Will stall if transfer from GPU memory to staging area hasn't finished yet. See queryIsTransferDone.
slice | First slice to map. Textures below 2048x2048 are guaranteed to be able to access [slice; getNumSlices). Textures above that will only be able to access [slice; slice+1) |
|
overridevirtual |
TextureGpuListener overload.
Implements Ogre::TextureGpuListener.