In Ogre 2.2 reading data from GPU back to CPU is asynchronous.
More...
#include <OgreAsyncTextureTicket.h>
|
enum | Reason {
Unknown,
FromStorageToSysRam,
FromSysRamToStorage,
GainedResidency,
LostResidency,
PoolTextureSlotChanged,
ResidentToSysRamSync,
MetadataCacheOutOfDate,
ExceptionThrown,
FsaaSettingAlteredByApi,
ReadyForRendering,
Deleted
} |
|
enum | Status { Ready,
Downloading,
Mapped
} |
|
|
| AsyncTextureTicket (uint32 width, uint32 height, uint32 depthOrSlices, TextureTypes::TextureTypes textureType, PixelFormatGpu pixelFormatFamily) |
|
virtual | ~AsyncTextureTicket () |
|
virtual bool | canMapMoreThanOneSlice (void) const |
| See Image2::convertFromTexture for an example of how to use AyncTextureTicket. More...
|
|
void | download (TextureGpu *textureSrc, uint8 mipLevel, bool accurateTracking, TextureBox *srcBox=0, bool bImmediate=false) |
| Downloads textureSrc into this ticket. More...
|
|
size_t | getBytesPerImage (void) const |
|
size_t | getBytesPerRow (void) const |
|
uint32 | getDepth (void) const |
| For TypeCube & TypeCubeArray, this value returns 1. More...
|
|
uint32 | getDepthOrSlices (void) const |
|
uint32 | getHeight (void) const |
|
uint32 | getNumSlices (void) const |
| For TypeCube this value returns 6. More...
|
|
PixelFormatGpu | getPixelFormatFamily (void) const |
|
uint32 | getWidth (void) const |
|
TextureBox | map (uint32 slice) |
| Maps the buffer for CPU access. More...
|
|
virtual void | notifyTextureChanged (TextureGpu *texture, TextureGpuListener::Reason reason, void *extraData) |
| TextureGpuListener overload. More...
|
|
void | operator delete (void *ptr) |
|
void | operator delete (void *ptr, void *) |
|
void | operator delete (void *ptr, const char *, int, const char *) |
|
void | operator delete[] (void *ptr) |
|
void | operator delete[] (void *ptr, const char *, int, const char *) |
|
void * | operator new (size_t sz, const char *file, int line, const char *func) |
| operator new, with debug line info More...
|
|
void * | operator new (size_t sz) |
|
void * | operator new (size_t sz, void *ptr) |
| placement operator new More...
|
|
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
| array operator new, with debug line info More...
|
|
void * | operator new[] (size_t sz) |
|
virtual bool | queryIsTransferDone (void) |
|
virtual bool | shouldStayLoaded (TextureGpu *texture) |
| Return true if this TextureGpu should likely stay loaded or else graphical changes could occur. More...
|
|
void | unmap (void) |
| Unmaps the pointer mapped with map(). More...
|
|
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.
- Use queryIsTransferDone to query if the transfer has finished. Beware not all APIs support querying async transfer status. In those cases there is no reliable way to determine when the transfer is done. An almost safe bet is to wait two frames before mapping.
- Call TextureGpuManager::destroyAsyncTextureTicket when you're done with this ticket.
◆ Reason
Enumerator |
---|
Unknown | |
FromStorageToSysRam | OnStorage -> OnSystemRam.
|
FromSysRamToStorage | OnSystemRam -> OnStorage.
|
GainedResidency | OnStorage -> Resident OnSystemRam -> Resident See ReadyForRendering.
|
LostResidency | Resident -> OnStorage Resident -> OnSystemRam.
|
PoolTextureSlotChanged | |
ResidentToSysRamSync | Only called while TextureGpu is still Resident, and strategy is AlwaysKeepSystemRamCopy.
This listener happens when something was done to the TextureGpu that modifies its contents in the GPU, and were thus forced to sync those values back to SystemRam. This listener calls tells that sync is over.
|
MetadataCacheOutOfDate | The Metadata cache was out of date and we had to do a ping-pong.
Expect this to be followed by at least LostResidency and GainedResidency calls
This is very important, because if you were expecting certain sequence of calls (e.g. you were expecting a LostResidency soon to arrive), expect that to be changed.
See TextureGpuManager for details about the metadata cache.
|
ExceptionThrown | Called when the worker thread caught an exception.
This exception has already been logged, and the texture resumed loading normally with a white 2x2 RGBA8 fallback.
This listener will get called from the main thread.
The texture may still have pending residency transitions (e.g. it may still be loading the 2x2 fallback)
Cast Exception e = reinterpret_cast<Exception>( extraData ); to know more info
|
FsaaSettingAlteredByApi | Requested FSAA (MSAA / CSAA / EQAA / etc) is not supported by the API, and thus the setting had to be downgraded.
Note this may happen on device lost, and a new GPU became in use; thus it's possible for a TextureGpu to initially support certain FSAA but later change.
|
ReadyForRendering | This Reason is called when TextureGpu::notifyDataIsReady is called.
This normally means worker thread is done loading texture from file and uploading it to GPU; and can now be used for rendering. It does NOT mean that Ogre has finished issueing rendering commands to a RenderTexture and is now ready to be presented to the monitor.
|
Deleted | |
◆ Status
Enumerator |
---|
Ready | |
Downloading | |
Mapped | |
◆ AsyncTextureTicket()
◆ ~AsyncTextureTicket()
virtual Ogre::AsyncTextureTicket::~AsyncTextureTicket |
( |
| ) |
|
|
virtual |
◆ canMapMoreThanOneSlice()
virtual bool Ogre::AsyncTextureTicket::canMapMoreThanOneSlice |
( |
void |
| ) |
const |
|
inlinevirtual |
◆ download()
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.
- Parameters
-
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. |
◆ getBytesPerImage()
size_t Ogre::AsyncTextureTicket::getBytesPerImage |
( |
void |
| ) |
const |
◆ getBytesPerRow()
size_t Ogre::AsyncTextureTicket::getBytesPerRow |
( |
void |
| ) |
const |
◆ getDepth()
uint32 Ogre::AsyncTextureTicket::getDepth |
( |
void |
| ) |
const |
For TypeCube & TypeCubeArray, this value returns 1.
◆ getDepthOrSlices()
uint32 Ogre::AsyncTextureTicket::getDepthOrSlices |
( |
void |
| ) |
const |
◆ getHeight()
uint32 Ogre::AsyncTextureTicket::getHeight |
( |
void |
| ) |
const |
◆ getNumSlices()
uint32 Ogre::AsyncTextureTicket::getNumSlices |
( |
void |
| ) |
const |
For TypeCube this value returns 6.
For TypeCubeArray, value returns numSlices * 6u.
◆ getPixelFormatFamily()
PixelFormatGpu Ogre::AsyncTextureTicket::getPixelFormatFamily |
( |
void |
| ) |
const |
◆ getWidth()
uint32 Ogre::AsyncTextureTicket::getWidth |
( |
void |
| ) |
const |
◆ map()
Maps the buffer for CPU access.
Will stall if transfer from GPU memory to staging area hasn't finished yet. See queryIsTransferDone.
- NOTE: When mapping a texture bigger than 2048x2048; in D3D11 the the returned pointer will return TextureBox::numSlices = 1, In this case you will have to use that slice, unmap this ticket, and map it again with the next slice.
- See Image2::convertFromTexture for an example of how to use AyncTextureTicket
- Parameters
-
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) |
- Returns
- The pointer with the data read from the GPU. Read only.
◆ notifyTextureChanged()
◆ operator delete() [1/3]
◆ operator delete() [2/3]
◆ operator delete() [3/3]
◆ operator delete[]() [1/2]
◆ operator delete[]() [2/2]
◆ operator new() [1/3]
template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new |
( |
size_t |
sz, |
|
|
const char * |
file, |
|
|
int |
line, |
|
|
const char * |
func |
|
) |
| |
|
inlineinherited |
operator new, with debug line info
◆ operator new() [2/3]
◆ operator new() [3/3]
◆ operator new[]() [1/2]
template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] |
( |
size_t |
sz, |
|
|
const char * |
file, |
|
|
int |
line, |
|
|
const char * |
func |
|
) |
| |
|
inlineinherited |
array operator new, with debug line info
◆ operator new[]() [2/2]
◆ queryIsTransferDone()
virtual bool Ogre::AsyncTextureTicket::queryIsTransferDone |
( |
void |
| ) |
|
|
virtual |
◆ shouldStayLoaded()
virtual bool Ogre::TextureGpuListener::shouldStayLoaded |
( |
TextureGpu * |
texture | ) |
|
|
inlinevirtualinherited |
◆ unmap()
void Ogre::AsyncTextureTicket::unmap |
( |
void |
| ) |
|
Unmaps the pointer mapped with map().
The documentation for this class was generated from the following file: