OGRE-Next: Ogre::DefaultTextureGpuManagerListener Class Reference

| OGRE-Next 3.0.0 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Ogre::DefaultTextureGpuManagerListener Class Reference
Core » Resources

This is a Default implementation of TextureGpuManagerListener based on heuristics. More...

`#include <OgreTextureGpuManagerListener.h>`

Inheritance diagram for Ogre::DefaultTextureGpuManagerListener:
[legend]

## Public Member Functions
| DefaultTextureGpuManagerListener ()
uint32 | getFiltersFor (const String &name, const String &aliasName, uint32 filters) const override
| getFiltersFor Gets a chance to alter the filters needed for the given texture to load
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.
void | notifyTextureChanged (TextureGpu *texture, TextureGpuListener::Reason reason, void *extraData) override
| Called when a TextureGpu changed in a way that affects how it is displayed:
Public Member Functions inherited from Ogre::TextureGpuManagerListener
| ~TextureGpuManagerListener () override
Public Member Functions inherited from Ogre::TextureGpuListener
virtual | ~TextureGpuListener ()
virtual bool | shouldStayLoaded (TextureGpu *texture)
| Return true if this TextureGpu should likely stay loaded or else graphical changes could occur.

## Public Attributes
uint32 | mMaxResolutionToApplyMinSlices [4]
| If texture resolution is <= maxResolutionToApplyMinSlices[i]; we'll apply minSlicesPerPool[i].
uint16 | mMinSlicesPerPool [4]
| Minimum slices per pool, regardless of maxBytesPerPool.
bool | mPackNonPow2
| Whether non-power-of-2 textures should also be pooled, or we should return 1.

## Additional Inherited Members
Public Types inherited from Ogre::TextureGpuListener
enum | Reason { Unknown , FromStorageToSysRam , FromSysRamToStorage , GainedResidency , LostResidency , PoolTextureSlotChanged , ResidentToSysRamSync , MetadataCacheOutOfDate , ExceptionThrown , FsaaSettingAlteredByApi , ReadyForRendering , Deleted }

## Detailed Description

This is a Default implementation of TextureGpuManagerListener based on heuristics.

These heuristics can be adjusted by modifying its member variables directly.

## Constructor & Destructor Documentation

## ◆ DefaultTextureGpuManagerListener()

Ogre::DefaultTextureGpuManagerListener::DefaultTextureGpuManagerListener | ( |  | ) |

## Member Function Documentation

## ◆ getFiltersFor()

uint32 Ogre::DefaultTextureGpuManagerListener::getFiltersFor | ( | const String & | name,
|  | const String & | aliasName,
|  | uint32 | filters ) const
| overridevirtual

getFiltersFor Gets a chance to alter the filters needed for the given texture to load

Parameters

  name | Name of the texture
  aliasName | Alias name of the texture
  filters | Current filters that are to be applied

Returns
  Actual filters to apply, if the listener modifies them

Implements Ogre::TextureGpuManagerListener.

## ◆ getNumSlicesFor()

size_t Ogre::DefaultTextureGpuManagerListener::getNumSlicesFor | ( | TextureGpu * | texture,
|  | TextureGpuManager * | textureManager )
| 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.
  Parameters

    texture | The first texture to which will be creating a pool based on its parameters
    textureManager | The manager, in case you need more info.

  Returns
    How many entries the pool should be able to hold.

Implements Ogre::TextureGpuManagerListener.

## ◆ notifyTextureChanged()

void Ogre::DefaultTextureGpuManagerListener::notifyTextureChanged | ( | TextureGpu * | texture,
|  | TextureGpuListener::Reason | reason,
|  | void * | extraData )
| overridevirtual

Called when a TextureGpu changed in a way that affects how it is displayed:

1. TextureGpu::notifyDataIsReady got called (texture is ready to be displayed)
2. Texture changed residency status.
3. Texture is being deleted. It won't be a valid pointer after this call.

Implements Ogre::TextureGpuListener.

## Member Data Documentation

## ◆ mMaxResolutionToApplyMinSlices

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;

## ◆ mMinSlicesPerPool

uint16 Ogre::DefaultTextureGpuManagerListener::mMinSlicesPerPool[4]

Minimum slices per pool, regardless of maxBytesPerPool.

It's also the starting num of slices. See mMaxResolutionToApplyMinSlices

## ◆ mPackNonPow2

bool Ogre::DefaultTextureGpuManagerListener::mPackNonPow2

Whether non-power-of-2 textures should also be pooled, or we should return 1.

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

- OgreTextureGpuManagerListener.h