15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_memory_attachment 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_memory_attachment 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Carsten Rohde, NVIDIA 125bd8deadSopenharmony_ci Christoph Kubisch, NVIDIA 135bd8deadSopenharmony_ci James Jones, NVIDIA 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ciContact 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ci Carsten Rohde, NVIDIA (crohde 'at' nvidia.com) 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ciStatus 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ci Complete 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ciVersion 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ci Last Modified Date: Aug 27, 2018 265bd8deadSopenharmony_ci Revision: 2 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciNumber 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci 524 315bd8deadSopenharmony_ci OpenGL ES Extension #305 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ciDependencies 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ci Requires GL_EXT_memory_object and ARB_texture_storage or a version of 365bd8deadSopenharmony_ci OpenGL or OpenGL ES that incorporates it. 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci Written against the OpenGL 4.6 and OpenGL ES 3.2 specifications. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci Interacts with ARB_direct_state_access (OpenGL) when OpenGL < 4.5 is used. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci Interacts with NV_shader_buffer_load. 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci Interacts with NV_bindless_texture and ARB_bindless_texture. 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ciOverview 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci This extension extends the memory objects introduced with EXT_memory_object 495bd8deadSopenharmony_ci to allow existing textures and buffers to be migrated to an imported memory 505bd8deadSopenharmony_ci allocation. The primary use-case of this extension is plug-in development 515bd8deadSopenharmony_ci where resource management (creation, deletion, sizing etc.) is handled by 525bd8deadSopenharmony_ci inaccessible host application code. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ciNew Procedures and Functions 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci If the GL_NV_memory_attachment string is reported, the following 575bd8deadSopenharmony_ci commands are added: 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci void GetMemoryObjectDetachedResourcesuivNV(uint memory, 605bd8deadSopenharmony_ci enum pname, 615bd8deadSopenharmony_ci int first, 625bd8deadSopenharmony_ci sizei count, 635bd8deadSopenharmony_ci uint *params) 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci void ResetMemoryObjectParameterNV(uint memory, 665bd8deadSopenharmony_ci enum pname); 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci void TexAttachMemoryNV(enum target, 695bd8deadSopenharmony_ci uint memory, 705bd8deadSopenharmony_ci uint64 offset); 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ci void BufferAttachMemoryNV(enum target, 735bd8deadSopenharmony_ci uint memory, 745bd8deadSopenharmony_ci uint64 offset); 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci [[ The following are added if direct state access is supported ]] 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci void TextureAttachMemoryNV(uint texture, 795bd8deadSopenharmony_ci uint memory, 805bd8deadSopenharmony_ci uint64 offset); 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci void NamedBufferAttachMemoryNV(uint buffer, 835bd8deadSopenharmony_ci uint memory, 845bd8deadSopenharmony_ci uint64 offset); 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ciNew Tokens 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci If the GL_NV_memory_attachment string is reported, the following tokens 895bd8deadSopenharmony_ci are added: 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci Accepted by the <pname> parameter of TexParameter{ifx}{v}, 925bd8deadSopenharmony_ci TexParameterI{i ui}v, TextureParameter{if}{v}, TextureParameterI{i ui}v, 935bd8deadSopenharmony_ci GetTexParameter{if}v, GetTexParameterI{i ui}v, GetTextureParameter{if}v, 945bd8deadSopenharmony_ci GetTextureParameterI{i ui}v, GetBufferParameter{i|i64}v and 955bd8deadSopenharmony_ci GetNamedBufferParameter{i|i64}v: 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ci ATTACHED_MEMORY_OBJECT_NV 0x95A4 985bd8deadSopenharmony_ci ATTACHED_MEMORY_OFFSET_NV 0x95A5 995bd8deadSopenharmony_ci MEMORY_ATTACHABLE_ALIGNMENT_NV 0x95A6 1005bd8deadSopenharmony_ci MEMORY_ATTACHABLE_SIZE_NV 0x95A7 1015bd8deadSopenharmony_ci MEMORY_ATTACHABLE_NV 0x95A8 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetFloatv, 1045bd8deadSopenharmony_ci GetIntegerv, GetInteger64v, GetUnsignedBytevEXT, 1055bd8deadSopenharmony_ci GetMemoryObjectParameterivEXT, and the <target> parameter of GetBooleani_v, 1065bd8deadSopenharmony_ci GetIntegeri_v,GetFloati_v, GetDoublei_v, GetInteger64i_v and 1075bd8deadSopenharmony_ci GetUnsignedBytei_vEXT: 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci DETACHED_MEMORY_INCARNATION_NV 0x95A9 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetMemoryObjectParameterivEXT, 1125bd8deadSopenharmony_ci GetMemoryObjectDetachedResourcesuivNV and ResetMemoryObjectParameterNV: 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci DETACHED_TEXTURES_NV 0x95AA 1155bd8deadSopenharmony_ci DETACHED_BUFFERS_NV 0x95AB 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci Accepted by the <pname> parameter of MemoryObjectParameterivEXT, 1185bd8deadSopenharmony_ci GetMemoryObjectParameterivEXT: 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci MAX_DETACHED_TEXTURES_NV 0x95AC 1215bd8deadSopenharmony_ci MAX_DETACHED_BUFFERS_NV 0x95AD 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci 1245bd8deadSopenharmony_ciAdditions to Chapter 6 of the EXT_external_objects Specification 1255bd8deadSopenharmony_ci(Memory Objects) 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci Add a new sections after 6.2 (Memory object parameters) 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci 6.3 Attaching memory to existing resources 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci MEMORY_ATTACHABLE_NV should be used to query if it is valid to attach 1325bd8deadSopenharmony_ci a memory object to an existing resource (buffer or texture). The 1335bd8deadSopenharmony_ci memory region size and offset alignment required by a resource can be 1345bd8deadSopenharmony_ci queried using MEMORY_ATTACHABLE_SIZE_NV and 1355bd8deadSopenharmony_ci MEMORY_ATTACHABLE_ALIGNMENT_NV respectively. The current attached 1365bd8deadSopenharmony_ci memory object and the used offset for a resource can be queried by 1375bd8deadSopenharmony_ci ATTACHED_MEMORY_OBJECT_NV and ATTACHED_MEMORY_OFFSET_NV. 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci If a resource which has memory attached is resized, the attached memory 1405bd8deadSopenharmony_ci will be detached and a new data store will be allocated. If a resource 1415bd8deadSopenharmony_ci which has memory attached is deleted, the attached memory will first be 1425bd8deadSopenharmony_ci detached. If any such detachment occurs, a global incarnation counter 1435bd8deadSopenharmony_ci will be increased and the current value will be stored in the detached 1445bd8deadSopenharmony_ci memory object. The incarnation counter can be queried by 1455bd8deadSopenharmony_ci DETACHED_MEMORY_INCARNATION_EXT either globally or for a specific 1465bd8deadSopenharmony_ci memory object. 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci The command 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci void GetMemoryObjectDetachedResourcesuivNV(uint memory, 1515bd8deadSopenharmony_ci enum pname, 1525bd8deadSopenharmony_ci int first, 1535bd8deadSopenharmony_ci sizei count, 1545bd8deadSopenharmony_ci uint *params) 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci will return a list of detached buffers (if <pname> is 1575bd8deadSopenharmony_ci DETACHED_BUFFERS_NV) or textures (if <pname> is DETACHED_TEXTURES_NV) 1585bd8deadSopenharmony_ci in <params> for memory object <memory>. It will return <count> items 1595bd8deadSopenharmony_ci beginning with <first> item. The number of available items can be 1605bd8deadSopenharmony_ci queried by calling GetMemoryObjectParameterivEXT with <pname> set to 1615bd8deadSopenharmony_ci DETACHED_TEXTURES_NV or DETACHED_BUFFERS_NV. An INVALID_VALUE error is 1625bd8deadSopenharmony_ci generated by GetMemoryObjectDetachedResourcesuivNV if <memory> is 0. 1635bd8deadSopenharmony_ci An INVALID_OPERATION error is generated if <memory> names a valid 1645bd8deadSopenharmony_ci memory object which has no associated memory. An INVALID_VALUE error 1655bd8deadSopenharmony_ci is generated if <pname> is neither DETACHED_BUFFERS_NV nor 1665bd8deadSopenharmony_ci DETACHED_TEXTURES_NV. An INVALID_VALUE error is generated if 1675bd8deadSopenharmony_ci <first> + <count> is greater than the number of available items in the 1685bd8deadSopenharmony_ci list. An INVALID_VALUE error is generated if <params> is NULL. 1695bd8deadSopenharmony_ci MemoryObjectParameterivEXT must be called with <pname> set to 1705bd8deadSopenharmony_ci MAX_DETACHED_TEXTURES_NV or MAX_DETACHED_BUFFERS_NV before calling 1715bd8deadSopenharmony_ci GetMemoryObjectDetachedResourcesuivNV to set the maximum number of 1725bd8deadSopenharmony_ci items in the list of detached textures or buffers. The default values 1735bd8deadSopenharmony_ci are 0 which means that tracking of detached textures and buffers is 1745bd8deadSopenharmony_ci disabled by default. 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ci The command 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci void ResetMemoryObjectParameterNV(uint memory, 1795bd8deadSopenharmony_ci enum pname); 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci will reset the list of detached buffers (if <pname> is 1825bd8deadSopenharmony_ci DETACHED_BUFFERS_NV) or textures (if <pname> is DETACHED_TEXTURES_NV) 1835bd8deadSopenharmony_ci for memory object <memory>. An INVALID_VALUE error is generated by 1845bd8deadSopenharmony_ci ResetMemoryObjectParameterNV if <memory> is 0. An INVALID_OPERATION 1855bd8deadSopenharmony_ci error is generated if <memory> names a valid memory object which has 1865bd8deadSopenharmony_ci no associated memory. An INVALID_VALUE error is generated if <pname> 1875bd8deadSopenharmony_ci is neither DETACHED_BUFFERS_NV nor DETACHED_TEXTURES_NV. 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 4.6 Specification (Buffer Objects) 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci Add a new section after 6.2.1 (Clearing Buffer Object Data Stores) 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci 6.2.2 Attaching a memory object to a buffer object 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci The commands 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci void BufferAttachMemoryNV(enum target, 1995bd8deadSopenharmony_ci uint memory, 2005bd8deadSopenharmony_ci uint64 offset); 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ci void NamedBufferAttachMemoryNV(uint buffer, 2035bd8deadSopenharmony_ci uint memory, 2045bd8deadSopenharmony_ci uint64 offset); 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci will attach a region of a memory object to a buffer object. For 2075bd8deadSopenharmony_ci BufferAttachMemoryNV, the buffer object is that bound to <target>, 2085bd8deadSopenharmony_ci which must be one of the values listed in table 6.1. For 2095bd8deadSopenharmony_ci NamedBufferAttachMemoryNV, <buffer> is the name of the buffer 2105bd8deadSopenharmony_ci object. <memory> and <offset> define a region of memory that will 2115bd8deadSopenharmony_ci replace the data store for <buffer>. The content of the original data 2125bd8deadSopenharmony_ci store will be preserved by a server side copy and the original data 2135bd8deadSopenharmony_ci store will be deleted after that copy. The implementation may restrict 2145bd8deadSopenharmony_ci which values of <offset> are valid for a given memory object and buffer 2155bd8deadSopenharmony_ci parameter combination. These restrictions are outside the scope of 2165bd8deadSopenharmony_ci this extension and must be determined by querying the API or mechanism 2175bd8deadSopenharmony_ci which created the resource which <memory> refers to. If an invalid 2185bd8deadSopenharmony_ci offset is specified an INVALID_VALUE error is generated. An 2195bd8deadSopenharmony_ci INVALID_VALUE error is generated by BufferAttachMemoryNV and 2205bd8deadSopenharmony_ci NamedBufferAttachMemoryNV if <memory> is 0. An INVALID_OPERATION error 2215bd8deadSopenharmony_ci is generated if <memory> names a valid memory object which has no 2225bd8deadSopenharmony_ci associated memory. An INVALID_OPERATION error is generated if the 2235bd8deadSopenharmony_ci specified buffer was created with MAP_PERSISTENT_BIT flag. An 2245bd8deadSopenharmony_ci INVALID_OPERATION error is generated if the specified buffer is 2255bd8deadSopenharmony_ci currently mapped by client. 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ciAdditions to Chapter 8 of the OpenGL 4.6 Specification (Textures and 2285bd8deadSopenharmony_ciSamplers) 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ci Add a new section between sections 8.19, "Immutable-Format Texture Images" 2315bd8deadSopenharmony_ci and section 8.20, "Invalidating Texture Image Data" 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ci 8.20 Attaching a memory object to a texture image 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ci The commands 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ci void TexAttachMemoryNV(enum target, 2385bd8deadSopenharmony_ci uint memory, 2395bd8deadSopenharmony_ci uint64 offset); 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci void TextureAttachMemoryNV(uint texture, 2425bd8deadSopenharmony_ci uint memory, 2435bd8deadSopenharmony_ci uint64 offset); 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ci will attach a region of a memory object to a texture. For 2465bd8deadSopenharmony_ci TexAttachMemoryNV, the texture is that bound to <target>, which must be 2475bd8deadSopenharmony_ci one of TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_1D_ARRAY, 2485bd8deadSopenharmony_ci TEXTURE_2D_ARRAY, TEXTURE_RECTANGLE, TEXTURE_CUBE_MAP, 2495bd8deadSopenharmony_ci TEXTURE_CUBE_MAP_ARRAY, TEXTURE_2D_MULTISAMPLE, or 2505bd8deadSopenharmony_ci TEXTURE_2D_MULTISAMPLE_ARRAY. For TextureAttachMemoryNV, <texture> is 2515bd8deadSopenharmony_ci the name of the texture. <memory> and <offset> define a region of 2525bd8deadSopenharmony_ci memory that will replace the data store for <texture>. The content of 2535bd8deadSopenharmony_ci the original data store will be preserved by a server side copy and the 2545bd8deadSopenharmony_ci original data store will be deleted after that copy. The 2555bd8deadSopenharmony_ci implementation may restrict which values of <offset> are valid for a 2565bd8deadSopenharmony_ci given memory object and texture parameter combination. These 2575bd8deadSopenharmony_ci restrictions are outside the scope of this extension and must be 2585bd8deadSopenharmony_ci determined by querying the API or mechanism which created the resource 2595bd8deadSopenharmony_ci which <memory> refers to. If an invalid offset is specified an 2605bd8deadSopenharmony_ci INVALID_VALUE error is generated. An INVALID_VALUE error is generated 2615bd8deadSopenharmony_ci by TexAttachMemoryNV and TextureAttachMemoryNV if <memory> is 0. An 2625bd8deadSopenharmony_ci INVALID_OPERATION error is generated if <memory> names a valid memory 2635bd8deadSopenharmony_ci object which has no associated memory. 2645bd8deadSopenharmony_ci 2655bd8deadSopenharmony_ciErrors 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ciNew State 2685bd8deadSopenharmony_ci 2695bd8deadSopenharmony_ciSample 2705bd8deadSopenharmony_ci 2715bd8deadSopenharmony_ci // host: code not visible to the plug-in developer 2725bd8deadSopenharmony_ci // plug-in: code written by plug-in developer 2735bd8deadSopenharmony_ci 2745bd8deadSopenharmony_ci uint tex0; 2755bd8deadSopenharmony_ci uint tex1; 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci // host 2785bd8deadSopenharmony_ci { 2795bd8deadSopenharmony_ci // sets up textures as usual 2805bd8deadSopenharmony_ci } 2815bd8deadSopenharmony_ci 2825bd8deadSopenharmony_ci // plug-in 2835bd8deadSopenharmony_ci { 2845bd8deadSopenharmony_ci int attachable0; 2855bd8deadSopenharmony_ci int attachable1; 2865bd8deadSopenharmony_ci GetTextureParameteriv(tex0, MEMORY_ATTACHABLE_NV, &attachable0); 2875bd8deadSopenharmony_ci GetTextureParameteriv(tex1, MEMORY_ATTACHABLE_NV, &attachable1); 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci if (attachable0 && attachable1){ 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci // allocate memory within vulkan and import it as specified in 2925bd8deadSopenharmony_ci // EXT_memory_object 2935bd8deadSopenharmony_ci 2945bd8deadSopenharmony_ci // attach imported vulkan memory 2955bd8deadSopenharmony_ci TextureAttachMemoryNV(tex0, memobj, memoffset0); 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci // ... do same for tex1 2985bd8deadSopenharmony_ci TextureAttachMemoryNV(tex1, memobj, memoffset1); 2995bd8deadSopenharmony_ci } 3005bd8deadSopenharmony_ci } 3015bd8deadSopenharmony_ci 3025bd8deadSopenharmony_ci /////////////////////////////// 3035bd8deadSopenharmony_ci // Querying mutations by host 3045bd8deadSopenharmony_ci 3055bd8deadSopenharmony_ci int incarnationExpected; 3065bd8deadSopenharmony_ci 3075bd8deadSopenharmony_ci // plug-in 3085bd8deadSopenharmony_ci { 3095bd8deadSopenharmony_ci // global query 3105bd8deadSopenharmony_ci GetIntegerv(DETACHED_MEMORY_INCARNATION_NV, &incarnationExpected); 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ci // if we have multiple memory objects 3135bd8deadSopenharmony_ci for each memobj { 3145bd8deadSopenharmony_ci GetMemoryObjectParameterivEXT(memobj.id, 3155bd8deadSopenharmony_ci DETACHED_MEMORY_INCARNATION_NV, 3165bd8deadSopenharmony_ci &memobj.incarnation); 3175bd8deadSopenharmony_ci GLint maxDetachedTextures = 64; 3185bd8deadSopenharmony_ci MemoryObjectParameterivEXT(memobj.id, 3195bd8deadSopenharmony_ci MAX_DETACHED_TEXTURES_NV, 3205bd8deadSopenharmony_ci &maxDetachedTextures); 3215bd8deadSopenharmony_ci } 3225bd8deadSopenharmony_ci } 3235bd8deadSopenharmony_ci 3245bd8deadSopenharmony_ci // host 3255bd8deadSopenharmony_ci { 3265bd8deadSopenharmony_ci // deletion triggers a detach 3275bd8deadSopenharmony_ci glDeleteTextures(1, &tex1); 3285bd8deadSopenharmony_ci } 3295bd8deadSopenharmony_ci 3305bd8deadSopenharmony_ci // plug-in 3315bd8deadSopenharmony_ci { 3325bd8deadSopenharmony_ci // global query if resources of context were affected 3335bd8deadSopenharmony_ci int incarnation; 3345bd8deadSopenharmony_ci GetIntegerv(DETACHED_MEMORY_INCARNATION_NV, &incarnation); 3355bd8deadSopenharmony_ci 3365bd8deadSopenharmony_ci if (incarnation != incarnationExpected) { 3375bd8deadSopenharmony_ci incarnationExpected = incarnation; 3385bd8deadSopenharmony_ci 3395bd8deadSopenharmony_ci // narrow down search which memory object was affected 3405bd8deadSopenharmony_ci for each memobj { 3415bd8deadSopenharmony_ci GetMemoryObjectParameterivEXT(memobj.id, 3425bd8deadSopenharmony_ci DETACHED_MEMORY_INCARNATION_NV, 3435bd8deadSopenharmony_ci &incarnation); 3445bd8deadSopenharmony_ci 3455bd8deadSopenharmony_ci if (incarnation != memobj.incarnation) { 3465bd8deadSopenharmony_ci memobj.incarnation = incarnation; 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ci int removedTexCount; 3495bd8deadSopenharmony_ci GetMemoryObjectParameterivEXT(memobj.id, 3505bd8deadSopenharmony_ci DETACHED_TEXTURES_NV, 3515bd8deadSopenharmony_ci &removedTexCount); 3525bd8deadSopenharmony_ci 3535bd8deadSopenharmony_ci std::vector<uint> removedTexs(removedTexCount); 3545bd8deadSopenharmony_ci 3555bd8deadSopenharmony_ci GetMemoryObjectDetachedResourcesuivNV( 3565bd8deadSopenharmony_ci memobj.id, 3575bd8deadSopenharmony_ci DETACHED_TEXTURES_NV, 3585bd8deadSopenharmony_ci 0, removedTexCount, 3595bd8deadSopenharmony_ci removedTexs.data()); 3605bd8deadSopenharmony_ci 3615bd8deadSopenharmony_ci for (int i = 0; i < removedTexCount; i++) { 3625bd8deadSopenharmony_ci uint tex = removedTexs[i]; 3635bd8deadSopenharmony_ci // look up tex in custom allocator and 3645bd8deadSopenharmony_ci // mark its memory as available again 3655bd8deadSopenharmony_ci } 3665bd8deadSopenharmony_ci 3675bd8deadSopenharmony_ci ResetMemoryObjectParameter(memobj.id, 3685bd8deadSopenharmony_ci DETACHED_TEXTURES_NV); 3695bd8deadSopenharmony_ci } 3705bd8deadSopenharmony_ci } 3715bd8deadSopenharmony_ci } 3725bd8deadSopenharmony_ci } 3735bd8deadSopenharmony_ci 3745bd8deadSopenharmony_ciIssues 3755bd8deadSopenharmony_ci 3765bd8deadSopenharmony_ci 1) Do we need to introduce allocation done within OpenGL 3775bd8deadSopenharmony_ci or is attaching existing resources to imported allocation 3785bd8deadSopenharmony_ci sufficient? 3795bd8deadSopenharmony_ci 3805bd8deadSopenharmony_ci RESOLVED: No. No need to duplicate work which has already been done 3815bd8deadSopenharmony_ci in Vulkan. 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci 2) Should binding memory only work on immutable resources? 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ci RESOLVED: No. To improve compatibility with existing GL resources, 3865bd8deadSopenharmony_ci allow mutable resources as well. A global and local incarnation counter 3875bd8deadSopenharmony_ci was introduced to test against changes, as well as detecting the 3885bd8deadSopenharmony_ci detached resources. 3895bd8deadSopenharmony_ci 3905bd8deadSopenharmony_ci 3) Do we support client-mappable resources? 3915bd8deadSopenharmony_ci 3925bd8deadSopenharmony_ci RESOLVED: Yes. Client-mappable resources are supported but not 3935bd8deadSopenharmony_ci when they are persistent. When memory is attached resource must be 3945bd8deadSopenharmony_ci unmapped. 3955bd8deadSopenharmony_ci 3965bd8deadSopenharmony_ci 4) What are the affects on TextureViews? 3975bd8deadSopenharmony_ci 3985bd8deadSopenharmony_ci RESOLVED: TextureViews inherit the memory state. 3995bd8deadSopenharmony_ci 4005bd8deadSopenharmony_ci 5) Do bindless resources change? 4015bd8deadSopenharmony_ci 4025bd8deadSopenharmony_ci RESOLVED: Yes. The existing handles and GPU addresses become invalid 4035bd8deadSopenharmony_ci when memory is attached and must be queried afterwards. 4045bd8deadSopenharmony_ci 4055bd8deadSopenharmony_ci 6) Should we support resources that were migrated to host memory by driver? 4065bd8deadSopenharmony_ci 4075bd8deadSopenharmony_ci RESOLVED: Yes, but the attached memory is independ from this state. 4085bd8deadSopenharmony_ci 4095bd8deadSopenharmony_ci 7) Do we need an "attachable" per-resource state? 4105bd8deadSopenharmony_ci 4115bd8deadSopenharmony_ci RESOLVED: Yes. 4125bd8deadSopenharmony_ci 4135bd8deadSopenharmony_ci 8) How is bindless residency affected? 4145bd8deadSopenharmony_ci 4155bd8deadSopenharmony_ci RESOLVED: A memory object becomes resident if at least one attached 4165bd8deadSopenharmony_ci resource is resident. 4175bd8deadSopenharmony_ci 4185bd8deadSopenharmony_ci 4195bd8deadSopenharmony_ciRevision History 4205bd8deadSopenharmony_ci 4215bd8deadSopenharmony_ci Revision 2, 2018-08-20 (Carsten Rohde, Christoph Kubisch) 4225bd8deadSopenharmony_ci - Added spec body describing new commands. 4235bd8deadSopenharmony_ci - Added non-DSA functions 4245bd8deadSopenharmony_ci - Resolve issues 4255bd8deadSopenharmony_ci 4265bd8deadSopenharmony_ci Revision 1, 2018-05-07 (Carsten Rohde, Christoph Kubisch) 4275bd8deadSopenharmony_ci - Initial draft. 428