15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_sample_shading 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_sample_shading 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Eric Werness, NVIDIA Corporation (ewerness 'at' nvidia.com) 125bd8deadSopenharmony_ci Pat Brown, NVIDIA Corporation (pbrown 'at' nvidia.com) 135bd8deadSopenharmony_ci 145bd8deadSopenharmony_ciContributors 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ci Murat Balci, AMD 175bd8deadSopenharmony_ci Pierre Boudier, AMD 185bd8deadSopenharmony_ci Pat Brown, NVIDIA 195bd8deadSopenharmony_ci Greg Roth, NVIDIA 205bd8deadSopenharmony_ci Graham Sellers, AMD 215bd8deadSopenharmony_ci Eric Werness, NVIDIA 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ciNotice 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ci Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at 265bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciSpecification Update Policy 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 315bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 325bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 335bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 345bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 355bd8deadSopenharmony_ci described in more detail at 365bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ciStatus 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci Complete. Approved by the ARB on July 3, 2009. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciVersion 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci Last Modified Date: 02/02/2010 455bd8deadSopenharmony_ci Revision: 8 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ciNumber 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci ARB Extension #70 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ciDependencies 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci OpenGL 2.0 is required. 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci OpenGL Shading Language 1.30 is required 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ci This extension is written against the OpenGL 2.0 specification and 585bd8deadSopenharmony_ci version 1.30 of the OpenGL Shading Language Specification. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ciOverview 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci In standard multisample rendering, an implementation is allowed to 635bd8deadSopenharmony_ci assign the same color and texture coordinate values to each sample, 645bd8deadSopenharmony_ci which then allows the optimization where the shader is only 655bd8deadSopenharmony_ci evaluated once and then distributed to the samples that have been 665bd8deadSopenharmony_ci determined to be covered by the primitive currently being 675bd8deadSopenharmony_ci rasterized. This can cause aliasing where the input color and 685bd8deadSopenharmony_ci texture coordinates are used to generate a result that doesn't 695bd8deadSopenharmony_ci antialias itself, for example with alpha-tested transparency. 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci This extension adds the ability to explicitly request that an 725bd8deadSopenharmony_ci implementation use a minimum number of unique set of fragment 735bd8deadSopenharmony_ci computation inputs when multisampling a pixel. Specifying such a 745bd8deadSopenharmony_ci requirement can reduce aliasing that results from evaluating the 755bd8deadSopenharmony_ci fragment computations too few times per pixel. 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci This extension adds new global state that controls the minimum 785bd8deadSopenharmony_ci number of samples for which attribute data is independently 795bd8deadSopenharmony_ci interpolated. When enabled, all operations that were traditionally 805bd8deadSopenharmony_ci executed per-fragment operate independently on each sample. 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci This also extends the shading language to allow control over the 835bd8deadSopenharmony_ci sample being processed. This includes built-in fragment input 845bd8deadSopenharmony_ci variables identifying the sample number and position being processed 855bd8deadSopenharmony_ci when executing fragment shaders per sample. 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ciNew Procedures and Functions 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci void MinSampleShadingARB(clampf value); 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ciNew Tokens 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, 945bd8deadSopenharmony_ci and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, 955bd8deadSopenharmony_ci and GetDoublev: 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ci SAMPLE_SHADING_ARB 0x8C36 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetDoublev, 1005bd8deadSopenharmony_ci GetIntegerv, and GetFloatv: 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation) 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci None. 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci Modify Section 3.2.1 Multisampling p. 93 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ci (add a new paragraph at the end of the section, p. 95) 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci Sample shading can be used to specify a minimum number of unique samples 1155bd8deadSopenharmony_ci to process for each fragment. Sample shading is controlled by by calling 1165bd8deadSopenharmony_ci Enable or Disable with the symbolic constant SAMPLE_SHADING_ARB. 1175bd8deadSopenharmony_ci 1185bd8deadSopenharmony_ci If MULTISAMPLE or SAMPLE_SHADING_ARB is disabled, sample shading has no 1195bd8deadSopenharmony_ci effect. Otherwise, an implementation must provide a minimum of 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci max(ceil(MIN_SAMPLE_SHADING_VALUE_ARB*SAMPLES),1) 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci unique color values and sets of texture coordinates for each 1245bd8deadSopenharmony_ci fragment. These are associated with the samples in an 1255bd8deadSopenharmony_ci implementation-dependent manner. The value of 1265bd8deadSopenharmony_ci MIN_SAMPLE_SHADING_VALUE_ARB is specified by calling 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ci void MinSampleShadingARB(clampf value); 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ci with <value> set to the desired minimum sample shading fraction. <value> 1315bd8deadSopenharmony_ci is clamped to [0,1] when specified. The sample shading fraction may be 1325bd8deadSopenharmony_ci queried by calling GetFloatv with pname set to 1335bd8deadSopenharmony_ci MIN_SAMPLE_SHADING_VALUE_ARB. 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci When the sample shading fraction is 1.0, a separate set of colors and 1365bd8deadSopenharmony_ci other associated data are evaluated for each sample, each set of values 1375bd8deadSopenharmony_ci are evaluated at the sample location. 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ci Modify section 3.11, Fragment Shaders, p. 193 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci Add the following paragraph to the section Shader Inputs, p. 196 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci The built-in read-only variable gl_SampleID is filled with the 1455bd8deadSopenharmony_ci sample number of the sample currently being processed. This variable 1465bd8deadSopenharmony_ci is in the range 0 to gl_NumSamples-1, where gl_NumSamples is the total 1475bd8deadSopenharmony_ci number of samples in the framebuffer, or one if rendering to a 1485bd8deadSopenharmony_ci non-multisample framebuffer. Using this variable in a fragment shader 1495bd8deadSopenharmony_ci causes the entire shader to be evaluated per-sample. When rendering to a 1505bd8deadSopenharmony_ci non-multisample buffer, or if multisample rasterization is disabled, 1515bd8deadSopenharmony_ci gl_SampleID will always be zero. gl_NumSamples is the sample count 1525bd8deadSopenharmony_ci of the framebuffer regardless of whether multisample rasterization 1535bd8deadSopenharmony_ci is enabled or not. 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci The built-in read-only variable gl_SamplePosition contains the 1565bd8deadSopenharmony_ci position of the current sample within the multi-sample draw buffer. 1575bd8deadSopenharmony_ci The x and y components of gl_SamplePosition contain the sub-pixel 1585bd8deadSopenharmony_ci coordinate of the current sample and will have values in the range 1595bd8deadSopenharmony_ci zero to one. The sub-pixel coordinate of the center of the pixel is 1605bd8deadSopenharmony_ci always (0.5, 0.5). Using this variable in a fragment shader 1615bd8deadSopenharmony_ci causes the entire shader to be evaluated per-sample. When rendering to a 1625bd8deadSopenharmony_ci non-multisample buffer, or if multisample rasterization is disabled, 1635bd8deadSopenharmony_ci gl_SamplePosition will always be (0.5, 0.5). 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci Add the following paragraph to the section Shader Outputs, p. 196 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci The built-in integer array gl_SampleMask[] can be used to change the 1685bd8deadSopenharmony_ci sample coverage for a fragment from within the shader. The number 1695bd8deadSopenharmony_ci of elements in the array is ceil(<s>/32), where <s> is the 1705bd8deadSopenharmony_ci maximum number of color samples supported by the implementation. 1715bd8deadSopenharmony_ci If bit <n> of element <w> in the array is set to zero, sample 1725bd8deadSopenharmony_ci <w>*32+<n> should be considered uncovered for the purposes of 1735bd8deadSopenharmony_ci multisample fragment operations (Section 4.1.3). Modifying the 1745bd8deadSopenharmony_ci sample mask in this way may exclude covered samples from being 1755bd8deadSopenharmony_ci processed further at a per-fragment granularity. However, setting 1765bd8deadSopenharmony_ci sample mask bits to one will never enable samples not covered by the 1775bd8deadSopenharmony_ci original primitive. If the fragment shader is being evaluated at 1785bd8deadSopenharmony_ci any frequency other than per-framgent, bits of the sample mask not 1795bd8deadSopenharmony_ci corresponding to the current fragment shader invocation are ignored. 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci Add the following prototypes to the list of built-in variables 1825bd8deadSopenharmony_ci accessible from a fragment shader: 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci in int gl_SampleID; 1855bd8deadSopenharmony_ci in vec2 gl_SamplePosition; 1865bd8deadSopenharmony_ci out int gl_SampleMask[]; 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci Add the following prototype to the list of built-in uniforms 1895bd8deadSopenharmony_ci accessible from a fragment shader: 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci uniform int gl_NumSamples; 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment 1955bd8deadSopenharmony_ciOperations and the Frame Buffer) 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci Modify Section 4.1.3, Multisample Fragment Operations, p. 200 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci (modify first paragraph of section) This step modifies fragment alpha and 2005bd8deadSopenharmony_ci coverage values based on the values of SAMPLE_ALPHA_TO_COVERAGE, 2015bd8deadSopenharmony_ci SAMPLE_ALPHA_TO_ONE, SAMPLE_COVERAGE, SAMPLE_COVERAGE_VALUE, 2025bd8deadSopenharmony_ci SAMPLE_COVERAGE_INVERT, and an output sample mask optionally written by 2035bd8deadSopenharmony_ci the fragment shader. No changes to the fragment alpha or coverage values 2045bd8deadSopenharmony_ci are made at this step if MULTISAMPLE is disabled, or if the value of 2055bd8deadSopenharmony_ci SAMPLE_BUFFERS is not one. 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ci (insert new paragraph after second paragraph, p. 201) 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci Next, if a fragment shader is active and statically assigns to the 2105bd8deadSopenharmony_ci built-in output variable gl_SampleMask, the fragment coverage is ANDed 2115bd8deadSopenharmony_ci with the bits of the sample mask. If such a fragment shader did not 2125bd8deadSopenharmony_ci assign a value to gl_SampleMask due to flow control, the value ANDed with 2135bd8deadSopenharmony_ci the fragment coverage is undefined. If no fragment shader is active, or 2145bd8deadSopenharmony_ci if the active fragment shader does not statically assign values to 2155bd8deadSopenharmony_ci gl_SampleMask, the fragment coverage is not modified. 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions) 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci None. 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 2.0 Specification (State and 2235bd8deadSopenharmony_ciState Requests) 2245bd8deadSopenharmony_ci 2255bd8deadSopenharmony_ci None. 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ci None 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ciGLX Protocol 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ci TBD 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ciErrors 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ci None. 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ciNew State 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci Get Value Get Command Type Initial Value Attribute 2425bd8deadSopenharmony_ci --------- ----------- ---- ------------- --------- 2435bd8deadSopenharmony_ci SAMPLE_SHADING_ARB IsEnabled B FALSE multisample/enable 2445bd8deadSopenharmony_ci MIN_SAMPLE_SHADING_VALUE_ARB GetFloatv R+ 0 multisample 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ciNew Implementation Dependent State 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci None. 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ciModifications to The OpenGL Shading Language Specification, Version 1.10.59 2515bd8deadSopenharmony_ci 2525bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 2535bd8deadSopenharmony_ci language features described in this extension: 2545bd8deadSopenharmony_ci 2555bd8deadSopenharmony_ci #extension GL_ARB_sample_shading 2565bd8deadSopenharmony_ci 2575bd8deadSopenharmony_ci A new preprocessor #define is added to the OpenGL Shading Language: 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ci #define GL_ARB_sample_shading 1 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci Add to section 7.2 "Fragment Shader Special Variables" 2625bd8deadSopenharmony_ci 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci The built-in output array gl_SampleMask[] sets the sample mask for 2655bd8deadSopenharmony_ci the fragment being processed. Coverage for the current fragment is 2665bd8deadSopenharmony_ci ANDed with the value of gl_SampleMask. Bit B of mask 2675bd8deadSopenharmony_ci gl_SampleMask[M] corresponds to sample 32*M+B. This array must be 2685bd8deadSopenharmony_ci sized in the fragment shader either implicitly or explicitly to be 2695bd8deadSopenharmony_ci the same size as the implementation dependent maximum sample mask 2705bd8deadSopenharmony_ci words determined by the maximum number of samples. If the fragment 2715bd8deadSopenharmony_ci shader statically assigns a value to gl_SampleMask[], the sample 2725bd8deadSopenharmony_ci mask will be undefined for any array elements of any fragment shader 2735bd8deadSopenharmony_ci invocations that fails to assign a value. If a shader does not 2745bd8deadSopenharmony_ci statically assign a value to gl_SampleMask, the sample mask has no 2755bd8deadSopenharmony_ci effect on the processing of a fragment. 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci The built-in read-only variable gl_SampleID is filled with the 2785bd8deadSopenharmony_ci sample number of the sample currently being processed. This 2795bd8deadSopenharmony_ci variable is in the range 0 to gl_NumSamples-1, where gl_NumSamples is 2805bd8deadSopenharmony_ci the total number of samples in the framebuffer, or one if rendering to 2815bd8deadSopenharmony_ci a non-multisample framebuffer. Using this variable in a fragment shader 2825bd8deadSopenharmony_ci causes the entire shader to be evaluated per-sample. 2835bd8deadSopenharmony_ci 2845bd8deadSopenharmony_ci The built-in read-only variable gl_SamplePosition contains the 2855bd8deadSopenharmony_ci position of the current sample within the multi-sample draw 2865bd8deadSopenharmony_ci buffer. The x and y components of gl_SamplePosition contain the 2875bd8deadSopenharmony_ci sub-pixel coordinate of the current sample and will have values in 2885bd8deadSopenharmony_ci the range zero to one. Using this variable in a fragment shader 2895bd8deadSopenharmony_ci causes the entire shader to be evaluated per-sample. 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci ... 2925bd8deadSopenharmony_ci 2935bd8deadSopenharmony_ci The built-in variables that are accessible from a fragment shader are 2945bd8deadSopenharmony_ci intrinsically given types as follows: 2955bd8deadSopenharmony_ci 2965bd8deadSopenharmony_ci int gl_SampleID; 2975bd8deadSopenharmony_ci vec2 gl_SamplePosition; 2985bd8deadSopenharmony_ci int gl_SampleMask[]; 2995bd8deadSopenharmony_ci 3005bd8deadSopenharmony_ci 3015bd8deadSopenharmony_ciIssues 3025bd8deadSopenharmony_ci 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci 1) Do we need both an enable and state? 3055bd8deadSopenharmony_ci 3065bd8deadSopenharmony_ci RESOLVED. Yes - that's just the way GL rolls 3075bd8deadSopenharmony_ci 3085bd8deadSopenharmony_ci 2) How many times is the fragment shader run? 3095bd8deadSopenharmony_ci 3105bd8deadSopenharmony_ci RESOLVED. The shader must be run at least once for each unique 3115bd8deadSopenharmony_ci set of texture coordinates and colors, so 3125bd8deadSopenharmony_ci max(MIN_SAMPLE_SHADING_VALUE_ARB*SAMPLES,1) times. 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci 3) What cases can benefit from enabling this? 3155bd8deadSopenharmony_ci 3165bd8deadSopenharmony_ci RESOLVED. Something like alpha-tested rendering using textures 3175bd8deadSopenharmony_ci don't benefit from multisampling right now - using this extension 3185bd8deadSopenharmony_ci to run the fragment shader or fixed-function texturing multiple 3195bd8deadSopenharmony_ci times per pixel can significantly improve quality. 3205bd8deadSopenharmony_ci 3215bd8deadSopenharmony_ci 4) What do KIL and discard do? 3225bd8deadSopenharmony_ci 3235bd8deadSopenharmony_ci RESOLVED. They terminate a single invocation of the shader, so a 3245bd8deadSopenharmony_ci single fragment may have some threads that discard and some that 3255bd8deadSopenharmony_ci don't. 3265bd8deadSopenharmony_ci 3275bd8deadSopenharmony_ci 5) Should there be an option to specify that all fragment shader inputs 3285bd8deadSopenharmony_ci be interpolated at per-sample frequency? If so, how? 3295bd8deadSopenharmony_ci 3305bd8deadSopenharmony_ci RESOLVED: Yes. Via the enable 3315bd8deadSopenharmony_ci 3325bd8deadSopenharmony_ci 6) Should the ability to specify per-sample or per-fragment 3335bd8deadSopenharmony_ci interpolation on a per-varying basis be added via the language? 3345bd8deadSopenharmony_ci 3355bd8deadSopenharmony_ci RESOLVED: Not in this extension. 3365bd8deadSopenharmony_ci 3375bd8deadSopenharmony_ci 7) Does gl_SampleMask belong here? 3385bd8deadSopenharmony_ci 3395bd8deadSopenharmony_ci RESOLVED: Yes, it's sample related and conteporary with the 3405bd8deadSopenharmony_ci hardware required for the rest of this extension. Thematically it 3415bd8deadSopenharmony_ci might match better with ARB_texture_multisample, but that 3425bd8deadSopenharmony_ci extension targets hardware that cannot support gl_sampleMask. 3435bd8deadSopenharmony_ci 3445bd8deadSopenharmony_ci 8) How should gl_SampleMask mask samples above the first 32? 3455bd8deadSopenharmony_ci 3465bd8deadSopenharmony_ci RESOLVED: By being an array with enough entries to encompass all 3475bd8deadSopenharmony_ci the implementation-dependent maximum number of samples. 3485bd8deadSopenharmony_ci 3495bd8deadSopenharmony_ci 9) Is per-sample shading ever triggered by properties of the fragment 3505bd8deadSopenharmony_ci shader? 3515bd8deadSopenharmony_ci 3525bd8deadSopenharmony_ci RESOLVED: Yes. The variables "gl_SampleID" and "gl_SamplePosition" 3535bd8deadSopenharmony_ci can be used to read properties of the current sample, which wouldn't 3545bd8deadSopenharmony_ci make much sense if the fragment shader were run at a lower frequency 3555bd8deadSopenharmony_ci than per-sample. 3565bd8deadSopenharmony_ci 3575bd8deadSopenharmony_ci 10) Does gl_SamplePosition need to support layout() qualifiers such as 3585bd8deadSopenharmony_ci "pixel_center_integer" in GLSL 1.50? 3595bd8deadSopenharmony_ci 3605bd8deadSopenharmony_ci RESOLVED: Not in this extension. "pixel_center_integer" was added in 3615bd8deadSopenharmony_ci part for compatibility with shaders originally targeting Direct3D 3625bd8deadSopenharmony_ci version 9.0 or earlier, where pixel centers were specified to be (X.0, 3635bd8deadSopenharmony_ci Y.0) instead of OpenGL's (X.5, Y.5). However, Direct3D 9.0 doesn't 3645bd8deadSopenharmony_ci support anything like "gl_SamplePosition", and Direct3D versions that do 3655bd8deadSopenharmony_ci support this functionality have adopted OpenGL's (X.5, Y.5) conventions. 3665bd8deadSopenharmony_ci 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ciRevision History 3695bd8deadSopenharmony_ci 3705bd8deadSopenharmony_ci Rev. Date Author Changes 3715bd8deadSopenharmony_ci ---- -------- -------- ----------------------------------------- 3725bd8deadSopenharmony_ci 8 02/02/2010 pbrown Clarify that use of gl_SamplePosition 3735bd8deadSopenharmony_ci triggers per-sample shading (bug 5911). 3745bd8deadSopenharmony_ci 3755bd8deadSopenharmony_ci 7 01/20/2010 Jon Leech Add rounding rule for computing number of 3765bd8deadSopenharmony_ci samples used depending on min sample 3775bd8deadSopenharmony_ci shading setting. 3785bd8deadSopenharmony_ci 3795bd8deadSopenharmony_ci 6 10/22/2009 pdaniell Specify that gl_NumSamples should return 3805bd8deadSopenharmony_ci the sample count for the framebuffer 3815bd8deadSopenharmony_ci regardless of whether MULTISAMPLE is enabled 3825bd8deadSopenharmony_ci or not. This matches the API-level queries. 3835bd8deadSopenharmony_ci 3845bd8deadSopenharmony_ci 5 09/17/2009 pbrown Clean up some language on MinSampleShading. 3855bd8deadSopenharmony_ci Add a clarification requiring variables to 3865bd8deadSopenharmony_ci be sampled at sample locations when doing 3875bd8deadSopenharmony_ci full per-sample shading. Add some more 3885bd8deadSopenharmony_ci details on the gl_SampleMask array and its 3895bd8deadSopenharmony_ci operation in the multisample fragment ops. 3905bd8deadSopenharmony_ci Rename gl_MaxSampleId to gl_NumSamples and 3915bd8deadSopenharmony_ci adjust language. 3925bd8deadSopenharmony_ci 3935bd8deadSopenharmony_ci 4 08/02/2009 Jon Leech Reformat to 80 columns and assign 3945bd8deadSopenharmony_ci ARB extension number 3955bd8deadSopenharmony_ci 3965bd8deadSopenharmony_ci 3 06/25/2009 groth Restore missing explanations of 3975bd8deadSopenharmony_ci MIN_SAMPLE_SHADING_VALUE_ARB 3985bd8deadSopenharmony_ci 3995bd8deadSopenharmony_ci 2 05/15/2009 groth Restore gl_sampleMask as an array 4005bd8deadSopenharmony_ci 4015bd8deadSopenharmony_ci 1 05/13/2009 groth Merge from NV_sample_shading_control, 4025bd8deadSopenharmony_ci NV_gpu_shader4_1, and AMD_sample_rate_shader 403