15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_query_resource 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_query_resource 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Kevin Lefebvre, NVIDIA (klefebvre 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ciStatus 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ci Under review. Target release in NVIDIA 387.00 drivers. 185bd8deadSopenharmony_ci NVIDIA's Tegra drivers will not expose this extensions. 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ciVersion 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ci Last Modified Date: May 4, 2017 235bd8deadSopenharmony_ci Author Revision: 0.1 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ciNumber 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ci OpenGL Extension #511 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ciDependencies 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ci OpenGL 2.0 is required. 325bd8deadSopenharmony_ci The extension is written against the OpenGL 2.0 Specification. 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciOverview 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci OpenGL implementations manage the residence of textures, shaders, and 375bd8deadSopenharmony_ci other graphical objects in GPU accessible memory (whether in on-board 385bd8deadSopenharmony_ci video memory or addressable system memory is implementation dependent). 395bd8deadSopenharmony_ci With more insight into OpenGL's memory usage 1) applications could make 405bd8deadSopenharmony_ci educated decisions on better utilizing the limited GPU resources, 415bd8deadSopenharmony_ci 2) users could better optimize their workflow when working with multiple 425bd8deadSopenharmony_ci tools, and 3) administrators can make better decisions regarding resource 435bd8deadSopenharmony_ci allocation and system configurations. 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci The purpose of this extension is to return a more detailed breakdown 465bd8deadSopenharmony_ci of memory usage in terms of the OpenGL objects residing in memory 475bd8deadSopenharmony_ci (textures, render buffers, buffer objects, system reserved objects, ...). 485bd8deadSopenharmony_ci This extension differs from GL_NVX_gpu_memory_info in that this extension 495bd8deadSopenharmony_ci returns detailed memory usage at the object level for video memory while 505bd8deadSopenharmony_ci the other extension only reports total vidmem usage. 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci For the purposes of this specification the term vidmem refers to video 535bd8deadSopenharmony_ci memory resident on the graphics card that is directly accessible to the 545bd8deadSopenharmony_ci GPU at the highest performance level. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ciNew Procedures and Functions 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci int QueryResourceNV(enum queryType, int pname, unsigned int bufSize, 595bd8deadSopenharmony_ci int *buffer); 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ciNew Tokens 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci Accepted by the <queryType> parameter of QueryResource: 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci QUERY_RESOURCE_TYPE_VIDMEM_ALLOC_NV 0x9540 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci New enums defined: 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci QUERY_RESOURCE_MEMTYPE_VIDMEM_NV 0x9542 705bd8deadSopenharmony_ci QUERY_RESOURCE_SYS_RESERVED_NV 0x9544 715bd8deadSopenharmony_ci QUERY_RESOURCE_TEXTURE_NV 0x9545 725bd8deadSopenharmony_ci QUERY_RESOURCE_RENDERBUFFER_NV 0x9546 735bd8deadSopenharmony_ci QUERY_RESOURCE_BUFFEROBJECT_NV 0x9547 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation) 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci none 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci none 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment 845bd8deadSopenharmony_ciOperations and the Frame Buffer) 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci none 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions) 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci none 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 2.0 Specification (State and 935bd8deadSopenharmony_ciState Requests) 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ci Section 6.1.x GPU Query Resource 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ci The command QueryResourceNV returns GL object usage of video memory in the 985bd8deadSopenharmony_ci application provided buffer. Both a summary of the total vidmen allocated 995bd8deadSopenharmony_ci by the driver is written along with a more detailed breakdown of memory 1005bd8deadSopenharmony_ci used by the GL objects created by the application (textures, render buffers 1015bd8deadSopenharmony_ci buffer objects, ...). Memory sizes reported are in kilobytes. 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci Due to various factors with the OpenGL driver the amount of memory in use 1045bd8deadSopenharmony_ci by GL objects may not equal the amount of memory actually allocated. 1055bd8deadSopenharmony_ci Alignment issues, freed but not released objects, or memory block 1065bd8deadSopenharmony_ci sub-allocation options may result in the driver holding more memory than 1075bd8deadSopenharmony_ci what can be accounted for by the total memory used by the GL objects. This 1085bd8deadSopenharmony_ci command will report both the memory used by GL objects and the amount of 1095bd8deadSopenharmony_ci memory free but allocated by the driver. 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci Currently the queryType parameter only accepts the type VIDMEM_ALLOC_NV 1125bd8deadSopenharmony_ci leaving future extensions possible. The param parameter is reserved for 1135bd8deadSopenharmony_ci future usage. The bufSize parameter indicates the size of the application 1145bd8deadSopenharmony_ci provided buffer in ints where the query results are returned. The buffer 1155bd8deadSopenharmony_ci parameter points to this return buffer. The commands return value is the 1165bd8deadSopenharmony_ci number of ints written in the return buffer. If the return value is 1175bd8deadSopenharmony_ci negative then the buffer is too small to hold the returned data. If the 1185bd8deadSopenharmony_ci buffer pointer is NULL then the return value specifies the size of buffer 1195bd8deadSopenharmony_ci needed to hold the results from the query call. 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci The format of the returned data from a query is a series of int's of the 1225bd8deadSopenharmony_ci form: 1235bd8deadSopenharmony_ci 1245bd8deadSopenharmony_ci fixedHeader 1255bd8deadSopenharmony_ci size - size of fixed header(in int's) 1265bd8deadSopenharmony_ci version - data stream version number (version = 1 at this time) 1275bd8deadSopenharmony_ci devCount - count of devices 1285bd8deadSopenharmony_ci deviceBlk[i from 0 to devCount - 1] 1295bd8deadSopenharmony_ci size - size of per device info including detail blocks (in int's) 1305bd8deadSopenharmony_ci numAllocs - number of GL object allocations 1315bd8deadSopenharmony_ci vidmem - size of vidmem in use by GL objects 1325bd8deadSopenharmony_ci vidmemFree - size of vidmem allocated but not in use 1335bd8deadSopenharmony_ci detailCount - number of detail blocks 1345bd8deadSopenharmony_ci detailBlk[j from 0 to detailCount - 1] 1355bd8deadSopenharmony_ci size - size of single detail block (in int's) 1365bd8deadSopenharmony_ci memType - only vidmem at this time 1375bd8deadSopenharmony_ci objType - GL object type 1385bd8deadSopenharmony_ci numAllocs - number of objects of this objType 1395bd8deadSopenharmony_ci vidmem - amount of memory used for this objType 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci For decoding the detail blocks the following constants are defined: 1425bd8deadSopenharmony_ci 1435bd8deadSopenharmony_ci memType: 1445bd8deadSopenharmony_ci QUERY_RESOURCE_MEMTYPE_VIDMEM_NV 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ci objType: 1475bd8deadSopenharmony_ci QUERY_RESOURCE_SYS_RESERVED_NV 1485bd8deadSopenharmony_ci QUERY_RESOURCE_TEXTURE_NV 1495bd8deadSopenharmony_ci QUERY_RESOURCE_RENDERBUFFER_NV 1505bd8deadSopenharmony_ci QUERY_RESOURCE_BUFFEROBJECT_NV 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ciErrors 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ci None 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ciNew State 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci None 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ciIssues 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci 1) With Windows 10 comes additional capabilities with respect to how much 1635bd8deadSopenharmony_ci vidmem an applicaiton can really gain access to and what happens when 1645bd8deadSopenharmony_ci the application comes under memory pressure. These capabilities include 1655bd8deadSopenharmony_ci OS vidmem budget levels, application setting a vidmem reservation as a 1665bd8deadSopenharmony_ci hint to the OS in an attempt to reduce memory thrashing, and what 1675bd8deadSopenharmony_ci allocations will be forced out of vidmem (into sysmem if the allocation 1685bd8deadSopenharmony_ci permits it). Should this extension try to report some of this 1695bd8deadSopenharmony_ci information? 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci PROPOSED RESOLUTION: This extension as written currently describes the 1725bd8deadSopenharmony_ci mem usage at a point in time that is only valid at the time of 1735bd8deadSopenharmony_ci calling. If this level of information is not sufficient to meet the 1745bd8deadSopenharmony_ci ISV and User needs then we should consider adding some of the Window 10 1755bd8deadSopenharmony_ci capabilities (abstracted for other OS/s if possible) in a follow-on 1765bd8deadSopenharmony_ci extension. 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ciRevision History 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci Rev. Date Author Changes 1815bd8deadSopenharmony_ci ---- -------- --------- ------------------------------------------------ 1825bd8deadSopenharmony_ci 1 05/04/17 klefebvre First draft 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci Changes from NVX version of extension: 1855bd8deadSopenharmony_ci - fix function prototype of QueryResourceNV 1865bd8deadSopenharmony_ci - remove queryType SUMMARY, default to DETAILED, leave queryType 1875bd8deadSopenharmony_ci parameter for future extension 1885bd8deadSopenharmony_ci - add size entries to each return record to support future 1895bd8deadSopenharmony_ci addition of data and have backwards compatability to decoder 1905bd8deadSopenharmony_ci - rework format of buffer return data 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci 193