OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::MetalTextureGpuManager Class Referencefinal

#include <OgreMetalTextureGpuManager.h>

+ Inheritance diagram for Ogre::MetalTextureGpuManager:

Public Member Functions

 MetalTextureGpuManager (VaoManager *vaoManager, RenderSystem *renderSystem, MetalDevice *device)
 
 ~MetalTextureGpuManager () override
 
bool checkSupport (PixelFormatGpu format, TextureTypes::TextureTypes textureType, uint32 textureFlags) const override
 Checks if the given format with the texture flags combination is supported. More...
 
TextureGpucreateTextureGpuWindow (MetalWindow *window)
 Creates a special MetalTextureGpuWindow pointer, to be used by Ogre::Window. More...
 
TextureGpucreateWindowDepthBuffer ()
 
id< MTLTexture > getBlankTextureMetalName (TextureTypes::TextureTypes textureType) const
 
MetalDevicegetDevice () const
 
- Public Member Functions inherited from Ogre::TextureGpuManager
 TextureGpuManager (VaoManager *vaoManager, RenderSystem *renderSystem)
 
 ~TextureGpuManager () override
 
void _queueDownloadToRam (TextureGpu *texture, bool resyncOnly)
 
void _releaseSlotFromTexture (TextureGpu *texture)
 Must be called from main thread. More...
 
void _removeMetadataCacheEntry (TextureGpu *texture)
 
void _reserveSlotForTexture (TextureGpu *texture)
 Must be called from main thread. More...
 
void _scheduleTransitionTo (TextureGpu *texture, GpuResidency::GpuResidency targetResidency, Image2 *image, bool autoDeleteImage, bool reuploadOnly, bool bSkipMultiload)
 
void _scheduleUpdate (TextureGpu *texture, uint32 filters, Image2 *image, bool autoDeleteImage, bool skipMetadataCache=false, uint32 sliceOrDepth=std::numeric_limits< uint32 >::max())
 
void _setIgnoreScheduledTasks (bool ignoreSchedTasks)
 When true we will ignore all tasks in mScheduledTasks and execute transitions immediately Caller is responsible for ensuring this is safe to do. More...
 
bool _update (bool syncWithWorkerThread)
 Returns true if there is no more streaming work to be done yet (if false, calls to _update could be needed once again) See waitForStreamingCompletion. More...
 
void _updateMetadataCache (TextureGpu *texture)
 
void _updateStreaming ()
 
unsigned long _updateStreamingWorkerThread (ThreadHandle *threadHandle)
 
unsigned long _updateTextureMultiLoadWorkerThread (ThreadHandle *threadHandle)
 Implements multiload. More...
 
void _waitFor (TextureGpu *texture, bool metadataOnly)
 Do not use directly. See TextureGpu::waitForMetadata & TextureGpu::waitForDataReady. More...
 
void _waitForPendingGpuToCpuSyncs (TextureGpu *texture)
 Do not use directly. See TextureGpu::waitForPendingSyncs. More...
 
AsyncTextureTicketcreateAsyncTextureTicket (uint32 width, uint32 height, uint32 depthOrSlices, TextureTypes::TextureTypes textureType, PixelFormatGpu pixelFormatFamily)
 Creates an AsyncTextureTicket that can be used to download data GPU -> CPU from a TextureGpu. More...
 
TextureGpucreateOrRetrieveTexture (const String &name, const String &aliasName, GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, CommonTextureTypes::CommonTextureTypes type, const String &resourceGroup=BLANKSTRING, uint32 poolId=0)
 Helper function to call createOrRetrieveTexture with common parameters used for 2D diffuse textures loaded from file. More...
 
TextureGpucreateOrRetrieveTexture (const String &name, const String &aliasName, GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, uint32 textureFlags, TextureTypes::TextureTypes initialType, const String &resourceGroup=BLANKSTRING, uint32 filters=0, uint32 poolId=0)
 
TextureGpucreateOrRetrieveTexture (const String &name, GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, CommonTextureTypes::CommonTextureTypes type, const String &resourceGroup=BLANKSTRING, uint32 poolId=0)
 
TextureGpucreateOrRetrieveTexture (const String &name, GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, uint32 textureFlags, TextureTypes::TextureTypes initialType, const String &resourceGroup=BLANKSTRING, uint32 filters=0, uint32 poolId=0)
 
TextureGpucreateTexture (const String &name, const String &aliasName, GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, uint32 textureFlags, TextureTypes::TextureTypes initialType, const String &resourceGroup=BLANKSTRING, uint32 filters=0, uint32 poolId=0)
 
TextureGpucreateTexture (const String &name, GpuPageOutStrategy::GpuPageOutStrategy pageOutStrategy, uint32 textureFlags, TextureTypes::TextureTypes initialType, const String &resourceGroup=BLANKSTRING, uint32 filters=0, uint32 poolId=0)
 
void destroyAllAsyncTextureTicket ()
 
void destroyAsyncTextureTicket (AsyncTextureTicket *ticket)
 
void destroyTexture (TextureGpu *texture)
 Destroys a texture. More...
 
void dumpMemoryUsage (Log *log, Ogre::uint32 mask=ResidencyMask::All) const
 
void dumpStats () const
 
void exportTextureMetadataCache (String &outJson)
 
const StringfindAliasNameStr (IdString idName) const
 This function CAN be called from any thread. More...
 
const StringfindResourceGroupStr (IdString idName) const
 This function CAN be called from any thread. More...
 
const StringfindResourceNameStr (IdString idName) const
 This function CAN be called from any thread. More...
 
TextureGpufindTextureNoThrow (IdString name) const
 
const BudgetEntryVecgetBudget () const
 
DefaultMipmapGen::DefaultMipmapGen getDefaultMipmapGeneration () const
 
DefaultMipmapGen::DefaultMipmapGen getDefaultMipmapGenerationCubemaps () const
 
const ResourceEntryMapgetEntries () const
 
uint64 getLoadRequestsCounter () const
 Calling waitForStreamingCompletion before Root::renderOneFrame should guarantee the render is perfect. More...
 
void getMemoryStats (size_t &outTextureBytesCpu, size_t &outTextureBytesGpu, size_t &outUsedStagingTextureBytes, size_t &outAvailableStagingTextureBytes)
 
bool getProfileLoadingTime () const
 
RenderSystemgetRenderSystem () const
 
StagingTexturegetStagingTexture (uint32 width, uint32 height, uint32 depth, uint32 slices, PixelFormatGpu pixelFormat, size_t minConsumptionRatioThreshold=25u)
 Creates a StagingTexture which is required to upload data CPU -> GPU into a TextureGpu. More...
 
VaoManagergetVaoManager () const
 
bool hasPoolId (uint32 poolId, uint32 width, uint32 height, uint8 numMipmaps, PixelFormatGpu pixelFormat) const
 
bool hasTextureResource (const String &aliasName, const String &resourceGroup) const
 Returns true if a texture with the given aliasName exists, or if a ResourceGroupListener provides such texture, or if such texture exists (i.e. More...
 
void importTextureMetadataCache (const String &filename, const char *jsonString, bool bCreateReservedPools)
 
bool isDoneStreaming () const
 Returns true if we're done loading all textures based on the return value of the last call to TextureGpuManager::_update and whether new tasks have been scheduled since then. More...
 
void notifyTextureChanged (TextureGpu *texture, TextureGpuListener::Reason reason, void *extraData) override
 
void removeStagingTexture (StagingTexture *stagingTexture)
 
TextureGpureservePoolId (uint32 poolId, uint32 width, uint32 height, uint32 numSlices, uint8 numMipmaps, PixelFormatGpu pixelFormat)
 Reserves and preallocates a pool with the given parameters Returns the master texture that owns the pool. More...
 
void saveTexture (TextureGpu *texture, const String &folderPath, set< String >::type &savedTextures, bool saveOitd, bool saveOriginal, HlmsTextureExportListener *listener)
 
void setDefaultMipmapGeneration (DefaultMipmapGen::DefaultMipmapGen defaultMipmapGen, DefaultMipmapGen::DefaultMipmapGen defaultMipmapGenCubemaps)
 Whether to use HW or SW mipmap generation when specifying TextureFilter::TypeGenerateDefaultMipmaps for loading files from textures. More...
 
void setMultiLoadPool (uint32 numThreads)
 OgreNext always performs background streaming to load textures in a worker thread. More...
 
void setProfileLoadingTime (bool bProfile)
 When enabled, we will profile the time it takes a texture to go from Resident to Ready and Log it. More...
 
void setStagingTextureMaxBudgetBytes (size_t stagingTextureMaxBudgetBytes)
 At a high level, texture loading works like this: More...
 
void setTextureGpuManagerListener (TextureGpuManagerListener *listener)
 Sets a new listener. More...
 
void setTrylockMutexFailureLimit (uint32 tryLockFailureLimit)
 The main thread tries to acquire a lock from the background thread, do something very quick, and release it. More...
 
void setWorkerThreadMaxPerStagingTextureRequestBytes (size_t maxPerStagingTextureRequestBytes)
 The worker thread tracks how many data it is loading so the Main thread can request additional StagingTextures if necessary. More...
 
void setWorkerThreadMaxPreloadBytes (size_t maxPreloadBytes)
 The worker thread first loads the texture from disk to RAM (aka "preload", and then copies from RAM to StagingTexture. More...
 
void setWorkerThreadMinimumBudget (const BudgetEntryVec &budget, uint32 maxSplitResolution=0)
 Background streaming works by having a bunch of preallocated StagingTextures so we're ready to start uploading as soon as we see a request to load a texture from file. More...
 
void shutdown ()
 
void waitForStreamingCompletion ()
 Blocks main thread until all pending textures are fully loaded. More...
 
- 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. More...
 

Additional Inherited Members

- Public Types inherited from Ogre::TextureGpuManager
typedef vector< BudgetEntry >::type BudgetEntryVec
 
typedef map< IdString, MetadataCacheEntry >::type MetadataCacheMap
 
typedef map< IdString, ResourceEntry >::type ResourceEntryMap
 
- Public Types inherited from Ogre::TextureGpuListener
enum  Reason {
  Unknown , FromStorageToSysRam , FromSysRamToStorage , GainedResidency ,
  LostResidency , PoolTextureSlotChanged , ResidentToSysRamSync , MetadataCacheOutOfDate ,
  ExceptionThrown , FsaaSettingAlteredByApi , ReadyForRendering , Deleted
}
 
- Public Attributes inherited from Ogre::TextureGpuManager
bool mIgnoreSRgbPreference
 While true, calls to createTexture & createOrRetrieveTexture will ignore and unset the TextureFlags::PrefersLoadingFromFileAsSRGB flag. More...
 

Constructor & Destructor Documentation

◆ MetalTextureGpuManager()

Ogre::MetalTextureGpuManager::MetalTextureGpuManager ( VaoManager vaoManager,
RenderSystem renderSystem,
MetalDevice device 
)

◆ ~MetalTextureGpuManager()

Ogre::MetalTextureGpuManager::~MetalTextureGpuManager ( )
override

Member Function Documentation

◆ checkSupport()

bool Ogre::MetalTextureGpuManager::checkSupport ( PixelFormatGpu  format,
TextureTypes::TextureTypes  textureType,
uint32  textureFlags 
) const
overridevirtual

Checks if the given format with the texture flags combination is supported.

Parameters
format
textureFlagsSee TextureFlags::TextureFlags Supported flags are: NotTexture RenderToTexture Uav AllowAutomipmaps

When NotTexture is set, we don't check whether it's possible to sample from this texture. Note that some buggy Android drivers may report that it's not possible to sample from that texture when it actually is.

Returns
True if supported. False otherwise

Reimplemented from Ogre::TextureGpuManager.

◆ createTextureGpuWindow()

TextureGpu* Ogre::MetalTextureGpuManager::createTextureGpuWindow ( MetalWindow window)

Creates a special MetalTextureGpuWindow pointer, to be used by Ogre::Window.

The pointer can be freed by a regular OGRE_DELETE. We do not track this pointer. If caller doesn't delete it, it will leak.

◆ createWindowDepthBuffer()

TextureGpu* Ogre::MetalTextureGpuManager::createWindowDepthBuffer ( )

◆ getBlankTextureMetalName()

id<MTLTexture> Ogre::MetalTextureGpuManager::getBlankTextureMetalName ( TextureTypes::TextureTypes  textureType) const

◆ getDevice()

MetalDevice* Ogre::MetalTextureGpuManager::getDevice ( ) const
inline

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