15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci OES_shader_image_atomic 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_OES_shader_image_atomic 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Bill Licea-Kane, Qualcomm Technologies, Inc. ( billl 'at' qti.qualcomm.com ) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Jeff Bolz, NVIDIA 165bd8deadSopenharmony_ci Pat Brown, NVIDIA 175bd8deadSopenharmony_ci Daniel Koch, NVIDIA 185bd8deadSopenharmony_ci Jon Leech 195bd8deadSopenharmony_ci Barthold Lichtenbelt, NVIDIA 205bd8deadSopenharmony_ci Bill Licea-Kane, AMD 215bd8deadSopenharmony_ci Eric Werness, NVIDIA 225bd8deadSopenharmony_ci Graham Sellers, AMD 235bd8deadSopenharmony_ci Greg Roth, NVIDIA 245bd8deadSopenharmony_ci Nick Haemel, AMD 255bd8deadSopenharmony_ci Pierre Boudier, AMD 265bd8deadSopenharmony_ci Piers Daniell, NVIDIA 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciNotice 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci Copyright (c) 2011-2015 The Khronos Group Inc. Copyright termsat 315bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ciSpecification Update Policy 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 365bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL ES Working Group. For 375bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 385bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 395bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 405bd8deadSopenharmony_ci described in more detail at 415bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ciStatus 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci Complete. 465bd8deadSopenharmony_ci Ratified by the Khronos Board of Promoters on 2014/03/14. 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ciVersion 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci Last Modified Date: April 30, 2015 515bd8deadSopenharmony_ci Revision: 5 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ciNumber 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci OpenGL ES Extension #171 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ciDependencies 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci This extension is written against the OpenGL ES Version 3.1 (April 29, 605bd8deadSopenharmony_ci 2015) Specification. 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci This extension is written against the OpenGL ES Shading Language 3.10, 635bd8deadSopenharmony_ci Revision 3, 6 June 2014 Specification. 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci OpenGL ES 3.1 and GLSL ES 3.10 are required. 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ciOverview 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci This extension provides built-in functions allowing shaders to perform 705bd8deadSopenharmony_ci atomic read-modify-write operations to a single level of a texture 715bd8deadSopenharmony_ci object from any shader stage. These built-in functions are named 725bd8deadSopenharmony_ci imageAtomic*(), and accept integer texel coordinates to identify the 735bd8deadSopenharmony_ci texel accessed. These built-in functions extend the Images in ESSL 3.10. 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciAdditions to Chapter 7 of the OpenGL ES 3.1 specification (Programs and Shaders) 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci Change the first paragraph of section 7.10 "Images" on p. 113: 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci "Images are special uniforms used in the OpenGL ES Shading Language to 805bd8deadSopenharmony_ci identify a level of a texture to be read or written using image load, 815bd8deadSopenharmony_ci store, and atomic built-in functions in the manner ..." 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci Change the third paragraph of section 7.10: 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci "The type of an image variable must match the texture target of the image 875bd8deadSopenharmony_ci currently bound to the image unit, otherwise the result of a load, 885bd8deadSopenharmony_ci store, or atomic operation..." 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci Change the first sentence of section 7.11 "Shader Memory Access" on p. 925bd8deadSopenharmony_ci 113: 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci "... shader buffer variables, or to texture or buffer object memory using 955bd8deadSopenharmony_ci built-in image load, store, and atomic functions operating on shader 965bd8deadSopenharmony_ci image variables..." 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ciAdditions to Chapter 8 of the OpenGL ES 3.1 specification (Textures and Samplers) 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci Change the caption to table 8.26, p. 199 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci "Table 8.26: Mapping of image load, store, and atomic texel..." 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci Change the first sentence of the second paragraph on p. 199: 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ci "When a shader accesses the texture bound to an image unit using a 1085bd8deadSopenharmony_ci built-in image load, store or atomic function..." 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci Change the fourth paragraph: 1125bd8deadSopenharmony_ci 1135bd8deadSopenharmony_ci "If the individual texel identified for an image load, store, or atomic 1145bd8deadSopenharmony_ci operation ... Invalid image stores will have no effect. Invalid image 1155bd8deadSopenharmony_ci atomics will not update any texture bound to the image unit and will 1165bd8deadSopenharmony_ci return zero. An access is considered invalid if..." 1175bd8deadSopenharmony_ci 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci Change the first complete paragraph on p. 200: 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci "Additionally, there are a number of cases where image load, store, or 1225bd8deadSopenharmony_ci atomic operations are considered to involve a format mismatch. In such 1235bd8deadSopenharmony_ci cases, undefined values will be returned by image loads and atomic 1245bd8deadSopenharmony_ci operations, and undefined values will be written by stores and atomic 1255bd8deadSopenharmony_ci operations. A format mismatch will occur if:" 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ci Change the last paragraph on p. 200: 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ci "Any image variable used for shader loads or atomic memory operations 1315bd8deadSopenharmony_ci must be declared with a format <layout> qualifier matching ..." 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci Change the last paragraph on p. 200: 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ci "When the format associated with an image unit does not exactly match the 1375bd8deadSopenharmony_ci internal format of the texture bound to the image unit, image loads, 1385bd8deadSopenharmony_ci stores and atomic operations re-interpret the memory holding the 1395bd8deadSopenharmony_ci components of an accessed texel according to the format of the image 1405bd8deadSopenharmony_ci unit. The re-interpretation for image loads and the read portion of 1415bd8deadSopenharmony_ci image atomics is performed as though data were copied from the texel of 1425bd8deadSopenharmony_ci the bound texture to a similar texel represented in the format of the 1435bd8deadSopenharmony_ci image unit. Similarly, the re-interpretation for image stores and the 1445bd8deadSopenharmony_ci write portion of image atomics is performed as though ..." 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ciChanges to Chapter 20 (State Tables) 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci Modify the description of MAX_IMAGE_UNITS in table 20.47 on p. 404: 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci "MAX_IMAGE_UNITS ... No. of units for image load/store/atomics" 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL ES 3.1 specification (Invariance) 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ci Change the third sentence of the first paragraph in section A.1, p. 408: 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci "This repeatability requirement doesn't apply when using shaders 1575bd8deadSopenharmony_ci containing side effects (image stores, image atomic operations, atomic 1585bd8deadSopenharmony_ci counter operations ..." 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci 1615bd8deadSopenharmony_ci Change the last sentence of Rule 4 in section A.3, p. 310: 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci "Invariance is relaxed for shaders with side effects, such as image 1645bd8deadSopenharmony_ci stores, image atomic operations, or accessing atomic counters (see 1655bd8deadSopenharmony_ci section A.4)." 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci Change the first sentence of the second paragraph of Rule 5, p. 310: 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci "If a sequence of GL commands specifies primitives to be rendered with 1715bd8deadSopenharmony_ci shaders containing side effects (image stores, image atomic operations, 1725bd8deadSopenharmony_ci atomic counter operations ..." 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci Change the first sentence of Rule 6, p. 411: 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci "For any given GL and framebuffer state vector, and for any given GL 1785bd8deadSopenharmony_ci command, the contents of any framebuffer state not directly or 1795bd8deadSopenharmony_ci indirectly affected by results of shader image stores, image atomic 1805bd8deadSopenharmony_ci operations, or atomic counter operations ..." 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ci 1835bd8deadSopenharmony_ci Change the first bullet of Rule 7, p. 411: 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci "* shader invocations do not use image atomic operations or atomic 1865bd8deadSopenharmony_ci counters;" 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci Change the first sentence of the second paragraph of Rule 7: 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci "When any sequence of GL commands triggers shader invocations that 1925bd8deadSopenharmony_ci perform image stores, image atomic operations, atomic counter 1935bd8deadSopenharmony_ci operations ..." 1945bd8deadSopenharmony_ci 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ciModifications to the OpenGL ES 3.10 Shading Language Specification 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 1995bd8deadSopenharmony_ci language features described in this extension: 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci #extension GL_OES_shader_image_atomic : <behavior> 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci where <behavior> is as specified in section 3.3. 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci New preprocessor #defines are added to the OpenGL Shading Language: 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ci #define GL_OES_shader_image_atomic 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci 2105bd8deadSopenharmony_ci Modifications to Chapter 4 (Variables and Types) of the OpenGL ES 3.10 2115bd8deadSopenharmony_ci Shading Language Specification 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ci Change the first sentence of the third paragraph of section 4.1.7.2 2145bd8deadSopenharmony_ci (Images), p. 28: 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ci "Image variables are used in the image load, store, and 2175bd8deadSopenharmony_ci atomic functions described in section 8.12 ..." 2185bd8deadSopenharmony_ci 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci Add to section 8.12 (Image Functions) 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci Add new overview and syntax and description table following existing 2235bd8deadSopenharmony_ci Image Functions table, p. 129: 2245bd8deadSopenharmony_ci 2255bd8deadSopenharmony_ci "The atomic functions perform operations on individual texels or samples 2265bd8deadSopenharmony_ci of an image variable. Atomic memory operations read a value from the 2275bd8deadSopenharmony_ci selected texel, compute a new value using one of the operations 2285bd8deadSopenharmony_ci described below, write the new value to the selected texel, and return 2295bd8deadSopenharmony_ci the original value read. The contents of the texel being updated by the 2305bd8deadSopenharmony_ci atomic operation are guaranteed not to be updated by any other image 2315bd8deadSopenharmony_ci store or atomic function between the time the original value is read and 2325bd8deadSopenharmony_ci the time the new value is written. 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci Atomic memory operations are supported on only a subset of all image 2355bd8deadSopenharmony_ci variable types; <image> must be either: 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ci * a signed integer image variable (type starts "iimage") and a format 2385bd8deadSopenharmony_ci qualifier of "r32i", used with a <data> argument of type "int", or 2395bd8deadSopenharmony_ci * an unsigned integer image variable (type starts "uimage") and a 2405bd8deadSopenharmony_ci format qualifier of "r32ui", used with a <data> argument of type 2415bd8deadSopenharmony_ci "uint", or 2425bd8deadSopenharmony_ci * a float image variable (type starts "image") and a format qualifier 2435bd8deadSopenharmony_ci of "r32f", used with a <data> argument of type "float" 2445bd8deadSopenharmony_ci (imageAtomicExchange only). 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ci Add to the table of image functions, p. 129: 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci Syntax Description 2495bd8deadSopenharmony_ci ------------------------------- ------------------------------------- 2505bd8deadSopenharmony_ci highp uint imageAtomicAdd( Computes a new value by adding the 2515bd8deadSopenharmony_ci coherent IMAGE_PARAMS, value of <data> to the contents of 2525bd8deadSopenharmony_ci uint data); the selected texel. 2535bd8deadSopenharmony_ci highp int imageAtomicAdd( 2545bd8deadSopenharmony_ci coherent IMAGE_PARAMS, 2555bd8deadSopenharmony_ci int data); 2565bd8deadSopenharmony_ci ----------------------------------------------------------------------- 2575bd8deadSopenharmony_ci highp uint imageAtomicMin( Computes a new value by taking the 2585bd8deadSopenharmony_ci coherent IMAGE_PARAMS, minimum of the value of <data> and 2595bd8deadSopenharmony_ci uint data); the contents of the selected texel. 2605bd8deadSopenharmony_ci highp int imageAtomicMin( 2615bd8deadSopenharmony_ci coherent IMAGE_PARAMS, 2625bd8deadSopenharmony_ci int data); 2635bd8deadSopenharmony_ci ----------------------------------------------------------------------- 2645bd8deadSopenharmony_ci highp uint imageAtomicMax( Computes a new value by taking the 2655bd8deadSopenharmony_ci coherent IMAGE_PARAMS, maximum of the value of <data> and 2665bd8deadSopenharmony_ci uint data); the contents of the selected texel. 2675bd8deadSopenharmony_ci highp int imageAtomicMax( 2685bd8deadSopenharmony_ci coherent IMAGE_PARAMS, 2695bd8deadSopenharmony_ci int data); 2705bd8deadSopenharmony_ci ----------------------------------------------------------------------- 2715bd8deadSopenharmony_ci highp uint imageAtomicAnd( Computes a new value by performing a 2725bd8deadSopenharmony_ci coherent IMAGE_PARAMS, bitwise AND of the value of <data> 2735bd8deadSopenharmony_ci uint data); and the contents of the selected 2745bd8deadSopenharmony_ci highp int imageAtomicAnd( texel. 2755bd8deadSopenharmony_ci coherent IMAGE_PARAMS, 2765bd8deadSopenharmony_ci int data); 2775bd8deadSopenharmony_ci ----------------------------------------------------------------------- 2785bd8deadSopenharmony_ci highp uint imageAtomicOr( Computes a new value by performing a 2795bd8deadSopenharmony_ci coherent IMAGE_PARAMS, bitwise OR of the value of <data> 2805bd8deadSopenharmony_ci uint data); and the contents of the selected 2815bd8deadSopenharmony_ci highp int imageAtomicOr( texel. 2825bd8deadSopenharmony_ci coherent IMAGE_PARAMS, 2835bd8deadSopenharmony_ci int data); 2845bd8deadSopenharmony_ci ----------------------------------------------------------------------- 2855bd8deadSopenharmony_ci highp uint imageAtomicXor( Computes a new value by performing a 2865bd8deadSopenharmony_ci coherent IMAGE_PARAMS, bitwise EXCLUSIVE OR of the value of 2875bd8deadSopenharmony_ci uint data); <data> and the contents of the 2885bd8deadSopenharmony_ci highp int imageAtomicXor( selected texel. 2895bd8deadSopenharmony_ci coherent IMAGE_PARAMS, 2905bd8deadSopenharmony_ci int data); 2915bd8deadSopenharmony_ci ----------------------------------------------------------------------- 2925bd8deadSopenharmony_ci highp uint imageAtomicExchange( Computes a new value by simply 2935bd8deadSopenharmony_ci coherent IMAGE_PARAMS, copying the value of <data>. 2945bd8deadSopenharmony_ci uint data); 2955bd8deadSopenharmony_ci highp int imageAtomicExchange( 2965bd8deadSopenharmony_ci coherent IMAGE_PARAMS, 2975bd8deadSopenharmony_ci int data); 2985bd8deadSopenharmony_ci highp float imageAtomicExchange( 2995bd8deadSopenharmony_ci coherent IMAGE_PARAMS, 3005bd8deadSopenharmony_ci float data); 3015bd8deadSopenharmony_ci ----------------------------------------------------------------------- 3025bd8deadSopenharmony_ci highp uint imageAtomicCompSwap( Compares the value of <compare> and 3035bd8deadSopenharmony_ci coherent IMAGE_PARAMS, the contents of the selected texel. 3045bd8deadSopenharmony_ci uint compare, If the values are equal, the new 3055bd8deadSopenharmony_ci uint data); value is given by <data>; otherwise, 3065bd8deadSopenharmony_ci highp int imageAtomicCompSwap( it is taken from the original value 3075bd8deadSopenharmony_ci coherent IMAGE_PARAMS, loaded from the texel. 3085bd8deadSopenharmony_ci int compare, 3095bd8deadSopenharmony_ci int data); 3105bd8deadSopenharmony_ci ----------------------------------------------------------------------- 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ciIssues 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci (0) This extension is based on ARB_shader_image_load_store. What 3155bd8deadSopenharmony_ci are the major differences? 3165bd8deadSopenharmony_ci 3175bd8deadSopenharmony_ci 1 - This extension splits out only the image atomic operations 3185bd8deadSopenharmony_ci from ARB_shader_image_load_store. 3195bd8deadSopenharmony_ci 2 - It depends on image load/store functionality that is part of 3205bd8deadSopenharmony_ci OpenGL ES 3.1, and inherits the list of differences from 3215bd8deadSopenharmony_ci desktop implementations in ES 3.1. Note that issue 0 of the 3225bd8deadSopenharmony_ci (unpublished) XXX_shader_image_load_store used for prototyping 3235bd8deadSopenharmony_ci ES 3.1 language contains the list explicitly; perhaps it should 3245bd8deadSopenharmony_ci should be reproduced here as well. 3255bd8deadSopenharmony_ci 3265bd8deadSopenharmony_ci (1) Should the shading language built-ins have OES suffixes? 3275bd8deadSopenharmony_ci 3285bd8deadSopenharmony_ci RESOLVED: No. Per Bug 11637, the WG made a policy decision 3295bd8deadSopenharmony_ci that GLSL ES identifiers imported without semantic change 3305bd8deadSopenharmony_ci or subsetting as OES extensions from core GLSL do not carry 3315bd8deadSopenharmony_ci suffixes. The #extension mechanism must still be used to 3325bd8deadSopenharmony_ci enable the appropriate extension before the functionality can 3335bd8deadSopenharmony_ci be used. 3345bd8deadSopenharmony_ci 3355bd8deadSopenharmony_ciRevision History 3365bd8deadSopenharmony_ci 3375bd8deadSopenharmony_ci Rev. Date Author Changes 3385bd8deadSopenharmony_ci 1 2014-01-30 wwlk Initial draft 3395bd8deadSopenharmony_ci 2 2014-01-31 wwlk Update to current draft base specs 3405bd8deadSopenharmony_ci (further updates coming as 3415bd8deadSopenharmony_ci additional draft specs done. 3425bd8deadSopenharmony_ci Otherwise, this spec is probably 3435bd8deadSopenharmony_ci ready to review.) 3445bd8deadSopenharmony_ci 3 2014-02-11 dkoch remove GLSL builtin suffixes per issue 1. 3455bd8deadSopenharmony_ci 4 2014-03-04 dkoch add coherent to image parameter (Bug 11595) 3465bd8deadSopenharmony_ci 5 2015-04-30 Jon Leech Require OpenGL ES 3.1 and remove dependency 3475bd8deadSopenharmony_ci on nonexistent shader_image_load_store 3485bd8deadSopenharmony_ci extension. Rewrite changes against the 3495bd8deadSopenharmony_ci published ES 3.1 / ESSL 3.10 specifications. 3505bd8deadSopenharmony_ci Remove references to multisampled image 3515bd8deadSopenharmony_ci atomic support, which does not exist in ES 3525bd8deadSopenharmony_ci 3.1. (Bugs 13879, 13887) 353