Can you delete a MTLLibrary once shaders are placed into pipeline?

Hello, I am quite new to using the metal API and was wondering if it was common (or even possible) if you knew that, when a pipeline was created, you never needed to make another one with the same shaders again, if it is safe to release the library the was used to reference the shaders? Only asking because this is possible in other apis, but apple never mentions (as far as I have found) if this is safe or not safe to do.

Answered by DTS Engineer in 861206022

Hello,

Yes.

For example most samples declare a local variable like this in an initialization function:

id<MTLLibrary> defaultLibrary = [_device newDefaultLibrary];

The memory for the local variable is reclaimed when it goes out of scope on initialization function exit.

Accepted Answer

Hello,

Yes.

For example most samples declare a local variable like this in an initialization function:

id<MTLLibrary> defaultLibrary = [_device newDefaultLibrary];

The memory for the local variable is reclaimed when it goes out of scope on initialization function exit.

Can you delete a MTLLibrary once shaders are placed into pipeline?
 
 
Q