OGRE-Next  2.3
Object-Oriented Graphics Rendering Engine
Ogre::NULLAsyncTextureTicket Class Reference

See AsyncTextureTicket. More...

#include <OgreNULLAsyncTextureTicket.h>

+ Inheritance diagram for Ogre::NULLAsyncTextureTicket:

Public Types

enum  Reason {
  Unknown , FromStorageToSysRam , FromSysRamToStorage , GainedResidency ,
  LostResidency , PoolTextureSlotChanged , ResidentToSysRamSync , MetadataCacheOutOfDate ,
  ExceptionThrown , FsaaSettingAlteredByApi , ReadyForRendering , Deleted
}
 
enum  Status { Ready , Downloading , Mapped }
 

Public Member Functions

 NULLAsyncTextureTicket (uint32 width, uint32 height, uint32 depthOrSlices, TextureTypes::TextureTypes textureType, PixelFormatGpu pixelFormatFamily)
 
virtual ~NULLAsyncTextureTicket ()
 
virtual bool canMapMoreThanOneSlice () 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 () const
 
size_t getBytesPerRow () const
 
uint32 getDepth () const
 For TypeCube & TypeCubeArray, this value returns 1. More...
 
uint32 getDepthOrSlices () const
 
uint32 getHeight () const
 
uint32 getNumSlices () const
 For TypeCube this value returns 6. More...
 
PixelFormatGpu getPixelFormatFamily () const
 
uint32 getWidth () const
 
TextureBox map (uint32 slice)
 Maps the buffer for CPU access. More...
 
void notifyTextureChanged (TextureGpu *texture, TextureGpuListener::Reason reason, void *extraData) override
 TextureGpuListener overload. More...
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete (void *ptr, void *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz)
 
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 *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz)
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
virtual bool queryIsTransferDone ()
 
virtual bool shouldStayLoaded (TextureGpu *texture)
 Return true if this TextureGpu should likely stay loaded or else graphical changes could occur. More...
 
void unmap ()
 Unmaps the pointer mapped with map(). More...
 

Detailed Description

Member Enumeration Documentation

◆ 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 

Constructor & Destructor Documentation

◆ NULLAsyncTextureTicket()

Ogre::NULLAsyncTextureTicket::NULLAsyncTextureTicket ( uint32  width,
uint32  height,
uint32  depthOrSlices,
TextureTypes::TextureTypes  textureType,
PixelFormatGpu  pixelFormatFamily 
)

◆ ~NULLAsyncTextureTicket()

virtual Ogre::NULLAsyncTextureTicket::~NULLAsyncTextureTicket ( )
virtual

Member Function Documentation

◆ canMapMoreThanOneSlice()

virtual bool Ogre::AsyncTextureTicket::canMapMoreThanOneSlice ( ) const
inlinevirtualinherited

See Image2::convertFromTexture for an example of how to use AyncTextureTicket.

◆ download()

void Ogre::AsyncTextureTicket::download ( TextureGpu textureSrc,
uint8  mipLevel,
bool  accurateTracking,
TextureBox srcBox = 0,
bool  bImmediate = false 
)
inherited

Downloads textureSrc into this ticket.

The size (resolution) of this ticket must match exactly of the region to download.

Remarks
The texture must either be Resident, or being streamed (i.e. scheduled to become Resident) If the texture isn't done streaming, the ticket will automatically schedule itself to perform the actual download once the streaming is done. If the Texture has a SystemRAM copy, it won't be used. You must access that directly, not via AsyncTextureTicket.
Parameters
textureSrcTexture to download from. Must be resident.
mipLevelMip level to download.
accurateTrackingWhen 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.
srcBoxWhen 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!)
bImmediateWhen 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 ( ) const
inherited

◆ getBytesPerRow()

size_t Ogre::AsyncTextureTicket::getBytesPerRow ( ) const
inherited

◆ getDepth()

uint32 Ogre::AsyncTextureTicket::getDepth ( ) const
inherited

For TypeCube & TypeCubeArray, this value returns 1.

◆ getDepthOrSlices()

uint32 Ogre::AsyncTextureTicket::getDepthOrSlices ( ) const
inherited

◆ getHeight()

uint32 Ogre::AsyncTextureTicket::getHeight ( ) const
inherited

◆ getNumSlices()

uint32 Ogre::AsyncTextureTicket::getNumSlices ( ) const
inherited

For TypeCube this value returns 6.

For TypeCubeArray, value returns numSlices * 6u.

◆ getPixelFormatFamily()

PixelFormatGpu Ogre::AsyncTextureTicket::getPixelFormatFamily ( ) const
inherited

◆ getWidth()

uint32 Ogre::AsyncTextureTicket::getWidth ( ) const
inherited

◆ map()

TextureBox Ogre::AsyncTextureTicket::map ( uint32  slice)
inherited

Maps the buffer for CPU access.

Will stall if transfer from GPU memory to staging area hasn't finished yet. See queryIsTransferDone.

Remarks
Attempting to write to the returned pointer is undefined behavior. Be careful of TextureBox::bytesPerRow & bytesPerImage, when downloading a subregion of a texture, these values may not always be what you expect.
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
sliceFirst 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()

void Ogre::AsyncTextureTicket::notifyTextureChanged ( TextureGpu texture,
TextureGpuListener::Reason  reason,
void *  extraData 
)
overridevirtualinherited

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [2/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() [3/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ operator new[]() [2/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

◆ queryIsTransferDone()

virtual bool Ogre::NULLAsyncTextureTicket::queryIsTransferDone ( )
virtual

Reimplemented from Ogre::AsyncTextureTicket.

◆ shouldStayLoaded()

virtual bool Ogre::TextureGpuListener::shouldStayLoaded ( TextureGpu texture)
inlinevirtualinherited

Return true if this TextureGpu should likely stay loaded or else graphical changes could occur.

Return false if it is certainly safe to unload.

Reimplemented in Ogre::VctLighting, and Ogre::OGRE_HLMS_TEXTURE_BASE_CLASS.

◆ unmap()

void Ogre::AsyncTextureTicket::unmap ( )
inherited

Unmaps the pointer mapped with map().


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