JOGL and NVX_gpu_memory_info extension

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

JOGL and NVX_gpu_memory_info extension

maany
Hi, I am new to JOGL.
I want to write a method to monitor GPU size and usage using JOGL. I know how to do this using openGL (http://nasutechtips.blogspot.fr/2011/02/how-to-get-gpu-memory-size-and-usage-in.html)

I wish to access the tokens GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX (0x9047)   and GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX  (0x9048) from NVX_gpu_memory_info NVIDIA openGL extension in JOGL, but i can't find them in the in any class or interface in the JOGL javadocs.

As an alternate approach, i have directly passed the value of these tokens to the gl.glGetIntegerv method ( gl is an instance of the class javax.media.opengl.GL). Unfortunately, I can't test the output as a NVIDIA gpu is not available to me.
here is the code snippet :

public int getFreeMemory() {
       GL gl = GLContext.getCurrentGL();
       IntBuffer freeMemory= BufferUtils.createIntBuffer(3);
       freeMemory.put(-1);
       try {                  
            if(gl.glGetString(GL.GL_VENDOR).equals("NVIDIA Corporation") && gl.isExtensionAvailable("GL_NVX_gpu_memory_info"))
            {
               freeMemory.clear();
               gl.glGetIntegerv(0x9048,freeMemory);
            }
       } catch (Exception e) {
           logger.log(Level.WARNING,"Cannot retrieve free memory for the NVIDIA GPU");
       }
       return freeMemory.get(0);
    }

Can you tell me
1)if JOGL API provides the constants GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX and GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX
2) will the getFreeMemory() method which involves direct passing of the values of these constants to the getIntegerv method work?  

Thanks
Maany
Reply | Threaded
Open this post in threaded view
|

Re: JOGL and NVX_gpu_memory_info extension

gouessej
Administrator
Hi

You already posted here:
http://stackoverflow.com/questions/22628157/jogl-monitor-gpu-memory/22634014#22634014

I agree with datenwolf's answer.

I'm not a big fan of those vendor specific APIs, they aren't supported yet, please make a request for enhancement (bug report) if you really want us to support them.
Julien Gouesse | Personal blog | Website