0

I've found the answer for desktops, but I could not find anything for Android/iOS (assume I can use up to OpenGL ES 3.0). So this is the same question for mobile devices: Is it possible to get the total memory in bytes used by OpenGL by my application programatically?

Note: I am OK with a non-universal solution (AFAIK universal solution does not exists), but something that works at least on popular devices (iOS/Snapdragon/..)

Community
  • 1
  • 1
sydd
  • 1,824
  • 2
  • 30
  • 54
  • do you want to know gpu memory used by OpenGL ?? and why do you need to know this? – Sung Sep 26 '16 at 06:30
  • @SungWoo I am writing an crossplatform mobile game engine in Xamarin & OpenTK and it would be nice to have a debug widget that can display stuff like number of draw calls, memory and GPU usage to help quickly identify leaks. – sydd Sep 26 '16 at 16:40

1 Answers1

3

No, it's not possible via any standard API.

Most graphics drivers will account any graphics memory to the process, so you can always use the "top" command line utility to get total process memory. It's not able to isolate the graphics memory, but it should give you an idea how how much your process is using in total.

That said, you probably have a pretty good idea how much data you uploaded/allocated storage for using the GLES API, which is probably a good finger in the air estimate for total memory. Most of the bulk storage related to application assets.

solidpixel
  • 10,688
  • 1
  • 20
  • 33
  • > you can always use the "top" command line utility to get total process memory -- not on Android or iOS (which the question is about) AFAIK. And is it possible by a non standard API on mobile? The desktop link I've got in the comment is about extensions too. – sydd Sep 26 '16 at 16:42
  • Install busybox or something similar for Android, and it'll work fine; the Linux kernel information is always exported from procfs. I think the only restriction is that you need to have rooted the device if you want to run command line busybox; not sure if it's possible to wrap in an APK, but it should be ... – solidpixel Sep 26 '16 at 18:22
  • I am writing a graphics engine, asking users to root is a bit too much :/ – sydd Sep 26 '16 at 18:30
  • If you control the engine you can get the same information as "top" for the current process via the proc file system. This doesn't need root on Android, but with the new versions on Android you can access the proc entry for the process making the access. – solidpixel Oct 30 '17 at 11:19