Metal setPurgeableState always returning empty on the simulator

I'm building a caching system for my textures and noticed that setPurgeableState (using MTLPurgeableStateKeepCurrent) always returns MTLPurgeableStateEmpty on the simulator. Is this a bug? I'm guessing the texture implementation is different than on the device but the debug strings are more or less the same so I'm wondering if there's a setting the can get the textures on the sim to behave like the textures on the device. It looks like the inner purgeable state is actually set correctly because it will complain about volatile/empty textures when used in a command buffer.

Hi marcuseckert,

The exact behavior of purgeable resources is dependent on the device you are running your program on. That is to say, while the simulator does support setting the purgeable state of resources, the concrete behavior may differ from what you may observe when running on and iOS device and even on a Mac.

Having said that, it is unexpected that you are always obtaining MTLPurgeableStateEmpty as a result. In the simulator, in particular, the expected result would be to obtain the same value that you have assigned to it.

If you are experiencing this behavior where MTLPurgeableStateEmpty is always returned, I would encourage you to file a Feedback Assistant ticket with us, so we can investigate the case further.

Please make sure to post the ID here so we can track the item and follow up with you. It would also help us investigate if you can additionally provide us with the macOS and Xcode build versions you are using in your test.

Metal setPurgeableState always returning empty on the simulator
 
 
Q