15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_bindless_texture 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_bindless_texture 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com) 125bd8deadSopenharmony_ci Pat Brown, NVIDIA Coproration (pbrown 'at' nvidia.com) 135bd8deadSopenharmony_ci 145bd8deadSopenharmony_ciContributors 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ci Daniel Koch, NVIDIA 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciStatus 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Shipping 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciVersion 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci Last Modified Date: June 13, 2014 255bd8deadSopenharmony_ci Author Revision: 3 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciNumber 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci OpenGL Extension #418 305bd8deadSopenharmony_ci OpenGL ES Extension #197 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciDependencies 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci This extension is written against the OpenGL 4.0 (Compatibility Profile) 355bd8deadSopenharmony_ci and OpenGL Shading Language 4.00 Specifications. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci OpenGL 4.0 or later is required for an OpenGL implementation. 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci The GLSL portion of this extension requires NV_gpu_shader5, or a similar 405bd8deadSopenharmony_ci extension providing 64-bit integer support in the shading language. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci This extension interacts with OpenGL 4.0 (Core Profile). 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci This extension interacts with OpenGL 3.3 and ARB_sampler_objects. 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci This extension interacts with OpenGL 4.2, ARB_shader_image_load_store, and 475bd8deadSopenharmony_ci EXT_shader_image_load_store. 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci This extension interacts with NV_vertex_attrib_integer_64bit. 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci This extension interacts with NV_gpu_shader5. 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci This extension interacts with EXT_direct_state_access. 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci This extension interacts with ARB_seamless_cube_map and 565bd8deadSopenharmony_ci AMD_seamless_cubemap_per_texture. 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci This extension interacts with NV_gpu_program4, NV_gpu_program5, and 595bd8deadSopenharmony_ci EXT_shader_image_load_store. 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci This extension interacts with GLSL 4.20. 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci OpenGL ES 3.0 or later is required for an OpenGL ES implementation. 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci This extension interacts with OpenGL ES 3.1. 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci This extension interacts with OES_shader_image_atomic. 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci This extension interacts with EXT_texture_cube_map_array. 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci This extension interacts with EXT_texture_buffer. 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci This extension interacts with EXT_shader_io_blocks. 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciOverview 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci This extension allows OpenGL applications to access texture objects in 785bd8deadSopenharmony_ci shaders without first binding each texture to one of a limited number of 795bd8deadSopenharmony_ci texture image units. Using this extension, an application can query a 805bd8deadSopenharmony_ci 64-bit unsigned integer texture handle for each texture that it wants to 815bd8deadSopenharmony_ci access and then use that handle directly in GLSL or assembly-based 825bd8deadSopenharmony_ci shaders. The ability to access textures without having to bind and/or 835bd8deadSopenharmony_ci re-bind them is similar to the capability provided by the 845bd8deadSopenharmony_ci NV_shader_buffer_load extension that allows shaders to access buffer 855bd8deadSopenharmony_ci objects without binding them. In both cases, these extensions 865bd8deadSopenharmony_ci significantly reduce the amount of API and internal GL driver overhead 875bd8deadSopenharmony_ci needed to manage resource bindings. 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci This extension also provides similar capability for the image load, store, 905bd8deadSopenharmony_ci and atomic functionality provided by OpenGL 4.2, OpenGL ES 3.1 and the 915bd8deadSopenharmony_ci ARB_shader_image_load_store and EXT_shader_image_load_store extensions, 925bd8deadSopenharmony_ci where a texture can be accessed without first binding it to an image unit. 935bd8deadSopenharmony_ci An image handle can be extracted from a texture object using an API with a 945bd8deadSopenharmony_ci set of parameters similar to those for BindImageTextureEXT. 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci This extension adds no new data types to GLSL. Instead, it uses existing 975bd8deadSopenharmony_ci sampler and image data types and allows them to be populated with texture 985bd8deadSopenharmony_ci and image handles. This extension does permit sampler and image data 995bd8deadSopenharmony_ci types to be used in more contexts than in unextended GLSL 4.00. In 1005bd8deadSopenharmony_ci particular, sampler and image types may be used as shader inputs/outputs, 1015bd8deadSopenharmony_ci temporary variables, and uniform block members, and may be assigned to by 1025bd8deadSopenharmony_ci shader code. Constructors are provided to convert 64-bit unsigned integer 1035bd8deadSopenharmony_ci values to and from sampler and image data types. Additionally, new APIs 1045bd8deadSopenharmony_ci are provided to load values for sampler and image uniforms with 64-bit 1055bd8deadSopenharmony_ci handle inputs. The use of existing integer-based Uniform* APIs is still 1065bd8deadSopenharmony_ci permitted, in which case the integer specified will identify a texture 1075bd8deadSopenharmony_ci image or image unit. For samplers and images with values specified as 1085bd8deadSopenharmony_ci texture image or image units, the GL implemenation will translate the unit 1095bd8deadSopenharmony_ci number to an internal handle as required. 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci To access texture or image resources using handles, the handles must first 1125bd8deadSopenharmony_ci be made resident. Accessing a texture or image by handle without first 1135bd8deadSopenharmony_ci making it resident can result in undefined results, including program 1145bd8deadSopenharmony_ci termination. Since the amount of texture memory required by an 1155bd8deadSopenharmony_ci application may exceed the amount of memory available to the system, this 1165bd8deadSopenharmony_ci extension provides API calls allowing applications to manage overall 1175bd8deadSopenharmony_ci texture memory consumption by making a texture resident and non-resident 1185bd8deadSopenharmony_ci as required. 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ciNew Procedures and Functions 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci uint64 GetTextureHandleNV(uint texture); 1245bd8deadSopenharmony_ci uint64 GetTextureSamplerHandleNV(uint texture, uint sampler); 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci void MakeTextureHandleResidentNV(uint64 handle); 1275bd8deadSopenharmony_ci void MakeTextureHandleNonResidentNV(uint64 handle); 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci uint64 GetImageHandleNV(uint texture, int level, boolean layered, 1305bd8deadSopenharmony_ci int layer, enum format); 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci void MakeImageHandleResidentNV(uint64 handle, enum access); 1335bd8deadSopenharmony_ci void MakeImageHandleNonResidentNV(uint64 handle); 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci void UniformHandleui64NV(int location, uint64 value); 1365bd8deadSopenharmony_ci void UniformHandleui64vNV(int location, sizei count, const uint64 *value); 1375bd8deadSopenharmony_ci void ProgramUniformHandleui64NV(uint program, int location, 1385bd8deadSopenharmony_ci uint64 value); 1395bd8deadSopenharmony_ci void ProgramUniformHandleui64vNV(uint program, int location, 1405bd8deadSopenharmony_ci sizei count, const uint64 *values); 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci boolean IsTextureHandleResidentNV(uint64 handle); 1435bd8deadSopenharmony_ci boolean IsImageHandleResidentNV(uint64 handle); 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ciNew Tokens 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci None. 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 4.0 (Compatibility Profile) Specification 1525bd8deadSopenharmony_ci(OpenGL Operation) 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ci Modify Section 2.7, Vertex Specification, p. 30 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci Replace the paragraph from NV_vertex_attrib_integer_64bit describing the 1575bd8deadSopenharmony_ci behavior of VertexAttribL*: 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci These commands specify one, two, three or four values. Note that attribute 1605bd8deadSopenharmony_ci variables declared with "double" types must be loaded with 1615bd8deadSopenharmony_ci VertexAttribL*d{v}EXT; loading attributes with VertexAttrib*d{v} will 1625bd8deadSopenharmony_ci produce undefined results. Similarly, attributes declared with 64-bit 1635bd8deadSopenharmony_ci integer types, sampler types, or image types must be loaded with 1645bd8deadSopenharmony_ci VertexAttribL*{i64,ui64}{v}. 1655bd8deadSopenharmony_ci 1665bd8deadSopenharmony_ci ... 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci The full set of VertexAttrib* commands specify generic attributes with 1695bd8deadSopenharmony_ci components one of eight data types: 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci * floating-point values (VertexAttrib*), 1725bd8deadSopenharmony_ci * signed or unsigned integers (VertexAttribI*), 1735bd8deadSopenharmony_ci * double-precision floating-point values (VertexAttribL*d*), and 1745bd8deadSopenharmony_ci * 64-bit signed or unsigned integers, images, or samplers 1755bd8deadSopenharmony_ci (VertexAttribL*{i64,ui64}*). 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci Modify Section 2.14.3, Vertex Attributes, p. 94 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci Edit Table X.1 of NV_vertex_attrib_integer_64bit (Scalar and vector 1815bd8deadSopenharmony_ci vertex attribute types and VertexAttrib* commands used to set the values 1825bd8deadSopenharmony_ci of the corresponding generic attribute.). Change the line describing 1835bd8deadSopenharmony_ci VertexAttribL1ui64NV to allow it for sampler and image types. 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci Data type Command 1865bd8deadSopenharmony_ci ------------------------------- ---------------------------------- 1875bd8deadSopenharmony_ci uint64_t VertexAttribL1ui64NV 1885bd8deadSopenharmony_ci sampler* isampler* usampler* 1895bd8deadSopenharmony_ci image* iimage* uimage* 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci Modify Section 2.14.4, Uniform Variables, p. 97 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci (Modify second paragraph, p. 98) ... uniform components, respectively. A 1945bd8deadSopenharmony_ci scalar or vector uniform with double-precision or 64-bit integer 1955bd8deadSopenharmony_ci components will consume no more than 2n components, where n is 1 for 1965bd8deadSopenharmony_ci scalars, and the component count for vectors. A sampler or image uniform 1975bd8deadSopenharmony_ci will consume no more than two components. A link error is generated... 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci (Edit Table 2.15, "OpenGL Shading Language type tokens returned by 2015bd8deadSopenharmony_ci GetActiveUniform and GetActiveUniformsiv...", pp. 104-106. In particular, 2025bd8deadSopenharmony_ci add dots to the "Attrib" and "Xfb" columns for all SAMPLER and IMAGE 2035bd8deadSopenharmony_ci types.) 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci (Edit the subsection "Loading Uniform Variables In The Default Uniform 2075bd8deadSopenharmony_ci Block", p. 108) 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci (Add the following commands to the list of uniform functions on p. 108.) 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci void UniformHandleui64NV(int location, uint64 value); 2125bd8deadSopenharmony_ci void UniformHandleui64vNV(int location, sizei count, 2135bd8deadSopenharmony_ci const uint64 *value); 2145bd8deadSopenharmony_ci void ProgramUniformHandleui64NV(uint program, int location, 2155bd8deadSopenharmony_ci uint64 value); 2165bd8deadSopenharmony_ci void ProgramUniformHandleui64vNV(uint program, int location, 2175bd8deadSopenharmony_ci sizei count, const uint64 *values); 2185bd8deadSopenharmony_ci 2195bd8deadSopenharmony_ci (Delete the sentence: "Only the Uniform1i{v} commands can be used to load 2205bd8deadSopenharmony_ci sampler values (see below)." from p. 108.) 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci (Insert a new paragarph after the second paragraph, p. 109) 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci The UniformHandleui64{v}NV commands will load <count> 64-bit unsigned 2255bd8deadSopenharmony_ci integer handles into a uniform location corresponding to sampler or image 2265bd8deadSopenharmony_ci variable types. Only the UniformHandleui64{v}NV and Uniform1i{v} commands 2275bd8deadSopenharmony_ci can be used to load sampler and image values as described in Section 2285bd8deadSopenharmony_ci 2.14.6 (Samplers). 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ci Edit Subsection "Uniform Buffer Object Storage", p. 110: 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ci (Add rules for sampler and image types to the list at the beginning of 2345bd8deadSopenharmony_ci p. 111.) 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci * Members of sampler types are extracted from a buffer object by 2375bd8deadSopenharmony_ci reading a single uint64-typed value at the specified offset. 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ci * Members of image types are extracted from a buffer object by reading 2405bd8deadSopenharmony_ci a single uint64-typed value at the specified offset. 2415bd8deadSopenharmony_ci 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ci Modify Section 2.14.6, Samplers, p. 117 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ci (Replace the section with the following, adding the ability to use 2465bd8deadSopenharmony_ci samplers in new places as well as describing the behavior of the new 2475bd8deadSopenharmony_ci UniformHandleui64{v}NV APIs.) 2485bd8deadSopenharmony_ci 2495bd8deadSopenharmony_ci Samplers are special data types used by the OpenGL Shading Language to 2505bd8deadSopenharmony_ci identify the texture object used for each texture lookup. Sampler 2515bd8deadSopenharmony_ci variables may be used as shader inputs and outputs, uniforms in the 2525bd8deadSopenharmony_ci default block or in user-defined blocks, or as temporaries. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci When used as uniforms in the default block, the value of sampler 2555bd8deadSopenharmony_ci variables may be specified with either Uniform1i{v} or 2565bd8deadSopenharmony_ci UniformHandleui64{v}NV. If a sampler uniform value is specified by 2575bd8deadSopenharmony_ci Uniform1i{v}, the value passed to Uniform1i{v} indicates a texture image 2585bd8deadSopenharmony_ci unit that will be accessed, and the value must be in the range from zero 2595bd8deadSopenharmony_ci to the implementation-dependent maximum supported number of texture image 2605bd8deadSopenharmony_ci units. The error INVALID_VALUE is generated if a Uniform1i{v} call is 2615bd8deadSopenharmony_ci used to set a sampler uniform to a value less than zero or greater than or 2625bd8deadSopenharmony_ci equal to the value of MAX_TEXTURE_IMAGE_UNITS. If a sampler uniform value 2635bd8deadSopenharmony_ci is specified by UniformHandleui64{v}NV, the value passed to 2645bd8deadSopenharmony_ci UniformHandleui64NV{v} directly specifies a texture object by handle, as 2655bd8deadSopenharmony_ci defined in Section 3.9.X (Bindless Textures). When a program is linked, 2665bd8deadSopenharmony_ci all sampler uniforms are initialized to zero and considered to be 2675bd8deadSopenharmony_ci references to texture image units. When used as shader inputs, outputs, 2685bd8deadSopenharmony_ci uniform block members, or temporaries, the value of the sampler is a 64- 2695bd8deadSopenharmony_ci bit unsigned integer handle and never refers to a texture image unit. 2705bd8deadSopenharmony_ci 2715bd8deadSopenharmony_ci When the value of a sampler indicates a texture image unit, the type of 2725bd8deadSopenharmony_ci the sampler identifies the target on the texture image unit. The texture 2735bd8deadSopenharmony_ci object bound to that texture image unit's target is used for any texture 2745bd8deadSopenharmony_ci accesses using that sampler. For example, a variable of type sampler2D 2755bd8deadSopenharmony_ci selects the target TEXTURE_2D on its texture image unit. Binding of 2765bd8deadSopenharmony_ci texture objects to targets is done as usual with BindTexture. Selecting 2775bd8deadSopenharmony_ci the texture image unit to bind to is done as usual with ActiveTexture. 2785bd8deadSopenharmony_ci 2795bd8deadSopenharmony_ci When the value of a sampler indicates a texture handle, the target of the 2805bd8deadSopenharmony_ci texture referred to by the handle must match the type of the sampler. For 2815bd8deadSopenharmony_ci example, a variable of type sampler2D must be used in conjunction with a 2825bd8deadSopenharmony_ci handle of a texture of target TEXTURE_2D. If the value of a sampler 2835bd8deadSopenharmony_ci variable is not a valid texture handle or is not resident (section 3.9.X), 2845bd8deadSopenharmony_ci the results of using that sampler during shader execution are undefined 2855bd8deadSopenharmony_ci and may lead to program termination. If the value of a sampler variable 2865bd8deadSopenharmony_ci is a valid handle of a texture with a target different from the variable 2875bd8deadSopenharmony_ci type, the results of using that handle are undefined but may not include 2885bd8deadSopenharmony_ci program termination. 2895bd8deadSopenharmony_ci 2905bd8deadSopenharmony_ci It is not allowed to have uniform variables of different sampler types 2915bd8deadSopenharmony_ci pointing to the same texture image unit within a program object. This 2925bd8deadSopenharmony_ci situation can only be detected at the next rendering command issued, and 2935bd8deadSopenharmony_ci an INVALID_OPERATION error will then be generated. Sampler uniforms 2945bd8deadSopenharmony_ci specified using handles do not count as using any texture image unit, even 2955bd8deadSopenharmony_ci if a texture referred to by a handle is currently bound to one or more 2965bd8deadSopenharmony_ci texture image units. 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ci Active samplers are those samplers actually being used in a program 2995bd8deadSopenharmony_ci object. When a program is linked by LinkProgram, the GL determines 3005bd8deadSopenharmony_ci whether each sampler is active or not. There is no limit on the number of 3015bd8deadSopenharmony_ci active sampler variables that may be used by a program or by any 3025bd8deadSopenharmony_ci particular shader. However, restrictions on the use of texture image 3035bd8deadSopenharmony_ci units imposes an effective limit on the number of non-handle sampler 3045bd8deadSopenharmony_ci uniforms. Active samplers used as shader inputs, shader outputs, or 3055bd8deadSopenharmony_ci uniforms in the default uniform block are counted toward 3065bd8deadSopenharmony_ci implementation-dependent limits on the total number of input, output, or 3075bd8deadSopenharmony_ci uniform components supported by the program. Each active sampler variable 3085bd8deadSopenharmony_ci may count as two components against such limits. 3095bd8deadSopenharmony_ci 3105bd8deadSopenharmony_ci 3115bd8deadSopenharmony_ci Modify Section 2.14.X, Images, from EXT_shader_image_load_store 3125bd8deadSopenharmony_ci 3135bd8deadSopenharmony_ci (Replace the section with the following, adding the ability to use images 3145bd8deadSopenharmony_ci in new places as well as describing the behavior of the new 3155bd8deadSopenharmony_ci UniformHandleui64{v}NV APIs.) 3165bd8deadSopenharmony_ci 3175bd8deadSopenharmony_ci Images are special data types used in the OpenGL Shading Language to 3185bd8deadSopenharmony_ci identify a level of a texture to be read or written using image load, 3195bd8deadSopenharmony_ci store, and atomic built-in functions in the manner described in Section 3205bd8deadSopenharmony_ci 3.9.X of the EXT_shader_image_load_store specification. Image variables 3215bd8deadSopenharmony_ci may be used as shader inputs and outputs, uniforms in the default block or 3225bd8deadSopenharmony_ci in user-defined blocks, or as temporaries. 3235bd8deadSopenharmony_ci 3245bd8deadSopenharmony_ci When used as uniforms in the default block, the value of image variables 3255bd8deadSopenharmony_ci may be specified with either Uniform1i{v} or UniformHandleui64{v}NV. If 3265bd8deadSopenharmony_ci an image uniform value is specified by Uniform1i{v}, the value passed to 3275bd8deadSopenharmony_ci Uniform1i{v} indicates an image unit that will be accessed, and the value 3285bd8deadSopenharmony_ci must be in the range from zero to the implementation-dependent maximum 3295bd8deadSopenharmony_ci supported number of image units. The error INVALID_VALUE is generated if 3305bd8deadSopenharmony_ci a Uniform1i{v} call is used to set an image uniform to a value less than 3315bd8deadSopenharmony_ci zero or greater than or equal to the value of MAX_IMAGE_UNITS_EXT. Note 3325bd8deadSopenharmony_ci that image units used for image variables are independent from the texture 3335bd8deadSopenharmony_ci image units used for sampler variables; the number of units provided by the 3345bd8deadSopenharmony_ci implementation may differ. Textures are bound independently and 3355bd8deadSopenharmony_ci separately to image and texture image units. If an image uniform value is 3365bd8deadSopenharmony_ci specified by UniformHandleui64{v}NV, the value provided directly specifies 3375bd8deadSopenharmony_ci a texture object by handle, as defined in Section 3.9.X (Bindless 3385bd8deadSopenharmony_ci Textures). When a program is linked, all image uniforms are initialized 3395bd8deadSopenharmony_ci to zero and considered to be references to image units. When used as 3405bd8deadSopenharmony_ci shader inputs, outputs, uniform block members, or temporaries, the value 3415bd8deadSopenharmony_ci of an image variable is a 64-bit unsigned integer handle and never refers 3425bd8deadSopenharmony_ci to an image unit. 3435bd8deadSopenharmony_ci 3445bd8deadSopenharmony_ci The type of an image variable must match the texture target of the image 3455bd8deadSopenharmony_ci currently bound to the image unit or referenced by the image handle. 3465bd8deadSopenharmony_ci Otherwise, the results of load, store, or atomic operations using the 3475bd8deadSopenharmony_ci image variable are undefined (see Section 4.1.X of the OpenGL Shading 3485bd8deadSopenharmony_ci Language specification edits in EXT_shader_image_load_store for more 3495bd8deadSopenharmony_ci detail) but may not include program termination. Additionally, if the 3505bd8deadSopenharmony_ci value of an image variable is not a valid image handle or is not resident 3515bd8deadSopenharmony_ci (section 3.9.X), the results of using that image variable during shader 3525bd8deadSopenharmony_ci execution are undefined and may lead to program termination. 3535bd8deadSopenharmony_ci 3545bd8deadSopenharmony_ci Active image variables are those variables actually being used in a 3555bd8deadSopenharmony_ci program object. When a program is linked by LinkProgram, the GL 3565bd8deadSopenharmony_ci determines whether each image variable is active or not. There is no 3575bd8deadSopenharmony_ci limit on the number of active image variables that may be used by a 3585bd8deadSopenharmony_ci program or by any particular shader. However, the limited number of image 3595bd8deadSopenharmony_ci units imposes an effective limit on the number of unique non-handle image 3605bd8deadSopenharmony_ci variables. Active image variables used as shader inputs, shader outputs, 3615bd8deadSopenharmony_ci or uniforms in the default uniform block are counted toward 3625bd8deadSopenharmony_ci implementation-dependent limits on the total number of input, output, or 3635bd8deadSopenharmony_ci uniform components supported by the program. Each active image variable 3645bd8deadSopenharmony_ci may count as two components against such limits. 3655bd8deadSopenharmony_ci 3665bd8deadSopenharmony_ci 3675bd8deadSopenharmony_ci Modify Section 2.14.7, Varying Variables, p. 118 3685bd8deadSopenharmony_ci 3695bd8deadSopenharmony_ci (modify first paragraph, p. 119) ... Each component of variables declared 3705bd8deadSopenharmony_ci as double-precision floating-point scalars, vectors, or matrices, as 3715bd8deadSopenharmony_ci 64-bit integer scalars or vectors, or as samplers or images may be counted 3725bd8deadSopenharmony_ci as consuming two components. 3735bd8deadSopenharmony_ci 3745bd8deadSopenharmony_ci (replace second paragraph, p. 121) For the purposes of counting the total 3755bd8deadSopenharmony_ci number of components to capture, each component of outputs declared as 3765bd8deadSopenharmony_ci double-precision floating-point scalars, vectors, or matrices, as 64-bit 3775bd8deadSopenharmony_ci integer scalars or vectors, or as samplers or images may be counted as 3785bd8deadSopenharmony_ci consuming two components. 3795bd8deadSopenharmony_ci 3805bd8deadSopenharmony_ci 3815bd8deadSopenharmony_ci Modify Section 2.14.8, Shader Execution, p. 122 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci (modify second paragraph, p. 126) ... against the 3845bd8deadSopenharmony_ci MAX_COMBINED_TEXTURE_IMAGE_UNITS limit. Samplers accessed using texture 3855bd8deadSopenharmony_ci handles (section 3.9.X) are not counted against this limit. 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ci (modify last paragraph of "Texture Access", p. 127) Using a sampler in a 3885bd8deadSopenharmony_ci shader will return (R,G,B,A) = (0,0,0,1) if the sampler's associated 3895bd8deadSopenharmony_ci texture is not complete, as defined in section 3.9.14. Textures referred 3905bd8deadSopenharmony_ci to by valid texture handles (section 3.9.X) will always be complete. 3915bd8deadSopenharmony_ci 3925bd8deadSopenharmony_ci 3935bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 4.0 Specification (Rasterization) 3945bd8deadSopenharmony_ci 3955bd8deadSopenharmony_ci Insert new section after Section 3.9.2, Sampler Objects, p. 257 3965bd8deadSopenharmony_ci 3975bd8deadSopenharmony_ci Section 3.9.X, Bindless Textures 3985bd8deadSopenharmony_ci 3995bd8deadSopenharmony_ci The previous sections describe mechanisms to make texture and sampler 4005bd8deadSopenharmony_ci objects available to shaders or fixed-function fragment processing by 4015bd8deadSopenharmony_ci binding the objects to texture image units. Additionally, texture objects 4025bd8deadSopenharmony_ci may be accessed by shader using texture handles, which are 64-bit unsigned 4035bd8deadSopenharmony_ci integers identifying the state of a texture and/or sampler object. The 4045bd8deadSopenharmony_ci handle zero is reserved and will never be assigned to a valid texture 4055bd8deadSopenharmony_ci handle. To obtain a texture handle, use the commands: 4065bd8deadSopenharmony_ci 4075bd8deadSopenharmony_ci uint64 GetTextureHandleNV(uint texture); 4085bd8deadSopenharmony_ci uint64 GetTextureSamplerHandleNV(uint texture, uint sampler); 4095bd8deadSopenharmony_ci 4105bd8deadSopenharmony_ci GetTextureHandleNV will create a texture handle using the current state of 4115bd8deadSopenharmony_ci the texture named <texture>, including any embedded sampler state. 4125bd8deadSopenharmony_ci GetTextureSamplerHandleNV will create a texture handle using the current 4135bd8deadSopenharmony_ci non-sampler state from the texture named <texture> and the sampler state 4145bd8deadSopenharmony_ci from the sampler object <sampler>. In both cases, a 64-bit unsigned 4155bd8deadSopenharmony_ci integer handle is returned. The error INVALID_VALUE is generated if 4165bd8deadSopenharmony_ci <texture> is zero or is not the name of an existing texture object or if 4175bd8deadSopenharmony_ci <sampler> is zero or is not the name of an existing sampler object. The 4185bd8deadSopenharmony_ci error INVALID_OPERATION is generated if the texture object <texture> is 4195bd8deadSopenharmony_ci not complete (section 3.9.14). If an error occurs, a handle of zero is 4205bd8deadSopenharmony_ci returned. 4215bd8deadSopenharmony_ci 4225bd8deadSopenharmony_ci The handle for each texture or texture/sampler pair is unique; the same 4235bd8deadSopenharmony_ci handle will be returned if GetTextureHandleNV is called multiple times for 4245bd8deadSopenharmony_ci the same texture or if GetTextureSamplerHandleNV is called multple times 4255bd8deadSopenharmony_ci for the same texture/sampler pair. 4265bd8deadSopenharmony_ci 4275bd8deadSopenharmony_ci When a texture object is referenced by one or more texture handles, the 4285bd8deadSopenharmony_ci texture parameters of the object (Section 3.9.8) may not be changed, and 4295bd8deadSopenharmony_ci the size and format of the images in the texture object (Section 3.9.3) 4305bd8deadSopenharmony_ci may not be re-specified. The error INVALID_OPERATION is generated if the 4315bd8deadSopenharmony_ci functions TexImage*, CopyTexImage*, CompressedTexImage*, TexBuffer*, or 4325bd8deadSopenharmony_ci TexParameter* are called to modify a texture object referenced by one or 4335bd8deadSopenharmony_ci more texture handles. The contents of the images in a texture object may 4345bd8deadSopenharmony_ci still be updated via commands such as TexSubImage*, CopyTexSubImage*, and 4355bd8deadSopenharmony_ci CompressedTexSubImage*, and by rendering to a framebuffer object, even if 4365bd8deadSopenharmony_ci the texture object is referenced by one or more texture handles. 4375bd8deadSopenharmony_ci 4385bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by BufferData if it is called to 4395bd8deadSopenharmony_ci modify a buffer object bound to a buffer texture while that texture object 4405bd8deadSopenharmony_ci is referenced by one or more texture handles. The contents of the buffer 4415bd8deadSopenharmony_ci object may still be updated via buffer update commands such as 4425bd8deadSopenharmony_ci BufferSubData and MapBuffer*, or via the texture update commands, even if 4435bd8deadSopenharmony_ci the buffer is bound to a texture while that buffer texture object is 4445bd8deadSopenharmony_ci referenced by one or more texture handles. 4455bd8deadSopenharmony_ci 4465bd8deadSopenharmony_ci When a sampler object is referenced by one or more texture handles, the 4475bd8deadSopenharmony_ci sampler parameters of the object may not be changed. The error 4485bd8deadSopenharmony_ci INVALID_OPERATION is generated when calling SamplerParameter* functions to 4495bd8deadSopenharmony_ci modify a sampler object referenced by one or more texture handles. 4505bd8deadSopenharmony_ci 4515bd8deadSopenharmony_ci To make a texture handle accessible to shaders for texture mapping 4525bd8deadSopenharmony_ci operations, a texture handle must first be made resident by calling: 4535bd8deadSopenharmony_ci 4545bd8deadSopenharmony_ci void MakeTextureHandleResidentNV(uint64 handle); 4555bd8deadSopenharmony_ci 4565bd8deadSopenharmony_ci While the texture handle is resident, it may be used in texture mapping 4575bd8deadSopenharmony_ci operations. If a shader attempts to perform a texture mapping operation 4585bd8deadSopenharmony_ci using a handle that is not resident, the results of that operation are 4595bd8deadSopenharmony_ci undefined and may lead to application termination. When a texture handle 4605bd8deadSopenharmony_ci is resident, the texture it references is also considered resident for the 4615bd8deadSopenharmony_ci purposes of the AreTexturesResident command. The error INVALID_OPERATION 4625bd8deadSopenharmony_ci is generated if <handle> is not a valid texture handle, or if <handle> is 4635bd8deadSopenharmony_ci already resident in the current GL context. 4645bd8deadSopenharmony_ci 4655bd8deadSopenharmony_ci A texture handle may be made inaccessible to shaders by calling: 4665bd8deadSopenharmony_ci 4675bd8deadSopenharmony_ci void MakeTextureHandleNonResidentNV(uint64 handle); 4685bd8deadSopenharmony_ci 4695bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if <handle> is not a valid 4705bd8deadSopenharmony_ci texture handle, or if <handle> is not resident in the current GL context. 4715bd8deadSopenharmony_ci 4725bd8deadSopenharmony_ci 4735bd8deadSopenharmony_ci Modify Section 3.9.10, Cube Map Texture Selection, p. 291 4745bd8deadSopenharmony_ci 4755bd8deadSopenharmony_ci (insert new paragraph before last paragraph of section, p. 293) 4765bd8deadSopenharmony_ci 4775bd8deadSopenharmony_ci When accessing cube map textures using texture handles, the seamless cube 4785bd8deadSopenharmony_ci map enable is ignored and treated as disabled. 4795bd8deadSopenharmony_ci 4805bd8deadSopenharmony_ci 4815bd8deadSopenharmony_ci Modify Section 3.9.11, Texture Minification, p. 293 4825bd8deadSopenharmony_ci 4835bd8deadSopenharmony_ci [[Compatibility profile-only]] 4845bd8deadSopenharmony_ci (modify last paragraph, p. 293) ... <bias_texunit> is zero for textures 4855bd8deadSopenharmony_ci referred to by handle, and is otherwise the value of TEXTURE_LOD_BIAS for 4865bd8deadSopenharmony_ci the current texture unit (as described in section 3.9.16). ... 4875bd8deadSopenharmony_ci 4885bd8deadSopenharmony_ci 4895bd8deadSopenharmony_ci Add to Section 3.9.X (Texture Image Loads and Stores) of 4905bd8deadSopenharmony_ci EXT_shader_image_load_store: 4915bd8deadSopenharmony_ci 4925bd8deadSopenharmony_ci While texture levels may be made available to shaders by binding them to 4935bd8deadSopenharmony_ci image units using BindImageTextureEXT, they may also be accessed using 4945bd8deadSopenharmony_ci image handles. Image handles are 64-bit integers that identify a level of 4955bd8deadSopenharmony_ci a texture object, layer information for array and cube map textures, and 4965bd8deadSopenharmony_ci an associated image format. The handle zero is reserved and will never be 4975bd8deadSopenharmony_ci assigned to a valid image handle. The command 4985bd8deadSopenharmony_ci 4995bd8deadSopenharmony_ci uint64 GetImageHandleNV(uint texture, int level, boolean layered, 5005bd8deadSopenharmony_ci int layer, enum format); 5015bd8deadSopenharmony_ci 5025bd8deadSopenharmony_ci creates and returns an image handle for level <level> of the texture 5035bd8deadSopenharmony_ci named <texture>. If <layered> is TRUE, a handle is created for the 5045bd8deadSopenharmony_ci entire texture level. If <layered> is FALSE, a handle is created for 5055bd8deadSopenharmony_ci only the layer <layer> of the texture level. <format> specifies a 5065bd8deadSopenharmony_ci format used to interpret the texels of the image when used for image 5075bd8deadSopenharmony_ci loads, stores, and atomics, and has the same meaning as the <format> 5085bd8deadSopenharmony_ci parameter of BindImageTextureEXT(). A 64-bit unsigned integer handle 5095bd8deadSopenharmony_ci is returned if the command succeeds; otherwise, zero is returned. 5105bd8deadSopenharmony_ci 5115bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetImageHandleNV if: 5125bd8deadSopenharmony_ci 5135bd8deadSopenharmony_ci * <texture> is zero or not the name of an existing texture object; 5145bd8deadSopenharmony_ci 5155bd8deadSopenharmony_ci * the image for the texture level <level> doesn't exist (i.e., has a 5165bd8deadSopenharmony_ci size of zero in <texture>); or 5175bd8deadSopenharmony_ci 5185bd8deadSopenharmony_ci * <layered> is FALSE and <layer> is greater than or equal to 5195bd8deadSopenharmony_ci the number of layers in the image at level <level>. 5205bd8deadSopenharmony_ci 5215bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by GetImageHandleNV if: 5225bd8deadSopenharmony_ci 5235bd8deadSopenharmony_ci * the texture object <texture> is not complete (section 3.9.14); 5245bd8deadSopenharmony_ci 5255bd8deadSopenharmony_ci * <layered> is TRUE and the texture is not a three-dimensional, 5265bd8deadSopenharmony_ci one-dimensional array, two dimensional array, cube map, or cube map 5275bd8deadSopenharmony_ci array texture. 5285bd8deadSopenharmony_ci 5295bd8deadSopenharmony_ci When a texture object is referenced by one or more image handles, the 5305bd8deadSopenharmony_ci texture parameters of the object (Section 3.9.8) may not be changed, and 5315bd8deadSopenharmony_ci the size and format of the images in the texture object (Section 3.9.3) 5325bd8deadSopenharmony_ci may not be re-specified. The error INVALID_OPERATION is generated when 5335bd8deadSopenharmony_ci calling TexImage*, CopyTexImage*, CompressedTexImage*, TexBuffer*, or 5345bd8deadSopenharmony_ci TexParameter* functions while a texture object is referenced by one or 5355bd8deadSopenharmony_ci more image handles. The contents of the images in a texture object may 5365bd8deadSopenharmony_ci still be updated via commands such as TexSubImage*, CopyTexSubImage*, and 5375bd8deadSopenharmony_ci CompressedTexSubImage*, and by rendering to a framebuffer object, even if 5385bd8deadSopenharmony_ci the texture object is referenced by one or more image handles. 5395bd8deadSopenharmony_ci 5405bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by BufferData if it is called to 5415bd8deadSopenharmony_ci modify a buffer object bound to a buffer texture while that texture object 5425bd8deadSopenharmony_ci is referenced by one or more image handles. The contents of the buffer 5435bd8deadSopenharmony_ci object may still be updated via buffer update commands such as 5445bd8deadSopenharmony_ci BufferSubData and MapBuffer*, or via the texture update commands, even if 5455bd8deadSopenharmony_ci the buffer is bound to a texture while that buffer texture object is 5465bd8deadSopenharmony_ci referenced by one or more image handles. 5475bd8deadSopenharmony_ci 5485bd8deadSopenharmony_ci The handle returned for each combination of <texture>, <level>, <layered>, 5495bd8deadSopenharmony_ci <layer>, and <format> is unique; the same handle will be returned if 5505bd8deadSopenharmony_ci GetImageHandleNV is called multiple times with the same parameters. 5515bd8deadSopenharmony_ci 5525bd8deadSopenharmony_ci To make an image handle accessible to shaders for image loads, stores, and 5535bd8deadSopenharmony_ci atomic operations, the handle must be made resident by calling: 5545bd8deadSopenharmony_ci 5555bd8deadSopenharmony_ci void MakeImageHandleResidentNV(uint64 handle, enum access); 5565bd8deadSopenharmony_ci 5575bd8deadSopenharmony_ci <access> specifies whether the texture bound to the image handle will be 5585bd8deadSopenharmony_ci treated as READ_ONLY, WRITE_ONLY, or READ_WRITE. If a shader reads from 5595bd8deadSopenharmony_ci an image handle made resident as WRITE_ONLY, or writes to an image handle 5605bd8deadSopenharmony_ci made resident as READ_ONLY, the results of that shader operation are 5615bd8deadSopenharmony_ci undefined and may lead to application termination. The error 5625bd8deadSopenharmony_ci INVALID_OPERATION is generated if <handle> is not a valid image handle, or 5635bd8deadSopenharmony_ci if <handle> is already resident in the current GL context. 5645bd8deadSopenharmony_ci 5655bd8deadSopenharmony_ci While the image handle is resident, it may be used in image load, store, 5665bd8deadSopenharmony_ci and atomic operations. If a shader attempts to perform an image operation 5675bd8deadSopenharmony_ci using a handle that is not resident, the results of that operation are 5685bd8deadSopenharmony_ci undefined and may lead to application termination. When an image handle 5695bd8deadSopenharmony_ci is resident, the texture it references is not necessarily considered 5705bd8deadSopenharmony_ci resident for the purposes of the AreTexturesResident command. 5715bd8deadSopenharmony_ci 5725bd8deadSopenharmony_ci An image handle may be made inaccessible to shaders by calling: 5735bd8deadSopenharmony_ci 5745bd8deadSopenharmony_ci void MakeImageHandleNonResidentNV(uint64 handle); 5755bd8deadSopenharmony_ci 5765bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if <handle> is not a valid image 5775bd8deadSopenharmony_ci handle, or if <handle> is not resident in the current GL context. 5785bd8deadSopenharmony_ci 5795bd8deadSopenharmony_ci 5805bd8deadSopenharmony_ci Modify Section 3.12.2, Shader Execution, p. 323 5815bd8deadSopenharmony_ci 5825bd8deadSopenharmony_ci (replace second-to-last paragraph of "Texture Access", p. 324) Using a 5835bd8deadSopenharmony_ci sampler in a shader will return (R,G,B,A) = (0,0,0,1) if the sampler's 5845bd8deadSopenharmony_ci associated texture is not complete, as defined in section 3.9.14. 5855bd8deadSopenharmony_ci Textures referred to by valid texture handles will always be complete. 5865bd8deadSopenharmony_ci 5875bd8deadSopenharmony_ci 5885bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 4.0 Specification (Special Functions) 5895bd8deadSopenharmony_ci 5905bd8deadSopenharmony_ci Modify Section 5.5.1, Commands Not Usable In Display Lists, p. 413 5915bd8deadSopenharmony_ci 5925bd8deadSopenharmony_ci (add a new category to the list on pp. 413-414) 5935bd8deadSopenharmony_ci 5945bd8deadSopenharmony_ci Handle residency management: MakeTextureHandleResidentNV, 5955bd8deadSopenharmony_ci MakeTextureHandleNonResidentNV, MakeImageHandleResidentNV, 5965bd8deadSopenharmony_ci MakeImageHandleNonResidentNV. 5975bd8deadSopenharmony_ci 5985bd8deadSopenharmony_ci (note: GetTextureHandleNV, GetTextureSamplerHandleNV, GetImageHandleNV, 5995bd8deadSopenharmony_ci IsTextureHandleResidentNV, and IsImageHandleResidentNV are also 6005bd8deadSopenharmony_ci non-listable, but are covered by the blanket rules for Get* and Is* 6015bd8deadSopenharmony_ci commands in "Other queries") 6025bd8deadSopenharmony_ci 6035bd8deadSopenharmony_ci 6045bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 4.0 Specification (Queries) 6055bd8deadSopenharmony_ci 6065bd8deadSopenharmony_ci Modify Section 6.1.4, Texture Queries, p. 427 6075bd8deadSopenharmony_ci 6085bd8deadSopenharmony_ci (add to the end of the section) The commands: 6095bd8deadSopenharmony_ci 6105bd8deadSopenharmony_ci boolean IsTextureHandleResidentNV(uint64 handle); 6115bd8deadSopenharmony_ci boolean IsImageHandleResidentNV(uint64 handle); 6125bd8deadSopenharmony_ci 6135bd8deadSopenharmony_ci return TRUE if the specified texture or image handle is resident in the 6145bd8deadSopenharmony_ci current context. The error INVALID_OPERATION will be generated by 6155bd8deadSopenharmony_ci IsTextureHandleResidentNV or IsImageHandleResidentNV if <handle> is not 6165bd8deadSopenharmony_ci a valid texture or image handle, respectively. In the case of an error, 6175bd8deadSopenharmony_ci FALSE is returned. 6185bd8deadSopenharmony_ci 6195bd8deadSopenharmony_ci 6205bd8deadSopenharmony_ciAdditions to Appendix D of the OpenGL 4.0 Specification (Shared Objects and 6215bd8deadSopenharmony_ciMultiple Contexts) 6225bd8deadSopenharmony_ci 6235bd8deadSopenharmony_ci Modify Section D.1.2, Deleted Object and Object Name Lifetimes 6245bd8deadSopenharmony_ci 6255bd8deadSopenharmony_ci (modify first paragraph, p. 534) ... A buffer, texture, sampler, or 6265bd8deadSopenharmony_ci renderbuffer object is in use while it is attached to any container object 6275bd8deadSopenharmony_ci or bound to a context bind point in any context. A texture or sampler 6285bd8deadSopenharmony_ci object is also in use if any texture or image handle referencing the 6295bd8deadSopenharmony_ci object is resident for any context. Texture and image handles are not 6305bd8deadSopenharmony_ci deleted until either the underlying texture or sampler object used to 6315bd8deadSopenharmony_ci create the handle are deleted. A sync object ... 6325bd8deadSopenharmony_ci 6335bd8deadSopenharmony_ci Modify/replace Section D.X of NV_shader_buffer_load 6345bd8deadSopenharmony_ci 6355bd8deadSopenharmony_ci Object Use by GPU Address or Handle 6365bd8deadSopenharmony_ci 6375bd8deadSopenharmony_ci The GPU address of a buffer object is valid in all contexts in the share 6385bd8deadSopenharmony_ci group that the buffer belongs to. Similarly, texture and image handles 6395bd8deadSopenharmony_ci extracted from texture and/or sampler objects are also valid in all 6405bd8deadSopenharmony_ci contexts in the share group. Buffers, texture handles, and image handles 6415bd8deadSopenharmony_ci must be made resident separately in each context referencing them by GPU 6425bd8deadSopenharmony_ci address or handle to allow the GL to determine which resources may be used 6435bd8deadSopenharmony_ci in each command stream. If a GPU address or handle is used by a given 6445bd8deadSopenharmony_ci context where the buffer or handle has not been made resident in that 6455bd8deadSopenharmony_ci context, undefined results including program termination may occur. Such 6465bd8deadSopenharmony_ci undefined results may occur even if the buffer or handle in question has 6475bd8deadSopenharmony_ci been made resident for other contexts belonging to the context's share 6485bd8deadSopenharmony_ci group. 6495bd8deadSopenharmony_ci 6505bd8deadSopenharmony_ci 6515bd8deadSopenharmony_ciModifications to The OpenGL Shading Language Specification, Version 4.00 6525bd8deadSopenharmony_ci 6535bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 6545bd8deadSopenharmony_ci language features described in this extension: 6555bd8deadSopenharmony_ci 6565bd8deadSopenharmony_ci #extension GL_NV_bindless_texture : <behavior> 6575bd8deadSopenharmony_ci 6585bd8deadSopenharmony_ci where <behavior> is as specified in section 3.3. 6595bd8deadSopenharmony_ci 6605bd8deadSopenharmony_ci New preprocessor #defines are added to the OpenGL Shading Language: 6615bd8deadSopenharmony_ci 6625bd8deadSopenharmony_ci #define GL_NV_bindless_texture 1 6635bd8deadSopenharmony_ci 6645bd8deadSopenharmony_ci 6655bd8deadSopenharmony_ci Replace Section 4.1.7 (Samplers), p. 25 6665bd8deadSopenharmony_ci 6675bd8deadSopenharmony_ci Sampler types (e.g., sampler2D) are effectively opaque handles to texture 6685bd8deadSopenharmony_ci and sampler objects. They are used with the built-in texture functions 6695bd8deadSopenharmony_ci (described in section 8.9 "Texture Lookup Functions") to specify which 6705bd8deadSopenharmony_ci texture to access and how it is to be filtered. Samplers are represented 6715bd8deadSopenharmony_ci using 64-bit integer handles, and may be converted to and from 64-bit 6725bd8deadSopenharmony_ci integers using constructors. Samplers may not be implicitly converted to 6735bd8deadSopenharmony_ci and from 64-bit integers, and may not be used in arithmetic expressions. 6745bd8deadSopenharmony_ci Samplers may be declared as shader inputs and outputs, as uniform 6755bd8deadSopenharmony_ci variables, as temporary variables, and as function parameters. Samplers 6765bd8deadSopenharmony_ci aggregated into arrays within a shader (using square brackets []) can be 6775bd8deadSopenharmony_ci indexed with arbitrary integer expressions. Samplers can be used as 6785bd8deadSopenharmony_ci l-values, so can be assigned into and used as "out" and "inout" function 6795bd8deadSopenharmony_ci parameters. As function parameters, samplers may be only passed to 6805bd8deadSopenharmony_ci samplers of matching type. As uniforms in the default uniform block, 6815bd8deadSopenharmony_ci samplers may be initialized only with the OpenGL API; they cannot be 6825bd8deadSopenharmony_ci declared with an initializer in a shader. 6835bd8deadSopenharmony_ci 6845bd8deadSopenharmony_ci The OpenGL API allows default block sampler uniforms to be assigned values 6855bd8deadSopenharmony_ci referencing either a texture image unit number or a texture handle, 6865bd8deadSopenharmony_ci depending on the API function used. All other sampler variables must be 6875bd8deadSopenharmony_ci assigned a texture handle. When a sampler uniform is assigned to a 6885bd8deadSopenharmony_ci texture image unit, texture functions using it will reference the texture 6895bd8deadSopenharmony_ci bound to the corresponding target of the selected texture image unit. 6905bd8deadSopenharmony_ci When a texture function uses a sampler variable assigned to a texture 6915bd8deadSopenharmony_ci handle, the value of the handle must be a valid handle returned by the 6925bd8deadSopenharmony_ci OpenGL API (Section 3.9.X, Bindless Textures) that has been made resident, 6935bd8deadSopenharmony_ci and that texture must have a target matching the sampler variable type. 6945bd8deadSopenharmony_ci Using a sampler whose the texture target does not match that sampler type 6955bd8deadSopenharmony_ci produces undefined results but not program termination. Using a sampler 6965bd8deadSopenharmony_ci that is not a texture image unit reference and is not a valid and resident 6975bd8deadSopenharmony_ci texture handle produces undefined results including possible program 6985bd8deadSopenharmony_ci termination. 6995bd8deadSopenharmony_ci 7005bd8deadSopenharmony_ci 7015bd8deadSopenharmony_ci Replace Section 4.1.X, (Images) 7025bd8deadSopenharmony_ci 7035bd8deadSopenharmony_ci Like samplers, images are effectively handles to one-, two-, or three- 7045bd8deadSopenharmony_ci dimensional images corresponding to all or a portion of a single level of 7055bd8deadSopenharmony_ci a texture image. Images are represented using 64-bit integer handles, and 7065bd8deadSopenharmony_ci may be converted to and from 64-bit integers using constructors. Samplers 7075bd8deadSopenharmony_ci may not be implicitly converted to and from 64-bit integers, and may not 7085bd8deadSopenharmony_ci be used in arithmetic expressions. There are distinct image variable 7095bd8deadSopenharmony_ci types for each texture target, and for each of float, integer, and 7105bd8deadSopenharmony_ci unsigned integer data types. Image accesses should use an image type that 7115bd8deadSopenharmony_ci matches the target of the texture whose level is being accessed, or for 7125bd8deadSopenharmony_ci non-layered bindings of 3D or array images should use the image type that 7135bd8deadSopenharmony_ci matches the dimensionality of the layer of the image (i.e. a layer of 3D, 7145bd8deadSopenharmony_ci 2DArray, Cube, or CubeArray should use image2D, a layer of 1DArray should 7155bd8deadSopenharmony_ci use image1D, and a layer of 2DMSArray should use image2DMS). If the image 7165bd8deadSopenharmony_ci target type does not match the image being accessed in this manner, if the 7175bd8deadSopenharmony_ci data type does not match the bound image, or if the "size" layout 7185bd8deadSopenharmony_ci qualifier does not match the image format as described in Section 3.9.X of 7195bd8deadSopenharmony_ci the OpenGL Specification, the results of image accesses are undefined but 7205bd8deadSopenharmony_ci may not include program termination. 7215bd8deadSopenharmony_ci 7225bd8deadSopenharmony_ci Image variables are used in the image load, store, and atomic functions 7235bd8deadSopenharmony_ci described in Section 8.X, "Image Functions" to specify an image to access. 7245bd8deadSopenharmony_ci Images may be declared as shader inputs and outputs, as uniform variables, 7255bd8deadSopenharmony_ci as temporary variables, and as function parameters. Images may be 7265bd8deadSopenharmony_ci aggregated into arrays within a shader (using square brackets []) and can 7275bd8deadSopenharmony_ci be indexed with general integer expressions. Images can be used as 7285bd8deadSopenharmony_ci l-values, so can be assigned into and used as "out" and "inout" function 7295bd8deadSopenharmony_ci parameters. As uniforms in the default uniform block, images may be 7305bd8deadSopenharmony_ci initialized only with the OpenGL API; they cannot be declared with an 7315bd8deadSopenharmony_ci initializer in a shader. As function parameters, images may be only 7325bd8deadSopenharmony_ci passed to images of matching type. 7335bd8deadSopenharmony_ci 7345bd8deadSopenharmony_ci The OpenGL API allows default block image uniforms to be assigned to 7355bd8deadSopenharmony_ci reference either an image unit number or an image handle, depending on the 7365bd8deadSopenharmony_ci API function used. All other image variables must be assigned an image 7375bd8deadSopenharmony_ci handle. When an image uniform is assigned to an image unit, image 7385bd8deadSopenharmony_ci functions using it will reference the texture and image state 7395bd8deadSopenharmony_ci corresponding to the selected image unit. When an image function uses a 7405bd8deadSopenharmony_ci variable assigned to an image handle, the value of the handle must be a 7415bd8deadSopenharmony_ci valid handle returned by the OpenGL API (Section 3.9.X of 7425bd8deadSopenharmony_ci EXT_shader_image_load_store, Texture Image Loads and Stores, as modified 7435bd8deadSopenharmony_ci by this extension) that has been made resident, and that contains image 7445bd8deadSopenharmony_ci data compatible with the variable type as described above. Using an image 7455bd8deadSopenharmony_ci variable that is not an image unit reference and is not a valid and 7465bd8deadSopenharmony_ci resident image handle produces undefined results including possible 7475bd8deadSopenharmony_ci program termination. 7485bd8deadSopenharmony_ci 7495bd8deadSopenharmony_ci 7505bd8deadSopenharmony_ci Modify Section 4.3.4, Inputs, p. 34 7515bd8deadSopenharmony_ci 7525bd8deadSopenharmony_ci (modify third paragraph of the section to allow sampler and image types) 7535bd8deadSopenharmony_ci ... Vertex shader inputs can only be float, single-precision 7545bd8deadSopenharmony_ci floating-point scalars, single-precision floating-point vectors, matrices, 7555bd8deadSopenharmony_ci signed and unsigned integers and integer vectors, sampler and image types. 7565bd8deadSopenharmony_ci 7575bd8deadSopenharmony_ci (modify last paragraph, p. 35, allowing samplers and images as fragment 7585bd8deadSopenharmony_ci shader inputs) ... Fragment inputs can only be signed and unsigned 7595bd8deadSopenharmony_ci integers and integer vectors, floating point scalars, floating-point 7605bd8deadSopenharmony_ci vectors, matrices, sampler and image types, or arrays or structures of 7615bd8deadSopenharmony_ci these. Fragment shader inputs that are signed or unsigned integers, 7625bd8deadSopenharmony_ci integer vectors, or any double-precision floating- point type, or any 7635bd8deadSopenharmony_ci sampler or image type must be qualified with the interpolation qualifier 7645bd8deadSopenharmony_ci "flat". 7655bd8deadSopenharmony_ci 7665bd8deadSopenharmony_ci 7675bd8deadSopenharmony_ci Modify Section 4.3.6, Outputs, p. 36 7685bd8deadSopenharmony_ci 7695bd8deadSopenharmony_ci (modify second paragraph, p. 37, to allow sampler and image outputs) 7705bd8deadSopenharmony_ci ... Output variables can only be floating-point scalars, floating-point 7715bd8deadSopenharmony_ci vectors, matrices, signed or unsigned integers or integer vectors, sampler 7725bd8deadSopenharmony_ci or image types, or arrays or structures of any these. 7735bd8deadSopenharmony_ci 7745bd8deadSopenharmony_ci (do not modify the last paragraph, p. 38; samplers and images are not 7755bd8deadSopenharmony_ci allowed as fragment shader outputs) 7765bd8deadSopenharmony_ci 7775bd8deadSopenharmony_ci 7785bd8deadSopenharmony_ci Modify Section 4.3.7, Interface Blocks, p. 38 7795bd8deadSopenharmony_ci 7805bd8deadSopenharmony_ci (remove the following bullet from the last list on p. 39, thereby 7815bd8deadSopenharmony_ci permitting sampler types in interface blocks; image types are also 7825bd8deadSopenharmony_ci permitted in blocks by this extension) 7835bd8deadSopenharmony_ci 7845bd8deadSopenharmony_ci * sampler types are not allowed 7855bd8deadSopenharmony_ci 7865bd8deadSopenharmony_ci 7875bd8deadSopenharmony_ci Modify Section 5.4.1, Conversion and Scalar Constructors, p. 60 7885bd8deadSopenharmony_ci 7895bd8deadSopenharmony_ci (add the following constructors:) 7905bd8deadSopenharmony_ci 7915bd8deadSopenharmony_ci uint64_t(any sampler type) // Converts a sampler type to a 7925bd8deadSopenharmony_ci // 64-bit unsigned integer 7935bd8deadSopenharmony_ci any sampler type(uint64_t) // Converts a 64-bit unsigned integer to 7945bd8deadSopenharmony_ci // a sampler type 7955bd8deadSopenharmony_ci uint64_t(any image type) // Converts an image type to a 7965bd8deadSopenharmony_ci // 64-bit unsigned integer 7975bd8deadSopenharmony_ci any image type(uint64_t) // Converts a 64-bit unsigned integer to 7985bd8deadSopenharmony_ci // an image type 7995bd8deadSopenharmony_ci 8005bd8deadSopenharmony_ci 8015bd8deadSopenharmony_ciAdditions to the AGL/EGL/GLX/WGL Specifications 8025bd8deadSopenharmony_ci 8035bd8deadSopenharmony_ci None 8045bd8deadSopenharmony_ci 8055bd8deadSopenharmony_ciInteractions with OpenGL 4.0 (Core Profile) 8065bd8deadSopenharmony_ci 8075bd8deadSopenharmony_ci If the core profile of OpenGL 4.0 (or any version since 3.0) is supported, 8085bd8deadSopenharmony_ci references to fixed-function fragment processing and display lists should 8095bd8deadSopenharmony_ci be removed. References to the TEXTURE_LOD_BIAS for the current texture 8105bd8deadSopenharmony_ci unit should also be removed. 8115bd8deadSopenharmony_ci 8125bd8deadSopenharmony_ciInteractions with OpenGL 3.3 and ARB_sampler_objects 8135bd8deadSopenharmony_ci 8145bd8deadSopenharmony_ci If neither OpenGL 3.3 nor ARB_sampler_objects is supported, the portion of 8155bd8deadSopenharmony_ci this extension referring to the sampler object type introduced in OpenGL 8165bd8deadSopenharmony_ci 3.3 should be removed. In particular, the GetTextureSamplerHandleNV API 8175bd8deadSopenharmony_ci will not be supported. 8185bd8deadSopenharmony_ci 8195bd8deadSopenharmony_ciInteractions with OpenGL 4.2, OpenGL ES 3.1, ARB_shader_image_load_store, and 8205bd8deadSopenharmony_ciEXT_shader_image_load_store 8215bd8deadSopenharmony_ci 8225bd8deadSopenharmony_ci If OpenGL 4.2, OpenGL ES 3.1, ARB_shader_image_load_store, and 8235bd8deadSopenharmony_ci EXT_shader_image_load_store are not supported, the portion of this 8245bd8deadSopenharmony_ci extension supporting image handles and image loads, stores, and atomics 8255bd8deadSopenharmony_ci should be removed. In particular, the functions GetImageHandleNV, 8265bd8deadSopenharmony_ci MakeImageHandleResidentNV, MakeImageHandleNonResidentNV should be removed. 8275bd8deadSopenharmony_ci 8285bd8deadSopenharmony_ci Portions of this extension have been written against the 8295bd8deadSopenharmony_ci EXT_shader_image_load_store, since OpenGL 4.2 and the ARB extension did 8305bd8deadSopenharmony_ci not exist when the specification was first written. Similar edits would 8315bd8deadSopenharmony_ci apply to the OpenGL 4.2 and ARB_shader_image_load_store specifications. 8325bd8deadSopenharmony_ci 8335bd8deadSopenharmony_ciInteractions with NV_vertex_attrib_integer_64bit 8345bd8deadSopenharmony_ci 8355bd8deadSopenharmony_ci If NV_vertex_attrib_integer_64bit is not supported, sampler and image 8365bd8deadSopenharmony_ci variables (which take 64-bit integer handles) are not allowed to be used 8375bd8deadSopenharmony_ci as vertex shader inputs. Additionally, portions of this extension 8385bd8deadSopenharmony_ci modifying NV_vertex_attrib_integer_64bit should be ignored. 8395bd8deadSopenharmony_ci 8405bd8deadSopenharmony_ciInteractions with NV_gpu_shader5 8415bd8deadSopenharmony_ci 8425bd8deadSopenharmony_ci If NV_gpu_shader5 or similar functionality providing 64-bit integer types 8435bd8deadSopenharmony_ci in the shading language is not supported, the GLSL portion of this 8445bd8deadSopenharmony_ci extension should be modified. In particular, references to 64-bit integer 8455bd8deadSopenharmony_ci scalars, vectors or other 64-bit types should be deleted, and the 8465bd8deadSopenharmony_ci constructors to convert 64-bit unsigned integer handles to and from sampler 8475bd8deadSopenharmony_ci and image data types (as added in Section 5.4.1), should be removed. 8485bd8deadSopenharmony_ci 8495bd8deadSopenharmony_ci Default block sampler and image uniforms can still be assigned handles via 8505bd8deadSopenharmony_ci the UniformHandleui64*NV and ProgramUniformHandleui64*NV functions, and 8515bd8deadSopenharmony_ci sampler and image types can continue to be used as shader inputs and 8525bd8deadSopenharmony_ci outputs, uniforms in user-defined blocks, and temporaries. Such uses of 8535bd8deadSopenharmony_ci these types may consume two components against any relevant limits. 8545bd8deadSopenharmony_ci Extracting these types from memory locations will be done as if reading 8555bd8deadSopenharmony_ci a uvec2-typed value at the specified location. 8565bd8deadSopenharmony_ci 8575bd8deadSopenharmony_ci Additionally, edits to Section 4.1.7 of the GLSL Specification describing 8585bd8deadSopenharmony_ci sampler indexing should be changed to read "Samplers aggregated into 8595bd8deadSopenharmony_ci arrays within a shader (using square brackets [ ]) can only be indexed 8605bd8deadSopenharmony_ci with a dynamically uniform integral expression, otherwise results are 8615bd8deadSopenharmony_ci undefined." This is the language found in unextended OpenGL 4.0; 8625bd8deadSopenharmony_ci NV_gpu_shader5 extends it to allow indexing with arbitrary integer 8635bd8deadSopenharmony_ci expressions. 8645bd8deadSopenharmony_ci 8655bd8deadSopenharmony_ciInteractions with EXT_direct_state_access 8665bd8deadSopenharmony_ci 8675bd8deadSopenharmony_ci In this extension, INVALID_OPERATION is generated when calling various 8685bd8deadSopenharmony_ci functions to modify the state of a texture object from which handles have 8695bd8deadSopenharmony_ci been extracted. If EXT_direct_state_access is suported, this error 8705bd8deadSopenharmony_ci behavior is further extended to cover similar functions provided by 8715bd8deadSopenharmony_ci EXT_direct_state access. In particular, this error will be generated by: 8725bd8deadSopenharmony_ci TextureImage*EXT, CopyTextureImage*EXT, CompressedTextureImage*EXT, 8735bd8deadSopenharmony_ci TextureBufferEXT, TextureParameterEXT, MultiTexImage*EXT, 8745bd8deadSopenharmony_ci CopyMultiTexImage*EXT, CompressedMultiTexImage*EXT, MultiTexBufferEXT, and 8755bd8deadSopenharmony_ci MultiTexParameter*EXT. 8765bd8deadSopenharmony_ci 8775bd8deadSopenharmony_ciInteractions with ARB_seamless_cubemap and AMD_seamless_cubemap_per_texture 8785bd8deadSopenharmony_ci 8795bd8deadSopenharmony_ci If ARB_seamless_cubemap (or OpenGL 4.0, which includes it) is supported, 8805bd8deadSopenharmony_ci the per-context seamless cubemap enable is ignored and treated as disabled 8815bd8deadSopenharmony_ci when using texture handles. 8825bd8deadSopenharmony_ci 8835bd8deadSopenharmony_ci If AMD_seamless_cubemap_per_texture is supported, the seamless cube map 8845bd8deadSopenharmony_ci texture parameter of the underlying texture does apply when texture 8855bd8deadSopenharmony_ci handles are used. 8865bd8deadSopenharmony_ci 8875bd8deadSopenharmony_ciInteractions with NV_gpu_program4, NV_gpu_program5, and 8885bd8deadSopenharmony_ciEXT_shader_image_load_store 8895bd8deadSopenharmony_ci 8905bd8deadSopenharmony_ci If NV_gpu_program5 is supported, the following edits are made to the 8915bd8deadSopenharmony_ci NV_gpu_program4, NV_gpu_program5, and EXT_shader_image_load_store 8925bd8deadSopenharmony_ci specifications: 8935bd8deadSopenharmony_ci 8945bd8deadSopenharmony_ci Modify Section 2.X.2, Program Grammar of NV_gpu_program5 8955bd8deadSopenharmony_ci 8965bd8deadSopenharmony_ci (add new grammar rules allowing textures to be referred to by handles, 8975bd8deadSopenharmony_ci e.g., "TEX result, coords, handle(texHandle.x), 2D") 8985bd8deadSopenharmony_ci 8995bd8deadSopenharmony_ci <textureUseV> ::= "handle" "(" <addrUseS> ")" 9005bd8deadSopenharmony_ci 9015bd8deadSopenharmony_ci <imageUnit> ::= "handle" "(" <addrUseS> ")" 9025bd8deadSopenharmony_ci 9035bd8deadSopenharmony_ci 9045bd8deadSopenharmony_ci Modify Section 2.X.4.4, Program Texture Access, of NV_gpu_program4 9055bd8deadSopenharmony_ci 9065bd8deadSopenharmony_ci (modify the paragraph beginning with "The texture used by TextureSample" 9075bd8deadSopenharmony_ci to permit the use of handles) The texture used by TextureSample() is 9085bd8deadSopenharmony_ci identified according to the <textureUseV> grammar rule. If <textureUseV> 9095bd8deadSopenharmony_ci expands to the grammar rule containing "handle", the texture used is 9105bd8deadSopenharmony_ci identified by taking the scalar value specified in that rule as a texture 9115bd8deadSopenharmony_ci handle. Otherwise, the texture corresponding to the texture image unit 9125bd8deadSopenharmony_ci specified by <textureUseV> is used. The texture target... 9135bd8deadSopenharmony_ci 9145bd8deadSopenharmony_ci If the instruction uses a named texture variable, the <nvTexImageUnit> 9155bd8deadSopenharmony_ci grammar rule, or the "texture" grammar rule, then the texture used by 9165bd8deadSopenharmony_ci TextureSample() is one of the textures bound to the texture image unit 9175bd8deadSopenharmony_ci whose number is specified in the instruction according to the 9185bd8deadSopenharmony_ci <texImageUnit> grammar rule, and the texture target accessed is specified 9195bd8deadSopenharmony_ci according to the <texTarget> grammar rule and Table X.17. If the 9205bd8deadSopenharmony_ci instruction uses the "handle" grammar rule, then the specified texture 9215bd8deadSopenharmony_ci handle will select which texture is used, and the target of that texture 9225bd8deadSopenharmony_ci must match the target specified by the <texTarget> grammar rule or else 9235bd8deadSopenharmony_ci the result is undefined. Fixed-function texture enables are always ignored 9245bd8deadSopenharmony_ci when determining which texture to access in a program. 9255bd8deadSopenharmony_ci 9265bd8deadSopenharmony_ci 9275bd8deadSopenharmony_ci Section 2.X.5.Y, Program Options 9285bd8deadSopenharmony_ci 9295bd8deadSopenharmony_ci If a program (in any shader stage) specifies the option 9305bd8deadSopenharmony_ci "NV_bindless_texture", the grammar edits described in section 2.X.2 9315bd8deadSopenharmony_ci will apply. 9325bd8deadSopenharmony_ci 9335bd8deadSopenharmony_ci 9345bd8deadSopenharmony_ci Modify Section 2.X.8.Z, LOADIM: Image Load, of EXT_shader_image_load_store 9355bd8deadSopenharmony_ci 9365bd8deadSopenharmony_ci (modify the first paragraph) The LOADIM instruction ... from the texture 9375bd8deadSopenharmony_ci specified by <imageUnit>. If <imageUnit> expands to the grammar rule 9385bd8deadSopenharmony_ci containing "handle", the texture used is identified by taking the scalar 9395bd8deadSopenharmony_ci value specified in that rule as an image handle. Otherwise, the texture 9405bd8deadSopenharmony_ci corresponding to the image unit specified by <imageUnit> is used. 9415bd8deadSopenharmony_ci Unformatted loads read... 9425bd8deadSopenharmony_ci 9435bd8deadSopenharmony_ci Modify Section 2.X.8.Z, STOREIM: Image Store, of 9445bd8deadSopenharmony_ci EXT_shader_image_load_store 9455bd8deadSopenharmony_ci 9465bd8deadSopenharmony_ci (modify the first paragraph) The STOREIM instruction ... to the texture 9475bd8deadSopenharmony_ci specified by <imageUnit> using the data specified in the first vector 9485bd8deadSopenharmony_ci operand. If <imageUnit> expands to the grammar rule containing "handle", 9495bd8deadSopenharmony_ci the texture used is identified by taking the scalar value specified in 9505bd8deadSopenharmony_ci that rule as an image handle. Otherwise, the texture corresponding to the 9515bd8deadSopenharmony_ci image unit specified by <imageUnit> is used. The store is performed in 9525bd8deadSopenharmony_ci the manner described in Section 3.9.X. 9535bd8deadSopenharmony_ci 9545bd8deadSopenharmony_ci 9555bd8deadSopenharmony_ci Modify Section 2.X.8.Z, ATOMIM: Image Atomic Memory Operation, of 9565bd8deadSopenharmony_ci EXT_shader_image_load_store 9575bd8deadSopenharmony_ci 9585bd8deadSopenharmony_ci (modify the first paragraph) The ATOMIM instruction takes ...image load 9595bd8deadSopenharmony_ci from the texture specified by <imageUnit>, performs ... returns the loaded 9605bd8deadSopenharmony_ci value in the vector result. If <imageUnit> expands to the grammar rule 9615bd8deadSopenharmony_ci containing "handle", the texture used is identified by taking the scalar 9625bd8deadSopenharmony_ci value specified in that rule as an image handle. Otherwise, the texture 9635bd8deadSopenharmony_ci corresponding to the image unit specified by <imageUnit> is used. The 9645bd8deadSopenharmony_ci atomic operation is performed in the manner described in Section 3.9.X. 9655bd8deadSopenharmony_ci 9665bd8deadSopenharmony_ciInteractions with GLSL 4.20 and GLSL ES 3.10 9675bd8deadSopenharmony_ci 9685bd8deadSopenharmony_ci Without GLSL 4.20 or GLSL ES 3.10 support, sampler and image uniforms 9695bd8deadSopenharmony_ci may only be initialized through the OpenGL API. With GLSL 4.20 and GLSL 9705bd8deadSopenharmony_ci ES 3.1, sampler and image uniforms may be initialized in the shader using 9715bd8deadSopenharmony_ci 9725bd8deadSopenharmony_ci layout(binding = integer-constant) 9735bd8deadSopenharmony_ci 9745bd8deadSopenharmony_ci as described in section 4.4.4 "Opaque-Uniform Layout Qualifiers". When 9755bd8deadSopenharmony_ci NV_bindless_texture is supported, these initial binding values are always 9765bd8deadSopenharmony_ci taken to mean a texture image or image unit number, not a bindless handle. 9775bd8deadSopenharmony_ci 9785bd8deadSopenharmony_ciInteractions with OpenGL ES 9795bd8deadSopenharmony_ci 9805bd8deadSopenharmony_ci If implemented in an OpenGL ES context, references to the following 9815bd8deadSopenharmony_ci should be removed: 9825bd8deadSopenharmony_ci - assembly-based shaders, 9835bd8deadSopenharmony_ci - display lists, 9845bd8deadSopenharmony_ci - fixed-function fragment processing, 9855bd8deadSopenharmony_ci - double-precision floating-point values, 9865bd8deadSopenharmony_ci - 1D and 1D-array textures and images, 9875bd8deadSopenharmony_ci - TEXTURE_LOD_BIAS for the current texture unit, 9885bd8deadSopenharmony_ci - the AreTexturesResident command, 9895bd8deadSopenharmony_ci unless subsequently added by a later extension or version. 9905bd8deadSopenharmony_ci 9915bd8deadSopenharmony_ci Modify the edits to Section to 3.9.10 to state that when accessing cube 9925bd8deadSopenharmony_ci map textures using texture handles in an OpenGL ES context, the cube maps 9935bd8deadSopenharmony_ci are always treated as seamless. 9945bd8deadSopenharmony_ci 9955bd8deadSopenharmony_ciInteractions with OpenGL ES 3.1 9965bd8deadSopenharmony_ci 9975bd8deadSopenharmony_ci If OpenGL ES 3.1 is supported, replace references to EXT_image_load_store 9985bd8deadSopenharmony_ci and BindImageTextureEXT with appropriate references to OpenGL ES 3.1 9995bd8deadSopenharmony_ci functionality and BindImageTexture. References to assigning a default 10005bd8deadSopenharmony_ci block image uniform an image unit number from the OpenGL API with the 10015bd8deadSopenharmony_ci Uniform* commands (but not the UniformHandle* commands) should be 10025bd8deadSopenharmony_ci removed since OpenGL ES only supports assigning image unit numbers 10035bd8deadSopenharmony_ci with the 'binding' layout qualifier in the shading language. 10045bd8deadSopenharmony_ci 10055bd8deadSopenharmony_ci Ignore references to 2DMSArray and 2DMS images as they are not supported 10065bd8deadSopenharmony_ci in OpenGL ES. 10075bd8deadSopenharmony_ci 10085bd8deadSopenharmony_ciInteractions with OES_shader_image_atomic 10095bd8deadSopenharmony_ci 10105bd8deadSopenharmony_ci If OES_shader_image_atomic or equivalent functionality is not supported, 10115bd8deadSopenharmony_ci ignore all references to atomic image operations. 10125bd8deadSopenharmony_ci 10135bd8deadSopenharmony_ciInteractions with EXT_texture_cube_map_array 10145bd8deadSopenharmony_ci 10155bd8deadSopenharmony_ci If EXT_texture_cube_map_array or equivalent functionality is not supported, 10165bd8deadSopenharmony_ci ignore all references to cube map array textures. 10175bd8deadSopenharmony_ci 10185bd8deadSopenharmony_ciInteractions with EXT_texture_buffer 10195bd8deadSopenharmony_ci 10205bd8deadSopenharmony_ci If EXT_texture_buffer or equivalent functionality is not supported, 10215bd8deadSopenharmony_ci ignore all references to buffer textures and related buffer functionality. 10225bd8deadSopenharmony_ci 10235bd8deadSopenharmony_ciInteractions with EXT_shader_io_blocks 10245bd8deadSopenharmony_ci 10255bd8deadSopenharmony_ci If EXT_shader_io_blocks or equivalent functionality is supported, sampler 10265bd8deadSopenharmony_ci and image types are allowed in interface blocks. Otherwise ignore all 10275bd8deadSopenharmony_ci references to interface blocks. 10285bd8deadSopenharmony_ci 10295bd8deadSopenharmony_ciErrors 10305bd8deadSopenharmony_ci 10315bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetTextureHandleNV or 10325bd8deadSopenharmony_ci GetTextureSamplerHandleNV if <texture> is zero or not the name of an 10335bd8deadSopenharmony_ci existing texture object. 10345bd8deadSopenharmony_ci 10355bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetTextureSamplerHandleNV if 10365bd8deadSopenharmony_ci <sampler> is zero or is not the name of an existing sampler object. 10375bd8deadSopenharmony_ci 10385bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by GetTextureHandleNV or 10395bd8deadSopenharmony_ci GetTextureSamplerHandleNV if thetexture object specified by <texture> is 10405bd8deadSopenharmony_ci not complete. 10415bd8deadSopenharmony_ci 10425bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by TexImage*, CopyTexImage*, 10435bd8deadSopenharmony_ci CompressedTexImage*, TexBuffer*, TexParameter*, as well as other functions 10445bd8deadSopenharmony_ci defined in terms of these, if the texture object to be modified is 10455bd8deadSopenharmony_ci referenced by one or more texture or image handles. 10465bd8deadSopenharmony_ci 10475bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by BufferData, or any function 10485bd8deadSopenharmony_ci defined in terms of this, if the buffer object to be modified is bound 10495bd8deadSopenharmony_ci to a buffer texture that is referenced by one or more texture or image 10505bd8deadSopenharmony_ci handles. 10515bd8deadSopenharmony_ci 10525bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by SamplerParameter* if <sampler> 10535bd8deadSopenharmony_ci identifies a sampler object referenced by one or more texture handles. 10545bd8deadSopenharmony_ci 10555bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by MakeTextureHandleResidentNV if 10565bd8deadSopenharmony_ci <handle> is not a valid texture handle, or if <handle> is already resident 10575bd8deadSopenharmony_ci in the current GL context. 10585bd8deadSopenharmony_ci 10595bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by MakeTextureHandleNonResidentNV 10605bd8deadSopenharmony_ci if <handle> is not a valid texture handle, or if <handle> is not resident 10615bd8deadSopenharmony_ci in the current GL context. 10625bd8deadSopenharmony_ci 10635bd8deadSopenharmony_ci The error INVALID_VALUE is generated by GetImageHandleNV if <texture> is 10645bd8deadSopenharmony_ci zero or not the name of an existing texture object, if the image for 10655bd8deadSopenharmony_ci <level> does not existing in <texture>, or if <layered> is FALSE and 10665bd8deadSopenharmony_ci <layer> is greater than or equal to the number of layers in the image at 10675bd8deadSopenharmony_ci <level>. 10685bd8deadSopenharmony_ci 10695bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by GetImageHandleNV if the 10705bd8deadSopenharmony_ci texture object <texture> is not complete or if <layered> is TRUE and 10715bd8deadSopenharmony_ci <texture> is not a three-dimensional, one-dimensional array, two 10725bd8deadSopenharmony_ci dimensional array, cube map, or cube map array texture. 10735bd8deadSopenharmony_ci 10745bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by MakeImageHandleResidentNV if 10755bd8deadSopenharmony_ci <handle> is not a valid image handle, or if <handle> is already resident 10765bd8deadSopenharmony_ci in the current GL context. 10775bd8deadSopenharmony_ci 10785bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by MakeImageHandleNonResidentNV 10795bd8deadSopenharmony_ci if <handle> is not a valid image handle, or if <handle> is not resident in 10805bd8deadSopenharmony_ci the current GL context. 10815bd8deadSopenharmony_ci 10825bd8deadSopenharmony_ci The error INVALID_OPERATION will be generated by IsTextureHandleResidentNV 10835bd8deadSopenharmony_ci and IsImageHandleResidentNV if <handle> is not a valid texture or image 10845bd8deadSopenharmony_ci handle, respectively. 10855bd8deadSopenharmony_ci 10865bd8deadSopenharmony_ciExamples 10875bd8deadSopenharmony_ci 10885bd8deadSopenharmony_ci To loop through a collection of 256 textures in the OpenGL API using a 10895bd8deadSopenharmony_ci conventional GLSL shader and without calling glBindTexture, one might do: 10905bd8deadSopenharmony_ci 10915bd8deadSopenharmony_ci #define NUM_TEXTURES 256 10925bd8deadSopenharmony_ci GLuint textures[NUM_TEXTURES]; 10935bd8deadSopenharmony_ci GLuint64 texHandles[NUM_TEXTURES]; 10945bd8deadSopenharmony_ci 10955bd8deadSopenharmony_ci // Initialize the texture objects and handles. 10965bd8deadSopenharmony_ci glGenTextures(NUM_TEXTURES, textures); 10975bd8deadSopenharmony_ci for (int i = 0; i < NUM_TEXTURES; i++) { 10985bd8deadSopenharmony_ci 10995bd8deadSopenharmony_ci // Initialize the texture images with glTexImage/glTexStorage. 11005bd8deadSopenharmony_ci // Initialize the texture parameters as required. 11015bd8deadSopenharmony_ci 11025bd8deadSopenharmony_ci // Get a handle for the texture. 11035bd8deadSopenharmony_ci texHandles[i] = glGetTextureHandleNV(textures[i]); 11045bd8deadSopenharmony_ci 11055bd8deadSopenharmony_ci // At this point, it's no longer possible to resize/reallocate 11065bd8deadSopenharmony_ci // texture images or modify texture parameters for "textures[i]". 11075bd8deadSopenharmony_ci // However, it's still possible to update texture data via 11085bd8deadSopenharmony_ci // glTexSubImage. 11095bd8deadSopenharmony_ci 11105bd8deadSopenharmony_ci // Make the handle resident before using it. 11115bd8deadSopenharmony_ci glMakeTextureHandleResidentNV(texHandles[i]); 11125bd8deadSopenharmony_ci } 11135bd8deadSopenharmony_ci 11145bd8deadSopenharmony_ci // Compile GLSL shader using sampler uniform <u>. The shader itself 11155bd8deadSopenharmony_ci // needs no special #extension directive as long as <u> is a uniform in 11165bd8deadSopenharmony_ci // the default partition. Link the program, and query the location of 11175bd8deadSopenharmony_ci // <u>, which we will store in <location>. 11185bd8deadSopenharmony_ci 11195bd8deadSopenharmony_ci // Render a little bit using each of the texture handles in turn. 11205bd8deadSopenharmony_ci for (int i = 0; i < NUM_TEXTURES; i++) { 11215bd8deadSopenharmony_ci 11225bd8deadSopenharmony_ci // Update the single sampler uniform <u> to point at "texHandles[i]". 11235bd8deadSopenharmony_ci glUniformHandleui64NV(location, texHandles[i]); 11245bd8deadSopenharmony_ci 11255bd8deadSopenharmony_ci drawStuff(); 11265bd8deadSopenharmony_ci } 11275bd8deadSopenharmony_ci 11285bd8deadSopenharmony_ci ... 11295bd8deadSopenharmony_ci 11305bd8deadSopenharmony_ci // If the application doesn't need to use texHandles[10] for a while, it 11315bd8deadSopenharmony_ci // can make it non-resident to reduce the overall memory footprint. 11325bd8deadSopenharmony_ci glMakeTextureHandleNonResidentNV(texHandles[10]); 11335bd8deadSopenharmony_ci 11345bd8deadSopenharmony_ci // After this point, the texture data associated with texHandles[10] is 11355bd8deadSopenharmony_ci // not guaranteed to be resident, and using it in a draw call could 11365bd8deadSopenharmony_ci // result in exceptions. Use glMakeTextureHandleResidentNV() to make it 11375bd8deadSopenharmony_ci // resident again before it's needed for rendering. 11385bd8deadSopenharmony_ci 11395bd8deadSopenharmony_ci The GLSL portion of this extension removes the restriction that sampler 11405bd8deadSopenharmony_ci variables must be uniforms in the default block. You can store a large 11415bd8deadSopenharmony_ci collection of samplers in a uniform block, pass them through the pipeline 11425bd8deadSopenharmony_ci as 64-bit integers. 11435bd8deadSopenharmony_ci 11445bd8deadSopenharmony_ci To use a "dictionary" of samplers in a uniform block, you could use a 11455bd8deadSopenharmony_ci shader like: 11465bd8deadSopenharmony_ci 11475bd8deadSopenharmony_ci #version 400 11485bd8deadSopenharmony_ci #extension GL_NV_bindless_texture : require 11495bd8deadSopenharmony_ci #define NUM_TEXTURES 256 11505bd8deadSopenharmony_ci 11515bd8deadSopenharmony_ci flat in int whichSampler; 11525bd8deadSopenharmony_ci in vec2 texCoord; 11535bd8deadSopenharmony_ci out vec4 finalColor; 11545bd8deadSopenharmony_ci 11555bd8deadSopenharmony_ci uniform Samplers { 11565bd8deadSopenharmony_ci sampler2D allTheSamplers[NUM_TEXTURES]; 11575bd8deadSopenharmony_ci }; 11585bd8deadSopenharmony_ci 11595bd8deadSopenharmony_ci void main() 11605bd8deadSopenharmony_ci { 11615bd8deadSopenharmony_ci finalColor = texture(allTheSamplers[whichSampler], texCoord); 11625bd8deadSopenharmony_ci } 11635bd8deadSopenharmony_ci 11645bd8deadSopenharmony_ci In the following example, the sampler to use is selected in a vertex 11655bd8deadSopenharmony_ci shader, passed to the fragment shader as a (flat) input, and then used for 11665bd8deadSopenharmony_ci a texture lookup. 11675bd8deadSopenharmony_ci 11685bd8deadSopenharmony_ci #version 400 11695bd8deadSopenharmony_ci #extension GL_NV_gpu_shader5 : require // for 64-bit integer types 11705bd8deadSopenharmony_ci #extension GL_NV_bindless_texture : require 11715bd8deadSopenharmony_ci 11725bd8deadSopenharmony_ci flat in sampler2D theSampler; 11735bd8deadSopenharmony_ci in vec2 texCoord; 11745bd8deadSopenharmony_ci out vec4 finalColor; 11755bd8deadSopenharmony_ci 11765bd8deadSopenharmony_ci void main() 11775bd8deadSopenharmony_ci { 11785bd8deadSopenharmony_ci finalColor = texture(theSampler, texCoord); 11795bd8deadSopenharmony_ci } 11805bd8deadSopenharmony_ci 11815bd8deadSopenharmony_ci 11825bd8deadSopenharmony_ciNew State 11835bd8deadSopenharmony_ci 11845bd8deadSopenharmony_ci Add new table, Bindless Texture Handles 11855bd8deadSopenharmony_ci 11865bd8deadSopenharmony_ci Initial 11875bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. Attribute 11885bd8deadSopenharmony_ci ------------ ---- -------------------- ------- ------------------------- ------ ------- 11895bd8deadSopenharmony_ci - Z64 GetTextureHandleNV n/a texture handle 3.9.X - 11905bd8deadSopenharmony_ci or GetTextureSampler- 11915bd8deadSopenharmony_ci HandleNV 11925bd8deadSopenharmony_ci - Z+ - n/a texture object used 3.9.X - 11935bd8deadSopenharmony_ci - Z+ - n/a sampler object used 3.9.X - 11945bd8deadSopenharmony_ci - nxB IsTextureHandle- FALSE is bindless texture handle 3.9.X - 11955bd8deadSopenharmony_ci ResidentNV resident for the current 11965bd8deadSopenharmony_ci context (separate state per 11975bd8deadSopenharmony_ci context/handle pair) 11985bd8deadSopenharmony_ci 11995bd8deadSopenharmony_ci Add new table, Bindless Image Handles 12005bd8deadSopenharmony_ci 12015bd8deadSopenharmony_ci Initial 12025bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. Attribute 12035bd8deadSopenharmony_ci ------------ ---- -------------------- ------- ------------------------- ------ ------- 12045bd8deadSopenharmony_ci - Z64 GetImageHandleNV n/a image handle 3.9.X - 12055bd8deadSopenharmony_ci - Z+ - n/a texture object used 3.9.X - 12065bd8deadSopenharmony_ci - Z+ - n/a texture object level 3.9.X - 12075bd8deadSopenharmony_ci - B - n/a is image handle layered? 3.9.X - 12085bd8deadSopenharmony_ci - Z+ - n/a selected layer for non- 3.9.X - 12095bd8deadSopenharmony_ci layered images 12105bd8deadSopenharmony_ci - Z_<n> - n/a image internal format enum 3.9.X - 12115bd8deadSopenharmony_ci - nxB IsImageHandle- FALSE is bindless image handle 3.9.X - 12125bd8deadSopenharmony_ci ResidentNV resident for the current 12135bd8deadSopenharmony_ci context (separate state 12145bd8deadSopenharmony_ci per context/handle pair) 12155bd8deadSopenharmony_ci 12165bd8deadSopenharmony_ciIssues 12175bd8deadSopenharmony_ci 12185bd8deadSopenharmony_ci (1) Could this have been specified as simply making the maximum number of 12195bd8deadSopenharmony_ci texture image units and image units arbitrarily large and then 12205bd8deadSopenharmony_ci indexing into an array of samplers or images? 12215bd8deadSopenharmony_ci 12225bd8deadSopenharmony_ci RESOLVED: Perhaps, but this approach doesn't involve any arbitrarily 12235bd8deadSopenharmony_ci limits. Allowing the implementation to choose the GPU handle can avoid 12245bd8deadSopenharmony_ci the need for some kind of unit->address translation. It's also 12255bd8deadSopenharmony_ci beneficial for the GPU handles to be static. 12265bd8deadSopenharmony_ci 12275bd8deadSopenharmony_ci (2) Should we add commands to allow prioritizing which allocations belong 12285bd8deadSopenharmony_ci in dedicated video memory? 12295bd8deadSopenharmony_ci 12305bd8deadSopenharmony_ci RESOLVED: Defer to a future extension. 12315bd8deadSopenharmony_ci 12325bd8deadSopenharmony_ci (3) How should we handle separate samplers? 12335bd8deadSopenharmony_ci 12345bd8deadSopenharmony_ci RESOLVED: OpenGL 3.3 created separate sampler objects, and provided 12355bd8deadSopenharmony_ci separate binding points in a texture image unit. When referencing a 12365bd8deadSopenharmony_ci texture image unit with a sampler object bound, the state of that object 12375bd8deadSopenharmony_ci is used; otherwise, sampler state embedded in the texture is used. In 12385bd8deadSopenharmony_ci either case, each texture image unit consists of a texture/sampler pair, 12395bd8deadSopenharmony_ci and no capability is provided to mix the texture from one unit with 12405bd8deadSopenharmony_ci samplers from another. 12415bd8deadSopenharmony_ci 12425bd8deadSopenharmony_ci This extension provides support for use of OpenGL 3.3-style sampler 12435bd8deadSopenharmony_ci objects via the GetTextureSamplerHandleNV entry point, which can be used 12445bd8deadSopenharmony_ci to create a handle for each pair of texture/sampler objects the 12455bd8deadSopenharmony_ci application wishes to use. GLSL samplers can be used with texture 12465bd8deadSopenharmony_ci handles in the same way that they can be used with the texture/sampler 12475bd8deadSopenharmony_ci object pair associated with a texture image unit. 12485bd8deadSopenharmony_ci 12495bd8deadSopenharmony_ci It's possible that some future extension to OpenGL might allow shaders 12505bd8deadSopenharmony_ci to mix and match texture and sampler objects within a shader instead of 12515bd8deadSopenharmony_ci using pre-defined pairs. Such shaders would use two different shader 12525bd8deadSopenharmony_ci variable types -- one encapsulating texture object state and the other 12535bd8deadSopenharmony_ci encapsulating sampler state. To allow bindless texture support in this 12545bd8deadSopenharmony_ci mode, we would expect to add a new handle type (sampler handles) and to 12555bd8deadSopenharmony_ci provide new APIs to extract sampler handles from sampler objects and to 12565bd8deadSopenharmony_ci manage sampler handle residency. (It's not immediately clear whether it 12575bd8deadSopenharmony_ci would even be necessary to manage sampler handle residency, since 12585bd8deadSopenharmony_ci sampler objects only have a small number of state variables.) 12595bd8deadSopenharmony_ci 12605bd8deadSopenharmony_ci (4) Can texture or sampler objects be modified while they are used by a 12615bd8deadSopenharmony_ci texture or image handle? 12625bd8deadSopenharmony_ci 12635bd8deadSopenharmony_ci RESOLVED: No. If such changes were permitted, each modification to the 12645bd8deadSopenharmony_ci texture object would require potential synchronization with one or more 12655bd8deadSopenharmony_ci texture/image handles extracted from the texture. This seems like a lot 12665bd8deadSopenharmony_ci of bookkeeping with little benefit. One exception to this rule is that 12675bd8deadSopenharmony_ci individual texels of such texture objects may still be updated with APIs 12685bd8deadSopenharmony_ci such as TexSubImage* and by rendering to a framebuffer object to which 12695bd8deadSopenharmony_ci the texture is attached. 12705bd8deadSopenharmony_ci 12715bd8deadSopenharmony_ci (5) Is there a way to release a texture or image handle after it is 12725bd8deadSopenharmony_ci created? 12735bd8deadSopenharmony_ci 12745bd8deadSopenharmony_ci RESOLVED: No API is provided to release or delete handles once they are 12755bd8deadSopenharmony_ci created. Texture and image handles are automatically reclaimed when the 12765bd8deadSopenharmony_ci underlying texture or sampler objects are finally deleted. This 12775bd8deadSopenharmony_ci deletion will happen only when no handle using the texture or sampler 12785bd8deadSopenharmony_ci object is resident on any context. This decision is similar to that of 12795bd8deadSopenharmony_ci NV_shader_buffer_load, which didn't provide any mechanism to release the 12805bd8deadSopenharmony_ci address of a buffer object. 12815bd8deadSopenharmony_ci 12825bd8deadSopenharmony_ci One consequence of this decision is that structural changes (e.g., image 12835bd8deadSopenharmony_ci size and format and parameter changes) to textures from which handles 12845bd8deadSopenharmony_ci are extracted are not possible for the lifetime of the texture. 12855bd8deadSopenharmony_ci 12865bd8deadSopenharmony_ci (6) How do texture and image handles work with multiple contexts sharing a 12875bd8deadSopenharmony_ci set of texture and sampler objects? 12885bd8deadSopenharmony_ci 12895bd8deadSopenharmony_ci RESOLVED: Texture and image handles are shared by all contexts in a 12905bd8deadSopenharmony_ci share group, in the same way that GPU addresses are shared in 12915bd8deadSopenharmony_ci NV_shader_buffer_load. Once a handle has been extracted from a texture 12925bd8deadSopenharmony_ci or texture/sampler pair in any context, that handle may be used by all 12935bd8deadSopenharmony_ci other contexts in the share group. 12945bd8deadSopenharmony_ci 12955bd8deadSopenharmony_ci However, texture and image handle residency is managed per-context. If 12965bd8deadSopenharmony_ci a texture or image handle is used in multiple contexts in a share group, 12975bd8deadSopenharmony_ci the handle must be made resident in all such contexts. 12985bd8deadSopenharmony_ci 12995bd8deadSopenharmony_ci (7) What happens if you try to delete a texture or sampler object with a 13005bd8deadSopenharmony_ci handle that is resident in another context? 13015bd8deadSopenharmony_ci 13025bd8deadSopenharmony_ci RESOLVED: Deleting the texture will remove the texture from the name 13035bd8deadSopenharmony_ci space and make all handles using the texture non-resident in the current 13045bd8deadSopenharmony_ci context. However, texture or image handles for a deleted texture are 13055bd8deadSopenharmony_ci not deleted until the underlying texture or sampler object itself is 13065bd8deadSopenharmony_ci deleted. That deletion won't happen until the object is not bound 13075bd8deadSopenharmony_ci anywhere and there are no handles using the object that are resident in 13085bd8deadSopenharmony_ci any context. 13095bd8deadSopenharmony_ci 13105bd8deadSopenharmony_ci (8) Can you get a handle from a default texture object (numbered zero)? 13115bd8deadSopenharmony_ci 13125bd8deadSopenharmony_ci RESOLVED: No, for several reasons. First, the APIs to extract a 13135bd8deadSopenharmony_ci texture handle only take a texture object number, with no target. Since 13145bd8deadSopenharmony_ci there is a separate default texture object for each texture target, the 13155bd8deadSopenharmony_ci texture object number zero does not identify a unique texture. 13165bd8deadSopenharmony_ci Additionally, since the spec forbids modification of textures used with 13175bd8deadSopenharmony_ci handles, extracting a handle from a default texture would leave the 13185bd8deadSopenharmony_ci texture in a state where it could be neither modified nor deleted. 13195bd8deadSopenharmony_ci 13205bd8deadSopenharmony_ci (9) Can you have multiple handles for the same texture or texture/sampler 13215bd8deadSopenharmony_ci pair? 13225bd8deadSopenharmony_ci 13235bd8deadSopenharmony_ci RESOLVED: Any texture object can have at most one handle extracted from 13245bd8deadSopenharmony_ci the texture object via GetTextureHandleNV; calling that function 13255bd8deadSopenharmony_ci multiple times on a single texture will always return the same handle. 13265bd8deadSopenharmony_ci 13275bd8deadSopenharmony_ci A texture or sampler object may have multiple texture handles extracted 13285bd8deadSopenharmony_ci from it via GetTextureSamplerHandleNV, since such handles correspond to 13295bd8deadSopenharmony_ci a texture/sampler pair and a single texture or sampler object may be 13305bd8deadSopenharmony_ci paired with multiple objects of the other type. However, calling that 13315bd8deadSopenharmony_ci function multiple times on a single texture/sampler pair will always 13325bd8deadSopenharmony_ci return the same handle. 13335bd8deadSopenharmony_ci 13345bd8deadSopenharmony_ci A texture object may have multiple image handles extracted from it via 13355bd8deadSopenharmony_ci GetImageHandleNV; however, each such handle must represent a different 13365bd8deadSopenharmony_ci "view" of the texture. If that function is called multiple times with 13375bd8deadSopenharmony_ci the same <texture>, <level>, <layered>, <layer>, and <format> 13385bd8deadSopenharmony_ci parameters, the same handle will always be returned. 13395bd8deadSopenharmony_ci 13405bd8deadSopenharmony_ci (10) Should we provide <access> parameters for MakeTextureHandleResidentNV 13415bd8deadSopenharmony_ci and MakeImageHandleResidentNV? 13425bd8deadSopenharmony_ci 13435bd8deadSopenharmony_ci RESOLVED: For MakeImageHandleResidentNV, yes. It may be useful to be 13445bd8deadSopenharmony_ci able to make a given texture resident only for reading or writing. For 13455bd8deadSopenharmony_ci MakeTextureHandleResidentNV, no. Texture mapping is a read-only 13465bd8deadSopenharmony_ci operation; texture handles can really only be used for reading. So all 13475bd8deadSopenharmony_ci calls to MakeTextureHandleResidentNV are considered to use an access 13485bd8deadSopenharmony_ci mode of READ_ONLY. 13495bd8deadSopenharmony_ci 13505bd8deadSopenharmony_ci (11) Should implicit conversions be supported for converting uint64-typed 13515bd8deadSopenharmony_ci handles to sampler and image types? 13525bd8deadSopenharmony_ci 13535bd8deadSopenharmony_ci RESOLVED: No. An explicit constructor is provided to build a handle 13545bd8deadSopenharmony_ci from 64-bit unsigned integer or vice versa. 13555bd8deadSopenharmony_ci 13565bd8deadSopenharmony_ci (12) How do we handle backwards compatibility for sampler uniforms in the 13575bd8deadSopenharmony_ci default uniform block, which have historically been set to point at a 13585bd8deadSopenharmony_ci texture image unit? 13595bd8deadSopenharmony_ci 13605bd8deadSopenharmony_ci RESOLVED: We allow sampler uniforms to be set either using handles (via 13615bd8deadSopenharmony_ci the UniformHandle* APIs) or texture image units (via the previously used 13625bd8deadSopenharmony_ci Uniform1i* APIs). If the uniform was last set with a handle, the 13635bd8deadSopenharmony_ci specified handle will be used for texture access. Otherwise, the value 13645bd8deadSopenharmony_ci of the uniform is treated as a texture image unit when the texture is 13655bd8deadSopenharmony_ci accessed, and is resolved to refer to the appropriate texture bound to 13665bd8deadSopenharmony_ci that unit. 13675bd8deadSopenharmony_ci 13685bd8deadSopenharmony_ci We expect that implementations will distinguish between the two types of 13695bd8deadSopenharmony_ci uniform values either by a per-uniform flag or by reserving a subset of 13705bd8deadSopenharmony_ci the 2^64 possible handle values to be used to refer to texture image 13715bd8deadSopenharmony_ci units. 13725bd8deadSopenharmony_ci 13735bd8deadSopenharmony_ci We impose no limit on the mixing and matching of texture image unit and 13745bd8deadSopenharmony_ci handle-based uniform values; an application is permitted to set some 13755bd8deadSopenharmony_ci uniforms via UniformHandle*NV and others via Uniform1i. We don't expect 13765bd8deadSopenharmony_ci such mixing and matching to be common. 13775bd8deadSopenharmony_ci 13785bd8deadSopenharmony_ci When a sampler or image uniform's value is queried via any of the 13795bd8deadSopenharmony_ci GetUniform* commands, the returned value will reflect the most recently 13805bd8deadSopenharmony_ci set value through either UniformHandle* or Uniform1i*, converted to the 13815bd8deadSopenharmony_ci requested type. 13825bd8deadSopenharmony_ci 13835bd8deadSopenharmony_ci (13) Should UniformHandleui64{v}NV check the provided uniform value(s) to 13845bd8deadSopenharmony_ci determine if they are valid handles? 13855bd8deadSopenharmony_ci 13865bd8deadSopenharmony_ci RESOLVED: No; passing in proper texture or image handles is the 13875bd8deadSopenharmony_ci responsibility of the application. Note that even if we did verify that 13885bd8deadSopenharmony_ci handles were valid at the time sampler or image uniforms were specified, 13895bd8deadSopenharmony_ci there is no guarantee that they would still be valid for texture or 13905bd8deadSopenharmony_ci image accesses when they are used. In particular, the texture referred 13915bd8deadSopenharmony_ci to by the handle may have be deleted, or may exist without being made 13925bd8deadSopenharmony_ci resident for the context in question. 13935bd8deadSopenharmony_ci 13945bd8deadSopenharmony_ci (14) With this extension, GLSL sampler and image variables may be 13955bd8deadSopenharmony_ci specified using 64-bit handles and are permitted to count as two 13965bd8deadSopenharmony_ci components toward implementation-dependent limits on uniforms, shader 13975bd8deadSopenharmony_ci inputs, and shader outputs. Is there a backward compatibility 13985bd8deadSopenharmony_ci problem here? 13995bd8deadSopenharmony_ci 14005bd8deadSopenharmony_ci RESOLVED: If there is one, we don't expect it to be very serious. 14015bd8deadSopenharmony_ci 14025bd8deadSopenharmony_ci Prior to this extension, samplers or images could not be used as shader 14035bd8deadSopenharmony_ci inputs or outputs, so there is no compatibility problem there. Samplers 14045bd8deadSopenharmony_ci and images could be used as uniforms, however. While there is no 14055bd8deadSopenharmony_ci explicit spec language describing the amount of storage required for 14065bd8deadSopenharmony_ci samplers and images, one might construe this lack of language to mean 14075bd8deadSopenharmony_ci that only a single component was previously required. Allowing for 14085bd8deadSopenharmony_ci 64-bit handles in this extension could double the requirement and cause 14095bd8deadSopenharmony_ci shaders that previously just barely fit to exceed implementation 14105bd8deadSopenharmony_ci limits. 14115bd8deadSopenharmony_ci 14125bd8deadSopenharmony_ci Implementations that consider this issue serious could increase their 14135bd8deadSopenharmony_ci uniform limit slightly to compensate. Note that the number of sampler 14145bd8deadSopenharmony_ci variables used prior to this extension was quite limited, so the amount 14155bd8deadSopenharmony_ci of extra storage required for 64-bit handles should be small. 14165bd8deadSopenharmony_ci 14175bd8deadSopenharmony_ci (15) What happens if you try to access a texture or image handle that is 14185bd8deadSopenharmony_ci (a) invalid, (b) non-resident, or (c) corresponds to a texture of a 14195bd8deadSopenharmony_ci target different from the target used for the access (e.g., doing a 14205bd8deadSopenharmony_ci 3D lookup with a handle referring to a 2D texture)? 14215bd8deadSopenharmony_ci 14225bd8deadSopenharmony_ci RESOLVED: For (a), we specify undefined behavior including possible 14235bd8deadSopenharmony_ci program termination. Such accesses are effectively equivalent to 14245bd8deadSopenharmony_ci chasing an invalid pointer. 14255bd8deadSopenharmony_ci 14265bd8deadSopenharmony_ci For (b), we treat non-resident handles as invalid. Note that this 14275bd8deadSopenharmony_ci extension doesn't require that accesses to non-resident handles fail. 14285bd8deadSopenharmony_ci 14295bd8deadSopenharmony_ci For (c), we specify that loads/stores to textures of the "wrong" type 14305bd8deadSopenharmony_ci may have undefined results but should not result in program termination. 14315bd8deadSopenharmony_ci This same situation could arise in EXT_shader_image_load_store, where 14325bd8deadSopenharmony_ci each image unit has a single attachment point shared by all targets, and 14335bd8deadSopenharmony_ci the same behavior was specified there. Similar situations could also 14345bd8deadSopenharmony_ci arise for indexed texture accesses in OpenGL 4.0, where out-of-bounds 14355bd8deadSopenharmony_ci array indices could cause a shader to use a texture unit whose "active" 14365bd8deadSopenharmony_ci target was the wrong kind. 14375bd8deadSopenharmony_ci 14385bd8deadSopenharmony_ci (16) Prior to this extension, there were limits on the number of different 14395bd8deadSopenharmony_ci textures that could be accessed at once -- the number of texture 14405bd8deadSopenharmony_ci image units and image units were limited by implementation-dependent 14415bd8deadSopenharmony_ci constants. What limits apply with this extension? 14425bd8deadSopenharmony_ci 14435bd8deadSopenharmony_ci RESOLVED: Since texture image units and image units need not be used 14445bd8deadSopenharmony_ci with this extension, those limits no longer apply to shaders that use 14455bd8deadSopenharmony_ci bindless textures. With this extension, there is no longer any direct 14465bd8deadSopenharmony_ci limit on the number of textures/images that may be used in any shader 14475bd8deadSopenharmony_ci stage. 14485bd8deadSopenharmony_ci 14495bd8deadSopenharmony_ci There may still be indirect limits based on the total amount of storage 14505bd8deadSopenharmony_ci available: 14515bd8deadSopenharmony_ci 14525bd8deadSopenharmony_ci * Limits on the total amount of uniform memory imply a limit on the 14535bd8deadSopenharmony_ci total number of texture handles stored as uniforms. 14545bd8deadSopenharmony_ci 14555bd8deadSopenharmony_ci * Limits on the number of shader input/output components imply a limit 14565bd8deadSopenharmony_ci on the number of texture handles passed as shader inputs and 14575bd8deadSopenharmony_ci outputs. 14585bd8deadSopenharmony_ci 14595bd8deadSopenharmony_ci * Limits on the total amount of addressable texture memory imply a 14605bd8deadSopenharmony_ci limit on the total number of resident texture handles. 14615bd8deadSopenharmony_ci 14625bd8deadSopenharmony_ci * Implementations may have (high) limits on the total number of 14635bd8deadSopenharmony_ci texture handles available in the system. 14645bd8deadSopenharmony_ci 14655bd8deadSopenharmony_ci (17) Should we provide any queries to extract information from texture or 14665bd8deadSopenharmony_ci image handles? 14675bd8deadSopenharmony_ci 14685bd8deadSopenharmony_ci RESOLVED: No. 14695bd8deadSopenharmony_ci 14705bd8deadSopenharmony_ci (18) Texture and image handles may be made resident or non-resident. How 14715bd8deadSopenharmony_ci does handle residency interact with texture residency queries from 14725bd8deadSopenharmony_ci OpenGL 1.1 (AreTexturesResident or TEXTURE_RESIDENT)? 14735bd8deadSopenharmony_ci 14745bd8deadSopenharmony_ci RESOLVED: The residency state for texture and image handles in this 14755bd8deadSopenharmony_ci extension is completely independent from OpenGL 1.1's TEXTURE_RESIDENT 14765bd8deadSopenharmony_ci query. Residency for texture handles is a function of whether the 14775bd8deadSopenharmony_ci MakeTextureHandleResidentNV has been called for the handle. OpenGL 1.1 14785bd8deadSopenharmony_ci residency is typically a function of whether the texture data are 14795bd8deadSopenharmony_ci resident in GPU-accessible memory. 14805bd8deadSopenharmony_ci 14815bd8deadSopenharmony_ci When a texture handle is not made resident, the texture that it refers 14825bd8deadSopenharmony_ci to may or may not be stored in GPU-accessible memory. The 14835bd8deadSopenharmony_ci TEXTURE_RESIDENT query may return TRUE in this case. However, it does 14845bd8deadSopenharmony_ci not guarantee that the texture handle may be used safely. 14855bd8deadSopenharmony_ci 14865bd8deadSopenharmony_ci When a texture handle is made resident, the texture that it refers to is 14875bd8deadSopenharmony_ci also considered resident for the purposes of the old TEXTURE_RESIDENT 14885bd8deadSopenharmony_ci query. When an image handle is resident, the texture that it refers to 14895bd8deadSopenharmony_ci may or may not be considered resident for the query -- the resident 14905bd8deadSopenharmony_ci image handle may refer only to a single layer of a single mipmap level 14915bd8deadSopenharmony_ci of the full texture. 14925bd8deadSopenharmony_ci 14935bd8deadSopenharmony_ci 14945bd8deadSopenharmony_ciRevision History 14955bd8deadSopenharmony_ci 14965bd8deadSopenharmony_ci Rev. Date Author Changes 14975bd8deadSopenharmony_ci ---- -------- -------- ----------------------------------------- 14985bd8deadSopenharmony_ci 3 06/12/14 dkoch Add interactions with OpenGL ES. 14995bd8deadSopenharmony_ci Define better functionality when NV_gpu_shader5 15005bd8deadSopenharmony_ci is not supported. 15015bd8deadSopenharmony_ci Fix a variety of typos and missing words. 15025bd8deadSopenharmony_ci Merge in typo fixes from v3 of the ARB extn. 15035bd8deadSopenharmony_ci Add missing error condition for BufferData and 15045bd8deadSopenharmony_ci buffer textures. 15055bd8deadSopenharmony_ci 15065bd8deadSopenharmony_ci 2 05/16/13 pbrown Fix typo in spec language. 15075bd8deadSopenharmony_ci 15085bd8deadSopenharmony_ci 1 jbolz Internal revisions. 15095bd8deadSopenharmony_ci pbrown 1510