![]() |
OGRE-Next
2.3
Object-Oriented Graphics Rendering Engine
|
This is a Default implementation of TextureGpuManagerListener based on heuristics. More...
#include <OgreTextureGpuManagerListener.h>
Public Types | |
enum | Reason { Unknown , FromStorageToSysRam , FromSysRamToStorage , GainedResidency , LostResidency , PoolTextureSlotChanged , ResidentToSysRamSync , MetadataCacheOutOfDate , ExceptionThrown , FsaaSettingAlteredByApi , ReadyForRendering , Deleted } |
Public Member Functions | |
DefaultTextureGpuManagerListener () | |
size_t | getNumSlicesFor (TextureGpu *texture, TextureGpuManager *textureManager) override |
Ogre normally puts Textures into pools (a Type2DArray texture) for efficient rendering Note that only textures of the same resolution and format can be put together in the same pool. More... | |
void | notifyTextureChanged (TextureGpu *texture, TextureGpuListener::Reason reason, void *extraData) override |
Called when a TextureGpu changed in a way that affects how it is displayed: More... | |
virtual bool | shouldStayLoaded (TextureGpu *texture) |
Return true if this TextureGpu should likely stay loaded or else graphical changes could occur. More... | |
Public Attributes | |
uint32 | mMaxResolutionToApplyMinSlices [4] |
If texture resolution is <= maxResolutionToApplyMinSlices[i]; we'll apply minSlicesPerPool[i]. More... | |
uint16 | mMinSlicesPerPool [4] |
Minimum slices per pool, regardless of maxBytesPerPool. More... | |
bool | mPackNonPow2 |
Whether non-power-of-2 textures should also be pooled, or we should return 1. More... | |
This is a Default implementation of TextureGpuManagerListener based on heuristics.
These heuristics can be adjusted by modifying its member variables directly.
|
inherited |
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 |
Ogre::DefaultTextureGpuManagerListener::DefaultTextureGpuManagerListener | ( | ) |
|
overridevirtual |
Ogre normally puts Textures into pools (a Type2DArray texture) for efficient rendering Note that only textures of the same resolution and format can be put together in the same pool.
This creates two issues: Unless it is known in advance, we do not know how large the array should be. if we create a pool that can hold 64 entries but only 1 texture is actually needed, then we waste a lot of GPU memory. Large textures, such as 4096x4096 RGBA8 occupy a lot of memory 64MB. These pools should not contain a large number of entries. For example creating a pool of 8 entries of these textures means we'd be asking the OS for 512MB of contiguous memory. Due to memory fragmentation, such request is likely to fail and cause Out of Memory conditions.
texture | The first texture to which will be creating a pool based on its parameters |
textureManager | The manager, in case you need more info. |
Implements Ogre::TextureGpuManagerListener.
|
overridevirtual |
Called when a TextureGpu changed in a way that affects how it is displayed:
Implements Ogre::TextureGpuListener.
|
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.
uint32 Ogre::DefaultTextureGpuManagerListener::mMaxResolutionToApplyMinSlices[4] |
If texture resolution is <= maxResolutionToApplyMinSlices[i]; we'll apply minSlicesPerPool[i].
Otherwise, we'll apply minSlicesPerPool[i+1] If resolution > mMaxResolutionToApplyMinSlices[N]; then minSlicesPerPool = 1;
uint16 Ogre::DefaultTextureGpuManagerListener::mMinSlicesPerPool[4] |
Minimum slices per pool, regardless of maxBytesPerPool.
It's also the starting num of slices. See mMaxResolutionToApplyMinSlices
bool Ogre::DefaultTextureGpuManagerListener::mPackNonPow2 |
Whether non-power-of-2 textures should also be pooled, or we should return 1.