In my iOS project Metal
is used extensively. Sometimes MTLDevice newTextureWithDescriptor
fails to create a texture. Texture format is valid, it's a small RGBA 512x512 texture, everything is set up correctly.
When I print MTLDevice.currentAllocatedSize >> 20
it's always 1396 MB
on iPhone XR
( A12
processor ).
I've used a lot this thread for max runtime RAM estimate: https://stackoverflow.com/a/15200855/2567725
So I believe for iPhone XR max allowed RAM is 1792 MB
.
I guess the texture is not created because RAM has been exsausted.
So the guestions are:
-
Is it true that on A12 Metal's
currentAllocatedSize
correlates withCPU
memory, andGPU
memory is "shared" with the CPU one, so1792 MB = GPU+CPU
for iPhone XR ? -
Is there any way to get the description of Metal error? (now it just returns
nil
innewTextureWithDescriptor
). -
Is it possible to know how Metal allocation strategy works, e.g. how small available
RAM
should be toMTLDevice newTextureWithDescriptor
returnnil
?
from How much memory is available for Metal in iOS?
No comments:
Post a Comment