Name NVX_query_resource Name Strings GL_NVX_query_resource Contact Kevin Lefebvre, NVIDIA Corporation (klefebvre 'at' nvidia.com) Contributors Status Complete Under review. Target release in NVIDIA 355.00 drivers NVIDIA's Tegra drivers will not expose this extensions. Version Last Modified Date: July 31, 2015 Author Revision: 1.1 Number TODO Dependencies OpenGL 2.0 is required. The extension is written against the OpenGL 2.0 Specification. Overview OpenGL implementations manage the residence of textures, shaders, and other graphical objects in GPU accessible memory (either in on-board video memory or addressable system memory depending on performance needs). With more insight into OpenGL's memory usage 1) applications could make educated decisions on better utilizing the limited GPU resources, 2) users could better optimize their workflow when working with multiple tools, and 3) administrators can make better decisions regarding resource allocation and system configurations. The purpose of this extension is to return a more detailed breakdown of memory usage in terms of the OpenGL objects residing in memory (textures, render buffers, buffer objects, system reserved objects, ...). This extension differs from GL_NVX_gpu_memory_info in that this extension returns detailed memory usage at the object level for both vidmem and sysmem while the other extension only reports total vidmem usage. For the purposes of this specification the term vidmem refers to video memory resident on the graphics card that is directly accessible to the GPU at the highest performance level. The term sysmem refers to memory resident in the system that is generally accessible to the CPU but can be accessed by the GPU via PTE's or other such mechanisms but at a much lower performance than vidmem. New Procedures and Functions int QueryResourceNVX(enum queryType, int param, int *buffer); New Tokens Accepted by the parameter of QueryResource: QUERY_RESOURCE_TYPE_SUMMARY_NVX 0x9540 QUERY_RESOURCE_TYPE_DETAILED_NVX 0x9541 QUERY_RESOURCE_MEMTYPE_VIDMEM 0x9542 QUERY_RESOURCE_MEMTYPE_SYSMEM 0x9543 QUERY_RESOURCE_SYS_RESERVED_NVX 0x9544 QUERY_RESOURCE_TEXTURE_NVX 0x9545 QUERY_RESOURCE_RENDERBUFFER_NVX 0x9546 QUERY_RESOURCE_BUFFEROBJECT_NVX 0x9547 Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation) none Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) none Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment Operations and the Frame Buffer) none Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions) none Additions to Chapter 6 of the OpenGL 2.0 Specification (State and State Requests) Section 6.1.x GPU Query Resource The command int QueryResourceNVX(enum queryType, int pname, int bufSize, int *buffer); returns GL object usage of both vidmem and sysmem memory. The level of information returned is controlled by the queryType parameter. A value of QUERY_TYPE_SUMMARY_NVX returns a summary of the total vidmem and sysmem allocated by the driver. A value of QUERY_TYPE_DETAILED_NVX returns a breakdown of the memory used by specific GL objects (ie. amount of memory used by textures, by render buffers, by buffer objects, ...). Due to various factors with the OpenGL driver the amount of memory in use by GL objects may not equal the amount of memory actually allocated. Alignment issues, freed but not released objects, or memory block sub-allocation options may result in the driver holding more memory than what can be accounted for by the total memory used by the GL objects. This command will report both the memory used by GL objects and the amount of memory free but allocated by the driver (memory sizes reported are in kilobytes) At this time the param parameter is reserved for future usage. The bufSize parameter indicates the size of the application provided buffer in ints where the query results are returned. The buffer parameter points to this return buffer. The commands return value is the number of ints written in the return buffer. If the return value is negative then the buffer is too small to hold the returned data. If the buffer pointer is NULL then the return value specifies the size of buffer needed to hold the results from the query call. The format of the returned data for QUERY_TYPE_SUMMARY_NVX is a series of int's of the form: following repeated for each device (n from 0 to devCount -1) detailed info only for QUERY_TYPE_DETAILED_NVX (m from 0 to detailCount -1) The data blocks listed above are defined as: fixed header info - data stream version number - count of devices summary info for device n <# allocs> - number of GL object allocations - size of vidmem in use by GL objects - size of sysmem in kb in use by GL objects - size of vidmem allocated but not in use - size of sysmem allocated but not in use - count of detail blocks for this device detail info block m - vidmem or sysmem indicator - GL object type - amount of memory used for this memType/objType <# allocs> - number of objects of this memType/objType For decoding the detail blocks the following constants are defined: memType: QUERY_RESOURCE_MEMTYPE_VIDMEM_NVX QUERY_RESOURCE_MEMTYPE_SYSMEM_NVX objType: QUERY_RESOURCE_SYS_RESERVED_NVX QUERY_RESOURCE_TEXTURE_NVX QUERY_RESOURCE_RENDERBUFFER_NVX QUERY_RESOURCE_BUFFEROBJECT_NVX Additions to Appendix A of the OpenGL 2.0 Specification (Invariance) none Additions to the AGL/GLX/WGL Specifications None GX Protocol None Errors None Issues None Revision History 1.0 initial revision 1.1 revise data stream definition