15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci OES_sample_variables 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_OES_sample_variables 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Daniel Koch, NVIDIA Corporation (dkoch 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Pat Brown, NVIDIA 165bd8deadSopenharmony_ci Eric Werness, NVIDIA 175bd8deadSopenharmony_ci Graeme Leese, Broadcom 185bd8deadSopenharmony_ci Contributors to ARB_gpu_shader5 195bd8deadSopenharmony_ci Contributors to ARB_sample_shading 205bd8deadSopenharmony_ci Members of the OpenGL ES Working Group 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciNotice 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci Copyright (c) 2011-2019 The Khronos Group Inc. Copyright terms at 255bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciSpecification Update Policy 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 305bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL ES Working Group. For 315bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 325bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 335bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 345bd8deadSopenharmony_ci described in more detail at 355bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ciStatus 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci Complete. 405bd8deadSopenharmony_ci Ratified by the Khronos Board of Promoters on 2014/03/14. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciVersion 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci Last Modified Date: January 10, 2019 455bd8deadSopenharmony_ci Revision: 10 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ciNumber 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci OpenGL ES Extension #170 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ciDependencies 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci OpenGL ES 3.0 and GLSL ES 3.00 required. 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci This extension is written against the OpenGL ES 3.0.2 (April 8, 2013) 565bd8deadSopenharmony_ci and the OpenGL ES Shading Language Specification Revision 4 575bd8deadSopenharmony_ci (March 6, 2013) specifications. 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci This extension interacts with OES_sample_shading. 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci This extension interacts with OES_shader_multisample_interpolation. 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci This extension interacts with OpenGL ES 3.1. 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ciOverview 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci This extension allows fragment shaders more control over multisample 685bd8deadSopenharmony_ci rendering. The mask of samples covered by a fragment can be read by 695bd8deadSopenharmony_ci the shader and individual samples can be masked out. Additionally 705bd8deadSopenharmony_ci fragment shaders can be run on individual samples and the sample's 715bd8deadSopenharmony_ci ID and position read to allow better interaction with multisample 725bd8deadSopenharmony_ci resources such as textures. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci In multisample rendering, an implementation is allowed to assign the 755bd8deadSopenharmony_ci same sets of fragment shader input values to each sample, which then 765bd8deadSopenharmony_ci allows the optimization where the shader is only evaluated once and 775bd8deadSopenharmony_ci then distributed to the samples that have been determined to be 785bd8deadSopenharmony_ci covered by the primitive currently being rasterized. This extension 795bd8deadSopenharmony_ci does not change how values are interpolated, but it makes some details 805bd8deadSopenharmony_ci of the current sample available. This means that where these features 815bd8deadSopenharmony_ci are used (gl_SampleID and gl_SamplePosition), implementations must 825bd8deadSopenharmony_ci run the fragment shader for each sample. 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci In order to obtain per-sample interpolation on fragment inputs, either 855bd8deadSopenharmony_ci OES_sample_shading or OES_shader_multisample_interpolation must 865bd8deadSopenharmony_ci be used in conjunction with the features from this extension. 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ciNew Procedures and Functions 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci None. 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ciNew Tokens 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci None. 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL ES 3.0 Specification (OpenGL ES Operation) 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci None. 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL ES 3.0 Specification (Rasterization) 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci Modify section 3.9.2, Shader Execution, p. 162 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci (Add the following paragraphs to the section Shader Inputs, p. 164, after 1055bd8deadSopenharmony_ci the paragraph about gl_FrontFacing) 1065bd8deadSopenharmony_ci 1075bd8deadSopenharmony_ci The built-in read-only variable gl_SampleID is filled with the 1085bd8deadSopenharmony_ci sample number of the sample currently being processed. This variable 1095bd8deadSopenharmony_ci is in the range zero to gl_NumSamples minus one, where 1105bd8deadSopenharmony_ci gl_NumSamples is the 1115bd8deadSopenharmony_ci total number of samples in the framebuffer, or one if rendering to a 1125bd8deadSopenharmony_ci non-multisample framebuffer. Using gl_SampleID in a fragment shader 1135bd8deadSopenharmony_ci causes the entire shader to be executed per-sample. When rendering to a 1145bd8deadSopenharmony_ci non-multisample buffer, 1155bd8deadSopenharmony_ci gl_SampleID will always be zero. gl_NumSamples is the sample count 1165bd8deadSopenharmony_ci of the framebuffer regardless of whether the framebuffer is multisampled 1175bd8deadSopenharmony_ci or not. 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci The built-in read-only variable gl_SamplePosition contains the 1205bd8deadSopenharmony_ci position of the current sample within the multi-sample draw buffer. 1215bd8deadSopenharmony_ci The x and y components of gl_SamplePosition contain the sub-pixel 1225bd8deadSopenharmony_ci coordinate of the current sample and will have values in the range 1235bd8deadSopenharmony_ci [0, 1]. The sub-pixel coordinate of the center of the pixel is 1245bd8deadSopenharmony_ci always (0.5, 0.5). Using this variable in a fragment shader 1255bd8deadSopenharmony_ci causes the entire shader to be executed per-sample. When rendering to a 1265bd8deadSopenharmony_ci non-multisample buffer, 1275bd8deadSopenharmony_ci gl_SamplePosition will always be (0.5, 0.5). 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci The built-in variable gl_SampleMaskIn is an integer array holding 1305bd8deadSopenharmony_ci bitfields indicating the set of fragment samples covered by the primitive 1315bd8deadSopenharmony_ci corresponding to the fragment shader invocation. The number of elements 1325bd8deadSopenharmony_ci in the array is ceil(gl_MaxSamples/32), where gl_MaxSamples is the 1335bd8deadSopenharmony_ci the value of MAX_SAMPLES, the maximum number of color samples supported 1345bd8deadSopenharmony_ci by the implementation. Bit <n> of element <w> in the 1355bd8deadSopenharmony_ci array is set if and only if the sample numbered <w>*32+<n> is considered 1365bd8deadSopenharmony_ci covered for this fragment shader invocation. When rendering to a 1375bd8deadSopenharmony_ci non-multisample buffer, all 1385bd8deadSopenharmony_ci bits are zero except for bit zero of the first array element. That bit 1395bd8deadSopenharmony_ci will be one if the pixel is covered and zero otherwise. Bits in the 1405bd8deadSopenharmony_ci sample mask corresponding to covered samples that will be killed due to 1415bd8deadSopenharmony_ci SAMPLE_COVERAGE or SAMPLE_MASK will not be set (section 4.1.3). 1425bd8deadSopenharmony_ci When per-sample shading is active due to the use of a fragment input 1435bd8deadSopenharmony_ci qualified by "sample" or due to the use of the gl_SampleID or 1445bd8deadSopenharmony_ci gl_SamplePosition variables, only the bit for the current sample is 1455bd8deadSopenharmony_ci set in gl_SampleMaskIn. 1465bd8deadSopenharmony_ci When OpenGL ES API state specifies multiple fragment shader invocations 1475bd8deadSopenharmony_ci for a given fragment, the bit corresponding to each covered sample will 1485bd8deadSopenharmony_ci be set in exactly one fragment shader invocation. 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci Modify section Shader Outputs, p. 165 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ci (Replace the second sentence of the first paragraph with the following) 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ci These outputs are split into two categories, user-defined outputs and the 1555bd8deadSopenharmony_ci built-in outputs gl_FragColor, gl_FragData[n] (both available only in 1565bd8deadSopenharmony_ci OpenGL ES Shading Language version 1.00), gl_FragDepth and gl_SampleMask. 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci (Insert the following paragraph after the first paragraph of the section) 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci The built-in integer array gl_SampleMask can be used to change the 1615bd8deadSopenharmony_ci sample coverage for a fragment from within the shader. The number 1625bd8deadSopenharmony_ci of elements in the array is ceil(gl_MaxSamples/32), where 1635bd8deadSopenharmony_ci gl_MaxSamples is the value of MAX_SAMPLES, the maximum number of 1645bd8deadSopenharmony_ci color samples supported by the implementation. 1655bd8deadSopenharmony_ci If bit <n> of element <w> in the array is set to zero, sample 1665bd8deadSopenharmony_ci <w>*32+<n> should be considered uncovered for the purposes of 1675bd8deadSopenharmony_ci multisample fragment operations (Section 4.1.3). Modifying the 1685bd8deadSopenharmony_ci sample mask in this way may exclude covered samples from being 1695bd8deadSopenharmony_ci processed further at a per-fragment granularity. However, setting 1705bd8deadSopenharmony_ci sample mask bits to one will never enable samples not covered by the 1715bd8deadSopenharmony_ci original primitive. If the fragment shader is being executed at 1725bd8deadSopenharmony_ci any frequency other than per-fragment, bits of the sample mask not 1735bd8deadSopenharmony_ci corresponding to the current fragment shader invocation are ignored. 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL ES 3.0.2 Specification (Per-Fragment 1775bd8deadSopenharmony_ciOperations and the Framebuffer) 1785bd8deadSopenharmony_ci 1795bd8deadSopenharmony_ci Modify Section 4.1.3, Multisample Fragment Operations, p. 170 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci (modify first paragraph of section) This step modifies fragment alpha and 1825bd8deadSopenharmony_ci coverage values based on the values of SAMPLE_ALPHA_TO_COVERAGE, 1835bd8deadSopenharmony_ci SAMPLE_COVERAGE, SAMPLE_COVERAGE_VALUE, 1845bd8deadSopenharmony_ci SAMPLE_COVERAGE_INVERT, and an output sample mask optionally written by 1855bd8deadSopenharmony_ci the fragment shader. No changes to the fragment alpha or coverage values 1865bd8deadSopenharmony_ci are made at this step if the value of 1875bd8deadSopenharmony_ci SAMPLE_BUFFERS is not one. 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci (insert new paragraph before the paragraph on SAMPLE_COVERAGE, p. 171) 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci Next, if a fragment shader is active and statically assigns to the 1925bd8deadSopenharmony_ci built-in output variable gl_SampleMask, the fragment coverage is ANDed 1935bd8deadSopenharmony_ci with the bits of the sample mask. The initial values for elements of 1945bd8deadSopenharmony_ci gl_SampleMask are undefined. Bits in each array element that are not 1955bd8deadSopenharmony_ci written due to flow control or partial writes (i.e., bit-wise operations) 1965bd8deadSopenharmony_ci will continue to have undefined values. The value of those bits ANDed with 1975bd8deadSopenharmony_ci the fragment coverage is undefined. If no fragment shader is active, or 1985bd8deadSopenharmony_ci if the active fragment shader does not statically assign values to 1995bd8deadSopenharmony_ci gl_SampleMask, the fragment coverage is not modified. 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL ES 3.0.2 Specification (Special Functions) 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci None. 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL ES 3.0.2 Specification (State and 2075bd8deadSopenharmony_ciState Requests) 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci None. 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ciModifications to The OpenGL ES Shading Language Specification, Version 3.00.04 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 2145bd8deadSopenharmony_ci language features described in this extension: 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ci #extension GL_OES_sample_variables 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci A new preprocessor #define is added to the OpenGL ES Shading Language: 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci #define GL_OES_sample_variables 1 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci Add to section 7.2 "Fragment Shader Special Variables" 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci (add the following to the list of built-in variables that are accessible 2255bd8deadSopenharmony_ci from a fragment shader) 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ci in lowp int gl_SampleID; 2285bd8deadSopenharmony_ci in mediump vec2 gl_SamplePosition; 2295bd8deadSopenharmony_ci in highp int gl_SampleMaskIn[(gl_MaxSamples+31)/32]; 2305bd8deadSopenharmony_ci out highp int gl_SampleMask[(gl_MaxSamples+31)/32]; 2315bd8deadSopenharmony_ci 2325bd8deadSopenharmony_ci (add the following descriptions of the new variables) 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci The input variable gl_SampleID is filled with the 2355bd8deadSopenharmony_ci sample number of the sample currently being processed. This 2365bd8deadSopenharmony_ci variable is in the range 0 to gl_NumSamples-1, where gl_NumSamples is 2375bd8deadSopenharmony_ci the total number of samples in the framebuffer, or one if rendering to 2385bd8deadSopenharmony_ci a non-multisample framebuffer. Any static use of gl_SampleID in a 2395bd8deadSopenharmony_ci fragment shader causes the entire shader to be executed per-sample. 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci The input variable gl_SamplePosition contains the 2425bd8deadSopenharmony_ci position of the current sample within the multi-sample draw 2435bd8deadSopenharmony_ci buffer. The x and y components of gl_SamplePosition contain the 2445bd8deadSopenharmony_ci sub-pixel coordinate of the current sample and will have values in 2455bd8deadSopenharmony_ci the range 0.0 to 1.0. Any static use of this variable in a fragment 2465bd8deadSopenharmony_ci shader causes the entire shader to be executed per-sample. 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci For the both the input array gl_SampleMaskIn[] and the output 2495bd8deadSopenharmony_ci array gl_SampleMask[], bit B of mask M (gl_SampleMaskIn[M] 2505bd8deadSopenharmony_ci or gl_SampleMask[M]) corresponds to sample 32*M+B. These arrays 2515bd8deadSopenharmony_ci have ceil(gl_MaxSamples/32) elements, where gl_MaxSamples is 2525bd8deadSopenharmony_ci the maximum number of color samples supported by the implementation. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci The input variable gl_SampleMaskIn indicates the set of samples covered 2555bd8deadSopenharmony_ci by the primitive generating the fragment during multisample rasterization. 2565bd8deadSopenharmony_ci It has a sample bit set if and only if the sample is considered covered for 2575bd8deadSopenharmony_ci this fragment shader invocation. 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ci The output array gl_SampleMask[] sets the sample mask for 2605bd8deadSopenharmony_ci the fragment being processed. Coverage for the current fragment will 2615bd8deadSopenharmony_ci be the logical AND of the coverage mask and the output 2625bd8deadSopenharmony_ci gl_SampleMask. If the fragment shader 2635bd8deadSopenharmony_ci statically assigns a value to gl_SampleMask, the sample mask will 2645bd8deadSopenharmony_ci be undefined for any array elements of any fragment shader 2655bd8deadSopenharmony_ci invocations that fails to assign a value. If a shader does not 2665bd8deadSopenharmony_ci statically assign a value to gl_SampleMask, the sample mask has no 2675bd8deadSopenharmony_ci effect on the processing of a fragment. 2685bd8deadSopenharmony_ci 2695bd8deadSopenharmony_ci Add to section 7.3 Built-in Constants 2705bd8deadSopenharmony_ci 2715bd8deadSopenharmony_ci const mediump int gl_MaxSamples = 4; 2725bd8deadSopenharmony_ci 2735bd8deadSopenharmony_ci Add to Section 7.4 Built-in Uniform State 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ci (Add the following prototype to the list of built-in uniforms 2765bd8deadSopenharmony_ci accessible from a fragment shader:) 2775bd8deadSopenharmony_ci 2785bd8deadSopenharmony_ci uniform lowp int gl_NumSamples; 2795bd8deadSopenharmony_ci 2805bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL/EGL Specifications 2815bd8deadSopenharmony_ci 2825bd8deadSopenharmony_ci None 2835bd8deadSopenharmony_ci 2845bd8deadSopenharmony_ciDependencies on OES_sample_shading 2855bd8deadSopenharmony_ci 2865bd8deadSopenharmony_ci If OES_sample_shading is not supported ignore any mention of API state 2875bd8deadSopenharmony_ci that forces multiple shader invocations per fragment. 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ciDependencies on OES_shader_multisample_interpolation 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci If OES_shader_multisample_interpolation is not supported ignore any mention of the 2925bd8deadSopenharmony_ci "sample" qualifier keyword for fragment inputs. 2935bd8deadSopenharmony_ci 2945bd8deadSopenharmony_ciDependencies on OpenGL ES 3.1 2955bd8deadSopenharmony_ci 2965bd8deadSopenharmony_ci If OpenGL ES 3.1 is not supported, ignore references to SAMPLE_MASK. 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ciErrors 2995bd8deadSopenharmony_ci 3005bd8deadSopenharmony_ci None. 3015bd8deadSopenharmony_ci 3025bd8deadSopenharmony_ciNew State 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci None. 3055bd8deadSopenharmony_ci 3065bd8deadSopenharmony_ciNew Implementation Dependent State 3075bd8deadSopenharmony_ci 3085bd8deadSopenharmony_ci None. 3095bd8deadSopenharmony_ci 3105bd8deadSopenharmony_ciIssues 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ci (0) This extension is based on ARB_sample_shading. What are the major 3135bd8deadSopenharmony_ci differences? 3145bd8deadSopenharmony_ci 3155bd8deadSopenharmony_ci 1- rebased against ES 3.0 3165bd8deadSopenharmony_ci 2- various editing for consistency to GL 4.4/GLSL 440 specs 3175bd8deadSopenharmony_ci 3- added precision qualifiers for GLSL builtins 3185bd8deadSopenharmony_ci 4- removed mention of SAMPLE_ALPHA_TO_ONE 3195bd8deadSopenharmony_ci 5- replaced mention of "color and texture coordinates" with more 3205bd8deadSopenharmony_ci generic language about fragment shader inputs. 3215bd8deadSopenharmony_ci 6- removed mention of multisample enable. 3225bd8deadSopenharmony_ci 7- added gl_SampleMaskIn from ARB_gpu_shader5 3235bd8deadSopenharmony_ci 8- replace the term 'evaluated' with 'executed' (Issue 3) 3245bd8deadSopenharmony_ci 9- removed mention of sizing gl_SampleMask[] (Issue 4) 3255bd8deadSopenharmony_ci 10- added gl_MaxSamples shading language constant. 3265bd8deadSopenharmony_ci 3275bd8deadSopenharmony_ci For historical issues, please see ARB_sample_shading and 3285bd8deadSopenharmony_ci ARB_gpu_shader5. 3295bd8deadSopenharmony_ci 3305bd8deadSopenharmony_ci (1) OpenGL has a MULTISAMPLE enable that was not included in OpenGL ES. 3315bd8deadSopenharmony_ci Should we add it into this extension or base it purely on if the target 3325bd8deadSopenharmony_ci surface is multisample? 3335bd8deadSopenharmony_ci 3345bd8deadSopenharmony_ci DISCUSSION: 3355bd8deadSopenharmony_ci GL (4.4) says: 3365bd8deadSopenharmony_ci "Multisample rasterization is enabled or disabled by calling Enable or 3375bd8deadSopenharmony_ci Disable with the symbolic constant MULTISAMPLE." 3385bd8deadSopenharmony_ci 3395bd8deadSopenharmony_ci GL ES (3.0.2) says: 3405bd8deadSopenharmony_ci "Multisample rasterization cannot be enabled or disabled after a GL 3415bd8deadSopenharmony_ci context is created." 3425bd8deadSopenharmony_ci 3435bd8deadSopenharmony_ci RESOLVED. Multisample rasterization should be based on the target 3445bd8deadSopenharmony_ci surface properties. Will not pick up the explicit multisample 3455bd8deadSopenharmony_ci enable, but the language for ES3.0.2 doesn't sound right either. 3465bd8deadSopenharmony_ci Bug 10690 tracks this and it should be fixed in later versions 3475bd8deadSopenharmony_ci of the ES3.0 specification. 3485bd8deadSopenharmony_ci 3495bd8deadSopenharmony_ci (2) ES requires vec2s in a fragment shader to be declared with a precision 3505bd8deadSopenharmony_ci qualifiers, what precision should be used for gl_SamplePosition? 3515bd8deadSopenharmony_ci 3525bd8deadSopenharmony_ci RESOLVED: mediump should be used since lowp might be implemented with 3535bd8deadSopenharmony_ci fixed point and be unable to exactly represent [0.5, 0.5]. 3545bd8deadSopenharmony_ci 3555bd8deadSopenharmony_ci (3) Is it reasonable to run shaders per-sample when interpolation is still 3565bd8deadSopenharmony_ci per-fragment? 3575bd8deadSopenharmony_ci 3585bd8deadSopenharmony_ci RESOLVED: Yes. This allows a useful way of interacting with 3595bd8deadSopenharmony_ci multi-sample resources so it is included. To avoid confusion between 3605bd8deadSopenharmony_ci between per-sample interpolation and per-sample execution, we'll 3615bd8deadSopenharmony_ci use the term "executed" instead of "evaluated". 3625bd8deadSopenharmony_ci 3635bd8deadSopenharmony_ci (4) ARB_sample_shaders says that "gl_SampleMask[] must be sized either 3645bd8deadSopenharmony_ci implicitly or explicitly in the fragment shader to be the same size 3655bd8deadSopenharmony_ci described above." ES doesn't have implicitly sized arrays. 3665bd8deadSopenharmony_ci Does this need to be explicitly declared in a shader or should it be 3675bd8deadSopenharmony_ci predeclared by the implementation? If predeclared, should it be an 3685bd8deadSopenharmony_ci error to redeclare it in the shader? 3695bd8deadSopenharmony_ci 3705bd8deadSopenharmony_ci RESOLVED: In practice, one couldn't detect a difference between an 3715bd8deadSopenharmony_ci implicitly sized array and one that is automatically sized correctly 3725bd8deadSopenharmony_ci by a builtin declaration. In ES it is considered to be declared 3735bd8deadSopenharmony_ci (correctly sized) by the implementation when necessary and thus no 3745bd8deadSopenharmony_ci specific statement is required. As with all built-ins it is an 3755bd8deadSopenharmony_ci error for a shader to redeclare it. 3765bd8deadSopenharmony_ci 3775bd8deadSopenharmony_ci (5) How does one know the size of the gl_SampleMaskIn/gl_SampleMask 3785bd8deadSopenharmony_ci arrays? 3795bd8deadSopenharmony_ci 3805bd8deadSopenharmony_ci RESOLVED: The GL spec states that the size of the arrays is 3815bd8deadSopenharmony_ci ceil(<s>/32) where <s> is the maximum number of color samples 3825bd8deadSopenharmony_ci in the implementation. <s> is thus the equivalent of MAX_SAMPLES 3835bd8deadSopenharmony_ci which is the upper bound on the number of supported sample 3845bd8deadSopenharmony_ci of any format. As a convenience we add the built-in shading 3855bd8deadSopenharmony_ci language constant gl_MaxSamples to mirror this API 3865bd8deadSopenharmony_ci constant in the shading language and the size of the arrays is 3875bd8deadSopenharmony_ci defined in terms of this constant. 3885bd8deadSopenharmony_ci 3895bd8deadSopenharmony_ci (6) Should the shading language built-ins have OES suffixes? 3905bd8deadSopenharmony_ci 3915bd8deadSopenharmony_ci RESOLVED: No. Per Bug 11637, the WG made a policy decision 3925bd8deadSopenharmony_ci that GLSL ES identifiers imported without semantic change 3935bd8deadSopenharmony_ci or subsetting as OES extensions from core GLSL do not carry 3945bd8deadSopenharmony_ci suffixes. The #extension mechanism must still be used to 3955bd8deadSopenharmony_ci enable the appropriate extension before the functionality can 3965bd8deadSopenharmony_ci be used. 3975bd8deadSopenharmony_ci 3985bd8deadSopenharmony_ci 3995bd8deadSopenharmony_ciRevision History 4005bd8deadSopenharmony_ci 4015bd8deadSopenharmony_ci Rev. Date Author Changes 4025bd8deadSopenharmony_ci ---- ---------- -------- ----------------------------------------- 4035bd8deadSopenharmony_ci 10 2019-01-10 Jon Leech Clarify the requirements on gl_SampleMaskIn 4045bd8deadSopenharmony_ci (internal API issue #45). 4055bd8deadSopenharmony_ci 9 2014-02-12 dkoch remove GLSL suffixes per Issue 6. 4065bd8deadSopenharmony_ci 8 2014-01-30 dkoch rename to OES, clean editing notes 4075bd8deadSopenharmony_ci 7 2013-12-11 dkoch correct names of interacting extensions 4085bd8deadSopenharmony_ci 6 2013-10-24 dkoch add gl_MaxSampleOES builtin constant and Issue 5 4095bd8deadSopenharmony_ci 5 2013-10-22 dkoch Clarifications from Ian Romanick 4105bd8deadSopenharmony_ci 4 2013-10-03 dkoch Added dependency on texture_storage_multisample 4115bd8deadSopenharmony_ci 3 2013-10-03 dkoch Resolved all issues. 4125bd8deadSopenharmony_ci Changed gl_SamplePosition to mediump. 4135bd8deadSopenharmony_ci Changed the term "evaluated" to "executed". 4145bd8deadSopenharmony_ci Removed language about sizing gl_SampleMask. 4155bd8deadSopenharmony_ci 2 2013-09-08 dkoch Added interactions for SampleMaskIn, deps. 4165bd8deadSopenharmony_ci Misc small editorial updates. 4175bd8deadSopenharmony_ci Added issue 4, unresolved issue 3. 4185bd8deadSopenharmony_ci 1 2013-09-03 gleese Extracted from OES_sample_shading and 4195bd8deadSopenharmony_ci OES_shader_multisample_interpolation 4205bd8deadSopenharmony_ci 421