API: How to know if native texture memory is located on the GPU?

How can I use the PackedNativeUnityEngineObject (Texture) to figure out whether the reported size corresponds to RAM, graphics memory or both?

The short answer is that you sadly can’t.

There is no unified way to query the hardware to tell you whether an Asset (Texture/Mesh…) is on the VRAM or RAM. Some Platforms/Vendors/Devices might come with API for this but even the presence for these APIs is not a given. So right now, it is just not implemented at all for Unity. Also, the current MemoryProfiler API doesn’t capture if an Asset is Read/Write enabled.

OK cool, thanks for the info!

You’re welcome :slight_smile:
And just to say this, we don’t like that we can’t tell you whether it is on the vram or not either. we’d like to be able to add this at some point for at least some platforms but… With it being such a scattershot right now, we can’t promise anything.

1 Like