15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_gpu_shader5 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_gpu_shader5 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Pat Brown, NVIDIA Corporation (pbrown 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Barthold Lichtenbelt, NVIDIA 165bd8deadSopenharmony_ci Bill Licea-Kane, AMD 175bd8deadSopenharmony_ci Bruce Merry, ARM 185bd8deadSopenharmony_ci Chris Dodd, NVIDIA 195bd8deadSopenharmony_ci Eric Werness, NVIDIA 205bd8deadSopenharmony_ci Graham Sellers, AMD 215bd8deadSopenharmony_ci Greg Roth, NVIDIA 225bd8deadSopenharmony_ci Jeff Bolz, NVIDIA 235bd8deadSopenharmony_ci Nick Haemel, AMD 245bd8deadSopenharmony_ci Pierre Boudier, AMD 255bd8deadSopenharmony_ci Piers Daniell, NVIDIA 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciNotice 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci Copyright (c) 2010-2013 The Khronos Group Inc. Copyright terms at 305bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciSpecification Update Policy 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 355bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 365bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 375bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 385bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 395bd8deadSopenharmony_ci described in more detail at 405bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciStatus 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci Complete. Approved by the ARB at the 2010/01/22 F2F meeting. 455bd8deadSopenharmony_ci Approved by the Khronos Board of Promoters on March 10, 2010. 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ciVersion 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci Version 16, March 30, 2012 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ciNumber 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci ARB Extension #88 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ciDependencies 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ci This extension is written against the OpenGL 3.2 (Compatibility Profile) 585bd8deadSopenharmony_ci Specification. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci This extension is written against Version 1.50 (Revision 09) of the OpenGL 615bd8deadSopenharmony_ci Shading Language Specification. 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci OpenGL 3.2 and GLSL 1.50 are required. 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci This extension interacts with ARB_gpu_shader_fp64. 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci This extension interacts with NV_gpu_shader5. 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci This extension interacts with ARB_sample_shading. 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci This extension interacts with ARB_texture_gather. 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ciOverview 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci This extension provides a set of new features to the OpenGL Shading 765bd8deadSopenharmony_ci Language and related APIs to support capabilities of new GPUs, extending 775bd8deadSopenharmony_ci the capabilities of version 1.50 of the OpenGL Shading Language. Shaders 785bd8deadSopenharmony_ci using the new functionality provided by this extension should enable this 795bd8deadSopenharmony_ci functionality via the construct 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci #extension GL_ARB_gpu_shader5 : require (or enable) 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci This extension provides a variety of new features for all shader types, 845bd8deadSopenharmony_ci including: 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci * support for indexing into arrays of samplers using non-constant 875bd8deadSopenharmony_ci indices, as long as the index doesn't diverge if multiple shader 885bd8deadSopenharmony_ci invocations are run in lockstep; 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci * extending the uniform block capability of OpenGL 3.1 and 3.2 to allow 915bd8deadSopenharmony_ci shaders to index into an array of uniform blocks; 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci * support for implicitly converting signed integer types to unsigned 945bd8deadSopenharmony_ci types, as well as more general implicit conversion and function 955bd8deadSopenharmony_ci overloading infrastructure to support new data types introduced by 965bd8deadSopenharmony_ci other extensions; 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci * a "precise" qualifier allowing computations to be carried out exactly 995bd8deadSopenharmony_ci as specified in the shader source to avoid optimization-induced 1005bd8deadSopenharmony_ci invariance issues (which might cause cracking in tessellation); 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci * new built-in functions supporting: 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci * fused floating-point multiply-add operations; 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci * splitting a floating-point number into a significand and exponent 1075bd8deadSopenharmony_ci (frexp), or building a floating-point number from a significand and 1085bd8deadSopenharmony_ci exponent (ldexp); 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci * integer bitfield manipulation, including functions to find the 1115bd8deadSopenharmony_ci position of the most or least significant set bit, count the number 1125bd8deadSopenharmony_ci of one bits, and bitfield insertion, extraction, and reversal; 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci * packing and unpacking vectors of small fixed-point data types into a 1155bd8deadSopenharmony_ci larger scalar; and 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci * convert floating-point values to or from their integer bit 1185bd8deadSopenharmony_ci encodings; 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci * extending the textureGather() built-in functions provided by 1215bd8deadSopenharmony_ci ARB_texture_gather: 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci * allowing shaders to select any single component of a multi-component 1245bd8deadSopenharmony_ci texture to produce the gathered 2x2 footprint; 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci * allowing shaders to perform a per-sample depth comparison when 1275bd8deadSopenharmony_ci gathering the 2x2 footprint using for shadow sampler types; 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci * allowing shaders to use arbitrary offsets computed at run-time to 1305bd8deadSopenharmony_ci select a 2x2 footprint to gather from; and 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci * allowing shaders to use separate independent offsets for each of the 1335bd8deadSopenharmony_ci four texels returned, instead of requiring a fixed 2x2 footprint. 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci This extension also provides some new capabilities for individual 1365bd8deadSopenharmony_ci shader types, including: 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci * support for instanced geometry shaders, where a geometry shader may be 1395bd8deadSopenharmony_ci run multiple times for each primitive, including a built-in 1405bd8deadSopenharmony_ci gl_InvocationID to identify the invocation number; 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci * support for emitting vertices in a geometry program where each vertex 1435bd8deadSopenharmony_ci emitted may be directed independently at a specified vertex stream (as 1445bd8deadSopenharmony_ci provided by ARB_transform_feedback3), and where each shader output is 1455bd8deadSopenharmony_ci associated with a stream; 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci * support for reading a mask of covered samples in a fragment shader; 1485bd8deadSopenharmony_ci and 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci * support for interpolating a fragment shader input at a programmable 1515bd8deadSopenharmony_ci offset relative to the pixel center, a programmable sample number, or 1525bd8deadSopenharmony_ci at the centroid. 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ciIP Status 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci No known IP claims. 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ciNew Procedures and Functions 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci None 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ciNew Tokens 1635bd8deadSopenharmony_ci 1645bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetProgramiv: 1655bd8deadSopenharmony_ci 1665bd8deadSopenharmony_ci GEOMETRY_SHADER_INVOCATIONS 0x887F 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, 1695bd8deadSopenharmony_ci GetDoublev, and GetInteger64v: 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A 1725bd8deadSopenharmony_ci MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B 1735bd8deadSopenharmony_ci MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C 1745bd8deadSopenharmony_ci FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D 1755bd8deadSopenharmony_ci MAX_VERTEX_STREAMS 0x8E71 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci (note: MAX_GEOMETRY_SHADER_INVOCATIONS, 1785bd8deadSopenharmony_ci MIN_FRAGMENT_INTERPOLATION_OFFSET, MAX_FRAGMENT_INTERPOLATION_OFFSET, and 1795bd8deadSopenharmony_ci FRAGMENT_INTERPOLATION_OFFSET_BITS have identical values to corresponding 1805bd8deadSopenharmony_ci "NV" enums from NV_gpu_program5. MAX_VERTEX_STREAMS is also defined in 1815bd8deadSopenharmony_ci ARB_transform_feedback3.) 1825bd8deadSopenharmony_ci 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 3.2 (Compatibility Profile) Specification 1855bd8deadSopenharmony_ci(OpenGL Operation) 1865bd8deadSopenharmony_ci 1875bd8deadSopenharmony_ci Modify Section 2.15.4, Geometry Shader Execution Environment, p. 121 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci (add two unnumbered subsections after "Texture Access", p. 122) 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci Instanced Geometry Shaders 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci For each input primitive received by the geometry shader pipeline stage, 1945bd8deadSopenharmony_ci the geometry shader may be run once or multiple times. The number of 1955bd8deadSopenharmony_ci times a geometry shader should be executed for each input primitive may be 1965bd8deadSopenharmony_ci specified using a layout qualifier in a geometry shader of a linked 1975bd8deadSopenharmony_ci program. If the invocation count is not specified in any layout 1985bd8deadSopenharmony_ci qualifier, the invocation count will be one. 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci Each separate geometry shader invocation is assigned a unique invocation 2015bd8deadSopenharmony_ci number. For a geometry shader with <N> invocations, each input primitive 2025bd8deadSopenharmony_ci spawns <N> invocations, numbered 0 through <N>-1. The built-in uniform 2035bd8deadSopenharmony_ci gl_InvocationID may be used by a geometry shader invocation to determine 2045bd8deadSopenharmony_ci its invocation number. 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci When executing instanced geometry shaders, the output primitives generated 2075bd8deadSopenharmony_ci from each input primitive are passed to subsequent pipeline stages using 2085bd8deadSopenharmony_ci the shader invocation number to order the output. The first primitives 2095bd8deadSopenharmony_ci received by the subsequent pipeline stages are those emitted by the shader 2105bd8deadSopenharmony_ci invocation numbered zero, followed by those from the shader invocation 2115bd8deadSopenharmony_ci numbered one, and so forth. Additionally, all output primitives generated 2125bd8deadSopenharmony_ci from a given input primitive are passed to subsequent pipeline stages 2135bd8deadSopenharmony_ci before any output primitives generated from subsequent input primitives. 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ci Geometry Shader Vertex Streams 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci Geometry shaders may emit primitives to multiple independent vertex 2195bd8deadSopenharmony_ci streams. Each vertex emitted by the geometry shader is directed at one of 2205bd8deadSopenharmony_ci the vertex streams. As vertices are received on each stream, they are 2215bd8deadSopenharmony_ci arranged into primitives of the type specified by the geometry shader 2225bd8deadSopenharmony_ci output primitive type. The shading language built-in functions 2235bd8deadSopenharmony_ci EndPrimitive() and EndStreamPrimitive() may be used to end the primitive 2245bd8deadSopenharmony_ci being assembled on a given vertex stream and start a new empty primitive 2255bd8deadSopenharmony_ci of the same type. If an implementation supports <N> vertex streams, the 2265bd8deadSopenharmony_ci individual streams are numbered 0 through <N>-1. There is no requirement 2275bd8deadSopenharmony_ci on the order of the streams to which vertices are emitted, and the number 2285bd8deadSopenharmony_ci of vertices emitted to each stream may be completely independent, subject 2295bd8deadSopenharmony_ci only to implementation-dependent output limits. 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ci The primitives emitted to all vertex streams are passed to the transform 2325bd8deadSopenharmony_ci feedback stage to be captured and written to buffer objects in the manner 2335bd8deadSopenharmony_ci specified by the transform feedback state. The primitives emitted to all 2345bd8deadSopenharmony_ci streams but stream zero are discarded after transform feedback. 2355bd8deadSopenharmony_ci Primitives emitted to stream zero are passed to subsequent pipeline stages 2365bd8deadSopenharmony_ci for clipping, rasterization, and subsequent fragment processing. 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ci Geometry shaders that emit vertices to multiple vertex streams are 2395bd8deadSopenharmony_ci currently limited to using only the "points" output primitive type. A 2405bd8deadSopenharmony_ci program will fail to link if it includes a geometry shader that calls the 2415bd8deadSopenharmony_ci EmitStreamVertex() built-in function and has any other output primitive 2425bd8deadSopenharmony_ci type parameter. 2435bd8deadSopenharmony_ci 2445bd8deadSopenharmony_ci 2455bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 3.2 (Compatibility Profile) Specification 2465bd8deadSopenharmony_ci(Rasterization) 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci Modify Section 3.3.1, Multisampling, p. 148 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci (add new paragraph at the end of the section, p. 149) 2515bd8deadSopenharmony_ci 2525bd8deadSopenharmony_ci If MULTISAMPLE is enabled and the current program object includes a 2535bd8deadSopenharmony_ci fragment shader with one or more input variables qualified with "sample 2545bd8deadSopenharmony_ci in", the data associated with those variables will be assigned 2555bd8deadSopenharmony_ci independently. The values for each sample must be evaluated at the 2565bd8deadSopenharmony_ci location of the sample. The data associated with any other variables not 2575bd8deadSopenharmony_ci qualified with "sample in" need not be evaluated independently for each 2585bd8deadSopenharmony_ci sample. 2595bd8deadSopenharmony_ci 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci Modify ARB_texture_gather, "Changes to Section 3.8.8" 2625bd8deadSopenharmony_ci 2635bd8deadSopenharmony_ci (extend language describing the operation of textureGather, allowing the 2645bd8deadSopenharmony_ci new <comp> argument to select any of the four components from a 2655bd8deadSopenharmony_ci multi-component texel vector) 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ci The textureGather and textureGatherOffset built-in shader functions... A 2685bd8deadSopenharmony_ci four-component vector is then assembled by taking a single component from 2695bd8deadSopenharmony_ci the swizzled texture source colors of the four texels, in the order 2705bd8deadSopenharmony_ci T_i0_j1, T_i1_j1, T_i1_j0, and T_i0_j0. The selected component is 2715bd8deadSopenharmony_ci identified by the optional <comp> argument, where the values zero, one, 2725bd8deadSopenharmony_ci two, and three identify the Rs, Gs, Bs, or As component, respectively. If 2735bd8deadSopenharmony_ci <comp> is omitted, it is treated as identifying the Rs component. 2745bd8deadSopenharmony_ci Incomplete textures (section 3.8.10) are considered to return a texture 2755bd8deadSopenharmony_ci source color of (0,0,0,1) for all four source texels. 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci (add further language describing textureGatherOffsets) 2785bd8deadSopenharmony_ci 2795bd8deadSopenharmony_ci The textureGatherOffsets built-in functions from the OpenGL Shading 2805bd8deadSopenharmony_ci Language return a vector derived from sampling four texels in the image 2815bd8deadSopenharmony_ci array of level <level_base>. For each of the four texel offsets specified 2825bd8deadSopenharmony_ci by the <offsets> argument, the rules for the LINEAR minification filter 2835bd8deadSopenharmony_ci are applied to identify a 2x2 texel footprint, from which the single texel 2845bd8deadSopenharmony_ci T_i0_j0 is selected. A four-component vector is then assembled by taking 2855bd8deadSopenharmony_ci a single component from each of the four T_i0_j0 texels in the same manner 2865bd8deadSopenharmony_ci as for the textureGather function. 2875bd8deadSopenharmony_ci 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci Modify Section 3.12.1, Shader Variables, p. 273 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci (insert prior to the last paragraph of the section, p. 274) 2925bd8deadSopenharmony_ci 2935bd8deadSopenharmony_ci When interpolating built-in and user-defined varying variables, the default 2945bd8deadSopenharmony_ci screen-space location at which these variables are sampled is defined in 2955bd8deadSopenharmony_ci previous rasterization sections. The default location may be overriden by 2965bd8deadSopenharmony_ci interpolation qualifiers. When interpolating variables declared using 2975bd8deadSopenharmony_ci "centroid in", the variable is sampled at a location within the pixel 2985bd8deadSopenharmony_ci covered by the primitive generating the fragment. When interpolating 2995bd8deadSopenharmony_ci variables declared using "sample in" when MULTISAMPLE is enabled, the 3005bd8deadSopenharmony_ci fragment shader will be invoked separately for each covered sample and the 3015bd8deadSopenharmony_ci variable will be sampled at the corresponding sample point. 3025bd8deadSopenharmony_ci 3035bd8deadSopenharmony_ci Additionally, built-in fragment shader functions provide further 3045bd8deadSopenharmony_ci fine-grained control over interpolation. The built-in functions 3055bd8deadSopenharmony_ci interpolateAtCentroid() and interpolateAtSample() will sample variables as 3065bd8deadSopenharmony_ci though they were declared with the "centroid" or "sample" qualifiers, 3075bd8deadSopenharmony_ci respectively. The built-in function interpolateAtOffset() will sample 3085bd8deadSopenharmony_ci variables at a specified (x,y) offset relative to the center of the pixel. 3095bd8deadSopenharmony_ci The range and granularity of offsets supported by this function is 3105bd8deadSopenharmony_ci implementation-dependent. If either component of the specified offset is 3115bd8deadSopenharmony_ci less than MIN_FRAGMENT_INTERPOLATION_OFFSET or greater than 3125bd8deadSopenharmony_ci MAX_FRAGMENT_INTERPOLATION_OFFSET, the position used to interpolate the 3135bd8deadSopenharmony_ci variable is undefined. Not all values of <offset> may be supported; x and 3145bd8deadSopenharmony_ci y offsets may be rounded to fixed-point values with the number of fraction 3155bd8deadSopenharmony_ci bits given by the implementation-dependent constant 3165bd8deadSopenharmony_ci FRAGMENT_INTERPOLATION_OFFSET_BITS. 3175bd8deadSopenharmony_ci 3185bd8deadSopenharmony_ci 3195bd8deadSopenharmony_ci Modify Section 3.12.2, Shader Execution, p. 274 3205bd8deadSopenharmony_ci 3215bd8deadSopenharmony_ci (insert prior to the next-to-last paragraph in "Shader Inputs", p. 277) 3225bd8deadSopenharmony_ci 3235bd8deadSopenharmony_ci The built-in variable gl_SampleMaskIn[] is an integer array holding 3245bd8deadSopenharmony_ci bitfields indicating the set of fragment samples covered by the primitive 3255bd8deadSopenharmony_ci corresponding to the fragment shader invocation. The number of elements 3265bd8deadSopenharmony_ci in the array is ceil(<s>/32), where <s> is the maximum number of color 3275bd8deadSopenharmony_ci samples supported by the implementation. Bit <n> of element <w> in the 3285bd8deadSopenharmony_ci array is set if and only if the sample numbered <w>*32+<n> is considered 3295bd8deadSopenharmony_ci covered for this fragment shader invocation. When rendering to a 3305bd8deadSopenharmony_ci non-multisample buffer, or if multisample rasterization is disabled, all 3315bd8deadSopenharmony_ci bits are zero except for bit zero of the first array element. That bit 3325bd8deadSopenharmony_ci will be one if the pixel is covered and zero otherwise. Bits in the 3335bd8deadSopenharmony_ci sample mask corresponding to covered samples that will be killed due to 3345bd8deadSopenharmony_ci SAMPLE_COVERAGE or SAMPLE_MASK_NV will not be set (section 4.1.3). When 3355bd8deadSopenharmony_ci per-sample shading is active due to the use of a fragment input qualified 3365bd8deadSopenharmony_ci by "sample", only the bit for the current sample is set in 3375bd8deadSopenharmony_ci gl_SampleMaskIn. When OpenGL API state specifies multiple fragment shader 3385bd8deadSopenharmony_ci invocations for a given fragment, the sample mask for any single fragment 3395bd8deadSopenharmony_ci shader invocation may specify a subset of the covered samples for the 3405bd8deadSopenharmony_ci fragment. In this case, the bit corresponding to each covered sample will 3415bd8deadSopenharmony_ci be set in exactly one fragment shader invocation. 3425bd8deadSopenharmony_ci 3435bd8deadSopenharmony_ci 3445bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 3.2 (Compatibility Profile) Specification 3455bd8deadSopenharmony_ci(Per-Fragment Operations and the Frame Buffer) 3465bd8deadSopenharmony_ci 3475bd8deadSopenharmony_ci None. 3485bd8deadSopenharmony_ci 3495bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 3.2 (Compatibility Profile) Specification 3505bd8deadSopenharmony_ci(Special Functions) 3515bd8deadSopenharmony_ci 3525bd8deadSopenharmony_ci None. 3535bd8deadSopenharmony_ci 3545bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 3.2 (Compatibility Profile) Specification 3555bd8deadSopenharmony_ci(State and State Requests) 3565bd8deadSopenharmony_ci 3575bd8deadSopenharmony_ci Modify Section 6.1.16, Shader and Program Queries, p. 384 3585bd8deadSopenharmony_ci 3595bd8deadSopenharmony_ci (add to long first paragraph, p. 386) ... If <pname> is 3605bd8deadSopenharmony_ci GEOMETRY_SHADER_INVOCATIONS, the number of geometry shader invocations per 3615bd8deadSopenharmony_ci primitive will be returned. If GEOMETRY_VERTICES_OUT, 3625bd8deadSopenharmony_ci GEOMETRY_INPUT_TYPE, GEOMETRY_OUTPUT_TYPE, or GEOMETRY_SHADER_INVOCATIONS 3635bd8deadSopenharmony_ci are queried for a program which has not been linked successfully, or which 3645bd8deadSopenharmony_ci does not contain objects to form a geometry shader, then an 3655bd8deadSopenharmony_ci INVALID_OPERATION error is generated. 3665bd8deadSopenharmony_ci 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 3.2 (Compatibility Profile) 3695bd8deadSopenharmony_ciSpecification (Invariance) 3705bd8deadSopenharmony_ci 3715bd8deadSopenharmony_ci None. 3725bd8deadSopenharmony_ci 3735bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 3745bd8deadSopenharmony_ci 3755bd8deadSopenharmony_ci None. 3765bd8deadSopenharmony_ci 3775bd8deadSopenharmony_ciModifications to The OpenGL Shading Language Specification, Version 1.50 3785bd8deadSopenharmony_ci(Revision 09) 3795bd8deadSopenharmony_ci 3805bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 3815bd8deadSopenharmony_ci language features described in this extension: 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci #extension GL_ARB_gpu_shader5 : <behavior> 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ci where <behavior> is as specified in section 3.3. 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ci New preprocessor #defines are added to the OpenGL Shading Language: 3885bd8deadSopenharmony_ci 3895bd8deadSopenharmony_ci #define GL_ARB_gpu_shader5 1 3905bd8deadSopenharmony_ci 3915bd8deadSopenharmony_ci 3925bd8deadSopenharmony_ci Modify Section 3.6, Keywords, p. 14 3935bd8deadSopenharmony_ci 3945bd8deadSopenharmony_ci (add to the keyword list) 3955bd8deadSopenharmony_ci 3965bd8deadSopenharmony_ci sample 3975bd8deadSopenharmony_ci 3985bd8deadSopenharmony_ci 3995bd8deadSopenharmony_ci Modify Section 4.1.7, Samplers, p. 23 4005bd8deadSopenharmony_ci 4015bd8deadSopenharmony_ci (modify 1st paragraph of the section, deleting the restriction requiring 4025bd8deadSopenharmony_ci constant indexing of sampler arrays but still requiring uniform indexing 4035bd8deadSopenharmony_ci across invocations) ... Samplers may aggregated into arrays within a 4045bd8deadSopenharmony_ci shader (using square brackets [ ]) and can be indexed with general integer 4055bd8deadSopenharmony_ci expressions. The results of accessing a sampler array with an 4065bd8deadSopenharmony_ci out-of-bounds index are undefined. ... 4075bd8deadSopenharmony_ci 4085bd8deadSopenharmony_ci (add new paragraph restricting the use of general integer expression in 4095bd8deadSopenharmony_ci sampler array indexing) When indexing an array of samplers, the integer 4105bd8deadSopenharmony_ci expression used to index the array must be uniform across shader 4115bd8deadSopenharmony_ci invocations. If this restriction is not satisfied, the results of 4125bd8deadSopenharmony_ci accessing the sampler array are undefined. For the purposes of this 4135bd8deadSopenharmony_ci uniformity test, the index used for texture lookups performed inside a 4145bd8deadSopenharmony_ci loop is considered uniform for the <n>th loop iteration if all shader 4155bd8deadSopenharmony_ci invocations that execute the loop at least <n> times compute the same 4165bd8deadSopenharmony_ci index on that iteration. For texture lookups inside a function other than 4175bd8deadSopenharmony_ci main(), an index is considered uniform if the value is the same for all 4185bd8deadSopenharmony_ci invocations calling the function from the same point in the caller. For 4195bd8deadSopenharmony_ci nested loops and function calls, the uniformity test requires that the 4205bd8deadSopenharmony_ci index match only those other shader invocations with identical loop 4215bd8deadSopenharmony_ci iteration counts and function call chains. 4225bd8deadSopenharmony_ci 4235bd8deadSopenharmony_ci 4245bd8deadSopenharmony_ci Modify Section 4.1.10, Implicit Conversions, p. 27 4255bd8deadSopenharmony_ci 4265bd8deadSopenharmony_ci (modify table of implicit conversions) 4275bd8deadSopenharmony_ci 4285bd8deadSopenharmony_ci Can be implicitly 4295bd8deadSopenharmony_ci Type of expression converted to 4305bd8deadSopenharmony_ci --------------------- ----------------- 4315bd8deadSopenharmony_ci int uint, float 4325bd8deadSopenharmony_ci ivec2 uvec2, vec2 4335bd8deadSopenharmony_ci ivec3 uvec3, vec3 4345bd8deadSopenharmony_ci ivec4 uvec4, vec4 4355bd8deadSopenharmony_ci 4365bd8deadSopenharmony_ci uint float 4375bd8deadSopenharmony_ci uvec2 vec2 4385bd8deadSopenharmony_ci uvec3 vec3 4395bd8deadSopenharmony_ci uvec4 vec4 4405bd8deadSopenharmony_ci 4415bd8deadSopenharmony_ci (modify second paragraph of the section) No implicit conversions are 4425bd8deadSopenharmony_ci provided to convert from unsigned to signed integer types or from 4435bd8deadSopenharmony_ci floating-point to integer types. There are no implicit array or structure 4445bd8deadSopenharmony_ci conversions. 4455bd8deadSopenharmony_ci 4465bd8deadSopenharmony_ci (insert before the final paragraph of the section) When performing 4475bd8deadSopenharmony_ci implicit conversion for binary operators, there may be multiple data types 4485bd8deadSopenharmony_ci to which the two operands can be converted. For example, when adding an 4495bd8deadSopenharmony_ci int value to a uint value, both values can be implicitly converted to uint 4505bd8deadSopenharmony_ci and float. In such cases, a floating-point type is chosen if either 4515bd8deadSopenharmony_ci operand has a floating-point type. Otherwise, an unsigned integer type is 4525bd8deadSopenharmony_ci chosen if either operand has an unsigned integer type. Otherwise, a 4535bd8deadSopenharmony_ci signed integer type is chosen. 4545bd8deadSopenharmony_ci 4555bd8deadSopenharmony_ci 4565bd8deadSopenharmony_ci Modify Section 4.3, Storage Qualifiers, p. 29 4575bd8deadSopenharmony_ci 4585bd8deadSopenharmony_ci (add to first table on the page) 4595bd8deadSopenharmony_ci 4605bd8deadSopenharmony_ci Qualifier Meaning 4615bd8deadSopenharmony_ci -------------- ---------------------------------------- 4625bd8deadSopenharmony_ci sample in linkage with per-sample interpolation 4635bd8deadSopenharmony_ci sample out linkage with per-sample interpolation 4645bd8deadSopenharmony_ci 4655bd8deadSopenharmony_ci (modify third paragraph, p. 29) These interpolation qualifiers may only 4665bd8deadSopenharmony_ci precede the qualifiers in, centroid in, sample in, out, centroid out, or 4675bd8deadSopenharmony_ci sample out in a declaration. ... 4685bd8deadSopenharmony_ci 4695bd8deadSopenharmony_ci 4705bd8deadSopenharmony_ci Modify Section 4.3.4, Inputs, p. 31 4715bd8deadSopenharmony_ci 4725bd8deadSopenharmony_ci (modify first paragraph of section) Shader input variables are declared 4735bd8deadSopenharmony_ci with the in, centroid in, or sample in storage qualifiers. ... Variables 4745bd8deadSopenharmony_ci declared as in, centroid in, or sample in may not be written to during 4755bd8deadSopenharmony_ci shader execution. ... 4765bd8deadSopenharmony_ci 4775bd8deadSopenharmony_ci (modify third paragraph, p. 32) ... Fragment shader inputs get 4785bd8deadSopenharmony_ci per-fragment values, typically interpolated from a previous stage's 4795bd8deadSopenharmony_ci outputs. They are declared in fragment shaders with the in, centroid in, 4805bd8deadSopenharmony_ci or sample in storage qualifiers or the deprecated varying and centroid 4815bd8deadSopenharmony_ci varying storage qualifiers. ... 4825bd8deadSopenharmony_ci 4835bd8deadSopenharmony_ci (add to examples immediately below) 4845bd8deadSopenharmony_ci 4855bd8deadSopenharmony_ci sample in vec4 perSampleColor; 4865bd8deadSopenharmony_ci 4875bd8deadSopenharmony_ci 4885bd8deadSopenharmony_ci Modify Section 4.3.6, Outputs, p. 33 4895bd8deadSopenharmony_ci 4905bd8deadSopenharmony_ci (modify first paragraph of section) Shader output variables are declared 4915bd8deadSopenharmony_ci with the out, centroid out, or sample out storage qualifiers. ... 4925bd8deadSopenharmony_ci 4935bd8deadSopenharmony_ci (modify third paragraph of section) Vertex and geometry output variables 4945bd8deadSopenharmony_ci output per-vertex data and are declared using the out, centroid out, or 4955bd8deadSopenharmony_ci sample out storage qualifiers, or the deprecated varying storage 4965bd8deadSopenharmony_ci qualifier. 4975bd8deadSopenharmony_ci 4985bd8deadSopenharmony_ci (add to examples immediately below) 4995bd8deadSopenharmony_ci 5005bd8deadSopenharmony_ci sample out vec4 perSampleColor; 5015bd8deadSopenharmony_ci 5025bd8deadSopenharmony_ci (modify last paragraph, p. 33) Fragment outputs output per-fragment data 5035bd8deadSopenharmony_ci and are declared using the out storage qualifier. It is an error to use 5045bd8deadSopenharmony_ci centroid out or sample out in a fragment shader. ... 5055bd8deadSopenharmony_ci 5065bd8deadSopenharmony_ci 5075bd8deadSopenharmony_ci Modify Section 4.3.7, Interface Blocks, p. 34 5085bd8deadSopenharmony_ci 5095bd8deadSopenharmony_ci (modify last paragaph, p. 36, removing the requirement for indexing 5105bd8deadSopenharmony_ci uniform blocks using constant expressions) For uniform blocks declared as 5115bd8deadSopenharmony_ci arrays, each individual array element corresponds to a separate buffer 5125bd8deadSopenharmony_ci object backing one instance of the block. As the array size indicates the 5135bd8deadSopenharmony_ci number of buffer objects needed, uniform block array declarations must 5145bd8deadSopenharmony_ci specify an integral array size. Arbitrary indices may be used to index a 5155bd8deadSopenharmony_ci uniform block array; integral constant expressions are not required. If 5165bd8deadSopenharmony_ci the index used to access an array of uniform blocks is out-of-bounds, the 5175bd8deadSopenharmony_ci results of the access are undefined. 5185bd8deadSopenharmony_ci 5195bd8deadSopenharmony_ci 5205bd8deadSopenharmony_ci Modify Section 4.3.8.1, Input Layout Qualifiers, p. 37 5215bd8deadSopenharmony_ci 5225bd8deadSopenharmony_ci (modify last paragraph, p. 37, and subsequent paragraphs on p. 38) 5235bd8deadSopenharmony_ci 5245bd8deadSopenharmony_ci Geometry shaders support input layout qualifiers. There are two types of 5255bd8deadSopenharmony_ci layout qualifiers used to specify an input primitive type and an 5265bd8deadSopenharmony_ci invocation count. The input primitive type and invocation count 5275bd8deadSopenharmony_ci qualifiers are allowed only on the interface qualifier in, not on an input 5285bd8deadSopenharmony_ci block, block member, or variable. 5295bd8deadSopenharmony_ci 5305bd8deadSopenharmony_ci layout-qualifier-id 5315bd8deadSopenharmony_ci points 5325bd8deadSopenharmony_ci lines 5335bd8deadSopenharmony_ci lines_adjacency 5345bd8deadSopenharmony_ci triangles 5355bd8deadSopenharmony_ci triangles_adjacency 5365bd8deadSopenharmony_ci invocations = integer-constant 5375bd8deadSopenharmony_ci 5385bd8deadSopenharmony_ci The identifiers "points", "lines", "lines_adjacency", "triangles", and 5395bd8deadSopenharmony_ci "triangles_adjacency" are used to specify the type of input primitive 5405bd8deadSopenharmony_ci accepted by the geometry shader, and only one of these is accepted. At 5415bd8deadSopenharmony_ci least one geometry shader (compilation unit) in a program must declare an 5425bd8deadSopenharmony_ci input primitive type, and all geometry shader input primitive type 5435bd8deadSopenharmony_ci declarations in a program must declare the same type. It is not required 5445bd8deadSopenharmony_ci that all geometry shaders in a program declare an input primitive type. 5455bd8deadSopenharmony_ci 5465bd8deadSopenharmony_ci The identifier "invocations" is used to specify the number of times the 5475bd8deadSopenharmony_ci geometry shader is invoked for each input primitive received. Invocation 5485bd8deadSopenharmony_ci count declarations are optional. If no invocation count is declared in 5495bd8deadSopenharmony_ci any geometry shader in the program, the geometry shader will be run once 5505bd8deadSopenharmony_ci for each input primitive. If an invocation count is declared, all such 5515bd8deadSopenharmony_ci declarations must specify the same count. If a shader specifies an 5525bd8deadSopenharmony_ci invocation count greater than the implementation-dependent maximum, it 5535bd8deadSopenharmony_ci will fail to compile. 5545bd8deadSopenharmony_ci 5555bd8deadSopenharmony_ci For example, 5565bd8deadSopenharmony_ci 5575bd8deadSopenharmony_ci layout(triangles, invocations=6) in; 5585bd8deadSopenharmony_ci 5595bd8deadSopenharmony_ci will establish that all inputs to the geometry shader are triangles and 5605bd8deadSopenharmony_ci that the geometry shader is run six times for each triangle processed. 5615bd8deadSopenharmony_ci 5625bd8deadSopenharmony_ci All geometry shader input unsized array declarations ... 5635bd8deadSopenharmony_ci 5645bd8deadSopenharmony_ci 5655bd8deadSopenharmony_ci Modify Section 4.3.8.2, Output Layout Qualifiers, p. 40 5665bd8deadSopenharmony_ci 5675bd8deadSopenharmony_ci (modify second and subsequent paragraphs, p. 40) 5685bd8deadSopenharmony_ci 5695bd8deadSopenharmony_ci Geometry shaders can have output layout qualifiers. There are three types 5705bd8deadSopenharmony_ci of output layout qualifiers used to specify an output primitive type, a 5715bd8deadSopenharmony_ci maximum output vertex count, and per-output stream numbers. The output 5725bd8deadSopenharmony_ci primitive type and output vertex count qualifiers are allowed only on the 5735bd8deadSopenharmony_ci interface qualifier out, not on an output block, block member, or variable 5745bd8deadSopenharmony_ci declaration. The output stream number qualifier is allowed on the 5755bd8deadSopenharmony_ci interface qualifier out, or on output blocks or variable declarations. 5765bd8deadSopenharmony_ci 5775bd8deadSopenharmony_ci The layout qualifier identifiers for geometry shader outputs are 5785bd8deadSopenharmony_ci 5795bd8deadSopenharmony_ci layout-qualifier-id 5805bd8deadSopenharmony_ci points 5815bd8deadSopenharmony_ci line_strip 5825bd8deadSopenharmony_ci triangle_strip 5835bd8deadSopenharmony_ci max_vertices = integer-constant 5845bd8deadSopenharmony_ci stream = integer-constant 5855bd8deadSopenharmony_ci 5865bd8deadSopenharmony_ci The identifiers "points", "line_strip", and "triangle_strip" are used to 5875bd8deadSopenharmony_ci specify the type of output primitive produced by the geometry shader, and 5885bd8deadSopenharmony_ci only one of these is accepted. At least one geometry shader (compilation 5895bd8deadSopenharmony_ci unit) in a program must declare an output primitive type, and all geometry 5905bd8deadSopenharmony_ci shader output primitive type declarations in a program must declare the 5915bd8deadSopenharmony_ci same primitive type. It is not required that all geometry shaders in a 5925bd8deadSopenharmony_ci program declare an output primitive type. 5935bd8deadSopenharmony_ci 5945bd8deadSopenharmony_ci The identifier "max_vertices" is used to specify the maximum number of 5955bd8deadSopenharmony_ci vertices the shader will ever emit in a single invocation. At least one 5965bd8deadSopenharmony_ci geometry shader (compilation unit) in a program must declare an maximum 5975bd8deadSopenharmony_ci output vertex count, and all geometry shader output vertex count 5985bd8deadSopenharmony_ci declarations in a program must declare the same count. It is not required 5995bd8deadSopenharmony_ci that all geometry shaders in a program declare a count. 6005bd8deadSopenharmony_ci 6015bd8deadSopenharmony_ci In the example, 6025bd8deadSopenharmony_ci 6035bd8deadSopenharmony_ci layout(triangle_strip, max_vertices = 60) out; // order does not matter 6045bd8deadSopenharmony_ci layout(max_vertices = 60) out; // redeclaration okay 6055bd8deadSopenharmony_ci layout(triangle_strip) out; // redeclaration okay 6065bd8deadSopenharmony_ci layout(points) out; // error, contradicts triangle_strip 6075bd8deadSopenharmony_ci layout(max_vertices = 30) out; // error, contradicts 60 6085bd8deadSopenharmony_ci 6095bd8deadSopenharmony_ci all outputs from the geometry shader are triangles and at most 60 vertices 6105bd8deadSopenharmony_ci will be emitted by the shader. It is an error for the maximum number of 6115bd8deadSopenharmony_ci vertices to be greater than gl_MaxGeometryOutputVertices. 6125bd8deadSopenharmony_ci 6135bd8deadSopenharmony_ci The identifier "stream" is used to specify that a geometry shader output 6145bd8deadSopenharmony_ci variable or block is associated with a particular vertex stream (numbered 6155bd8deadSopenharmony_ci beginning with zero). A default stream number may be declared at global 6165bd8deadSopenharmony_ci scope by qualifying interface qualifier out as in this example: 6175bd8deadSopenharmony_ci 6185bd8deadSopenharmony_ci layout(stream = 1) out; 6195bd8deadSopenharmony_ci 6205bd8deadSopenharmony_ci The stream number specified in such a declaration replaces any previous 6215bd8deadSopenharmony_ci default and applies to all subsequent block and variable declarations 6225bd8deadSopenharmony_ci until a new default is established. The initial default stream number is 6235bd8deadSopenharmony_ci zero. 6245bd8deadSopenharmony_ci 6255bd8deadSopenharmony_ci Each output block or non-block output variable is associated with a vertex 6265bd8deadSopenharmony_ci stream. If the block or variable is declared with a stream qualifier, it 6275bd8deadSopenharmony_ci is associated with the specified stream; otherwise, it is associated with 6285bd8deadSopenharmony_ci the current default stream. A block member may be declared with a stream 6295bd8deadSopenharmony_ci qualifier, but the specified stream must match the stream associated with 6305bd8deadSopenharmony_ci the containing block. One example: 6315bd8deadSopenharmony_ci 6325bd8deadSopenharmony_ci layout(stream=1) out; // default is now stream 1 6335bd8deadSopenharmony_ci out vec4 var1; // var1 gets default stream (1) 6345bd8deadSopenharmony_ci layout(stream=2) out Block1 { // "Block1" belongs to stream 2 6355bd8deadSopenharmony_ci layout(stream=2) vec4 var2; // redundant block member stream decl 6365bd8deadSopenharmony_ci layout(stream=3) vec2 var3; // ILLEGAL (must match block stream) 6375bd8deadSopenharmony_ci vec3 var4; // belongs to stream 2 6385bd8deadSopenharmony_ci }; 6395bd8deadSopenharmony_ci layout(stream=0) out; // default is now stream 0 6405bd8deadSopenharmony_ci out vec4 var5; // var5 gets default stream (0) 6415bd8deadSopenharmony_ci out Block2 { // "Block2" gets default stream (0) 6425bd8deadSopenharmony_ci vec4 var6; 6435bd8deadSopenharmony_ci }; 6445bd8deadSopenharmony_ci layout(stream=3) out vec4 var7; // var7 belongs to stream 3 6455bd8deadSopenharmony_ci 6465bd8deadSopenharmony_ci If a geometry shader output block or variable is declared more than once, 6475bd8deadSopenharmony_ci all such declarations must associate the variable with the same vertex 6485bd8deadSopenharmony_ci stream. If any stream declaration specifies a non-existent stream number, 6495bd8deadSopenharmony_ci the shader will fail to compile. 6505bd8deadSopenharmony_ci 6515bd8deadSopenharmony_ci Built-in geometry shader outputs are always associated with vertex stream 6525bd8deadSopenharmony_ci zero. 6535bd8deadSopenharmony_ci 6545bd8deadSopenharmony_ci Each vertex emitted by the geometry shader is assigned to a specific 6555bd8deadSopenharmony_ci stream, and the attributes of the emitted vertex are taken from the set of 6565bd8deadSopenharmony_ci output blocks and variables assigned to the targeted stream. After each 6575bd8deadSopenharmony_ci vertex is emitted, the values of all output variables become undefined. 6585bd8deadSopenharmony_ci Additionally, the output variables associated with each vertex stream may 6595bd8deadSopenharmony_ci share storage. Writing to an output variable associated with one stream 6605bd8deadSopenharmony_ci may overwrite output variables associated with any other stream. When 6615bd8deadSopenharmony_ci emitting each vertex, a geometry shader should write to all outputs 6625bd8deadSopenharmony_ci associated with the stream to which the vertex will be emitted and to no 6635bd8deadSopenharmony_ci outputs associated with any other stream. 6645bd8deadSopenharmony_ci 6655bd8deadSopenharmony_ci 6665bd8deadSopenharmony_ci Modify Section 4.3.9, Interpolation, p. 42 6675bd8deadSopenharmony_ci 6685bd8deadSopenharmony_ci (modify first paragraph of section, add reference to sample in/out) The 6695bd8deadSopenharmony_ci presence of and type of interpolation is controlled by the storage 6705bd8deadSopenharmony_ci qualifiers centroid in, sample in, centroid out, and sample out, by the 6715bd8deadSopenharmony_ci optional interpolation qualifiers smooth, flat, and noperspective, and by 6725bd8deadSopenharmony_ci default behaviors established through the OpenGL API when no interpolation 6735bd8deadSopenharmony_ci qualifier is present. ... 6745bd8deadSopenharmony_ci 6755bd8deadSopenharmony_ci (modify second paragraph) ... A variable may be qualified as flat centroid 6765bd8deadSopenharmony_ci or flat sample, which will mean the same thing as qualifying it only as 6775bd8deadSopenharmony_ci flat. 6785bd8deadSopenharmony_ci 6795bd8deadSopenharmony_ci (replace last paragraph, p. 42) 6805bd8deadSopenharmony_ci 6815bd8deadSopenharmony_ci When multisample rasterization is disabled, or for fragment shader input 6825bd8deadSopenharmony_ci variables qualified with neither "centroid in" nor "sample in", the value 6835bd8deadSopenharmony_ci of the assigned variable may be interpolated anywhere within the pixel and 6845bd8deadSopenharmony_ci a single value may be assigned to each sample within the pixel, to the 6855bd8deadSopenharmony_ci extent permitted by the OpenGL Specification. 6865bd8deadSopenharmony_ci 6875bd8deadSopenharmony_ci When multisample rasterization is enabled, "centroid" and "sample" may be 6885bd8deadSopenharmony_ci used to control the location and frequency of the sampling of the 6895bd8deadSopenharmony_ci qualified fragment shader input. If a fragment shader input is qualified 6905bd8deadSopenharmony_ci with "centroid", a single value may be assigned to that variable for all 6915bd8deadSopenharmony_ci samples in the pixel, but that value must be interpolated at a location 6925bd8deadSopenharmony_ci that lies in both the pixel and in the primitive being rendered, including 6935bd8deadSopenharmony_ci any of the pixel's samples covered by the primitive. Because the location 6945bd8deadSopenharmony_ci at which the variable is sampled may be different in neighboring pixels, 6955bd8deadSopenharmony_ci derivatives of centroid-sampled inputs may be less accurate than those for 6965bd8deadSopenharmony_ci non-centroid interpolated variables. If a fragment shader input is 6975bd8deadSopenharmony_ci qualified with "sample", a separate value must be assigned to that 6985bd8deadSopenharmony_ci variable for each covered sample in the pixel, and that value must be 6995bd8deadSopenharmony_ci sampled at the location of the individual sample. 7005bd8deadSopenharmony_ci 7015bd8deadSopenharmony_ci 7025bd8deadSopenharmony_ci (Insert before Section 4.7, Order of Qualification, p. 47) 7035bd8deadSopenharmony_ci 7045bd8deadSopenharmony_ci Section 4.Q, The Precise Qualifier 7055bd8deadSopenharmony_ci 7065bd8deadSopenharmony_ci Some algorithms may require that floating-point computations be carried 7075bd8deadSopenharmony_ci out in exactly the manner specified in the source code, even if the 7085bd8deadSopenharmony_ci implementation supports optimizations that could produce nearly equivalent 7095bd8deadSopenharmony_ci results with higher performance. For example, many GL implementations 7105bd8deadSopenharmony_ci support a "multiply-add" that can compute values such as 7115bd8deadSopenharmony_ci 7125bd8deadSopenharmony_ci float result = (float(a) * float(b)) + float(c); 7135bd8deadSopenharmony_ci 7145bd8deadSopenharmony_ci in a single operation. The result of a floating-point multiply-add may 7155bd8deadSopenharmony_ci not always be identical to first doing a multiply yielding a 7165bd8deadSopenharmony_ci floating-point result, and then doing a floating-point add. By default, 7175bd8deadSopenharmony_ci implementations are permitted to perform optimizations that effectively 7185bd8deadSopenharmony_ci modify the order of the operations used to evaluate an expression, even if 7195bd8deadSopenharmony_ci those optimizations may produce slightly different results relative to 7205bd8deadSopenharmony_ci unoptimized code. 7215bd8deadSopenharmony_ci 7225bd8deadSopenharmony_ci The qualifier "precise" will ensure that operations contributing to a 7235bd8deadSopenharmony_ci variable's value are performed in the order and with the precision 7245bd8deadSopenharmony_ci specified in the source code. Order of evaluation is determined by 7255bd8deadSopenharmony_ci operator precedence and parentheses, as described in Section 5. 7265bd8deadSopenharmony_ci Expressions must be evaluated with a precision consistent with the 7275bd8deadSopenharmony_ci operation; for example, multiplying two "float" values must produce a 7285bd8deadSopenharmony_ci single value with "float" precision. This effectively prohibits the 7295bd8deadSopenharmony_ci arbitrary use of fused multiply-add operations if the intermediate 7305bd8deadSopenharmony_ci multiply result is kept at a higher precision. For example: 7315bd8deadSopenharmony_ci 7325bd8deadSopenharmony_ci precise out vec4 position; 7335bd8deadSopenharmony_ci 7345bd8deadSopenharmony_ci declares that computations used to produce the value of "position" must be 7355bd8deadSopenharmony_ci performed precisely using the order and precision specified. As with the 7365bd8deadSopenharmony_ci invariant qualifier (section 4.6.1), the precise qualifier may be used to 7375bd8deadSopenharmony_ci qualify a built-in or previously declared user-defined variable as being 7385bd8deadSopenharmony_ci precise: 7395bd8deadSopenharmony_ci 7405bd8deadSopenharmony_ci out vec3 Color; 7415bd8deadSopenharmony_ci precise Color; // make existing Color be precise 7425bd8deadSopenharmony_ci 7435bd8deadSopenharmony_ci This qualifier will affect the evaluation of expressions used on the 7445bd8deadSopenharmony_ci right-hand side of an assignment if and only if: 7455bd8deadSopenharmony_ci 7465bd8deadSopenharmony_ci * the variable assigned to is qualified as "precise"; or 7475bd8deadSopenharmony_ci 7485bd8deadSopenharmony_ci * the value assigned is used later in the same function, either directly 7495bd8deadSopenharmony_ci or indirectly, on the right-hand of an assignment to a variable 7505bd8deadSopenharmony_ci declared as "precise". 7515bd8deadSopenharmony_ci 7525bd8deadSopenharmony_ci Expressions computed in a function are treated as precise only if assigned 7535bd8deadSopenharmony_ci to a variable qualified as "precise" in that same function. Any other 7545bd8deadSopenharmony_ci expressions within a function are not automatically treated as precise, 7555bd8deadSopenharmony_ci even if they are used to determine a value that is returned by the 7565bd8deadSopenharmony_ci function and directly assigned to a variable qualified as "precise". 7575bd8deadSopenharmony_ci 7585bd8deadSopenharmony_ci Some examples of the use of "precise" include: 7595bd8deadSopenharmony_ci 7605bd8deadSopenharmony_ci in vec4 a, b, c, d; 7615bd8deadSopenharmony_ci precise out vec4 v; 7625bd8deadSopenharmony_ci 7635bd8deadSopenharmony_ci float func(float e, float f, float g, float h) 7645bd8deadSopenharmony_ci { 7655bd8deadSopenharmony_ci return (e*f) + (g*h); // no special precision 7665bd8deadSopenharmony_ci } 7675bd8deadSopenharmony_ci 7685bd8deadSopenharmony_ci float func2(float e, float f, float g, float h) 7695bd8deadSopenharmony_ci { 7705bd8deadSopenharmony_ci precise result = (e*f) + (g*h); // ensures a precise return value 7715bd8deadSopenharmony_ci return result; 7725bd8deadSopenharmony_ci } 7735bd8deadSopenharmony_ci 7745bd8deadSopenharmony_ci float func3(float i, float j, precise out float k) 7755bd8deadSopenharmony_ci { 7765bd8deadSopenharmony_ci k = i * i + j; // precise, due to <k> declaration 7775bd8deadSopenharmony_ci } 7785bd8deadSopenharmony_ci 7795bd8deadSopenharmony_ci void main(void) 7805bd8deadSopenharmony_ci { 7815bd8deadSopenharmony_ci vec4 r = vec3(a * b); // precise, used to compute v.xyz 7825bd8deadSopenharmony_ci vec4 s = vec3(c * d); // precise, used to compute v.xyz 7835bd8deadSopenharmony_ci v.xyz = r + s; // precise 7845bd8deadSopenharmony_ci v.w = (a.w * b.w) + (c.w * d.w); // precise 7855bd8deadSopenharmony_ci v.x = func(a.x, b.x, c.x, d.x); // values computed in func() 7865bd8deadSopenharmony_ci // are NOT precise 7875bd8deadSopenharmony_ci v.x = func2(a.x, b.x, c.x, d.x); // precise! 7885bd8deadSopenharmony_ci func3(a.x * b.x, c.x * d.x, v.x); // precise! 7895bd8deadSopenharmony_ci } 7905bd8deadSopenharmony_ci 7915bd8deadSopenharmony_ci 7925bd8deadSopenharmony_ci Modify Section 4.7, Order of Qualification, p. 47 7935bd8deadSopenharmony_ci 7945bd8deadSopenharmony_ci When multiple qualifications are present, they must follow a strict order. 7955bd8deadSopenharmony_ci This order is as follows: 7965bd8deadSopenharmony_ci 7975bd8deadSopenharmony_ci precise-qualifier invariant-qualifier interpolation-qualifier storage-qualifier 7985bd8deadSopenharmony_ci precision-qualifier 7995bd8deadSopenharmony_ci 8005bd8deadSopenharmony_ci 8015bd8deadSopenharmony_ci Modify Section 5.9, Expressions, p. 57 8025bd8deadSopenharmony_ci 8035bd8deadSopenharmony_ci (modify bulleted list as follows, adding support for implicit conversion 8045bd8deadSopenharmony_ci between signed and unsigned types) 8055bd8deadSopenharmony_ci 8065bd8deadSopenharmony_ci Expressions in the shading language are built from the following: 8075bd8deadSopenharmony_ci 8085bd8deadSopenharmony_ci * Constants of type bool, int, int64_t, uint, uint64_t, float, all vector 8095bd8deadSopenharmony_ci types, and all matrix types. 8105bd8deadSopenharmony_ci 8115bd8deadSopenharmony_ci ... 8125bd8deadSopenharmony_ci 8135bd8deadSopenharmony_ci * The operator modulus (%) operates on signed or unsigned integer scalars 8145bd8deadSopenharmony_ci or vectors. If the fundamental types of the operands do not match, the 8155bd8deadSopenharmony_ci conversions from Section 4.1.10 "Implicit Conversions" are applied to 8165bd8deadSopenharmony_ci produce matching types. ... 8175bd8deadSopenharmony_ci 8185bd8deadSopenharmony_ci 8195bd8deadSopenharmony_ci Modify Section 6.1, Function Definitions, p. 63 8205bd8deadSopenharmony_ci 8215bd8deadSopenharmony_ci (modify description of overloading, beginning at the top of p. 64) 8225bd8deadSopenharmony_ci 8235bd8deadSopenharmony_ci Function names can be overloaded. The same function name can be used for 8245bd8deadSopenharmony_ci multiple functions, as long as the parameter types differ. If a function 8255bd8deadSopenharmony_ci name is declared twice with the same parameter types, then the return 8265bd8deadSopenharmony_ci types and all qualifiers must also match, and it is the same function 8275bd8deadSopenharmony_ci being declared. For example, 8285bd8deadSopenharmony_ci 8295bd8deadSopenharmony_ci vec4 f(in vec4 x, out vec4 y); // (A) 8305bd8deadSopenharmony_ci vec4 f(in vec4 x, out uvec4 y); // (B) okay, different argument type 8315bd8deadSopenharmony_ci vec4 f(in ivec4 x, out uvec4 y); // (C) okay, different argument type 8325bd8deadSopenharmony_ci 8335bd8deadSopenharmony_ci int f(in vec4 x, out ivec4 y); // error, only return type differs 8345bd8deadSopenharmony_ci vec4 f(in vec4 x, in vec4 y); // error, only qualifier differs 8355bd8deadSopenharmony_ci vec4 f(const in vec4 x, out vec4 y); // error, only qualifier differs 8365bd8deadSopenharmony_ci 8375bd8deadSopenharmony_ci When function calls are resolved, an exact type match for all the 8385bd8deadSopenharmony_ci arguments is sought. If an exact match is found, all other functions are 8395bd8deadSopenharmony_ci ignored, and the exact match is used. If no exact match is found, then 8405bd8deadSopenharmony_ci the implicit conversions in Section 4.1.10 (Implicit Conversions) will be 8415bd8deadSopenharmony_ci applied to find a match. Mismatched types on input parameters (in or 8425bd8deadSopenharmony_ci inout or default) must have a conversion from the calling argument type 8435bd8deadSopenharmony_ci to the formal parameter type. Mismatched types on output parameters (out 8445bd8deadSopenharmony_ci or inout) must have a conversion from the formal parameter type to the 8455bd8deadSopenharmony_ci calling argument type. 8465bd8deadSopenharmony_ci 8475bd8deadSopenharmony_ci If implicit conversions can be used to find more than one matching 8485bd8deadSopenharmony_ci function, a single best-matching function is sought. To determine a best 8495bd8deadSopenharmony_ci match, the conversions between calling argument and formal parameter 8505bd8deadSopenharmony_ci types are compared for each function argument and pair of matching 8515bd8deadSopenharmony_ci functions. After these comparisons are performed, each pair of matching 8525bd8deadSopenharmony_ci functions are compared. A function definition A is considered a better 8535bd8deadSopenharmony_ci match than function definition B if: 8545bd8deadSopenharmony_ci 8555bd8deadSopenharmony_ci * for at least one function argument, the conversion for that argument 8565bd8deadSopenharmony_ci in A is better than the corresponding conversion in B; and 8575bd8deadSopenharmony_ci 8585bd8deadSopenharmony_ci * there is no function argument for which the conversion in B is better 8595bd8deadSopenharmony_ci than the corresponding conversion in A. 8605bd8deadSopenharmony_ci 8615bd8deadSopenharmony_ci If a single function definition is considered a better match than every 8625bd8deadSopenharmony_ci other matching function definition, it will be used. Otherwise, a 8635bd8deadSopenharmony_ci semantic error occurs and the shader will fail to compile. 8645bd8deadSopenharmony_ci 8655bd8deadSopenharmony_ci To determine whether the conversion for a single argument in one match is 8665bd8deadSopenharmony_ci better than that for another match, the following rules are applied, in 8675bd8deadSopenharmony_ci order: 8685bd8deadSopenharmony_ci 8695bd8deadSopenharmony_ci 1. An exact match is better than a match involving any implicit 8705bd8deadSopenharmony_ci conversion. 8715bd8deadSopenharmony_ci 8725bd8deadSopenharmony_ci 2. A match involving an implicit conversion from float to double is 8735bd8deadSopenharmony_ci better than a match involving any other implicit conversion. 8745bd8deadSopenharmony_ci 8755bd8deadSopenharmony_ci 3. A match involving an implicit conversion from either int or uint to 8765bd8deadSopenharmony_ci float is better than a match involving an implicit conversion from 8775bd8deadSopenharmony_ci either int or uint to double. 8785bd8deadSopenharmony_ci 8795bd8deadSopenharmony_ci If none of the rules above apply to a particular pair of conversions, 8805bd8deadSopenharmony_ci neither conversion is considered better than the other. 8815bd8deadSopenharmony_ci 8825bd8deadSopenharmony_ci For the function prototypes (A), (B), and (C) above, the following 8835bd8deadSopenharmony_ci examples show how the rules apply to different sets of calling argument 8845bd8deadSopenharmony_ci types: 8855bd8deadSopenharmony_ci 8865bd8deadSopenharmony_ci f(vec4, vec4); // exact match of vec4 f(in vec4 x, out vec4 y) 8875bd8deadSopenharmony_ci f(vec4, uvec4); // exact match of vec4 f(in vec4 x, out ivec4 y) 8885bd8deadSopenharmony_ci f(vec4, ivec4); // matched to vec4 f(in vec4 x, out vec4 y) 8895bd8deadSopenharmony_ci // (C) not relevant, can't convert vec4 to 8905bd8deadSopenharmony_ci // ivec4. (A) better than (B) for 2nd 8915bd8deadSopenharmony_ci // argument (rule 2), same on first argument. 8925bd8deadSopenharmony_ci f(ivec4, vec4); // NOT matched. All three match by implicit 8935bd8deadSopenharmony_ci // conversion. (C) is better than (A) and (B) 8945bd8deadSopenharmony_ci // on the first argument. (A) is better than 8955bd8deadSopenharmony_ci // (B) and (C). 8965bd8deadSopenharmony_ci 8975bd8deadSopenharmony_ci 8985bd8deadSopenharmony_ci Modify Section 7.1, Vertex And Geometry Shader Special Variables, p. 69 8995bd8deadSopenharmony_ci 9005bd8deadSopenharmony_ci (add to the list of geometry shader special variables, p. 69) 9015bd8deadSopenharmony_ci 9025bd8deadSopenharmony_ci in int gl_InvocationID; 9035bd8deadSopenharmony_ci 9045bd8deadSopenharmony_ci (add to the end of the section, p. 71) 9055bd8deadSopenharmony_ci 9065bd8deadSopenharmony_ci The input variable gl_InvocationID is available in the geometry language 9075bd8deadSopenharmony_ci and is filled with an integer holding the invocation number associated 9085bd8deadSopenharmony_ci with the given shader invocation. If the program is linked to support 9095bd8deadSopenharmony_ci multiple geometry shader invocations per input primitive, the invocations 9105bd8deadSopenharmony_ci are numbered 0, 1, 2, ..., <N>-1. gl_InvocationID is not available in the 9115bd8deadSopenharmony_ci vertex or fragment language. 9125bd8deadSopenharmony_ci 9135bd8deadSopenharmony_ci 9145bd8deadSopenharmony_ci Modify Section 7.2, Fragment Shader Special Variables, p. 72 9155bd8deadSopenharmony_ci 9165bd8deadSopenharmony_ci (add to the list of built-in variables) 9175bd8deadSopenharmony_ci 9185bd8deadSopenharmony_ci in int gl_SampleMaskIn[]; 9195bd8deadSopenharmony_ci 9205bd8deadSopenharmony_ci The variable gl_SampleMaskIn is an array of integers, each holding a 9215bd8deadSopenharmony_ci bitfield indicating the set of samples covered by the primitive generating 9225bd8deadSopenharmony_ci the fragment during multisample rasterization. The array has ceil(<s>/32) 9235bd8deadSopenharmony_ci elements, where <s> is the maximum number of color samples supported by 9245bd8deadSopenharmony_ci the implementation. Bit <n> or word <w> in the bitfield is set if and 9255bd8deadSopenharmony_ci only if the sample numbered <w>*32+<n> is considered covered for this 9265bd8deadSopenharmony_ci fragment shader invocation. 9275bd8deadSopenharmony_ci 9285bd8deadSopenharmony_ci 9295bd8deadSopenharmony_ci Modify Section 8.3, Common Functions, p. 84 9305bd8deadSopenharmony_ci 9315bd8deadSopenharmony_ci (add support for floating-point multiply-add) 9325bd8deadSopenharmony_ci 9335bd8deadSopenharmony_ci Syntax: 9345bd8deadSopenharmony_ci 9355bd8deadSopenharmony_ci genType fma(genType a, genType b, genType c); 9365bd8deadSopenharmony_ci 9375bd8deadSopenharmony_ci The function fma() performs a fused floating-point multiply-add to compute 9385bd8deadSopenharmony_ci the value a*b+c. The results of fma() may not be identical to evaluating 9395bd8deadSopenharmony_ci the expression (a*b)+c, because the computation may be performed in a 9405bd8deadSopenharmony_ci single operation with intermediate precision different from that used to 9415bd8deadSopenharmony_ci compute a non-fma() expression. 9425bd8deadSopenharmony_ci 9435bd8deadSopenharmony_ci The results of fma() are guaranteed to be invariant given fixed inputs 9445bd8deadSopenharmony_ci <a>, <b>, and <c>, as though the result were taken from a variable 9455bd8deadSopenharmony_ci declared as "precise". 9465bd8deadSopenharmony_ci 9475bd8deadSopenharmony_ci 9485bd8deadSopenharmony_ci (add support for single-precision frexp and ldexp functions) 9495bd8deadSopenharmony_ci 9505bd8deadSopenharmony_ci Syntax: 9515bd8deadSopenharmony_ci 9525bd8deadSopenharmony_ci genType frexp(genType x, out genIType exp); 9535bd8deadSopenharmony_ci genType ldexp(genType x, in genIType exp); 9545bd8deadSopenharmony_ci 9555bd8deadSopenharmony_ci The function frexp() splits each single-precision floating-point number in 9565bd8deadSopenharmony_ci <x> into a binary significand, a floating-point number in the range [0.5, 9575bd8deadSopenharmony_ci 1.0), and an integral exponent of two, such that: 9585bd8deadSopenharmony_ci 9595bd8deadSopenharmony_ci x = significand * 2 ^ exponent 9605bd8deadSopenharmony_ci 9615bd8deadSopenharmony_ci The significand is returned by the function; the exponent is returned in 9625bd8deadSopenharmony_ci the parameter <exp>. For a floating-point value of zero, the significant 9635bd8deadSopenharmony_ci and exponent are both zero. For a floating-point value that is an 9645bd8deadSopenharmony_ci infinity or is not a number, the results of frexp() are undefined. 9655bd8deadSopenharmony_ci 9665bd8deadSopenharmony_ci If the input <x> is a vector, this operation is performed in a 9675bd8deadSopenharmony_ci component-wise manner; the value returned by the function and the value 9685bd8deadSopenharmony_ci written to <exp> are vectors with the same number of components as <x>. 9695bd8deadSopenharmony_ci 9705bd8deadSopenharmony_ci The function ldexp() builds a single-precision floating-point number from 9715bd8deadSopenharmony_ci each significand component in <x> and the corresponding integral exponent 9725bd8deadSopenharmony_ci of two in <exp>, returning: 9735bd8deadSopenharmony_ci 9745bd8deadSopenharmony_ci significand * 2 ^ exponent 9755bd8deadSopenharmony_ci 9765bd8deadSopenharmony_ci If this product is too large to be represented as a single-precision 9775bd8deadSopenharmony_ci floating-point value, the result is considered undefined. 9785bd8deadSopenharmony_ci 9795bd8deadSopenharmony_ci If the input <x> is a vector, this operation is performed in a 9805bd8deadSopenharmony_ci component-wise manner; the value passed in <exp> and returned by the 9815bd8deadSopenharmony_ci function are vectors with the same number of components as <x>. 9825bd8deadSopenharmony_ci 9835bd8deadSopenharmony_ci 9845bd8deadSopenharmony_ci (add support for new integer built-in functions) 9855bd8deadSopenharmony_ci 9865bd8deadSopenharmony_ci Syntax: 9875bd8deadSopenharmony_ci 9885bd8deadSopenharmony_ci genIType bitfieldExtract(genIType value, int offset, int bits); 9895bd8deadSopenharmony_ci genUType bitfieldExtract(genUType value, int offset, int bits); 9905bd8deadSopenharmony_ci 9915bd8deadSopenharmony_ci genIType bitfieldInsert(genIType base, genIType insert, int offset, 9925bd8deadSopenharmony_ci int bits); 9935bd8deadSopenharmony_ci genUType bitfieldInsert(genUType base, genUType insert, int offset, 9945bd8deadSopenharmony_ci int bits); 9955bd8deadSopenharmony_ci 9965bd8deadSopenharmony_ci genIType bitfieldReverse(genIType value); 9975bd8deadSopenharmony_ci genUType bitfieldReverse(genUType value); 9985bd8deadSopenharmony_ci 9995bd8deadSopenharmony_ci genIType bitCount(genIType value); 10005bd8deadSopenharmony_ci genIType bitCount(genUType value); 10015bd8deadSopenharmony_ci 10025bd8deadSopenharmony_ci genIType findLSB(genIType value); 10035bd8deadSopenharmony_ci genIType findLSB(genUType value); 10045bd8deadSopenharmony_ci 10055bd8deadSopenharmony_ci genIType findMSB(genIType value); 10065bd8deadSopenharmony_ci genIType findMSB(genUType value); 10075bd8deadSopenharmony_ci 10085bd8deadSopenharmony_ci The function bitfieldExtract() extracts bits <offset> through 10095bd8deadSopenharmony_ci <offset>+<bits>-1 from each component in <value>, returning them in the 10105bd8deadSopenharmony_ci least significant bits of corresponding component of the result. For 10115bd8deadSopenharmony_ci unsigned data types, the most significant bits of the result will be set 10125bd8deadSopenharmony_ci to zero. For signed data types, the most significant bits will be set to 10135bd8deadSopenharmony_ci the value of bit <offset>+<base>-1. If <bits> is zero, the result will be 10145bd8deadSopenharmony_ci zero. The result will be undefined if <offset> or <bits> is negative, or 10155bd8deadSopenharmony_ci if the sum of <offset> and <bits> is greater than the number of bits used 10165bd8deadSopenharmony_ci to store the operand. Note that for vector versions of bitfieldExtract(), 10175bd8deadSopenharmony_ci a single pair of <offset> and <bits> values is shared for all components. 10185bd8deadSopenharmony_ci 10195bd8deadSopenharmony_ci The function bitfieldInsert() inserts the <bits> least significant bits of 10205bd8deadSopenharmony_ci each component of <insert> into the corresponding component of <base>. 10215bd8deadSopenharmony_ci The result will have bits numbered <offset> through <offset>+<bits>-1 10225bd8deadSopenharmony_ci taken from bits 0 through <bits>-1 of <insert>, and all other bits taken 10235bd8deadSopenharmony_ci directly from the corresponding bits of <base>. If <bits> is zero, the 10245bd8deadSopenharmony_ci result will simply be <base>. The result will be undefined if <offset> or 10255bd8deadSopenharmony_ci <bits> is negative, or if the sum of <offset> and <bits> is greater than 10265bd8deadSopenharmony_ci the number of bits used to store the operand. Note that for vector 10275bd8deadSopenharmony_ci versions of bitfieldInsert(), a single pair of <offset> and <bits> values 10285bd8deadSopenharmony_ci is shared for all components. 10295bd8deadSopenharmony_ci 10305bd8deadSopenharmony_ci The function bitfieldReverse() reverses the bits of <value>. The bit 10315bd8deadSopenharmony_ci numbered <n> of the result will be taken from bit (<bits>-1)-<n> of 10325bd8deadSopenharmony_ci <value>, where <bits> is the total number of bits used to represent 10335bd8deadSopenharmony_ci <value>. 10345bd8deadSopenharmony_ci 10355bd8deadSopenharmony_ci The function bitCount() returns the number of one bits in the binary 10365bd8deadSopenharmony_ci representation of <value>. 10375bd8deadSopenharmony_ci 10385bd8deadSopenharmony_ci The function findLSB() returns the bit number of the least significant one 10395bd8deadSopenharmony_ci bit in the binary representation of <value>. If <value> is zero, -1 will 10405bd8deadSopenharmony_ci be returned. 10415bd8deadSopenharmony_ci 10425bd8deadSopenharmony_ci The function findMSB() returns the bit number of the most significant bit 10435bd8deadSopenharmony_ci in the binary representation of <value>. For positive integers, the 10445bd8deadSopenharmony_ci result will be the bit number of the most significant one bit. For 10455bd8deadSopenharmony_ci negative integers, the result will be the bit number of the most 10465bd8deadSopenharmony_ci significant zero bit. For a <value> of zero or negative one, -1 will be 10475bd8deadSopenharmony_ci returned. 10485bd8deadSopenharmony_ci 10495bd8deadSopenharmony_ci 10505bd8deadSopenharmony_ci (add support for general packing functions) 10515bd8deadSopenharmony_ci 10525bd8deadSopenharmony_ci Syntax: 10535bd8deadSopenharmony_ci 10545bd8deadSopenharmony_ci uint packUnorm2x16(vec2 v); 10555bd8deadSopenharmony_ci uint packUnorm4x8(vec4 v); 10565bd8deadSopenharmony_ci uint packSnorm4x8(vec4 v); 10575bd8deadSopenharmony_ci 10585bd8deadSopenharmony_ci vec2 unpackUnorm2x16(uint v); 10595bd8deadSopenharmony_ci vec4 unpackUnorm4x8(uint v); 10605bd8deadSopenharmony_ci vec4 unpackSnorm4x8(uint v); 10615bd8deadSopenharmony_ci 10625bd8deadSopenharmony_ci The functions packUnorm2x16(), packUnorm4x8(), and packSnorm4x8() first 10635bd8deadSopenharmony_ci convert each component of a two- or four-component vector of normalized 10645bd8deadSopenharmony_ci floating-point values into 8- or 16-bit integer values. Then, the results 10655bd8deadSopenharmony_ci are packed into a 32-bit unsigned integer. The first component of the 10665bd8deadSopenharmony_ci vector will be written to the least significant bits of the output; the 10675bd8deadSopenharmony_ci last component will be written to the most significant bits. 10685bd8deadSopenharmony_ci 10695bd8deadSopenharmony_ci The functions unpackUnorm2x16(), unpackUnorm4x8(), and unpackSnorm4x8() 10705bd8deadSopenharmony_ci first unpacks a single 32-bit unsigned integer into a pair of 16-bit 10715bd8deadSopenharmony_ci unsigned integers, four 8-bit unsigned integers, or four 8-bit signed 10725bd8deadSopenharmony_ci integers. The, each component is converted to a normalized floating-point 10735bd8deadSopenharmony_ci value to generate a two- or four-component vector. The first component of 10745bd8deadSopenharmony_ci the vector will be extracted from the least significant bits of the input; 10755bd8deadSopenharmony_ci the last component will be extracted from the most significant bits. 10765bd8deadSopenharmony_ci 10775bd8deadSopenharmony_ci The conversion between fixed- and normalized floating-point values will be 10785bd8deadSopenharmony_ci performed as below. 10795bd8deadSopenharmony_ci 10805bd8deadSopenharmony_ci function conversion 10815bd8deadSopenharmony_ci --------------- ----------------------------------------------------- 10825bd8deadSopenharmony_ci packUnorm2x16 fixed_val = round(clamp(float_val, 0, +1) * 65535.0); 10835bd8deadSopenharmony_ci packUnorm4x8 fixed_val = round(clamp(float_val, 0, +1) * 255.0); 10845bd8deadSopenharmony_ci packSnorm4x8 fixed_val = round(clamp(float_val, -1, +1) * 127.0); 10855bd8deadSopenharmony_ci unpackUnorm2x16 float_val = fixed_val / 65535.0; 10865bd8deadSopenharmony_ci unpackUnorm4x8 float_val = fixed_val / 255.0; 10875bd8deadSopenharmony_ci unpackSnorm4x8 float_val = clamp(fixed_val / 127.0, -1, +1); 10885bd8deadSopenharmony_ci 10895bd8deadSopenharmony_ci 10905bd8deadSopenharmony_ci (add functions to get/set the bit encoding for floating-point values) 10915bd8deadSopenharmony_ci 10925bd8deadSopenharmony_ci 32-bit floating-point data types in the OpenGL shading language are 10935bd8deadSopenharmony_ci specified to be encoded according to the IEEE 754 specification for 10945bd8deadSopenharmony_ci single-precision floating-point values. The functions below allow shaders 10955bd8deadSopenharmony_ci to convert floating-point values to and from signed or unsigned integers 10965bd8deadSopenharmony_ci representing their encoding. 10975bd8deadSopenharmony_ci 10985bd8deadSopenharmony_ci To obtain signed or unsigned integer values holding the encoding of a 10995bd8deadSopenharmony_ci floating-point value, use: 11005bd8deadSopenharmony_ci 11015bd8deadSopenharmony_ci genIType floatBitsToInt(genType value); 11025bd8deadSopenharmony_ci genUType floatBitsToUint(genType value); 11035bd8deadSopenharmony_ci 11045bd8deadSopenharmony_ci Conversions are done on a component-by-component basis. 11055bd8deadSopenharmony_ci 11065bd8deadSopenharmony_ci To obtain a floating-point value corresponding to a signed or unsigned 11075bd8deadSopenharmony_ci integer encoding, use: 11085bd8deadSopenharmony_ci 11095bd8deadSopenharmony_ci genType intBitsToFloat(genIType value); 11105bd8deadSopenharmony_ci genType uintBitsToFloat(genUType value); 11115bd8deadSopenharmony_ci 11125bd8deadSopenharmony_ci 11135bd8deadSopenharmony_ci (support for unsigned integer add/subtract with carry-out) 11145bd8deadSopenharmony_ci 11155bd8deadSopenharmony_ci Syntax: 11165bd8deadSopenharmony_ci 11175bd8deadSopenharmony_ci genUType uaddCarry(genUType x, genUType y, out genUType carry); 11185bd8deadSopenharmony_ci genUType usubBorrow(genUType x, genUType y, out genUType borrow); 11195bd8deadSopenharmony_ci 11205bd8deadSopenharmony_ci The function uaddCarry() adds 32-bit unsigned integers or vectors <x> and 11215bd8deadSopenharmony_ci <y>, returning the sum modulo 2^32. The value <carry> is set to zero if 11225bd8deadSopenharmony_ci the sum was less than 2^32, or one otherwise. 11235bd8deadSopenharmony_ci 11245bd8deadSopenharmony_ci The function usubBorrow() subtracts the 32-bit unsigned integer or vector 11255bd8deadSopenharmony_ci <y> from <x>, returning the difference if non-negative or 2^32 plus the 11265bd8deadSopenharmony_ci difference, otherwise. The value <borrow> is set to zero if x >= y, or 11275bd8deadSopenharmony_ci one otherwise. 11285bd8deadSopenharmony_ci 11295bd8deadSopenharmony_ci 11305bd8deadSopenharmony_ci (support for signed and unsigned multiplies, with 32-bit inputs and a 11315bd8deadSopenharmony_ci 64-bit result spanning two 32-bit outputs) 11325bd8deadSopenharmony_ci 11335bd8deadSopenharmony_ci Syntax: 11345bd8deadSopenharmony_ci 11355bd8deadSopenharmony_ci void umulExtended(genUType x, genUType y, out genUType msb, 11365bd8deadSopenharmony_ci out genUType lsb); 11375bd8deadSopenharmony_ci void imulExtended(genIType x, genIType y, out genIType msb, 11385bd8deadSopenharmony_ci out genIType lsb); 11395bd8deadSopenharmony_ci 11405bd8deadSopenharmony_ci The functions umulExtended() and imulExtended() multiply 32-bit unsigned 11415bd8deadSopenharmony_ci or signed integers or vectors <x> and <y>, producing a 64-bit result. The 11425bd8deadSopenharmony_ci 32 least significant bits are returned in <lsb>; the 32 most significant 11435bd8deadSopenharmony_ci bits are returned in <msb>. 11445bd8deadSopenharmony_ci 11455bd8deadSopenharmony_ci 11465bd8deadSopenharmony_ci Modify Section 8.7, Texture Lookup Functions, p. 91 11475bd8deadSopenharmony_ci 11485bd8deadSopenharmony_ci (extend the basic versions of textureGather from ARB_texture_gather, 11495bd8deadSopenharmony_ci allowing for optional component selection in a multi-component texture 11505bd8deadSopenharmony_ci and for shadow mapping) 11515bd8deadSopenharmony_ci 11525bd8deadSopenharmony_ci Syntax: 11535bd8deadSopenharmony_ci gvec4 textureGather(gsampler2D sampler, vec2 coord[, int comp]); 11545bd8deadSopenharmony_ci gvec4 textureGather(gsampler2DArray sampler, vec3 coord[, int comp]); 11555bd8deadSopenharmony_ci gvec4 textureGather(gsamplerCube sampler, vec3 coord[, int comp]); 11565bd8deadSopenharmony_ci gvec4 textureGather(gsamplerCubeArray sampler, vec4 coord[, int comp]); 11575bd8deadSopenharmony_ci gvec4 textureGather(gsampler2DRect sampler, vec2 coord[, int comp]); 11585bd8deadSopenharmony_ci 11595bd8deadSopenharmony_ci vec4 textureGather(sampler2DShadow sampler, vec2 coord, float refZ); 11605bd8deadSopenharmony_ci vec4 textureGather(sampler2DArrayShadow sampler, vec3 coord, float refZ); 11615bd8deadSopenharmony_ci vec4 textureGather(samplerCubeShadow sampler, vec3 coord, float refZ); 11625bd8deadSopenharmony_ci vec4 textureGather(samplerCubeArrayShadow sampler, vec4 coord, 11635bd8deadSopenharmony_ci float refZ); 11645bd8deadSopenharmony_ci vec4 textureGather(sampler2DRectShadow sampler, vec2 coord, float refZ); 11655bd8deadSopenharmony_ci 11665bd8deadSopenharmony_ci The textureGather() functions use the texture coordinates given by <coord> 11675bd8deadSopenharmony_ci to determine a set of four texels to sample from the texture identified by 11685bd8deadSopenharmony_ci <sampler>. These functions return a four-component vector consisting of 11695bd8deadSopenharmony_ci one component from each texel. If specified, the value of <comp> must be 11705bd8deadSopenharmony_ci a constant integer expression with a value of zero, one, two, or three, 11715bd8deadSopenharmony_ci identifying the <x>, <y>, <z>, or <w> component of the four-component 11725bd8deadSopenharmony_ci vector lookup result for each texel, respectively. If <comp> is not 11735bd8deadSopenharmony_ci specified, the <x> component of each texel will be used to generate the 11745bd8deadSopenharmony_ci result vector. As described in the OpenGL Specification, the vector 11755bd8deadSopenharmony_ci selects the post-swizzle component corresponding to <comp> from each of 11765bd8deadSopenharmony_ci the four texels, returning: 11775bd8deadSopenharmony_ci 11785bd8deadSopenharmony_ci vec4(T_i0_j1(coord, base).<comp>, 11795bd8deadSopenharmony_ci T_i1_j1(coord, base).<comp>, 11805bd8deadSopenharmony_ci T_i1_j0(coord, base).<comp>, 11815bd8deadSopenharmony_ci T_i0_j0(coord, base).<comp>) 11825bd8deadSopenharmony_ci 11835bd8deadSopenharmony_ci For textureGather() functions using a shadow sampler type, each of the 11845bd8deadSopenharmony_ci four texel lookups performs a depth comparison against the depth reference 11855bd8deadSopenharmony_ci value passed in <refZ>, and returns the result of that comparison in the 11865bd8deadSopenharmony_ci appropriate component of the result vector. The parameter <comp> used for 11875bd8deadSopenharmony_ci component selection is not supported for textureGather() functions with 11885bd8deadSopenharmony_ci shader sampler types. 11895bd8deadSopenharmony_ci 11905bd8deadSopenharmony_ci As with other texture lookup functions, the results of textureGather() are 11915bd8deadSopenharmony_ci undefined for shadow samplers if the texture referenced is not a depth 11925bd8deadSopenharmony_ci texture or has depth comparisons disabled; or for non-shadow samplers if 11935bd8deadSopenharmony_ci the texture referenced is a depth texture with depth comparisons enabled. 11945bd8deadSopenharmony_ci 11955bd8deadSopenharmony_ci 11965bd8deadSopenharmony_ci (extend the "Offset" versions of textureGather from ARB_texture_gather, 11975bd8deadSopenharmony_ci allowing for optional component selection in a multi-component texture, 11985bd8deadSopenharmony_ci non-constant offsets, and shadow mapping) 11995bd8deadSopenharmony_ci 12005bd8deadSopenharmony_ci Syntax: 12015bd8deadSopenharmony_ci gvec4 textureGatherOffset(gsampler2D sampler, vec2 coord, 12025bd8deadSopenharmony_ci ivec2 offset[, int comp]); 12035bd8deadSopenharmony_ci gvec4 textureGatherOffset(gsampler2DArray sampler, vec3 coord, 12045bd8deadSopenharmony_ci ivec2 offset[, int comp]); 12055bd8deadSopenharmony_ci gvec4 textureGatherOffset(gsampler2DRect sampler, vec2 coord, 12065bd8deadSopenharmony_ci ivec2 offset[, int comp]); 12075bd8deadSopenharmony_ci 12085bd8deadSopenharmony_ci vec4 textureGatherOffset(sampler2DShadow sampler, vec2 coord, 12095bd8deadSopenharmony_ci float refZ, ivec2 offset); 12105bd8deadSopenharmony_ci vec4 textureGatherOffset(sampler2DArrayShadow sampler, vec3 coord, 12115bd8deadSopenharmony_ci float refZ, ivec2 offset); 12125bd8deadSopenharmony_ci vec4 textureGatherOffset(sampler2DRectShadow sampler, vec2 coord, 12135bd8deadSopenharmony_ci float refZ, ivec2 offset); 12145bd8deadSopenharmony_ci 12155bd8deadSopenharmony_ci The textureGatherOffset() functions operate identically to 12165bd8deadSopenharmony_ci textureGather(), except that the 2-component integer texel offset vector 12175bd8deadSopenharmony_ci <offset> is applied as a (u,v) offset to determine the four texels to 12185bd8deadSopenharmony_ci sample. The value <offset> need not be constant; however, a limited range 12195bd8deadSopenharmony_ci of offset values are supported. If any component of <offset> is less than 12205bd8deadSopenharmony_ci MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB or greater than 12215bd8deadSopenharmony_ci MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB, the offset applied to the texture 12225bd8deadSopenharmony_ci coordinates is undefined. Note that <offset> does not apply to the layer 12235bd8deadSopenharmony_ci coordinate for array textures. 12245bd8deadSopenharmony_ci 12255bd8deadSopenharmony_ci 12265bd8deadSopenharmony_ci (add new "Offsets" versions of textureGather from ARB_texture_gather, 12275bd8deadSopenharmony_ci allowing for optional component selection in a multi-component texture, 12285bd8deadSopenharmony_ci separate non-constant offsets for each texel in the footprint, and shadow 12295bd8deadSopenharmony_ci mapping) 12305bd8deadSopenharmony_ci 12315bd8deadSopenharmony_ci Syntax: 12325bd8deadSopenharmony_ci gvec4 textureGatherOffsets(gsampler2D sampler, vec2 coord, 12335bd8deadSopenharmony_ci ivec2 offsets[4][, int comp]); 12345bd8deadSopenharmony_ci gvec4 textureGatherOffsets(gsampler2DArray sampler, vec3 coord, 12355bd8deadSopenharmony_ci ivec2 offsets[4][, int comp]); 12365bd8deadSopenharmony_ci gvec4 textureGatherOffsets(gsampler2DRect sampler, vec2 coord, 12375bd8deadSopenharmony_ci ivec2 offsets[4][, int comp]); 12385bd8deadSopenharmony_ci 12395bd8deadSopenharmony_ci vec4 textureGatherOffsets(sampler2DShadow sampler, vec2 coord, 12405bd8deadSopenharmony_ci float refZ, ivec2 offsets[4]); 12415bd8deadSopenharmony_ci vec4 textureGatherOffsets(sampler2DArrayShadow sampler, vec3 coord, 12425bd8deadSopenharmony_ci float refZ, ivec2 offsets[4]); 12435bd8deadSopenharmony_ci vec4 textureGatherOffsets(sampler2DRectShadow sampler, vec2 coord, 12445bd8deadSopenharmony_ci float refZ, ivec2 offsets[4]); 12455bd8deadSopenharmony_ci 12465bd8deadSopenharmony_ci The textureGatherOffsets() functions operate identically to 12475bd8deadSopenharmony_ci textureGather(), except that the array of two-component integer vectors 12485bd8deadSopenharmony_ci <offsets> is used to determine the location of the four texels to sample. 12495bd8deadSopenharmony_ci Each of the four texels is obtained by applying the corresponding offset 12505bd8deadSopenharmony_ci in the four-element array <offsets> as a (u,v) coordinate offset to the 12515bd8deadSopenharmony_ci coordinates <coord>, identifying the four-texel LINEAR footprint, and then 12525bd8deadSopenharmony_ci selecting the texel T_i0_j0 of that footprint. The specified values in 12535bd8deadSopenharmony_ci <offsets> must be constant. A limited range of offset values are 12545bd8deadSopenharmony_ci supported; the minimum and maximum offset values are 12555bd8deadSopenharmony_ci implementation-dependent and given by 12565bd8deadSopenharmony_ci MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB and 12575bd8deadSopenharmony_ci MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB, respectively. Note that <offset> 12585bd8deadSopenharmony_ci does not apply to the layer coordinate for array textures. 12595bd8deadSopenharmony_ci 12605bd8deadSopenharmony_ci 12615bd8deadSopenharmony_ci Modify Section 8.8, Fragment Processing Functions, p. 101 12625bd8deadSopenharmony_ci 12635bd8deadSopenharmony_ci (add new functions to the end of section, p. 102) 12645bd8deadSopenharmony_ci 12655bd8deadSopenharmony_ci Built-in interpolation functions are available to compute an interpolated 12665bd8deadSopenharmony_ci value of a fragment shader input variable at a shader-specified (x,y) 12675bd8deadSopenharmony_ci location. A separate (x,y) location may be used for each invocation of 12685bd8deadSopenharmony_ci the built-in function, and those locations may differ from the default 12695bd8deadSopenharmony_ci (x,y) location used to produce the default value of the input. 12705bd8deadSopenharmony_ci 12715bd8deadSopenharmony_ci float interpolateAtCentroid(float interpolant); 12725bd8deadSopenharmony_ci vec2 interpolateAtCentroid(vec2 interpolant); 12735bd8deadSopenharmony_ci vec3 interpolateAtCentroid(vec3 interpolant); 12745bd8deadSopenharmony_ci vec4 interpolateAtCentroid(vec4 interpolant); 12755bd8deadSopenharmony_ci 12765bd8deadSopenharmony_ci float interpolateAtSample(float interpolant, int sample); 12775bd8deadSopenharmony_ci vec2 interpolateAtSample(vec2 interpolant, int sample); 12785bd8deadSopenharmony_ci vec3 interpolateAtSample(vec3 interpolant, int sample); 12795bd8deadSopenharmony_ci vec4 interpolateAtSample(vec4 interpolant, int sample); 12805bd8deadSopenharmony_ci 12815bd8deadSopenharmony_ci float interpolateAtOffset(float interpolant, vec2 offset); 12825bd8deadSopenharmony_ci vec2 interpolateAtOffset(vec2 interpolant, vec2 offset); 12835bd8deadSopenharmony_ci vec3 interpolateAtOffset(vec3 interpolant, vec2 offset); 12845bd8deadSopenharmony_ci vec4 interpolateAtOffset(vec4 interpolant, vec2 offset); 12855bd8deadSopenharmony_ci 12865bd8deadSopenharmony_ci The function interpolateAtCentroid() will return the value of the input 12875bd8deadSopenharmony_ci varying <interpolant> sampled at a location inside the both the pixel and 12885bd8deadSopenharmony_ci the primitive being processed. The value obtained would be the same value 12895bd8deadSopenharmony_ci assigned to the input variable if declared with the "centroid" qualifier. 12905bd8deadSopenharmony_ci 12915bd8deadSopenharmony_ci The function interpolateAtSample() will return the value of the input 12925bd8deadSopenharmony_ci varying <interpolant> at the location of the sample numbered <sample>. If 12935bd8deadSopenharmony_ci multisample buffers are not available, the input varying will be evaluated 12945bd8deadSopenharmony_ci at the center of the pixel. If the sample number given by <sample> does 12955bd8deadSopenharmony_ci not exist, the position used to interpolate the input varying is 12965bd8deadSopenharmony_ci undefined. 12975bd8deadSopenharmony_ci 12985bd8deadSopenharmony_ci The function interpolateAtOffset() will return the value of the input 12995bd8deadSopenharmony_ci varying <interpolant> sampled at an offset from the center of the pixel 13005bd8deadSopenharmony_ci specified by <offset>. The two floating-point components of <offset> 13015bd8deadSopenharmony_ci give the offset in pixels in the x and y directions, respectively. 13025bd8deadSopenharmony_ci An offset of (0,0) identifies the center of the pixel. The range and 13035bd8deadSopenharmony_ci granularity of offsets supported by this function is 13045bd8deadSopenharmony_ci implementation-dependent. 13055bd8deadSopenharmony_ci 13065bd8deadSopenharmony_ci For all of the interpolation functions, <interpolant> must be an input 13075bd8deadSopenharmony_ci variable or an element of an input variable declared as an array. 13085bd8deadSopenharmony_ci Component selection operators (e.g., ".xy") may not be used when 13095bd8deadSopenharmony_ci specifying <interpolant>. If <interpolant> is declared with a "flat" or 13105bd8deadSopenharmony_ci "centroid" qualifier, the qualifier will have no effect on the 13115bd8deadSopenharmony_ci interpolated value. If <interpolant> is declared with the "noperspective" 13125bd8deadSopenharmony_ci qualifier, the interpolated value will be computed without perspective 13135bd8deadSopenharmony_ci correction. 13145bd8deadSopenharmony_ci 13155bd8deadSopenharmony_ci 13165bd8deadSopenharmony_ci Modify Section 8.10, Geometry Shader Functions, p. 104 13175bd8deadSopenharmony_ci 13185bd8deadSopenharmony_ci (replace the section, using the following more general formulation) 13195bd8deadSopenharmony_ci 13205bd8deadSopenharmony_ci These functions are only available in geometry shaders. 13215bd8deadSopenharmony_ci 13225bd8deadSopenharmony_ci Syntax: 13235bd8deadSopenharmony_ci 13245bd8deadSopenharmony_ci void EmitStreamVertex(int stream); // Geometry-only 13255bd8deadSopenharmony_ci void EndStreamPrimitive(int stream); // Geometry-only 13265bd8deadSopenharmony_ci 13275bd8deadSopenharmony_ci void EmitVertex(); // Geometry-only 13285bd8deadSopenharmony_ci void EndPrimitive(); // Geometry-only 13295bd8deadSopenharmony_ci 13305bd8deadSopenharmony_ci Description: 13315bd8deadSopenharmony_ci 13325bd8deadSopenharmony_ci The function EmitStreamVertex() specifies that the vertex being generated 13335bd8deadSopenharmony_ci by the geometry shader is completed. A vertex is added to the current 13345bd8deadSopenharmony_ci output primitive in the vertex stream numbered <stream> using the current 13355bd8deadSopenharmony_ci values of all output variables associated with <stream>. The values of 13365bd8deadSopenharmony_ci any unwritten output variables associated with <stream> are undefined. 13375bd8deadSopenharmony_ci The argument <stream> must be a constant integral expression. The values 13385bd8deadSopenharmony_ci of all output variables (for all output streams) are undefined after 13395bd8deadSopenharmony_ci calling EmitStreamVertex(). If a geometry shader invocation has emitted 13405bd8deadSopenharmony_ci more vertices than permitted by the output layout qualifier 13415bd8deadSopenharmony_ci "max_vertices", the results of calling EmitStreamVertex() are undefined. 13425bd8deadSopenharmony_ci 13435bd8deadSopenharmony_ci The function EmitVertex() is equivalent to calling EmitStreamVertex() with 13445bd8deadSopenharmony_ci <stream> set to zero. 13455bd8deadSopenharmony_ci 13465bd8deadSopenharmony_ci The function EndStreamPrimitive() specifies that the current output 13475bd8deadSopenharmony_ci primitive for the vertex stream numbered <stream> is completed and that a 13485bd8deadSopenharmony_ci new empty output primitive of the same type should be started. The 13495bd8deadSopenharmony_ci argument <stream> must be a constant integral expression. This function 13505bd8deadSopenharmony_ci does not emit a vertex. If the output layout is declared to be "points", 13515bd8deadSopenharmony_ci calling EndPrimitive() is optional. 13525bd8deadSopenharmony_ci 13535bd8deadSopenharmony_ci The function EndPrimitive() is equivalent to calling EndStreamPrimitive() 13545bd8deadSopenharmony_ci with <stream> set to zero. 13555bd8deadSopenharmony_ci 13565bd8deadSopenharmony_ci A geometry shader starts with an output primitive containing no vertices 13575bd8deadSopenharmony_ci for each stream. When a geometry shader terminates, the current output 13585bd8deadSopenharmony_ci primitive for each vertex stream is automatically completed. It is not 13595bd8deadSopenharmony_ci necessary to call EndPrimitive() or EndStreamPrimitive() for any stream 13605bd8deadSopenharmony_ci where the geometry shader writes only a single primitive. 13615bd8deadSopenharmony_ci 13625bd8deadSopenharmony_ci Multiple vertex streams are supported only if the output primitive type is 13635bd8deadSopenharmony_ci declared to be "points". A program will fail to link if it contains a 13645bd8deadSopenharmony_ci geometry shader calling EmitStreamVertex() or EndStreamPrimitive() if its 13655bd8deadSopenharmony_ci output primitive type is not "points". 13665bd8deadSopenharmony_ci 13675bd8deadSopenharmony_ci 13685bd8deadSopenharmony_ci Modify Section 9, Shading Language Grammar, p. 92 13695bd8deadSopenharmony_ci 13705bd8deadSopenharmony_ci !!! TBD !!! 13715bd8deadSopenharmony_ci 13725bd8deadSopenharmony_ci 13735bd8deadSopenharmony_ciGLX Protocol 13745bd8deadSopenharmony_ci 13755bd8deadSopenharmony_ci None. 13765bd8deadSopenharmony_ci 13775bd8deadSopenharmony_ciDependencies on ARB_gpu_shader_fp64 13785bd8deadSopenharmony_ci 13795bd8deadSopenharmony_ci This extension, ARB_gpu_shader_fp64, and NV_gpu_shader5 all modify the set 13805bd8deadSopenharmony_ci of implicit conversions supported in the OpenGL Shading Language. If more 13815bd8deadSopenharmony_ci than one of these extensions is supported, an expression of one type may 13825bd8deadSopenharmony_ci be converted to another type if that conversion is allowed by any of these 13835bd8deadSopenharmony_ci specifications. 13845bd8deadSopenharmony_ci 13855bd8deadSopenharmony_ci If ARB_gpu_shader_fp64 or a similar extension introducing new data types 13865bd8deadSopenharmony_ci is not supported, the function overloading rule in the GLSL specification 13875bd8deadSopenharmony_ci preferring promotion an input parameters to smaller type to a larger type 13885bd8deadSopenharmony_ci is never applicable, as all data types are of the same size. That rule 13895bd8deadSopenharmony_ci and the example referring to "double" should be removed. 13905bd8deadSopenharmony_ci 13915bd8deadSopenharmony_ci 13925bd8deadSopenharmony_ciDependencies on NV_gpu_shader5 13935bd8deadSopenharmony_ci 13945bd8deadSopenharmony_ci This extension, ARB_gpu_shader_fp64, and NV_gpu_shader5 all modify the set 13955bd8deadSopenharmony_ci of implicit conversions supported in the OpenGL Shading Language. If more 13965bd8deadSopenharmony_ci than one of these extensions is supported, an expression of one type may 13975bd8deadSopenharmony_ci be converted to another type if that conversion is allowed by any of these 13985bd8deadSopenharmony_ci specifications. 13995bd8deadSopenharmony_ci 14005bd8deadSopenharmony_ci This specification and NV_gpu_shader5 both lift the restriction in GLSL 14015bd8deadSopenharmony_ci 1.50 requiring that indexing in arrays of samplers must be done with 14025bd8deadSopenharmony_ci constant expressions. However, this extension specifies that results are 14035bd8deadSopenharmony_ci undefined if the indices would diverge if multiple shader invocations are 14045bd8deadSopenharmony_ci run in lockstep. NV_gpu_shader5 does not impose the non-divergent 14055bd8deadSopenharmony_ci indexing requirement. 14065bd8deadSopenharmony_ci 14075bd8deadSopenharmony_ci If NV_gpu_shader5 is supported, integer data types are supported with four 14085bd8deadSopenharmony_ci different precisions (8-, 16, 32-, and 64-bit) and floating-point data 14095bd8deadSopenharmony_ci types are supported with three different precisions (16-, 32-, and 14105bd8deadSopenharmony_ci 64-bit). The extension adds the following rule for output parameters, 14115bd8deadSopenharmony_ci which is similar to the one present in this extension for input 14125bd8deadSopenharmony_ci parameters: 14135bd8deadSopenharmony_ci 14145bd8deadSopenharmony_ci 5. If the formal parameters in both matches are output parameters, a 14155bd8deadSopenharmony_ci conversion from a type with a larger number of bits per component is 14165bd8deadSopenharmony_ci better than a conversion from a type with a smaller number of bits 14175bd8deadSopenharmony_ci per component. For example, a conversion from an "int16_t" formal 14185bd8deadSopenharmony_ci parameter type to "int" is better than one from an "int8_t" formal 14195bd8deadSopenharmony_ci parameter type to "int". 14205bd8deadSopenharmony_ci 14215bd8deadSopenharmony_ci Such a rule is not provided in this extension because there is no 14225bd8deadSopenharmony_ci combination of types in this extension and ARB_gpu_shader_fp64 where this 14235bd8deadSopenharmony_ci rule has any effect. 14245bd8deadSopenharmony_ci 14255bd8deadSopenharmony_ci 14265bd8deadSopenharmony_ciDependencies on ARB_sample_shading 14275bd8deadSopenharmony_ci 14285bd8deadSopenharmony_ci This extension builds upon the per-sample shading support provided by 14295bd8deadSopenharmony_ci ARB_sample_shading to provide several new capabilities, including: 14305bd8deadSopenharmony_ci 14315bd8deadSopenharmony_ci * the built-in variable gl_SampleMaskIn[] indicates the set of samples 14325bd8deadSopenharmony_ci covered by the input primitive corresponding to the fragment shader 14335bd8deadSopenharmony_ci invocation; and 14345bd8deadSopenharmony_ci 14355bd8deadSopenharmony_ci * use of the "sample" qualifier on a fragment shader input forces 14365bd8deadSopenharmony_ci per-sample shading, and specifies that the value of the input be 14375bd8deadSopenharmony_ci evaluated per-sample. 14385bd8deadSopenharmony_ci 14395bd8deadSopenharmony_ci There is no interaction between the extensions, except that shaders using 14405bd8deadSopenharmony_ci the features of this extension seem likely to use features from 14415bd8deadSopenharmony_ci ARB_sample_shading as well. 14425bd8deadSopenharmony_ci 14435bd8deadSopenharmony_ci 14445bd8deadSopenharmony_ciDependencies on ARB_texture_gather 14455bd8deadSopenharmony_ci 14465bd8deadSopenharmony_ci This extension builds upon the textureGather() built-ins provided by 14475bd8deadSopenharmony_ci ARB_texture_gather to provide several new capabilities, including: 14485bd8deadSopenharmony_ci 14495bd8deadSopenharmony_ci * allowing shaders to select any single component of a multi-component 14505bd8deadSopenharmony_ci texture to produce the gathered 2x2 footprint; 14515bd8deadSopenharmony_ci 14525bd8deadSopenharmony_ci * allowing shaders to perform a per-sample depth comparison when 14535bd8deadSopenharmony_ci gathering the 2x2 footprint using for shadow sampler types; 14545bd8deadSopenharmony_ci 14555bd8deadSopenharmony_ci * allowing shaders to use arbitrary offsets computed at run-time to 14565bd8deadSopenharmony_ci select a 2x2 footprint to gather from; and 14575bd8deadSopenharmony_ci 14585bd8deadSopenharmony_ci * allowing shaders to use separate independent offsets for each of the 14595bd8deadSopenharmony_ci four texels returned, instead of requiring a fixed 2x2 footprint. 14605bd8deadSopenharmony_ci 14615bd8deadSopenharmony_ci Other than the fact that they provide similar functionality, there is no 14625bd8deadSopenharmony_ci interaction between the extensions. 14635bd8deadSopenharmony_ci 14645bd8deadSopenharmony_ci Since this extension requires support for gathering from multi-component 14655bd8deadSopenharmony_ci textures, the minimum value of MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 14665bd8deadSopenharmony_ci is increased to 4. 14675bd8deadSopenharmony_ci 14685bd8deadSopenharmony_ci 14695bd8deadSopenharmony_ciErrors 14705bd8deadSopenharmony_ci 14715bd8deadSopenharmony_ci INVALID_OPERATION is generated by GetProgram if <pname> is 14725bd8deadSopenharmony_ci GEOMETRY_SHADER_INVOCATIONS and the program which has not been linked 14735bd8deadSopenharmony_ci successfully, or does not contain objects to form a geometry shader. 14745bd8deadSopenharmony_ci 14755bd8deadSopenharmony_ci 14765bd8deadSopenharmony_ciNew State 14775bd8deadSopenharmony_ci 14785bd8deadSopenharmony_ci Add the following state to Table 6.40, Program Object State, p. 378 14795bd8deadSopenharmony_ci 14805bd8deadSopenharmony_ci Initial 14815bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. Attribute 14825bd8deadSopenharmony_ci ------------------------- ---- ------------ ------- ------------------------- ------ ------- 14835bd8deadSopenharmony_ci GEOMETRY_SHADER_ Z+ GetProgramiv 1 number of times a geometry 6.1.16 - 14845bd8deadSopenharmony_ci INVOCATIONS shader should be executed 14855bd8deadSopenharmony_ci for each input primitive 14865bd8deadSopenharmony_ci 14875bd8deadSopenharmony_ciNew Implementation Dependent State 14885bd8deadSopenharmony_ci 14895bd8deadSopenharmony_ci Min. 14905bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. Attrib 14915bd8deadSopenharmony_ci ---------------------- ---- ----------- ----- -------------------------- -------- ------ 14925bd8deadSopenharmony_ci MAX_GEOMETRY_SHADER_ Z+ GetIntegerv 32 maximum supported geometry 2.16.4 - 14935bd8deadSopenharmony_ci INVOCATIONS shader invocation count 14945bd8deadSopenharmony_ci MIN_FRAGMENT_INTERP- R GetFloatv -0.5 furthest negative offset 3.12.1 - 14955bd8deadSopenharmony_ci OLATION_OFFSET for interpolateAtOffset() 14965bd8deadSopenharmony_ci MAX_FRAGMENT_INTERP- R GetFloatv +0.5 furthest positive offset 3.12.1 - 14975bd8deadSopenharmony_ci OLATION_OFFSET for interpolateAtOffset() 14985bd8deadSopenharmony_ci FRAGMENT_INTERPOLATION_ Z+ GetIntegerv 4 supixel bits for 3.12.1 - 14995bd8deadSopenharmony_ci OFFSET_BITS interpolateAtOffset() 15005bd8deadSopenharmony_ci MAX_VERTEX_STREAMS Z+ GetInteger 4 total number of vertex 2.16.4 - 15015bd8deadSopenharmony_ci streams 15025bd8deadSopenharmony_ci 15035bd8deadSopenharmony_ci (Note: The minimum value for MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB, 15045bd8deadSopenharmony_ci added by ARB_texture_gather, is increased to 4.) 15055bd8deadSopenharmony_ci 15065bd8deadSopenharmony_ciIssues 15075bd8deadSopenharmony_ci 15085bd8deadSopenharmony_ci (1) This extension builds on the capability provided by 15095bd8deadSopenharmony_ci ARB_sample_shading, adding a new built-in variable for the input 15105bd8deadSopenharmony_ci sample mask. It seems likely that a shader using this mask might also 15115bd8deadSopenharmony_ci want to use one or more ARB_sample_shading built-ins. Are such 15125bd8deadSopenharmony_ci shaders required to include #extension lines for both extensions? 15135bd8deadSopenharmony_ci 15145bd8deadSopenharmony_ci UNRESOLVED: It would be nice if it wasn't required. 15155bd8deadSopenharmony_ci 15165bd8deadSopenharmony_ci (2) How do the per-sample shading features of this extension interact with 15175bd8deadSopenharmony_ci non-multisample rendering? 15185bd8deadSopenharmony_ci 15195bd8deadSopenharmony_ci RESOLVED: Non-multisample rendering (due to no multisample buffer or 15205bd8deadSopenharmony_ci MULTISAMPLE disabled) is treated as single-sample rendering. 15215bd8deadSopenharmony_ci 15225bd8deadSopenharmony_ci (3) This extension lifts the restriction requiring that indices into 15235bd8deadSopenharmony_ci samplers be constant expressions, but makes the results undefined if 15245bd8deadSopenharmony_ci the indices used would diverge in lockstep execution. What is this 15255bd8deadSopenharmony_ci good for? 15265bd8deadSopenharmony_ci 15275bd8deadSopenharmony_ci RESOLVED: This allows shaders to index into samplers using integer 15285bd8deadSopenharmony_ci uniforms, or with non-divergent values computed at run-time (e.g., loop 15295bd8deadSopenharmony_ci counters). Many implementations of this extension will be SIMD, running 15305bd8deadSopenharmony_ci multiple shader invocations at once, and some implementations may have 15315bd8deadSopenharmony_ci difficulty with accessing multiple textures in a single SIMD 15325bd8deadSopenharmony_ci instruction. 15335bd8deadSopenharmony_ci 15345bd8deadSopenharmony_ci Note that the NV_gpu_shader5 extension similarly lifts the restriction 15355bd8deadSopenharmony_ci but does not require non-divergent indexing. 15365bd8deadSopenharmony_ci 15375bd8deadSopenharmony_ci (4) What sort of implicit conversions should we support in this and 15385bd8deadSopenharmony_ci related extensions? 15395bd8deadSopenharmony_ci 15405bd8deadSopenharmony_ci RESOLVED: In GLSL 1.50, we have implicit conversion from "int" and 15415bd8deadSopenharmony_ci "uint" to "float", as well as equivalent conversions for vector type. 15425bd8deadSopenharmony_ci One of the primary motivations of this feature is to allow constants 15435bd8deadSopenharmony_ci that are nominally integer values to be used in floating-point contexts 15445bd8deadSopenharmony_ci without requiring special suffixes. The following code compiles 15455bd8deadSopenharmony_ci successfully in GLSL 1.50. 15465bd8deadSopenharmony_ci 15475bd8deadSopenharmony_ci float square(float x) { 15485bd8deadSopenharmony_ci return x * x; 15495bd8deadSopenharmony_ci } 15505bd8deadSopenharmony_ci float f = 0; 15515bd8deadSopenharmony_ci float g = f * 2; 15525bd8deadSopenharmony_ci float h = square(3); 15535bd8deadSopenharmony_ci 15545bd8deadSopenharmony_ci The same code would fail on GLSL 1.1, because "0", "2", and "3" would 15555bd8deadSopenharmony_ci need to be written as "0.0", "2.0", and "3.0", respectively. 15565bd8deadSopenharmony_ci 15575bd8deadSopenharmony_ci This extension adds implicit conversions from "int" to "uint" to allow 15585bd8deadSopenharmony_ci for cases like: 15595bd8deadSopenharmony_ci 15605bd8deadSopenharmony_ci uint square(uint x) { 15615bd8deadSopenharmony_ci return x * x; 15625bd8deadSopenharmony_ci } 15635bd8deadSopenharmony_ci uint v = square(2); 15645bd8deadSopenharmony_ci 15655bd8deadSopenharmony_ci This code is legal with this extension, but not in GLSL 1.50 ("2" would 15665bd8deadSopenharmony_ci need to be replaced with "2U" or "uint(2)"). 15675bd8deadSopenharmony_ci 15685bd8deadSopenharmony_ci ARB_gpu_shader_fp64 adds a new type "double", and we extend existing 15695bd8deadSopenharmony_ci implicit conversions to allow for promotion of "int", "uint", and 15705bd8deadSopenharmony_ci "float" to "double". 15715bd8deadSopenharmony_ci 15725bd8deadSopenharmony_ci Unlike C/C++, the general rule for implicit conversions in GLSL is that 15735bd8deadSopenharmony_ci conversions are unidirectional. If type A can be implicitly converted 15745bd8deadSopenharmony_ci to type B, type B can not be converted to type A. 15755bd8deadSopenharmony_ci 15765bd8deadSopenharmony_ci (5) Increasing the number of available implicit conversions means that 15775bd8deadSopenharmony_ci there is the possibility of ambiguities in various operators? How do 15785bd8deadSopenharmony_ci we deal with these cases? 15795bd8deadSopenharmony_ci 15805bd8deadSopenharmony_ci RESOLVED: For binary operators, the new implicit conversions mean that 15815bd8deadSopenharmony_ci there may be multiple ways to resolve an expression. For example, in 15825bd8deadSopenharmony_ci the following declaration 15835bd8deadSopenharmony_ci 15845bd8deadSopenharmony_ci int i; 15855bd8deadSopenharmony_ci uint u; 15865bd8deadSopenharmony_ci 15875bd8deadSopenharmony_ci the expression "i+u" could be resolved either by implicitly converting 15885bd8deadSopenharmony_ci "i" to "uint", or by implicitly converting both values to either "float" 15895bd8deadSopenharmony_ci or "double". To resolve, we define a set of preferences for a common 15905bd8deadSopenharmony_ci data type based on the types of the operands: 15915bd8deadSopenharmony_ci 15925bd8deadSopenharmony_ci - use a floating-point type if either operand is floating-point 15935bd8deadSopenharmony_ci - use an unsigned integer type if either operand is unsigned 15945bd8deadSopenharmony_ci - use a signed integer type otherwise 15955bd8deadSopenharmony_ci 15965bd8deadSopenharmony_ci If conversions to multiple precisions are supported, the 15975bd8deadSopenharmony_ci lowest-precision available data type is preferred (e.g., int*float will 15985bd8deadSopenharmony_ci be converted to float*float and not double*double). 15995bd8deadSopenharmony_ci 16005bd8deadSopenharmony_ci These rules should extend naturally if new basic data types are added. 16015bd8deadSopenharmony_ci 16025bd8deadSopenharmony_ci (6) Increasing the number of available implicit conversions means that 16035bd8deadSopenharmony_ci there is an increased possibility of ambiguity when function 16045bd8deadSopenharmony_ci overloading is involved? Additionally, this and related extensions 16055bd8deadSopenharmony_ci add new function overloads? How do we deal with these cases? 16065bd8deadSopenharmony_ci 16075bd8deadSopenharmony_ci RESOLVED: The general rule for function overloading in GLSL 1.50 is 16085bd8deadSopenharmony_ci that we first check for a function prototype that exactly matches the 16095bd8deadSopenharmony_ci parameters passed to a function call. If no match exists, we check for 16105bd8deadSopenharmony_ci prototypes that can be matched by implicit conversions. If more than 16115bd8deadSopenharmony_ci one matching prototype can be matched by conversion, the function call 16125bd8deadSopenharmony_ci is considered ambiguous and results in a complication error. 16135bd8deadSopenharmony_ci 16145bd8deadSopenharmony_ci Unfortunately, when adding new implicit conversions, it is possible for 16155bd8deadSopenharmony_ci cases that were formally unambiguous to become ambiguous. For backward 16165bd8deadSopenharmony_ci compatibility purposes, it would be desirable to ensure that shaders 16175bd8deadSopenharmony_ci that succeeded in old language versions should still compile if 16185bd8deadSopenharmony_ci "upgraded" to more recent versions/extensions. However, the new 16195bd8deadSopenharmony_ci conversions and overloads might make this more difficult without 16205bd8deadSopenharmony_ci modifying other language rules. For example, the following prototypes 16215bd8deadSopenharmony_ci are available for the standard built-in function min() on scalar values 16225bd8deadSopenharmony_ci when this extension and ARB_gpu_shader_fp64 are supported: 16235bd8deadSopenharmony_ci 16245bd8deadSopenharmony_ci int min(int a, int b); 16255bd8deadSopenharmony_ci uint min(uint a, uint b); 16265bd8deadSopenharmony_ci float min(float a, float b); 16275bd8deadSopenharmony_ci double min(double a, double b); 16285bd8deadSopenharmony_ci 16295bd8deadSopenharmony_ci In GLSL 1.50, a function call such as: 16305bd8deadSopenharmony_ci 16315bd8deadSopenharmony_ci float f; 16325bd8deadSopenharmony_ci min(f, 1); 16335bd8deadSopenharmony_ci 16345bd8deadSopenharmony_ci would be considered unambiguous because the double-precision version of 16355bd8deadSopenharmony_ci min() didn't exist and the call matched only the single-precision 16365bd8deadSopenharmony_ci version. However, with double-precision, implicit conversions can be 16375bd8deadSopenharmony_ci used to resolve to either the single- or double-precision versions. 16385bd8deadSopenharmony_ci 16395bd8deadSopenharmony_ci To resolve this issue, we provide a set of rules that can be used to 16405bd8deadSopenharmony_ci resolve multiple candidates to a "best match". The rules for 16415bd8deadSopenharmony_ci determining a best match are similar to those for C++ function 16425bd8deadSopenharmony_ci overloading, but not exactly the same. Like C++, these rules compare 16435bd8deadSopenharmony_ci the conversions required on an argument-by-argument basis. A function 16445bd8deadSopenharmony_ci prototype A is better than function prototype B if: 16455bd8deadSopenharmony_ci 16465bd8deadSopenharmony_ci - A is better than B for one or more arguments 16475bd8deadSopenharmony_ci - B is better than A for no arguments 16485bd8deadSopenharmony_ci 16495bd8deadSopenharmony_ci If a single function prototype is better than all others, that one is 16505bd8deadSopenharmony_ci used. Otherwise, we get the same ambiguity error as on previous GLSL 16515bd8deadSopenharmony_ci versions. 16525bd8deadSopenharmony_ci 16535bd8deadSopenharmony_ci As far as argument-by-argument comparisons go, the order of preference 16545bd8deadSopenharmony_ci is: 16555bd8deadSopenharmony_ci 16565bd8deadSopenharmony_ci - favor exact matches 16575bd8deadSopenharmony_ci - prefer "promotions" (float->double) to other conversions 16585bd8deadSopenharmony_ci - prefer conversions from int/uint to float over similar conversion to 16595bd8deadSopenharmony_ci double 16605bd8deadSopenharmony_ci 16615bd8deadSopenharmony_ci If none of the rules apply, one match is considered neither better nor 16625bd8deadSopenharmony_ci worse than the other. 16635bd8deadSopenharmony_ci 16645bd8deadSopenharmony_ci With these rules, the "min(f,1)" example above resolves to the "float" 16655bd8deadSopenharmony_ci version, as is the case in GLSL 1.50. However, there are other cases 16665bd8deadSopenharmony_ci where ambiguity remains. For example, consider the prototypes: 16675bd8deadSopenharmony_ci 16685bd8deadSopenharmony_ci int f(uint x); 16695bd8deadSopenharmony_ci int f(float x); 16705bd8deadSopenharmony_ci 16715bd8deadSopenharmony_ci With GLSL 1.50 rules, "f(3)" would match the floating-point version, as 16725bd8deadSopenharmony_ci no implicit conversions existed from "int" to "uint". With the new 16735bd8deadSopenharmony_ci implicit conversions, both prototypes match and neither is preferred. 16745bd8deadSopenharmony_ci Because of the ambiguity, "f(3)" would fail to compile with this 16755bd8deadSopenharmony_ci extension enabled, but should still compile on implementations 16765bd8deadSopenharmony_ci supporting this extension if the extension is not enabled in GLSL source 16775bd8deadSopenharmony_ci code. 16785bd8deadSopenharmony_ci 16795bd8deadSopenharmony_ci (7) The function overloading rules described in this extension describe 16805bd8deadSopenharmony_ci conversions between data types with different sizes, however all 16815bd8deadSopenharmony_ci existing data types allowing implicit conversion (int, uint, float) 16825bd8deadSopenharmony_ci are the same size? Why do we specify these rules? 16835bd8deadSopenharmony_ci 16845bd8deadSopenharmony_ci RESOLVED: This extension is specified at the same time as the related 16855bd8deadSopenharmony_ci ARB_gpu_shader_fp64 and NV_gpu_shader5 extensions, which do provide such 16865bd8deadSopenharmony_ci types. The rules are specified all in one place here so we don't have 16875bd8deadSopenharmony_ci to replicate and extend the rules in the other extensions. It also 16885bd8deadSopenharmony_ci provides the ability to automatically convert from signed to unsigned 16895bd8deadSopenharmony_ci integer types, as in the C programming language. 16905bd8deadSopenharmony_ci 16915bd8deadSopenharmony_ci (8) Should we support textureGather() for rectangle textures 16925bd8deadSopenharmony_ci (sampler2DRect)? They aren't in ARB_texture_gather. 16935bd8deadSopenharmony_ci 16945bd8deadSopenharmony_ci RESOLVED: Yes. 16955bd8deadSopenharmony_ci 16965bd8deadSopenharmony_ci (9) How does the input sample mask interact with the fixed-function 16975bd8deadSopenharmony_ci SampleCoverage and SampleMask state? Will samples be removed from the 16985bd8deadSopenharmony_ci input mask if they would be eliminated by these masks in the 16995bd8deadSopenharmony_ci per-fragment operations? 17005bd8deadSopenharmony_ci 17015bd8deadSopenharmony_ci UNRESOLVED. 17025bd8deadSopenharmony_ci 17035bd8deadSopenharmony_ci (10) Should we support reading patches as geometry shader inputs, and if 17045bd8deadSopenharmony_ci so, where? 17055bd8deadSopenharmony_ci 17065bd8deadSopenharmony_ci RESOLVED: Not in this extension. This capability will be provided in 17075bd8deadSopenharmony_ci NV_gpu_shader5. 17085bd8deadSopenharmony_ci 17095bd8deadSopenharmony_ci (11) Should we support per-sample interpolation of attributes? If so, 17105bd8deadSopenharmony_ci how? 17115bd8deadSopenharmony_ci 17125bd8deadSopenharmony_ci RESOLVED. Yes. When multisample rasterization is enabled, qualifying 17135bd8deadSopenharmony_ci one or more fragment shader inputs with "sample" will force per-sample 17145bd8deadSopenharmony_ci interpolation of those attributes. If the same shader includes other 17155bd8deadSopenharmony_ci fragment inputs not qualified with sample, those attributes may be 17165bd8deadSopenharmony_ci interpolated per-pixel (i.e., all samples get the same values, likely 17175bd8deadSopenharmony_ci evaluated at the pixel center). 17185bd8deadSopenharmony_ci 17195bd8deadSopenharmony_ci (12) Should we reserve "sample" as a keyword for per-sample interpolation 17205bd8deadSopenharmony_ci qualifiers, or use something more obscure, such as "per_sample"? 17215bd8deadSopenharmony_ci 17225bd8deadSopenharmony_ci RESOLVED: This extension uses "sample". 17235bd8deadSopenharmony_ci 17245bd8deadSopenharmony_ci (13) What should be the base data type for the bitCount(), findLSB(), and 17255bd8deadSopenharmony_ci findMSB() functions -- signed or unsigned integers? 17265bd8deadSopenharmony_ci 17275bd8deadSopenharmony_ci RESOLVED: These functions will return signed values, with -1 returned 17285bd8deadSopenharmony_ci by findLSB/findMSB if no bit is found. Note that the shading language 17295bd8deadSopenharmony_ci supports implicit conversions of signed integers to unsigned, which 17305bd8deadSopenharmony_ci makes it easy enough if an unsigned result is desired. 17315bd8deadSopenharmony_ci 17325bd8deadSopenharmony_ci (14) Why do EmitVertex() and EndPrimitive() begin with capitalized words 17335bd8deadSopenharmony_ci while most of the other built-ins start with a lower-case (e.g., 17345bd8deadSopenharmony_ci emitVertex)? Which precedent should the new per-vertex stream emit 17355bd8deadSopenharmony_ci and end primitive functions follow? 17365bd8deadSopenharmony_ci 17375bd8deadSopenharmony_ci RESOLVED: The inconsistency began with the original functions in 17385bd8deadSopenharmony_ci EXT_geometry_shader4; the spec author can't recall the original reasons 17395bd8deadSopenharmony_ci (if any). Regardless, we decided to match the existing functions as 17405bd8deadSopenharmony_ci closely as possible and use EmitStreamVertex() and EndStreamPrimitive(). 17415bd8deadSopenharmony_ci 17425bd8deadSopenharmony_ci (15) How do the textureGather functions work with sRGB textures? 17435bd8deadSopenharmony_ci 17445bd8deadSopenharmony_ci RESOLVED: Gamma-correction is applied to the texture source color 17455bd8deadSopenharmony_ci before "gathering" and hence applies to all four components, unless the 17465bd8deadSopenharmony_ci texture swizzle of the selected component is ALPHA in which case no 17475bd8deadSopenharmony_ci gamma-correction is applied. 17485bd8deadSopenharmony_ci 17495bd8deadSopenharmony_ci (16) How should we support arrays of uniform blocks (i.e., multiple blocks 17505bd8deadSopenharmony_ci in a group, each backed by a separate buffer object)? 17515bd8deadSopenharmony_ci 17525bd8deadSopenharmony_ci RESOLVED: We will use instance names in the block definitions, which 17535bd8deadSopenharmony_ci can be declared as regular arrays: 17545bd8deadSopenharmony_ci 17555bd8deadSopenharmony_ci uniform UniformData { 17565bd8deadSopenharmony_ci vec4 stuff; 17575bd8deadSopenharmony_ci } blocks[4]; 17585bd8deadSopenharmony_ci 17595bd8deadSopenharmony_ci These four blocks used will be referred to as "block[0]" through 17605bd8deadSopenharmony_ci "block[3]" in shader code, and "UniformData[0]" through "UniformData[3]" 17615bd8deadSopenharmony_ci in the OpenGL API code. The block member in this example will be 17625bd8deadSopenharmony_ci referred to as "UniformData.stuff" in the API. A similar approach was 17635bd8deadSopenharmony_ci already adopted in GLSL 1.50, where geometry shaders supported arrays of 17645bd8deadSopenharmony_ci input blocks that were treated similarly. Since this spec depends on 17655bd8deadSopenharmony_ci GLSL 1.50, little new spec language is required here. 17665bd8deadSopenharmony_ci 17675bd8deadSopenharmony_ci (17) What are instanced geometry shaders useful for? 17685bd8deadSopenharmony_ci 17695bd8deadSopenharmony_ci RESOLVED: Instanced geometry shaders allow geometry programs that 17705bd8deadSopenharmony_ci perform regular operations to run more efficiently. 17715bd8deadSopenharmony_ci 17725bd8deadSopenharmony_ci Consider a simple example of an algorithm that uses geometry shaders to 17735bd8deadSopenharmony_ci render primitives to a cube map in a single pass. Without instanced 17745bd8deadSopenharmony_ci geometry shaders, the geometry shader to render triangles to the cube 17755bd8deadSopenharmony_ci map would do something like: 17765bd8deadSopenharmony_ci 17775bd8deadSopenharmony_ci for (face = 0; face < 6; face++) { 17785bd8deadSopenharmony_ci for (vertex = 0; vertex < 3; vertex++) { 17795bd8deadSopenharmony_ci project vertex <vertex> onto face <face>, output position 17805bd8deadSopenharmony_ci compute/copy attributes of emitted <vertex> to outputs 17815bd8deadSopenharmony_ci output <face> to result.layer 17825bd8deadSopenharmony_ci emit the projected vertex 17835bd8deadSopenharmony_ci } 17845bd8deadSopenharmony_ci end the primitive (next triangle) 17855bd8deadSopenharmony_ci } 17865bd8deadSopenharmony_ci 17875bd8deadSopenharmony_ci This algorithm would output 18 vertices per input triangle, three for 17885bd8deadSopenharmony_ci each cube face. The six triangles emitted would be rasterized, one per 17895bd8deadSopenharmony_ci face. Geometry shaders that emit a large number of attributes have 17905bd8deadSopenharmony_ci often posed performance challenges, since all the attributes must be 17915bd8deadSopenharmony_ci stored somewhere until the emitted primitives. Large storage 17925bd8deadSopenharmony_ci requirements may limit the number of threads that can be run in parallel 17935bd8deadSopenharmony_ci and reduce overall performance. 17945bd8deadSopenharmony_ci 17955bd8deadSopenharmony_ci Instanced geometry shaders allow this example to be restructured to run 17965bd8deadSopenharmony_ci with six separate invocations, one per face. Each invocation projects 17975bd8deadSopenharmony_ci the triangle to only a single face (identified by the invocation number) 17985bd8deadSopenharmony_ci and emits only 3 vertices. The reduced storage requirements allow more 17995bd8deadSopenharmony_ci geometry shader invocations to be run in parallel, with greater overall 18005bd8deadSopenharmony_ci efficiency. 18015bd8deadSopenharmony_ci 18025bd8deadSopenharmony_ci Additionally, the total number of attributes that can be emitted by a 18035bd8deadSopenharmony_ci single geometry shader invocation is limited. However, for instanced 18045bd8deadSopenharmony_ci geometry shaders, that limit applies to each of <N> invocations which 18055bd8deadSopenharmony_ci allows for a larger total output. For example, if the GL implementation 18065bd8deadSopenharmony_ci supports only 1024 components of output per invocation, the 18-vertex 18075bd8deadSopenharmony_ci algorithm above could emit no more than 56 components per vertex. The 18085bd8deadSopenharmony_ci same algorithm implemented as a 3-vertex 6-invocation geometry program 18095bd8deadSopenharmony_ci could theoretically allow for 341 components per vertex. 18105bd8deadSopenharmony_ci 18115bd8deadSopenharmony_ci (18) Should EmitStreamVertex() and EndStreamPrimitive() accept a 18125bd8deadSopenharmony_ci non-constant stream number? 18135bd8deadSopenharmony_ci 18145bd8deadSopenharmony_ci RESOLVED: Not in this extension. Requiring a constant stream number 18155bd8deadSopenharmony_ci for each call simplifies code generation for the compiler. 18165bd8deadSopenharmony_ci 18175bd8deadSopenharmony_ci (19) Are there any restrictions on geometry shaders with multiple output 18185bd8deadSopenharmony_ci streams? 18195bd8deadSopenharmony_ci 18205bd8deadSopenharmony_ci RESOLVED: Yes, such geometry shaders are required to generate points; 18215bd8deadSopenharmony_ci line strip and triangle strip outputs are not supported. 18225bd8deadSopenharmony_ci 18235bd8deadSopenharmony_ci (20) Since multi-stream geometry shaders only support points, why does 18245bd8deadSopenharmony_ci EndStreamPrimitive() exist? Neither it nor EndStream() does anything 18255bd8deadSopenharmony_ci useful when emitting points. 18265bd8deadSopenharmony_ci 18275bd8deadSopenharmony_ci RESOLVED: This function was added for completeness, and would be useful 18285bd8deadSopenharmony_ci if the requirement for emitting points were lifted by a future 18295bd8deadSopenharmony_ci extension. 18305bd8deadSopenharmony_ci 18315bd8deadSopenharmony_ci (21) Should we provide mechanisms allowing shaders to examine or set the 18325bd8deadSopenharmony_ci bit representation of floating-point numbers? 18335bd8deadSopenharmony_ci 18345bd8deadSopenharmony_ci RESOLVED: Yes, we will provide functions to convert single-precision 18355bd8deadSopenharmony_ci floats to/from signed and unsigned 32-bit integers. The 18365bd8deadSopenharmony_ci ARB_gpu_shader_fp64 extension will provide similar functionality for 18375bd8deadSopenharmony_ci double-precision floats. We chose to adopt the Java naming convention 18385bd8deadSopenharmony_ci here -- converting a single-precision float to/from a signed integer is 18395bd8deadSopenharmony_ci accomplished by the functions floatBitsToInt() and intBitsToFloat(). 18405bd8deadSopenharmony_ci 18415bd8deadSopenharmony_ci Note that this functionality has also been forked off into a separate 18425bd8deadSopenharmony_ci extension (ARB_shader_bit_encoding) that can be exported on 18435bd8deadSopenharmony_ci implementations capable of performing such conversions but not capable 18445bd8deadSopenharmony_ci of the full feature set of this extension and/or OpenGL 4.0. 18455bd8deadSopenharmony_ci 18465bd8deadSopenharmony_ci (22) What is the "precise" qualifier good for? 18475bd8deadSopenharmony_ci 18485bd8deadSopenharmony_ci RESOLVED: Like "invariant", "precise" provides some invariance 18495bd8deadSopenharmony_ci guarantees is useful for certain algorithms. 18505bd8deadSopenharmony_ci 18515bd8deadSopenharmony_ci With an output position qualified as "invariant", we ensure that if the 18525bd8deadSopenharmony_ci same geometry is processed by multiple shaders using the exact same 18535bd8deadSopenharmony_ci code, it will be transformed in exactly the same way to ensure that we 18545bd8deadSopenharmony_ci have no cracking or flickering in multi-pass algorithms using different 18555bd8deadSopenharmony_ci shaders. 18565bd8deadSopenharmony_ci 18575bd8deadSopenharmony_ci With "precise", we ensure that an algorithm can be written to produce 18585bd8deadSopenharmony_ci identical results on subtly different inputs. For example, the order of 18595bd8deadSopenharmony_ci vertices visible to a geometry or tessellation shader used to subdivide 18605bd8deadSopenharmony_ci primitive edges might present an edge shared between two primitives in 18615bd8deadSopenharmony_ci one direction for one primitive and the other direction for the adjacent 18625bd8deadSopenharmony_ci primitive. Even if the weights are identical in the two cases, there 18635bd8deadSopenharmony_ci may be cracking if the computations are being done in an order-dependent 18645bd8deadSopenharmony_ci manner. If the position of a new vertex were provided by evaluation the 18655bd8deadSopenharmony_ci function f() below with limited-precision floating-point math, it's not 18665bd8deadSopenharmony_ci necessarily the case that f(a,b,c) == f(c,b,a) in the following code: 18675bd8deadSopenharmony_ci 18685bd8deadSopenharmony_ci float f(float x, float y, float z) 18695bd8deadSopenharmony_ci { 18705bd8deadSopenharmony_ci return (x + y) + z; 18715bd8deadSopenharmony_ci } 18725bd8deadSopenharmony_ci 18735bd8deadSopenharmony_ci This function f() can be rewritten as follows with "precise" and a 18745bd8deadSopenharmony_ci symmetric evaluation order to ensure that f(a,b,c) == f(c,b,a). 18755bd8deadSopenharmony_ci 18765bd8deadSopenharmony_ci float f(float x, float y, float z) 18775bd8deadSopenharmony_ci { 18785bd8deadSopenharmony_ci // Note that we intentionally compute "(x+z)" instead of "(x+y)" 18795bd8deadSopenharmony_ci // here, because that value will be the same when <x> and <z> 18805bd8deadSopenharmony_ci // are reversed. 18815bd8deadSopenharmony_ci precise float result = (x + z) + y; 18825bd8deadSopenharmony_ci return result; 18835bd8deadSopenharmony_ci } 18845bd8deadSopenharmony_ci 18855bd8deadSopenharmony_ci (a + b) + c == (c + b) + a 18865bd8deadSopenharmony_ci 18875bd8deadSopenharmony_ci The "precise" qualifier will disable certain optimization and thus 18885bd8deadSopenharmony_ci carries a performance cost. The cost may be higher than "invariant", 18895bd8deadSopenharmony_ci because "invariant" permits optimizations disallowed by "precise" as 18905bd8deadSopenharmony_ci long as the compiler ensures that it always optimizes in the exact same 18915bd8deadSopenharmony_ci manner. 18925bd8deadSopenharmony_ci 18935bd8deadSopenharmony_ci (23) What computations will be affected by the "precise" qualifier, and 18945bd8deadSopenharmony_ci what computations aren't? 18955bd8deadSopenharmony_ci 18965bd8deadSopenharmony_ci RESOLVED: We will ensure precise computation of any expressions within 18975bd8deadSopenharmony_ci a single function used directly or indirectly to produce the value of a 18985bd8deadSopenharmony_ci variable qualified as "precise". 18995bd8deadSopenharmony_ci 19005bd8deadSopenharmony_ci We chose not to provide this guarantee across function boundaries, even 19015bd8deadSopenharmony_ci if the results of a function are used in the computation of an output 19025bd8deadSopenharmony_ci qualified as "precise". Algorithms requiring the use of "precise" may 19035bd8deadSopenharmony_ci have a mix of computations, some required to be precise, some not. This 19045bd8deadSopenharmony_ci function boundary rule may serve to limit the amount of computation 19055bd8deadSopenharmony_ci indirectly forced to be precise. 19065bd8deadSopenharmony_ci 19075bd8deadSopenharmony_ci Additionally, the subroutine rule permits non-precise sub-operations in 19085bd8deadSopenharmony_ci a computation required to be precise. For example, a shader might need 19095bd8deadSopenharmony_ci to compute a "precise" position by taking a weighted average as in the 19105bd8deadSopenharmony_ci following code: 19115bd8deadSopenharmony_ci 19125bd8deadSopenharmony_ci precise vec3 pos = (p[0]*w[0] + p[1]*w[1]) + (p[2]*w[2] + p[3]*w[3]); 19135bd8deadSopenharmony_ci 19145bd8deadSopenharmony_ci However, if the main precision requirement is that the same result be 19155bd8deadSopenharmony_ci generated when <p> and <w> are reversed, the following code also gets 19165bd8deadSopenharmony_ci the job done, even if posmad() is implemented with multiply-add 19175bd8deadSopenharmony_ci operations. 19185bd8deadSopenharmony_ci 19195bd8deadSopenharmony_ci vec3 posmad(vec3 p0, float w0, vec3 p1w1) { return p0*w0+p1w1; } 19205bd8deadSopenharmony_ci precise vec3 pos = (posmad(p[0], w[0], p[1]*w[1]) + 19215bd8deadSopenharmony_ci posmad(p[3], w[3], p[2]*w[2])); 19225bd8deadSopenharmony_ci 19235bd8deadSopenharmony_ci To generate precise results within a function, the function arguments 19245bd8deadSopenharmony_ci and/or temporaries within the function body should be qualified as 19255bd8deadSopenharmony_ci "precise" as needed. 19265bd8deadSopenharmony_ci 19275bd8deadSopenharmony_ci Note that when applying "precise" rules to assignments, indirect 19285bd8deadSopenharmony_ci application of this rule applies on an assignment-by-assignment basis. 19295bd8deadSopenharmony_ci In the following perverse example: 19305bd8deadSopenharmony_ci 19315bd8deadSopenharmony_ci float a,b,c,d,e,f; 19325bd8deadSopenharmony_ci precise float g; 19335bd8deadSopenharmony_ci f = a + b + c; 19345bd8deadSopenharmony_ci ... 19355bd8deadSopenharmony_ci f = c + d + e; 19365bd8deadSopenharmony_ci g = f * 2.0; 19375bd8deadSopenharmony_ci 19385bd8deadSopenharmony_ci The first assignment to <f> need not be treated as "precise", since the 19395bd8deadSopenharmony_ci value assigned will have no effect on the final value of the 19405bd8deadSopenharmony_ci precise-qualified <g>. The second assignment to <f> must be evaluated 19415bd8deadSopenharmony_ci precisely. The fact that one assignment to a variable needs to be 19425bd8deadSopenharmony_ci treated as precise does not mean that the variable itself is implicitly 19435bd8deadSopenharmony_ci treated as "precise". 19445bd8deadSopenharmony_ci 19455bd8deadSopenharmony_ci (24) Are "precise" qualifiers allowed on function arguments? If so, what 19465bd8deadSopenharmony_ci do they mean? Can a return value for a function be declared as 19475bd8deadSopenharmony_ci precise? 19485bd8deadSopenharmony_ci 19495bd8deadSopenharmony_ci RESOLVED: Yes; the rules permit the use of "precise" on any variable 19505bd8deadSopenharmony_ci declaration, including function arguments. The code 19515bd8deadSopenharmony_ci 19525bd8deadSopenharmony_ci float f(precise in vec4 arg1, precise out vec4 arg2) { ... } 19535bd8deadSopenharmony_ci 19545bd8deadSopenharmony_ci specifies that any expressions used to assign values to <arg1> or <arg2> 19555bd8deadSopenharmony_ci within f() will be evaluated as a precise manner. 19565bd8deadSopenharmony_ci 19575bd8deadSopenharmony_ci Expressions used to derive the value passed to the function f() as 19585bd8deadSopenharmony_ci <arg1> will be treated as precise according to the normal rules. The 19595bd8deadSopenharmony_ci expression for <arg1> is treated as precise if and only if the function 19605bd8deadSopenharmony_ci call is on the right-hand side of an assignment to a variable qualified 19615bd8deadSopenharmony_ci as "precise" or is indirectly used in an assignment to such a variable. 19625bd8deadSopenharmony_ci It is not automatically treated as precise just because the formal 19635bd8deadSopenharmony_ci parameter <arg1> is qualified with "precise". 19645bd8deadSopenharmony_ci 19655bd8deadSopenharmony_ci For the purposes of this rule, variables passed as "out" parameters do 19665bd8deadSopenharmony_ci not count as assignments. Values assigned to an output parameter will 19675bd8deadSopenharmony_ci not be evaluated precisely just because the caller provides a variable 19685bd8deadSopenharmony_ci qualified as "precise". When the output parameter itself is qualified 19695bd8deadSopenharmony_ci as "precise", precise evaluation of that output is required within the 19705bd8deadSopenharmony_ci callee. 19715bd8deadSopenharmony_ci 19725bd8deadSopenharmony_ci We chose not to permit function return values to be qualified as 19735bd8deadSopenharmony_ci "precise", though we could have hypothetically allowed code such as: 19745bd8deadSopenharmony_ci 19755bd8deadSopenharmony_ci precise float f(float a, float b, float c) { return (a+b)+c; } 19765bd8deadSopenharmony_ci 19775bd8deadSopenharmony_ci To obtain a precise return value in such a case, use code such as: 19785bd8deadSopenharmony_ci 19795bd8deadSopenharmony_ci float f(float a, float b, float c) 19805bd8deadSopenharmony_ci { 19815bd8deadSopenharmony_ci precise float result = (a+b) + c; 19825bd8deadSopenharmony_ci return result; 19835bd8deadSopenharmony_ci } 19845bd8deadSopenharmony_ci 19855bd8deadSopenharmony_ci (25) How does texture gather interact with incomplete textures? 19865bd8deadSopenharmony_ci 19875bd8deadSopenharmony_ci RESOLVED: For regular texture lookups, incomplete textures are 19885bd8deadSopenharmony_ci considered to return a texel value with RGBA components of (0,0,0,1). 19895bd8deadSopenharmony_ci For texture gather operations, each texel in the sampled footprint is 19905bd8deadSopenharmony_ci considered to have RGBA components of (0,0,0,1). When using the 19915bd8deadSopenharmony_ci textureGather() function to select the R, G, or B component of an 19925bd8deadSopenharmony_ci incomplete texture, (0,0,0,0) will be returned. When selecting the A 19935bd8deadSopenharmony_ci component, (1,1,1,1) will be returned. 19945bd8deadSopenharmony_ci 19955bd8deadSopenharmony_ci 19965bd8deadSopenharmony_ciRevision History 19975bd8deadSopenharmony_ci 19985bd8deadSopenharmony_ci Rev. Date Author Changes 19995bd8deadSopenharmony_ci ---- -------- -------- ----------------------------------------- 20005bd8deadSopenharmony_ci 16 03/30/12 pbrown Fix typo in language restricting the use of 20015bd8deadSopenharmony_ci EmitStreamVertex()/EndStreamPrimitive() to 20025bd8deadSopenharmony_ci programs with an output primitive type of 20035bd8deadSopenharmony_ci points, not an input type of points (bug 8371). 20045bd8deadSopenharmony_ci 20055bd8deadSopenharmony_ci 15 10/17/11 pbrown Fix prototypes for textureGather and 20065bd8deadSopenharmony_ci textureGatherOffset to use vec2 coordinates for 20075bd8deadSopenharmony_ci "2DRect" sampler versions (bug 7964). 20085bd8deadSopenharmony_ci 20095bd8deadSopenharmony_ci 14 01/27/11 pbrown Add further clarification on the interaction 20105bd8deadSopenharmony_ci of texture gather and incomplete textures (bug 20115bd8deadSopenharmony_ci 7289). 20125bd8deadSopenharmony_ci 20135bd8deadSopenharmony_ci 13 09/24/10 pbrown Clarify the interaction of texture gather 20145bd8deadSopenharmony_ci with swizzle (bug 5910), fixing conflicts 20155bd8deadSopenharmony_ci between API and GLSL spec language. 20165bd8deadSopenharmony_ci Consolidate into one copy in the API 20175bd8deadSopenharmony_ci spec. 20185bd8deadSopenharmony_ci 20195bd8deadSopenharmony_ci 12 03/23/10 pbrown Update issues section, both fixing/numbering 20205bd8deadSopenharmony_ci existing issues and including other issues 20215bd8deadSopenharmony_ci that were left behind in NV_gpu_shader5 when the 20225bd8deadSopenharmony_ci specs were refactored. 20235bd8deadSopenharmony_ci 20245bd8deadSopenharmony_ci 11 03/23/10 Jon Leech Describe <offset> to interpolateAtOffset 20255bd8deadSopenharmony_ci without implying it is a constant expression 20265bd8deadSopenharmony_ci (Bug 6026). 20275bd8deadSopenharmony_ci 20285bd8deadSopenharmony_ci 10 03/07/10 pbrown Fix typo in an output stream qualifier example. 20295bd8deadSopenharmony_ci 20305bd8deadSopenharmony_ci 9 03/05/10 pbrown Modify function overloading rules to remove 20315bd8deadSopenharmony_ci most preferences when converting between 20325bd8deadSopenharmony_ci two different types. The only preferences 20335bd8deadSopenharmony_ci that remain are promoting "float" to "double" 20345bd8deadSopenharmony_ci over other conversions, and preferring 20355bd8deadSopenharmony_ci conversion of integers to "float" to converting 20365bd8deadSopenharmony_ci to "double" (bug 5938). 20375bd8deadSopenharmony_ci 20385bd8deadSopenharmony_ci 8 01/29/10 pbrown Update the spec to require that the minimum 20395bd8deadSopenharmony_ci value for MAX_PROGRAM_TEXTURE_GATHER_- 20405bd8deadSopenharmony_ci COMPONENTS is 4 (bug 5919). 20415bd8deadSopenharmony_ci 20425bd8deadSopenharmony_ci 7 01/21/10 pbrown Clarify the rules for determining a best match 20435bd8deadSopenharmony_ci if implicit conversions can result in multiple 20445bd8deadSopenharmony_ci matching function prototypes. Modify the rules 20455bd8deadSopenharmony_ci to pick a best match by comparing pairs of 20465bd8deadSopenharmony_ci functions, and using any function deemed better 20475bd8deadSopenharmony_ci than any other choice. Modify the argument 20485bd8deadSopenharmony_ci conversion preference rules for overloading to 20495bd8deadSopenharmony_ci disfavor "int" to "uint" conversions, for 20505bd8deadSopenharmony_ci backward compatibility with previous GLSL 20515bd8deadSopenharmony_ci versions. Add some new discussion of the 20525bd8deadSopenharmony_ci choices involved to the issues section (bug 20535bd8deadSopenharmony_ci 5938). 20545bd8deadSopenharmony_ci 20555bd8deadSopenharmony_ci 6 01/14/10 pbrown Minor wording updates from spec reviews. 20565bd8deadSopenharmony_ci 20575bd8deadSopenharmony_ci 5 12/10/09 pbrown Functionality updates from spec review: 20585bd8deadSopenharmony_ci Rename fmad to fma. Fix error in spec 20595bd8deadSopenharmony_ci language for negative diffs in usubBorrow. 20605bd8deadSopenharmony_ci 20615bd8deadSopenharmony_ci 4 12/10/09 pbrown Convert from EXT to ARB. 20625bd8deadSopenharmony_ci 20635bd8deadSopenharmony_ci 3 12/08/09 pbrown Miscellaneous fixes from spec review: Added 20645bd8deadSopenharmony_ci missing implementation constants for 20655bd8deadSopenharmony_ci interpolation offset range and granularity; 20665bd8deadSopenharmony_ci added explicit section to OpenGL spec describing 20675bd8deadSopenharmony_ci shader requested interpolation modifiers and 20685bd8deadSopenharmony_ci functions. Clean up more dangling "ThreadID" 20695bd8deadSopenharmony_ci references. General typo fixes and language 20705bd8deadSopenharmony_ci clarifications. 20715bd8deadSopenharmony_ci 20725bd8deadSopenharmony_ci 2 10/01/09 pbrown Renamed gl_ThreadID to gl_InvocationID. 20735bd8deadSopenharmony_ci 20745bd8deadSopenharmony_ci 1 pbrown Internal revisions. 2075