Skip to content

Commit

Permalink
fixes for memoryless_tiler feature
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenegff committed Nov 21, 2024
1 parent 7b3a46e commit 4c58ba8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
5 changes: 1 addition & 4 deletions RenderSystems/Metal/src/OgreMetalTextureGpuManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@ of this software and associated documentation files (the "Software"), to deal
//-----------------------------------------------------------------------------------
TextureGpu *MetalTextureGpuManager::createTextureGpuWindow( MetalWindow *window )
{
const RenderSystemCapabilities *capabilities =
Root::getSingleton().getRenderSystem()->getCapabilities();
const bool isTiler = capabilities->hasCapability( RSC_IS_TILER );
return OGRE_NEW MetalTextureGpuWindow( GpuPageOutStrategy::Discard, mVaoManager, "RenderWindow",
TextureFlags::NotTexture | TextureFlags::RenderToTexture |
TextureFlags::RenderWindowSpecific |
Expand All @@ -169,7 +166,7 @@ of this software and associated documentation files (the "Software"), to deal
return OGRE_NEW MetalTextureGpuRenderTarget(
GpuPageOutStrategy::Discard, mVaoManager, "RenderWindow DepthBuffer",
TextureFlags::NotTexture | TextureFlags::RenderToTexture |
( bMemoryLess ? TextureFlags::TilerMemoryless : 0 ) |
( isTiler && bMemoryLess ? TextureFlags::TilerMemoryless : 0 ) |
TextureFlags::RenderWindowSpecific | TextureFlags::DiscardableContent,
TextureTypes::Type2D, this );
}
Expand Down
11 changes: 3 additions & 8 deletions RenderSystems/Metal/src/OgreMetalWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,9 @@ static void SetupMetalWindowListeners( Ogre::MetalWindow *metalWindow, NSWindow
assert( rs );
const RenderSystemCapabilities *capabilities = rs->getCapabilities();
bool isTiler = capabilities->hasCapability( RSC_IS_TILER );
if( isTiler )
{
ConfigOptionMap &options = rs->getConfigOptions();
Ogre::ConfigOptionMap::iterator opt = options.find( "WindowMemoryless" );
if( opt != options.end() )
isTiler = opt->second.currentValue == "Yes";
}
if( isTiler )
TextureGpuManager *textureGpuManager = rs->getTextureGpuManager();

This comment has been minimized.

Copy link
@darksylinc

darksylinc Nov 21, 2024

Member

bAllowMemoryless must be false if RSC_IS_TILER is not set.

Perhaps there is a problem with the order in which things are initialized? (e.g. TextureGpuManager::setAllowMemoryless gets called after window initialization?)

This comment has been minimized.

Copy link
@eugenegff

eugenegff Nov 21, 2024

Author Member

bAllowMemoryless can be false even if RSC_IS_TILER is set - it is global opt-out switch for memoryless behavior for applications that know they have too complex scenes. So, both capability and global opt-out switch should be checked.

Do we need separate per window opt-out switch "WindowMemoryless" - is interesting question, but note that current code is for MSAA part of RenderWindow, and "WindowMemoryless" is never used for anything else, including non-MSAA part of RenderWindow. Seems that "WindowMemoryless" - just overlooked obsolete part of our code, where "WindowMemoryless" was main opt-in switch.

This comment has been minimized.

Copy link
@darksylinc

darksylinc Nov 21, 2024

Member

What I mean is that if you call setAllowMemoryless( true ) and RSC_IS_TILER is false, OgreNext will still force it to false.

See setAllowMemoryless implementation.

Therefore the check shouldn't be necessary:

Opt in/out? is Tiler? bAllowMemoryless
IN YES true
OUT YES false
IN NO false
OUT NO false

This comment has been minimized.

Copy link
@eugenegff

eugenegff Nov 22, 2024

Author Member

Ouch. Yes

bool bAllowMemoryless = mTextureManager->allowMemoryless();
if( isTiler && bAllowMemoryless )
{
if( @available( iOS 10, macOS 11, * ) )
desc.storageMode = MTLStorageModeMemoryless;
Expand Down

0 comments on commit 4c58ba8

Please sign in to comment.