OGRE  2.2.4
Object-Oriented Graphics Rendering Engine
Ogre::GpuResource Class Reference

#include <OgreGpuResource.h>

+ Inheritance diagram for Ogre::GpuResource:

Public Member Functions

 GpuResource (GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, VaoManager *vaoManager, IdString name)
 
virtual ~GpuResource ()
 
void _addPendingResidencyChanges (uint32 value)
 
void _setNextResidencyStatus (GpuResidency::GpuResidency nextResidency)
 
GpuPageOutStrategy::GpuPageOutStrategy getGpuPageOutStrategy (void) const
 
IdString getName (void) const
 
virtual String getNameStr (void) const
 Retrieves a user-friendly name. More...
 
GpuResidency::GpuResidency getNextResidencyStatus (void) const
 When getResidencyStatus() != getNextResidencyStatus(), residency changes happen in the main thread, while some preparation may be happening in the background. More...
 
uint32 getPendingResidencyChanges (void) const
 Returns the number of pending residency changes. More...
 
GpuResidency::GpuResidency getResidencyStatus (void) const
 
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)
 

Constructor & Destructor Documentation

◆ GpuResource()

Ogre::GpuResource::GpuResource ( GpuPageOutStrategy::GpuPageOutStrategy  pageOutStrategy,
VaoManager vaoManager,
IdString  name 
)

◆ ~GpuResource()

virtual Ogre::GpuResource::~GpuResource ( )
virtual

Member Function Documentation

◆ _addPendingResidencyChanges()

void Ogre::GpuResource::_addPendingResidencyChanges ( uint32  value)

◆ _setNextResidencyStatus()

void Ogre::GpuResource::_setNextResidencyStatus ( GpuResidency::GpuResidency  nextResidency)

◆ getGpuPageOutStrategy()

GpuPageOutStrategy::GpuPageOutStrategy Ogre::GpuResource::getGpuPageOutStrategy ( void  ) const

◆ getName()

IdString Ogre::GpuResource::getName ( void  ) const

◆ getNameStr()

virtual String Ogre::GpuResource::getNameStr ( void  ) const
virtual

Retrieves a user-friendly name.

May involve a look up. NOT THREAD SAFE. ONLY CALL FROM MAIN THREAD.

Reimplemented in Ogre::TextureGpu.

◆ getNextResidencyStatus()

GpuResidency::GpuResidency Ogre::GpuResource::getNextResidencyStatus ( void  ) const

When getResidencyStatus() != getNextResidencyStatus(), residency changes happen in the main thread, while some preparation may be happening in the background.

For example when a texture is not resident but getNextResidencyStatus says it will, a background thread is loading the texture file from disk, but the actual transition won't happen until the main thread changes it. You can call texture->waitForData() which will stall, as the main thread will be communicating back and forth with the background to see if it's ready; and when it is, the main thread will perform the transition inside waitForData

Likewise, if that texture is resident but will soon not be, it is still legal to access its contents as long as you access them from the main thread before that main thread changes the residency. This gives you a strong serialization guarantee, but be careful with async tickets such as AsyncTextureTickets:

If you call AsyncTextureTicket *asyncTicket = textureManager->createAsyncTextureTicket( ... ); assert( texture->getResidencyStatus() == GpuResidency::Resident ); ... do something else that calls Ogre functionality ... assert( texture->getResidencyStatus() == GpuResidency::Resident ); asyncTicket->download( texture, mip, true ); Then the second assert may trigger because that "do something else" ended up calling a function inside Ogre that finalized the transition. Once you've called download and the resource was still Resident, you are safe that your data integrity will be kept.

Remarks
Beware of the ABA problem. If the following transitions are scheduled: OnStorage -> Resident -> OnStorage Then both getResidencyStatus & getNextResidencyStatus will return OnStorage. Use GpuResource::getPendingResidencyChanges to fix the ABA problem.

◆ getPendingResidencyChanges()

uint32 Ogre::GpuResource::getPendingResidencyChanges ( void  ) const

Returns the number of pending residency changes.

Residency changes may not be immediate and thus be delayed (e.g. see TextureGpu::scheduleTransitionTo).

When this value is 0 it implies that mResidencyStatus == mNextResidencyStatus

◆ getResidencyStatus()

GpuResidency::GpuResidency Ogre::GpuResource::getResidencyStatus ( void  ) const

◆ 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,
void *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
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,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [2/3]

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

◆ 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,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

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

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

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