JOGL - monitor GPU memory

可紊 提交于 2019-12-24 12:13:08

问题


I am looking for some JOGL classes/methods/examples to retrieve the size of total available GPU memory and the current available GPU memory.

I know it can be done using OpenGl (JOGL Java docs).


回答1:


The link you posted uses NVidia proprietary extensions. However given the way modern GPUs operate it's absolutely useless to know how much "memory" there's left. Why?

Because OpenGL always operated on an abstract memory model. Single data objects (textures, VBOs) may be too large to fit into the working memory of a GPU, but there's virtually no limit on how many textures and VBOs you can have other than your system memory (CPU RAM). OpenGL always did swap the contents on demand.

And ever since OpenGL-4 / DirectX-11 capable GPUs came around which have integrated MMUs even the notion of a data object size became meaningless. Today's GPUs support sparse data objects. On a modern GPU you can allocate textures several thousand pixels wide and high and only sparsely populate them with data. So even if only one texture object is bound, parts of it may reside dormant in system memory while other parts are in GPU working memory.

Old OpenGL actually had functions to query if a texture was loaded into fast memory. But with the boundaries between GPU and system RAM vanishing those no longer made sense had subsequently have been removed.

Effectively the GPU RAM nowadays is a cache and you should treat it as such. You'll hardly query the size of the CPU caches at runtime except for very special applications.



来源:https://stackoverflow.com/questions/22628157/jogl-monitor-gpu-memory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!