15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_external_objects_win32 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_memory_object_win32 85bd8deadSopenharmony_ci GL_EXT_semaphore_win32 95bd8deadSopenharmony_ci 105bd8deadSopenharmony_ciContributors 115bd8deadSopenharmony_ci 125bd8deadSopenharmony_ci Carsten Rohde, NVIDIA 135bd8deadSopenharmony_ci James Jones, NVIDIA 145bd8deadSopenharmony_ci Jan-Harald Fredriksen, ARM 155bd8deadSopenharmony_ci Jeff Juliano, NVIDIA 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciContact 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci James Jones, NVIDIA (jajones 'at' nvidia.com) 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciStatus 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci Complete 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ciVersion 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ci Last Modified Date: June 2, 2017 285bd8deadSopenharmony_ci Revision: 8 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ciNumber 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci 505 335bd8deadSopenharmony_ci OpenGL ES Extension #282 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ciDependencies 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci Written against the OpenGL 4.5 and OpenGL ES 3.2 specifications 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci GL_EXT_memory_object_win32 requires GL_EXT_memory_object 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci GL_EXT_semaphore_win32 requires GL_EXT_semaphore 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ciOverview 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci Building upon the OpenGL memory object and semaphore framework 465bd8deadSopenharmony_ci defined in EXT_external_objects, this extension enables an OpenGL 475bd8deadSopenharmony_ci application to import a memory object or semaphore from a Win32 NT 485bd8deadSopenharmony_ci handle or a KMT share handle. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ciNew Procedures and Functions 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci If the GL_EXT_memory_object_win32 string is reported, the following 545bd8deadSopenharmony_ci commands are added: 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci void ImportMemoryWin32HandleEXT(uint memory, 575bd8deadSopenharmony_ci uint64 size, 585bd8deadSopenharmony_ci enum handleType, 595bd8deadSopenharmony_ci void *handle); 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci void ImportMemoryWin32NameEXT(uint memory, 625bd8deadSopenharmony_ci uint64 size, 635bd8deadSopenharmony_ci enum handleType, 645bd8deadSopenharmony_ci const void *name); 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci If the GL_EXT_semaphore_win32 string is reported, the following commands 675bd8deadSopenharmony_ci are added: 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci void ImportSemaphoreWin32HandleEXT(uint semaphore, 705bd8deadSopenharmony_ci enum handleType, 715bd8deadSopenharmony_ci void *handle); 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci void ImportSemaphoreWin32NameEXT(uint semaphore, 745bd8deadSopenharmony_ci enum handleType, 755bd8deadSopenharmony_ci const void *name); 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ciNew Tokens 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci The following tokens are added if either of the 805bd8deadSopenharmony_ci GL_EXT_memory_object_win32 or GL_EXT_semaphore_win32 strings are 815bd8deadSopenharmony_ci reported: 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci Accepted by the <handleType> parameter of 845bd8deadSopenharmony_ci ImportMemoryWin32HandleEXT(), ImportMemoryWin32NameEXT(), 855bd8deadSopenharmony_ci ImportSemaphoreWin32HandleEXT(), and ImportSemaphoreWin32NameEXT(): 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci HANDLE_TYPE_OPAQUE_WIN32_EXT 0x9587 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci Accepted by the <handleType> parameter of 905bd8deadSopenharmony_ci ImportMemoryWin32HandleEXT() and ImportSemaphoreWin32HandleEXT(): 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ci HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT 0x9588 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetFloatv, 955bd8deadSopenharmony_ci GetIntegerv, GetInteger64v, GetBooleani_v, GetIntegeri_v, GetFloati_v, 965bd8deadSopenharmony_ci GetDoublei_v, and GetInteger64i_v: 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci DEVICE_LUID_EXT 0x9599 995bd8deadSopenharmony_ci DEVICE_NODE_MASK_EXT 0x959A 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci Constant values: 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci LUID_SIZE_EXT 8 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci If the GL_EXT_memory_object_win32 string is reported, the following 1065bd8deadSopenharmony_ci tokens are added: 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci Accepted by the <handleType> parameter of 1095bd8deadSopenharmony_ci ImportMemoryWin32HandleEXT() and ImportMemoryWin32NameEXT(): 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci HANDLE_TYPE_D3D12_TILEPOOL_EXT 0x9589 1125bd8deadSopenharmony_ci HANDLE_TYPE_D3D12_RESOURCE_EXT 0x958A 1135bd8deadSopenharmony_ci HANDLE_TYPE_D3D11_IMAGE_EXT 0x958B 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci Accepted by the <handleType> parameter of 1165bd8deadSopenharmony_ci ImportMemoryWin32HandleEXT(): 1175bd8deadSopenharmony_ci HANDLE_TYPE_D3D11_IMAGE_KMT_EXT 0x958C 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci If the GL_EXT_semaphore_win32 string is reported, the following tokens 1205bd8deadSopenharmony_ci are added: 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ci Accepted by the <handleType> parameter of 1235bd8deadSopenharmony_ci ImportSemaphoreWin32HandleEXT(): 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci HANDLE_TYPE_D3D12_FENCE_EXT 0x9594 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci Accepted by the <pname> parameter of SemaphoreParameterui64v() and 1285bd8deadSopenharmony_ci GetSemaphoreParameterui64v(): 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ci D3D12_FENCE_VALUE_EXT 0x9595 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 4.5 Specification (Event Model) 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci Add the following entries to table 4.2 "Commands for importing 1355bd8deadSopenharmony_ci external semaphore handles." 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci | Handle Type | Import commands | 1385bd8deadSopenharmony_ci +----------------------------------+--------------------------------+ 1395bd8deadSopenharmony_ci | HANDLE_TYPE_OPAQUE_WIN32_EXT | ImportSemaphoreWin32HandleEXT, | 1405bd8deadSopenharmony_ci | | ImportSemaphoreWin32NameEXT | 1415bd8deadSopenharmony_ci | HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT | ImportSemaphoreWin32HandleEXT | 1425bd8deadSopenharmony_ci | HANDLE_TYPE_D3D12_FENCE_EXT | ImportSemaphoreWin32HandleEXT, | 1435bd8deadSopenharmony_ci | | ImportSemaphoreWin32NameEXT | 1445bd8deadSopenharmony_ci +----------------------------------+--------------------------------+ 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ci Add the following after the second paragraph of section 4.2.1 "Importing 1475bd8deadSopenharmony_ci External Semaphore Handles into Semaphores" 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci The devices in use by the current context may also be identified by 1505bd8deadSopenharmony_ci an (LUID, node) pair. To determine the LUID of the 1515bd8deadSopenharmony_ci current context, call GetUnsignedBytev with <pname> set to 1525bd8deadSopenharmony_ci DEVICE_LUID_EXT and <data> set to point to an array of LUID_SIZE_EXT 1535bd8deadSopenharmony_ci unsigned bytes. Following the call, <data> can be cast to a pointer 1545bd8deadSopenharmony_ci to an LUID object that will be equal to the locally unique 1555bd8deadSopenharmony_ci identifier of an IDXGIAdapter1 object corresponding to the adapter 1565bd8deadSopenharmony_ci used by the current context. To identify which individual devices 1575bd8deadSopenharmony_ci within an adapter are used by the current context, call GetIntegerv 1585bd8deadSopenharmony_ci with <pname> set to DEVICE_NODE_MASK_EXT. A bitfield is returned 1595bd8deadSopenharmony_ci with one bit set for each device node used by the current context. 1605bd8deadSopenharmony_ci The bits set will be subset of those available on a Direct3D 12 1615bd8deadSopenharmony_ci device created on an adapter with the same LUID as the current 1625bd8deadSopenharmony_ci context. 1635bd8deadSopenharmony_ci 1645bd8deadSopenharmony_ci Replace the paragraph in section 4.2.1 beginning "External handles 1655bd8deadSopenharmony_ci are often defined..." with the following 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci The commands 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ci void ImportSemaphoreWin32HandleEXT(uint semaphore, 1705bd8deadSopenharmony_ci enum handleType, 1715bd8deadSopenharmony_ci void *handle); 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci void ImportSemaphoreWin32NameEXT(uint semaphore, 1745bd8deadSopenharmony_ci enum handleType, 1755bd8deadSopenharmony_ci const void *name); 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci import a semaphore from the win32 handle <handle> or the win32 1785bd8deadSopenharmony_ci object name <name>. <handle> is a windows HANDLE cast to the type 1795bd8deadSopenharmony_ci "void*". <name> is a NULL-terminated array of UTF-16 characters. 1805bd8deadSopenharmony_ci What type of object <handle> or <name> refers to is determined by 1815bd8deadSopenharmony_ci <handleType>. Importing a Windows handle does not transfer 1825bd8deadSopenharmony_ci ownership of the handle to the GL implementation. For handle types 1835bd8deadSopenharmony_ci defined as NT handles, the application must release the handle using 1845bd8deadSopenharmony_ci an appropriate system call when it is no longer needed. 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci The parameter <handle> takes the value of a windows HANDLE cast to 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci Add the following entries to table 4.3 "Semaphore parameters" 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci | Name | Handle Types | Legal Values | 1925bd8deadSopenharmony_ci +-----------------------+-----------------------------+--------------+ 1935bd8deadSopenharmony_ci | D3D12_FENCE_VALUE_EXT | HANDLE_TYPE_D3D12_FENCE_EXT | any value | 1945bd8deadSopenharmony_ci +-----------------------+-----------------------------+--------------+ 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci Add the following after the first paragraph of section 4.2.3 "Waiting 1975bd8deadSopenharmony_ci for Semaphores" 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci If <semaphore> was imported from a handle of the type 2005bd8deadSopenharmony_ci HANDLE_TYPE_D3D12_FENCE_EXT, it will reach the signaled state when 2015bd8deadSopenharmony_ci its value is greater than or equal to the value specified by its 2025bd8deadSopenharmony_ci D3D12_FENCE_VALUE_EXT parameter. 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci Add the following after the first paragraph of section 4.2.4 "Signaling 2055bd8deadSopenharmony_ci Semaphores" 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ci If <semaphore> was imported from a handle of the type 2085bd8deadSopenharmony_ci HANDLE_TYPE_D3D12_FENCE_EXT, its value will be set to the value 2095bd8deadSopenharmony_ci specified by its D3D12_FENCE_VALUE_EXT parameter when the signal 2105bd8deadSopenharmony_ci operation completes. 2115bd8deadSopenharmony_ci 2125bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 4.5 Specification (Memory Objects) 2135bd8deadSopenharmony_ci 2145bd8deadSopenharmony_ci Add the following entry to table 6.2 "Commands for importing 2155bd8deadSopenharmony_ci external memory handles." 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci | Handle Type | Import command | 2185bd8deadSopenharmony_ci +----------------------------------+-----------------------------+ 2195bd8deadSopenharmony_ci | HANDLE_TYPE_OPAQUE_WIN32_EXT | ImportMemoryWin32HandleEXT, | 2205bd8deadSopenharmony_ci | | ImportMemoryWin32NameEXT | 2215bd8deadSopenharmony_ci | HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT | ImportMemoryWin32HandleEXT, | 2225bd8deadSopenharmony_ci | HANDLE_TYPE_D3D12_TILEPOOL_EXT | ImportMemoryWin32HandleEXT, | 2235bd8deadSopenharmony_ci | | ImportMemoryWin32NameEXT | 2245bd8deadSopenharmony_ci | HANDLE_TYPE_D3D12_RESOURCE_EXT | ImportMemoryWin32HandleEXT, | 2255bd8deadSopenharmony_ci | | ImportMemoryWin32NameEXT | 2265bd8deadSopenharmony_ci | HANDLE_TYPE_D3D11_IMAGE_EXT | ImportMemoryWin32HandleEXT, | 2275bd8deadSopenharmony_ci | | ImportMemoryWin32NameEXT | 2285bd8deadSopenharmony_ci | HANDLE_TYPE_D3D11_KMT_IMAGE_EXT | ImportMemoryWin32HandleEXT | 2295bd8deadSopenharmony_ci +----------------------------------------------------------------+ 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ci Replace the paragraph in section 6.1 beginning "External handles are 2325bd8deadSopenharmony_ci often defined..." with the following 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci The commands 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci void ImportMemoryWin32HandleEXT(uint memory, 2375bd8deadSopenharmony_ci uint64 size, 2385bd8deadSopenharmony_ci enum handleType, 2395bd8deadSopenharmony_ci void *handle); 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci void ImportMemoryWin32NameEXT(uint memory, 2425bd8deadSopenharmony_ci uint64 size, 2435bd8deadSopenharmony_ci enum handleType, 2445bd8deadSopenharmony_ci const void *name); 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ci import a memory object of length <size> from the win32 handle 2475bd8deadSopenharmony_ci <handle> or the win32 object name <name>. <handle> is a windows 2485bd8deadSopenharmony_ci HANDLE cast to the type "void*". <name> is NULL-terminated array of 2495bd8deadSopenharmony_ci UTF-16 characters. What type of object <handle> or <name> refers to 2505bd8deadSopenharmony_ci is determined by <handleType>. Importing a Windows handle does not 2515bd8deadSopenharmony_ci transfer ownership of the handle to the GL implementation. For 2525bd8deadSopenharmony_ci handle types defined as NT handles, the application must release the 2535bd8deadSopenharmony_ci handle using an appropriate system call when it is no longer needed. 2545bd8deadSopenharmony_ci 2555bd8deadSopenharmony_ciAdditions to Chapter 21 of the OpenGL 4.5 Specification (Special Functions) 2565bd8deadSopenharmony_ci 2575bd8deadSopenharmony_ci Add the following to section 21.4.1, Commands Not Usable in Display 2585bd8deadSopenharmony_ci Lists. 2595bd8deadSopenharmony_ci 2605bd8deadSopenharmony_ci Under the "Memory Objects" section: 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci ImportMemoryWin32HandleEXT, ImportMemoryWin32NameEXT 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci Under the "GL command stream management" section: 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci ImportSemaphoreWin32HandleEXT, ImportSemaphoreWin32NameEXT 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ciIssues 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ci 1) What should the type of the <name> parameter be in the functions 2715bd8deadSopenharmony_ci ImportMemoryWin32NameEXT() and ImportSemaphoreWin32NameEXT()? 2725bd8deadSopenharmony_ci 2735bd8deadSopenharmony_ci RESOLVED: const void*. There is no wchar type in GL, and the issues 2745bd8deadSopenharmony_ci with C's wchar_t make it seem undesirable to introduce one. 2755bd8deadSopenharmony_ci Further, wchar_t isn't necessarily the correct type. The win32 type 2765bd8deadSopenharmony_ci LPCWSTR is the fully correct type, but using it directly would 2775bd8deadSopenharmony_ci introduce dependencies on windows headers in glext.h. Reusing 2785bd8deadSopenharmony_ci GLshort or GLushort would result in a correctly sized type, but 2795bd8deadSopenharmony_ci casting would still often be needed, and it looks non-intuitive. 2805bd8deadSopenharmony_ci Therefore, it seems best to leave the pointer loosely typed in the 2815bd8deadSopenharmony_ci prototype and define its type through spec language. 2825bd8deadSopenharmony_ci 2835bd8deadSopenharmony_ciRevision History 2845bd8deadSopenharmony_ci 2855bd8deadSopenharmony_ci Revision 9, 2022-07-15 (James Jones) 2865bd8deadSopenharmony_ci - Added commands to the list of commands not permitted in display 2875bd8deadSopenharmony_ci lists. 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci Revision 8, 2017-06-02 (James Jones) 2905bd8deadSopenharmony_ci - Added extension numbers. 2915bd8deadSopenharmony_ci - Fixed the name of GL_HANDLE_TYPE_D3D12_RESOURCE_EXT. 2925bd8deadSopenharmony_ci - Fixed the name -f GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT. 2935bd8deadSopenharmony_ci - Clarified which extensions each command and token belongs to. 2945bd8deadSopenharmony_ci - Clarified how to assign values to the "handle" import parameters. 2955bd8deadSopenharmony_ci - Marked complete. 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci Revision 7, 2017-05-24 (James Jones) 2985bd8deadSopenharmony_ci - Filled in real token values 2995bd8deadSopenharmony_ci - Refer to the GL implementation, not the Vulkan implementation. 3005bd8deadSopenharmony_ci - ImportSemaphoreWin32HandleEXT is used to import semaphores, 3015bd8deadSopenharmony_ci not ImportMemoryWin32HandleEXT. 3025bd8deadSopenharmony_ci - Added name-based object import functions. 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci Revision 6, 2017-04-05 (James Jones) 3055bd8deadSopenharmony_ci - Added context device LUID and node mask queries. 3065bd8deadSopenharmony_ci 3075bd8deadSopenharmony_ci Revision 5, 2017-04-04 (James Jones) 3085bd8deadSopenharmony_ci - Clarified the effects of import operations on handles. 3095bd8deadSopenharmony_ci 3105bd8deadSopenharmony_ci Revision 4, 2017-03-17 (James Jones) 3115bd8deadSopenharmony_ci - Renamed from KHR to EXT 3125bd8deadSopenharmony_ci - Added D3D12 fence value semaphore parameter 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci Revision 3, 2016-09-28 (James Jones) 3155bd8deadSopenharmony_ci - Merged the GL_KHR_memory_object_win32 and GL_KHR_semaphore_win32 3165bd8deadSopenharmony_ci specs. 3175bd8deadSopenharmony_ci - Added spec body describing how to use the new commands and tokens. 3185bd8deadSopenharmony_ci 3195bd8deadSopenharmony_ci Revision 2, 2016-08-15 (Jeff Juliano) 3205bd8deadSopenharmony_ci - Clarified overview text. 3215bd8deadSopenharmony_ci 3225bd8deadSopenharmony_ci Revision 1, 2016-08-05 (James Jones) 3235bd8deadSopenharmony_ci - Initial draft. 324