15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_multisample 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_multisample 85bd8deadSopenharmony_ci WGL_EXT_multisample 95bd8deadSopenharmony_ci 105bd8deadSopenharmony_ciVersion 115bd8deadSopenharmony_ci 125bd8deadSopenharmony_ci Last Modified Date: January 4, 1999 135bd8deadSopenharmony_ci Author Revision: 1.2 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Based on: SGIS_Multisample Specification Revision 1.14 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciNumber 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci 209 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciDependencies 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci WGL_EXT_extensions_string is required. 245bd8deadSopenharmony_ci WGL_EXT_pixel_format is required. 255bd8deadSopenharmony_ci 265bd8deadSopenharmony_ciOverview 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ci This extension provides a mechanism to antialias all GL primitives: 295bd8deadSopenharmony_ci points, lines, polygons, bitmaps, and images. The technique is to 305bd8deadSopenharmony_ci sample all primitives multiple times at each pixel. The color sample 315bd8deadSopenharmony_ci values are resolved to a single, displayable color each time a pixel 325bd8deadSopenharmony_ci is updated, so the antialiasing appears to be automatic at the 335bd8deadSopenharmony_ci application level. Because each sample includes depth and stencil 345bd8deadSopenharmony_ci information, the depth and stencil functions perform equivalently 355bd8deadSopenharmony_ci to the single-sample mode. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci An additional buffer, called the multisample buffer, is added to 385bd8deadSopenharmony_ci the framebuffer. Pixel sample values, including color, depth, and 395bd8deadSopenharmony_ci stencil values, are stored in this buffer. When the framebuffer 405bd8deadSopenharmony_ci includes a multisample buffer, it does not also include separate 415bd8deadSopenharmony_ci depth or stencil buffers, even if the multisample buffer does not 425bd8deadSopenharmony_ci store depth or stencil values. Color buffers (left/right, front/ 435bd8deadSopenharmony_ci back, and aux) do coexist with the multisample buffer, however. 445bd8deadSopenharmony_ci 455bd8deadSopenharmony_ci Multisample antialiasing is most valuable for rendering polygons, 465bd8deadSopenharmony_ci because it requires no sorting for hidden surface elimination, and 475bd8deadSopenharmony_ci it correctly handles adjacent polygons, object silhouettes, and 485bd8deadSopenharmony_ci even intersecting polygons. If only points or lines are being 495bd8deadSopenharmony_ci rendered, the "smooth" antialiasing mechanism provided by the base 505bd8deadSopenharmony_ci GL may result in a higher quality image. This extension is designed 515bd8deadSopenharmony_ci to allow multisample and smooth antialiasing techniques to be 525bd8deadSopenharmony_ci alternated during the rendering of a single scene. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ciIssues 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci * Should SamplePatternEXT be eliminated? Does anyone use this feature? 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci * Should WGL_SAMPLE_BUFFERS_EXT and SAMPLE_BUFFERS_EXT be eliminated? 595bd8deadSopenharmony_ci Given the current specification, applications that query only 605bd8deadSopenharmony_ci WGL_SAMPLES_EXT will be written, taking zero to mean that there is 615bd8deadSopenharmony_ci no multisample buffer. 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ciNew Procedures and Functions 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci void SampleMaskEXT(clampf value, 665bd8deadSopenharmony_ci boolean invert); 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci void SamplePatternEXT(enum pattern); 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ciNew Tokens 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ci Accepted by the <attribute> parameter of wglGetPixelFormatAttribivEXT, 735bd8deadSopenharmony_ci wglGetPixelFormatAttribfvEXT, and wglChoosePixelFormatExEXT: 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci WGL_SAMPLE_BUFFERS_EXT 0x2041 765bd8deadSopenharmony_ci WGL_SAMPLES_EXT 0x2042 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and 795bd8deadSopenharmony_ci by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and 805bd8deadSopenharmony_ci GetDoublev: 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci MULTISAMPLE_EXT 0x809D 835bd8deadSopenharmony_ci SAMPLE_ALPHA_TO_MASK_EXT 0x809E 845bd8deadSopenharmony_ci SAMPLE_ALPHA_TO_ONE_EXT 0x809F 855bd8deadSopenharmony_ci SAMPLE_MASK_EXT 0x80A0 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci Accepted by the <mask> parameter of PushAttrib: 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci MULTISAMPLE_BIT_EXT 0x20000000 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci Accepted by the <pattern> parameter of SamplePatternEXT: 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci 1PASS_EXT 0x80A1 945bd8deadSopenharmony_ci 2PASS_0_EXT 0x80A2 955bd8deadSopenharmony_ci 2PASS_1_EXT 0x80A3 965bd8deadSopenharmony_ci 4PASS_0_EXT 0x80A4 975bd8deadSopenharmony_ci 4PASS_1_EXT 0x80A5 985bd8deadSopenharmony_ci 4PASS_2_EXT 0x80A6 995bd8deadSopenharmony_ci 4PASS_3_EXT 0x80A7 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetDoublev, 1025bd8deadSopenharmony_ci GetIntegerv, and GetFloatv: 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci SAMPLE_BUFFERS_EXT 0x80A8 1055bd8deadSopenharmony_ci SAMPLES_EXT 0x80A9 1065bd8deadSopenharmony_ci SAMPLE_MASK_VALUE_EXT 0x80AA 1075bd8deadSopenharmony_ci SAMPLE_MASK_INVERT_EXT 0x80AB 1085bd8deadSopenharmony_ci SAMPLE_PATTERN_EXT 0x80AC 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.2 Specification (OpenGL Operation) 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ci None 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.2 Specification (Rasterization) 1155bd8deadSopenharmony_ci 1165bd8deadSopenharmony_ci If SAMPLE_BUFFERS_EXT is one, the rasterization of all GL primitives 1175bd8deadSopenharmony_ci is changed, and is referred to as multisample rasterization. Otherwise 1185bd8deadSopenharmony_ci primitive rasterization operates as it is described in the GL 1195bd8deadSopenharmony_ci specification, and is referred to as single-sample rasterization. The 1205bd8deadSopenharmony_ci value of SAMPLE_BUFFERS_EXT is an implementation dependent constant, and 1215bd8deadSopenharmony_ci is queried by calling GetIntegerv with <pname> set to SAMPLE_BUFFERS_EXT. 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci During multisample rendering the contents of a pixel fragment are 1245bd8deadSopenharmony_ci changed in two ways. First, each fragment includes a coverage mask 1255bd8deadSopenharmony_ci with SAMPLES_EXT bits. The value of SAMPLES_EXT is an implementation 1265bd8deadSopenharmony_ci dependent constant, and is queried by calling GetIntegerv with <pname> 1275bd8deadSopenharmony_ci set to SAMPLES_EXT. Second, each fragment includes SAMPLES_EXT depth 1285bd8deadSopenharmony_ci values, instead of the single depth value that is maintained in 1295bd8deadSopenharmony_ci single-sample rendering mode. Each pixel fragment thus consists of 1305bd8deadSopenharmony_ci integer x and y grid coordinates, a color, SAMPLES_EXT depth values, 1315bd8deadSopenharmony_ci texture coordinates, a coverage value, and the SAMPLES_EXT-bit mask. 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci The behavior of multisample rasterization is a function of 1345bd8deadSopenharmony_ci MULTISAMPLE_EXT, which is enabled and disabled by calling Enable or 1355bd8deadSopenharmony_ci Disable, with <cap> set to MULTISAMPLE_EXT. Its value is queried using 1365bd8deadSopenharmony_ci IsEnabled, with <cap> set to MULTISAMPLE_EXT. 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci If MULTISAMPLE_EXT is disabled, multisample rasterization of all 1395bd8deadSopenharmony_ci primitives is equivalent to single-sample rasterization, except that the 1405bd8deadSopenharmony_ci fragment coverage mask is set to all ones. The depth values may all 1415bd8deadSopenharmony_ci be set to the single value that would have been assigned by single-sample 1425bd8deadSopenharmony_ci rasterization, or they may be assigned as described below for 1435bd8deadSopenharmony_ci MULTISAMPLE_EXT-enabled multisample rasterization. 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci If MULTISAMPLE_EXT is enabled, multisample rasterization of all 1465bd8deadSopenharmony_ci primitives differs substantially from single-sample rasterization. 1475bd8deadSopenharmony_ci It is understood that each pixel in the framebuffer has SAMPLES_EXT 1485bd8deadSopenharmony_ci locations associated with it. These locations are exact positions, 1495bd8deadSopenharmony_ci rather than regions or areas, and each is referred to as a sample point. 1505bd8deadSopenharmony_ci The sample points associated with a pixel may be located inside or 1515bd8deadSopenharmony_ci outside of the unit square that is considered to bound the pixel. 1525bd8deadSopenharmony_ci Furthermore, the pattern (relative location) of sample points may 1535bd8deadSopenharmony_ci be identical for each pixel in the framebuffer, or it may differ. 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci The locations of the sample points are relatively static; they change 1565bd8deadSopenharmony_ci only when SamplePatternEXT is called, as a repeatable function of 1575bd8deadSopenharmony_ci parameter <pattern>. The default pattern 1PASS_EXT is designed to 1585bd8deadSopenharmony_ci produce a well antialiased result in a single rendering pass. Patterns 1595bd8deadSopenharmony_ci 2PASS_0_EXT and 2PASS_1_EXT together specify twice the number of 1605bd8deadSopenharmony_ci sample points per pixel. It is intended that a scene be completely 1615bd8deadSopenharmony_ci rendered using pattern 2PASS_0_EXT, then completely rendered again 1625bd8deadSopenharmony_ci using 2PASS_1_EXT. When these two images are averaged using the 1635bd8deadSopenharmony_ci accumulation buffer, the result is as if a single pass had been 1645bd8deadSopenharmony_ci rendered with a filter of twice SAMPLES_EXT sample points. Patterns 1655bd8deadSopenharmony_ci 4PASS_0_EXT, 4PASS_1_EXT, 4PASS_2_EXT, and 4PASS_3_EXT together define 1665bd8deadSopenharmony_ci a pattern of four times SAMPLES_EXT sample points. They can be used 1675bd8deadSopenharmony_ci to accumulate an image after four complete rendering passes. It is 1685bd8deadSopenharmony_ci not possible to query the actual sample locations of a pixel. The 1695bd8deadSopenharmony_ci sample pattern mode is queried by calling GetIntegerv with <pname> 1705bd8deadSopenharmony_ci set to SAMPLE_PATTERN_EXT. By default the sample pattern is 1PASS_EXT. 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci If the sample patterns differ per pixel, they should be aligned to 1735bd8deadSopenharmony_ci window, not screen, boundaries. Otherwise rendering results will be 1745bd8deadSopenharmony_ci window-position specific. The invariance requirement described 1755bd8deadSopenharmony_ci in section 3.1 is relaxed for all enabled multisample rendering, 1765bd8deadSopenharmony_ci because the sample patterns may be a function of pixel location. 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci 3.3.2 Point Multisample Rasterization 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci If MULTISAMPLE_EXT is enabled, and SAMPLE_BUFFERS_EXT is one, then 1815bd8deadSopenharmony_ci points are rasterized using the following algorithm, regardless of 1825bd8deadSopenharmony_ci whether point antialiasing (POINT_SMOOTH) is enabled or disabled. 1835bd8deadSopenharmony_ci Point rasterization produces a fragment for each framebuffer pixel 1845bd8deadSopenharmony_ci with one or more sample points that intersect the region lying within 1855bd8deadSopenharmony_ci the circle having diameter equal to the current point width and 1865bd8deadSopenharmony_ci centered at the point's (Xw,Yw). The coverage value for each fragment 1875bd8deadSopenharmony_ci is 1. Mask bits that correspond to sample points that intersect the 1885bd8deadSopenharmony_ci circular region are 1, other mask bits are 0. All depth values of the 1895bd8deadSopenharmony_ci fragment are assigned the depth value of the point being rasterized. 1905bd8deadSopenharmony_ci The data associated with each fragment are otherwise the data 1915bd8deadSopenharmony_ci associated with the point being rasterized. 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci Point size range and number of gradations are equivalent to those 1945bd8deadSopenharmony_ci supported for antialiased points. 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci 3.4.4 Line Multisample Rasterization 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci If MULTISAMPLE_EXT is enabled, and SAMPLE_BUFFERS_EXT is one, then 1995bd8deadSopenharmony_ci lines are rasterized using the following algorithm, regardless of 2005bd8deadSopenharmony_ci whether line antialiasing (LINE_SMOOTH) is enabled or disabled. Line 2015bd8deadSopenharmony_ci rasterization produces a fragment for each framebuffer pixel with one 2025bd8deadSopenharmony_ci or more sample points that intersect the rectangular region that is 2035bd8deadSopenharmony_ci described in the Antialiasing section of 3.4.2 (Other Line Segment 2045bd8deadSopenharmony_ci Features). If line stippling is enabled, the rectangular region is 2055bd8deadSopenharmony_ci subdivided into adjacent unit-length rectangles, with some rectangles 2065bd8deadSopenharmony_ci eliminated according to the procedure given under Line Stipple, where 2075bd8deadSopenharmony_ci "fragment" is replaced by "rectangle". 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci The coverage value for each fragment is 1. Mask bits that correspond 2105bd8deadSopenharmony_ci to sample points that intersect a retained rectangle are 1, other mask 2115bd8deadSopenharmony_ci bits are 0. Each depth value is produced by substituting the 2125bd8deadSopenharmony_ci corresponding sample location into equation 3.1, then using the 2135bd8deadSopenharmony_ci result to evaluate equation 3.3. The data associated with each 2145bd8deadSopenharmony_ci fragment are otherwise computed by evaluating equation 3.1 at the 2155bd8deadSopenharmony_ci fragment center, then substituting into equation 3.2. 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci Line width range and number of gradations are equivalent to those 2185bd8deadSopenharmony_ci supported for antialiased lines. 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci 3.5.7 Polygon Multisample Rasterization 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci If MULTISAMPLE_EXT is enabled, and SAMPLE_BUFFERS_EXT is one, then 2235bd8deadSopenharmony_ci polygons are rasterized using the following algorithm, regardless of 2245bd8deadSopenharmony_ci whether polygon antialiasing (POLYGON_SMOOTH) is enabled or disabled. 2255bd8deadSopenharmony_ci Polygon rasterization produces a fragment for each framebuffer pixel 2265bd8deadSopenharmony_ci with one or more sample points that satisfy the point sampling 2275bd8deadSopenharmony_ci criteria described in section 3.5.1, including the special treatment 2285bd8deadSopenharmony_ci for sample points that lie on a polygon boundary edge. If a polygon 2295bd8deadSopenharmony_ci is culled, based on its orientation and the CullFace mode, then no 2305bd8deadSopenharmony_ci fragments are produced during rasterization. Fragments are culled 2315bd8deadSopenharmony_ci by the polygon stipple just as they are for aliased and antialiased 2325bd8deadSopenharmony_ci polygons. 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci The coverage value for each fragment is 1. Mask bits that correspond 2355bd8deadSopenharmony_ci to sample points that satisfy the point sampling criteria are 1, other 2365bd8deadSopenharmony_ci mask bits are 0. Each depth value is produced by substituting the 2375bd8deadSopenharmony_ci corresponding sample location into the barycentric equations described 2385bd8deadSopenharmony_ci in section 3.5.1, using the approximation to equation 3.4 that omits 2395bd8deadSopenharmony_ci w components. The data associated with each fragment are otherwise 2405bd8deadSopenharmony_ci computed by barycentric evaluation using the fragment's center point. 2415bd8deadSopenharmony_ci 2425bd8deadSopenharmony_ci The rasterization described above applies only to the FILL state of 2435bd8deadSopenharmony_ci PolygonMode. For POINT and LINE, the rasterizations described in 2445bd8deadSopenharmony_ci 3.3.2 (Point Multisample Rasterization) and 3.4.4 (Line Multisample 2455bd8deadSopenharmony_ci Rasterization) apply. 2465bd8deadSopenharmony_ci 2475bd8deadSopenharmony_ci 3.6.6 Multisample Rasterization of Pixel Rectangles 2485bd8deadSopenharmony_ci 2495bd8deadSopenharmony_ci If MULTISAMPLE_EXT is enabled, and SAMPLE_BUFFERS_EXT is one, then 2505bd8deadSopenharmony_ci pixel rectangles are rasterized using the following algorithm. 2515bd8deadSopenharmony_ci Let (Xrp,Yrp) be the current raster position. (If the current raster 2525bd8deadSopenharmony_ci position is invalid, then DrawPixels is ignored.) If a particular 2535bd8deadSopenharmony_ci group (index or components) is the nth in a row and belongs to the 2545bd8deadSopenharmony_ci mth row, consider the region in window coordinates bounded by the 2555bd8deadSopenharmony_ci rectangle with corners 2565bd8deadSopenharmony_ci 2575bd8deadSopenharmony_ci (Xrp + Zx*n, Yrp + Zy*m) 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ci and 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci (Xrp + Zx*(n+1), Yrp + Zy*(m+1)) 2625bd8deadSopenharmony_ci 2635bd8deadSopenharmony_ci where Zx and Zy are the pixel zoom factors specified by PixelZoom, 2645bd8deadSopenharmony_ci and may each be either positive or negative. A fragment representing 2655bd8deadSopenharmony_ci group n,m is produced for each framebuffer pixel with one or more 2665bd8deadSopenharmony_ci sample points that lie inside, or on the bottom or left boundary, of 2675bd8deadSopenharmony_ci this rectangle. Each fragment so produced takes its associated data 2685bd8deadSopenharmony_ci from the group and from the current raster position, in a manner 2695bd8deadSopenharmony_ci consistent with the discussion in the Conversion to Fragments 2705bd8deadSopenharmony_ci subsection of section 3.6.4 of the GL specification. All depth 2715bd8deadSopenharmony_ci sample values are assigned the same value, taken either from the 2725bd8deadSopenharmony_ci group (if it is a depth component group) or from the current raster 2735bd8deadSopenharmony_ci position (if it is not). 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ci A single pixel rectangle will generate multiple, perhaps very many 2765bd8deadSopenharmony_ci fragments for the same framebuffer pixel, depending on the pixel zoom 2775bd8deadSopenharmony_ci factors. 2785bd8deadSopenharmony_ci 2795bd8deadSopenharmony_ci 3.7.1 Bitmap Multisample Rasterization 2805bd8deadSopenharmony_ci 2815bd8deadSopenharmony_ci If MULTISAMPLE_EXT is enabled, and SAMPLE_BUFFERS_EXT is one, then 2825bd8deadSopenharmony_ci bitmaps are rasterized using the following algorithm. If the current 2835bd8deadSopenharmony_ci raster position is invalid, the bitmap is ignored. Otherwise, a 2845bd8deadSopenharmony_ci screen-aligned array of pixel-size rectangles is constructed, with its 2855bd8deadSopenharmony_ci lower-left corner at (Xrp,Yrp), and its upper right corner at 2865bd8deadSopenharmony_ci (Xrp+w,Yrp+h), where w and h are the width and height of the bitmap. 2875bd8deadSopenharmony_ci Rectangles in this array are eliminated if the corresponding bit in the 2885bd8deadSopenharmony_ci bitmap is zero, and are retained otherwise. Bitmap rasterization 2895bd8deadSopenharmony_ci produces a fragment for each framebuffer pixel with one or more sample 2905bd8deadSopenharmony_ci points either inside or on the bottom or left edge of a retained 2915bd8deadSopenharmony_ci rectangle. 2925bd8deadSopenharmony_ci 2935bd8deadSopenharmony_ci The coverage value for each fragment is 1. Mask bits that correspond 2945bd8deadSopenharmony_ci to sample points either inside or on the bottom or left edge of a 2955bd8deadSopenharmony_ci retained rectangle are 1, other mask bits are 0. The associated data 2965bd8deadSopenharmony_ci for each fragment are those associated with the current raster 2975bd8deadSopenharmony_ci position. Once the fragments have been produced, the current raster 2985bd8deadSopenharmony_ci position is updated exactly as it is in the single-sample rasterization 2995bd8deadSopenharmony_ci case. 3005bd8deadSopenharmony_ci 3015bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations 3025bd8deadSopenharmony_ciand the Frame Buffer) 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci 4.1.2.5 Multisample Fragment Operations 3055bd8deadSopenharmony_ci 3065bd8deadSopenharmony_ci [This section follows section 4.1.2 (Scissor test) and precedes section 3075bd8deadSopenharmony_ci 4.1.3 (Alpha test)] 3085bd8deadSopenharmony_ci 3095bd8deadSopenharmony_ci This step modifies fragment alpha and mask values, based on the values 3105bd8deadSopenharmony_ci of SAMPLE_ALPHA_TO_MASK_EXT, SAMPLE_ALPHA_TO_ONE_EXT, SAMPLE_MASK_EXT, 3115bd8deadSopenharmony_ci SAMPLE_MASK_VALUE_EXT, and SAMPLE_MASK_INVERT_EXT. No changes to the 3125bd8deadSopenharmony_ci fragment alpha or mask values are made at this step if MULTISAMPLE_EXT 3135bd8deadSopenharmony_ci is disabled, or if SAMPLE_BUFFERS_EXT is zero. 3145bd8deadSopenharmony_ci 3155bd8deadSopenharmony_ci SAMPLE_ALPHA_TO_MASK_EXT, SAMPLE_ALPHA_TO_ONE_EXT, and SAMPLE_MASK_EXT 3165bd8deadSopenharmony_ci are enabled and disabled by calling Enable and Disable with <cap> 3175bd8deadSopenharmony_ci specified as one of the three token values. All three values are 3185bd8deadSopenharmony_ci queried by calling IsEnabled, with <cap> set to the desired token value. 3195bd8deadSopenharmony_ci If SAMPLE_ALPHA_TO_MASK_EXT is enabled, the fragment alpha value is 3205bd8deadSopenharmony_ci used to generate a temporary mask value, which is then ANDed with the 3215bd8deadSopenharmony_ci fragment mask value. Otherwise the fragment mask value is unchanged at 3225bd8deadSopenharmony_ci this point. 3235bd8deadSopenharmony_ci 3245bd8deadSopenharmony_ci This specification does not require a specific algorithm for converting 3255bd8deadSopenharmony_ci an alpha value to a temporary mask value. It is intended that the number 3265bd8deadSopenharmony_ci of 1's in the temporary mask be proportional to the alpha value, with 3275bd8deadSopenharmony_ci all 1's corresponding to the maximum alpha value, and all 0's 3285bd8deadSopenharmony_ci corresponding to an alpha value of 0. It is also intended that the 3295bd8deadSopenharmony_ci algorithm be pseudo-random in nature, to avoid image artifacts due 3305bd8deadSopenharmony_ci to regular mask patterns. The algorithm can and probably should be 3315bd8deadSopenharmony_ci different at different pixel locations. If it does differ, it should 3325bd8deadSopenharmony_ci be defined relative to window, not screen, coordinates, so that 3335bd8deadSopenharmony_ci rendering results are invariant with respect to window position. 3345bd8deadSopenharmony_ci 3355bd8deadSopenharmony_ci Next, if SAMPLE_ALPHA_TO_ONE_EXT is enabled, fragment alpha is replaced 3365bd8deadSopenharmony_ci by the maximum representable alpha value. Otherwise, fragment alpha 3375bd8deadSopenharmony_ci value is not changed. 3385bd8deadSopenharmony_ci 3395bd8deadSopenharmony_ci Finally, if SAMPLE_MASK_EXT is enabled, the fragment mask is ANDed 3405bd8deadSopenharmony_ci with another temporary mask. This temporary mask is generated in the 3415bd8deadSopenharmony_ci same manner as the one described above, but as a function of the value 3425bd8deadSopenharmony_ci of SAMPLE_MASK_VALUE_EXT. The function need not be identical, but it 3435bd8deadSopenharmony_ci must have the same properties of proportionality and invariance. If 3445bd8deadSopenharmony_ci SAMPLE_MASK_INVERT_EXT is TRUE, the temporary mask is inverted (all 3455bd8deadSopenharmony_ci bit values are inverted) before it is ANDed with the fragment mask. 3465bd8deadSopenharmony_ci 3475bd8deadSopenharmony_ci The values of SAMPLE_MASK_VALUE_EXT and SAMPLE_MASK_INVERT_EXT are 3485bd8deadSopenharmony_ci specified simultaneously by calling SampleMaskEXT, with <value> set 3495bd8deadSopenharmony_ci to the desired mask value, and <invert> set to TRUE or FALSE. <value> 3505bd8deadSopenharmony_ci is clamped to [0,1] before being stored as SAMPLE_MASK_VALUE_EXT. 3515bd8deadSopenharmony_ci SAMPLE_MASK_VALUE_EXT is queried by calling GetFloatv with <pname> set 3525bd8deadSopenharmony_ci to SAMPLE_MASK_VALUE_EXT. SAMPLE_MASK_INVERT_EXT is queried by calling 3535bd8deadSopenharmony_ci GetBooleanv with <pname> set to SAMPLE_MASK_INVERT_EXT. 3545bd8deadSopenharmony_ci 3555bd8deadSopenharmony_ci 4.1.9 Multisample Fragment Operations 3565bd8deadSopenharmony_ci 3575bd8deadSopenharmony_ci If the DrawBuffers mode is NONE, no change is made to any multisample 3585bd8deadSopenharmony_ci or color buffer. Otherwise, fragment processing is as described below. 3595bd8deadSopenharmony_ci 3605bd8deadSopenharmony_ci If MULTISAMPLE_EXT is enabled, and SAMPLE_BUFFERS_EXT is one, the 3615bd8deadSopenharmony_ci stencil test, depth test, blending, and dithering operations described 3625bd8deadSopenharmony_ci in sections 4.1.4, 4.1.5, 4.1.6, and 4.1.7 are performed for each 3635bd8deadSopenharmony_ci pixel sample, rather than just once for each fragment. Failure 3645bd8deadSopenharmony_ci of the stencil or depth test results in termination of the processing 3655bd8deadSopenharmony_ci of that sample, rather than discarding of the fragment. All operations 3665bd8deadSopenharmony_ci are performed on the color, depth, and stencil values stored in the 3675bd8deadSopenharmony_ci multisample buffer (to be described in a following section). The 3685bd8deadSopenharmony_ci contents of the color buffers are not modified at this point. 3695bd8deadSopenharmony_ci 3705bd8deadSopenharmony_ci Stencil, depth, blending, and dithering operations are performed 3715bd8deadSopenharmony_ci for a pixel sample only if that sample's fragment mask bit is 1. If 3725bd8deadSopenharmony_ci the corresponding mask bit is 0, no operations are performed for that 3735bd8deadSopenharmony_ci sample. Depth operations use the fragment depth value that is 3745bd8deadSopenharmony_ci specific to each sample. The single fragment color value is used for 3755bd8deadSopenharmony_ci all sample operations, however, as is the current stencil value. 3765bd8deadSopenharmony_ci 3775bd8deadSopenharmony_ci If MULTISAMPLE_EXT is disabled, and SAMPLE_BUFFERS_EXT is one, the 3785bd8deadSopenharmony_ci fragment may be treated exactly as described above, with optimization 3795bd8deadSopenharmony_ci possible because the fragment mask must be all 1's. Further 3805bd8deadSopenharmony_ci optimization is allowed, however. An implementation may choose to 3815bd8deadSopenharmony_ci identify a centermost sample, and to perform stencil and depth tests 3825bd8deadSopenharmony_ci on only that sample. Regardless of the outcome of the stencil test, 3835bd8deadSopenharmony_ci all multisample buffer stencil sample values are set to the appropriate 3845bd8deadSopenharmony_ci new stencil value. If the depth test passes, all multisample buffer 3855bd8deadSopenharmony_ci depth sample values are set to the depth of the fragment's centermost 3865bd8deadSopenharmony_ci sample's depth value, and all multisample buffer color sample values 3875bd8deadSopenharmony_ci are set to the color value of the incoming fragment. Otherwise, no 3885bd8deadSopenharmony_ci change is made to any multisample buffer color or depth value. 3895bd8deadSopenharmony_ci 3905bd8deadSopenharmony_ci After all operations have been completed on the multisample buffer, 3915bd8deadSopenharmony_ci the color sample values are combined to produce a single color value, 3925bd8deadSopenharmony_ci and that value is written into each color buffer that is currently 3935bd8deadSopenharmony_ci enabled, based on the DrawBuffers mode. The method of combination is 3945bd8deadSopenharmony_ci not specified, though a simple average computed independently for each 3955bd8deadSopenharmony_ci color component is recommended. 3965bd8deadSopenharmony_ci 3975bd8deadSopenharmony_ci 4.2.2.5 Fine Control of Multisample Buffer Updates 3985bd8deadSopenharmony_ci 3995bd8deadSopenharmony_ci When SAMPLE_BUFFERS_EXT is one, ColorMask, DepthMask, and StencilMask 4005bd8deadSopenharmony_ci control the modification of values in the multisample buffer. The 4015bd8deadSopenharmony_ci color mask has no effect on modifications to the color buffers. If 4025bd8deadSopenharmony_ci the color mask is entirely disabled, the color sample values must 4035bd8deadSopenharmony_ci still be combined (as described above) and the result used to replace 4045bd8deadSopenharmony_ci the color values of the buffers enabled by DrawBuffers. 4055bd8deadSopenharmony_ci 4065bd8deadSopenharmony_ci 4.2.3.5 Clearing the Multisample Buffer 4075bd8deadSopenharmony_ci 4085bd8deadSopenharmony_ci The color samples of the multisample buffer are cleared when one or 4095bd8deadSopenharmony_ci more color buffers are cleared, as specified by the Clear mask bit 4105bd8deadSopenharmony_ci COLOR_BUFFER_BIT and the DrawBuffers mode. If the DrawBuffers mode is 4115bd8deadSopenharmony_ci NONE, the color samples of the multisample buffer cannot be cleared. 4125bd8deadSopenharmony_ci 4135bd8deadSopenharmony_ci Clear mask bits DEPTH_BUFFER_BIT and STENCIL_BUFFER_BIT indicate that 4145bd8deadSopenharmony_ci the depth and stencil samples of the multisample buffer are to be 4155bd8deadSopenharmony_ci cleared. If Clear mask bit DEPTH_BUFFER_BIT is specified, and if 4165bd8deadSopenharmony_ci the DrawBuffers mode is not NONE, then the multisample depth buffer 4175bd8deadSopenharmony_ci samples are cleared. Likewise, if Clear mask bit STENCIL_BUFFER_BIT 4185bd8deadSopenharmony_ci is specified, and if the DrawBuffers mode is not NONE, then the 4195bd8deadSopenharmony_ci multisample stencil buffer is cleared. 4205bd8deadSopenharmony_ci 4215bd8deadSopenharmony_ci 4.3.2 Reading Pixels 4225bd8deadSopenharmony_ci 4235bd8deadSopenharmony_ci [These changes are made to the text in section 4.3.2, following the 4245bd8deadSopenharmony_ci subheading Obtaining Pixels from the Framebuffer.] 4255bd8deadSopenharmony_ci 4265bd8deadSopenharmony_ci Follow the sentence "If there is no depth buffer, the error 4275bd8deadSopenharmony_ci INVALID_OPERATION occurs." with: If there is a multisample buffer 4285bd8deadSopenharmony_ci (SAMPLE_BUFFERS_EXT is 1) then values are obtained from the depth 4295bd8deadSopenharmony_ci samples in this buffer. It is recommended that the depth value 4305bd8deadSopenharmony_ci of the centermost sample be used, though implementations may choose 4315bd8deadSopenharmony_ci any function of the depth sample values at each pixel. 4325bd8deadSopenharmony_ci 4335bd8deadSopenharmony_ci Follow the sentence "if there is no stencil buffer, the error 4345bd8deadSopenharmony_ci INVALID_OPERATION occurs." with: If there is a multisample buffer, 4355bd8deadSopenharmony_ci then values are obtained from the stencil samples in this buffer. 4365bd8deadSopenharmony_ci It is recommended that the stencil value of the centermost sample 4375bd8deadSopenharmony_ci be used, though implementations may choose any function of the stencil 4385bd8deadSopenharmony_ci sample values at each pixel. 4395bd8deadSopenharmony_ci 4405bd8deadSopenharmony_ci This extension makes no change to the way that color values are 4415bd8deadSopenharmony_ci obtained from the framebuffer. 4425bd8deadSopenharmony_ci 4435bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.0 Specification (Special Functions) 4445bd8deadSopenharmony_ci 4455bd8deadSopenharmony_ci None 4465bd8deadSopenharmony_ci 4475bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.0 Specification (State and State Requests) 4485bd8deadSopenharmony_ci 4495bd8deadSopenharmony_ci An additional group of state variables, MULTISAMPLE_BIT_EXT, is defined 4505bd8deadSopenharmony_ci by this extension. When PushAttrib is called with bit MULTISAMPLE_BIT_EXT 4515bd8deadSopenharmony_ci set, the multisample group of state variables is pushed onto the 4525bd8deadSopenharmony_ci attribute stack. When PopAttrib is called, these state variables are 4535bd8deadSopenharmony_ci restored to their previous values if they were pushed. Some multisample 4545bd8deadSopenharmony_ci state is included in the ENABLE_BIT group as well. In order to avoid 4555bd8deadSopenharmony_ci incompatibility with GL implementations that do not support 4565bd8deadSopenharmony_ci EXT_multisample, ALL_ATTRIB_BITS does not include MULTISAMPLE_BIT_EXT. 4575bd8deadSopenharmony_ci 4585bd8deadSopenharmony_ciAdditions to the WGL Specification 4595bd8deadSopenharmony_ci 4605bd8deadSopenharmony_ci The parameter WGL_SAMPLE_BUFFERS_EXT is added to wglGetPixelFormatAttrib*v. 4615bd8deadSopenharmony_ci When queried, by calling wglGetPixelFormatAttrib*v with <attributes> set 4625bd8deadSopenharmony_ci to WGL_SAMPLE_BUFFERS_EXT, it returns the number of multisample buffers 4635bd8deadSopenharmony_ci included in the pixel format. For a normal visual, the return value is 4645bd8deadSopenharmony_ci zero. A return value of one indicates that a single multisample buffer 4655bd8deadSopenharmony_ci is available. The number of samples per pixel is queried by calling 4665bd8deadSopenharmony_ci wglGetPixelFormatAttrib*v with <attrib> set to WGL_SAMPLES_EXT. It is 4675bd8deadSopenharmony_ci understood that the number of color, depth, and stencil bits per sample 4685bd8deadSopenharmony_ci in the multisample buffer are as specified by the WGL_*_SIZE parameters. 4695bd8deadSopenharmony_ci It is also understood that there are no single-sample depth or stencil 4705bd8deadSopenharmony_ci buffers associated with this visual -- the only depth and stencil 4715bd8deadSopenharmony_ci buffers are those in the multisample buffer. WGL_SAMPLES_EXT is zero 4725bd8deadSopenharmony_ci if WGL_SAMPLE_BUFFERS_EXT is zero. 4735bd8deadSopenharmony_ci 4745bd8deadSopenharmony_ci wglChoosePixelFormatEx accepts WGL_SAMPLE_BUFFERS_EXT in <attributes>, 4755bd8deadSopenharmony_ci followed by the minimum number of multisample buffers that can be 4765bd8deadSopenharmony_ci accepted. Pixel formats with the smallest number of multisample buffers 4775bd8deadSopenharmony_ci that meets or exceeds the specified minimum number are preferred. 4785bd8deadSopenharmony_ci Currently operation with more than one multisample buffer is undefined, 4795bd8deadSopenharmony_ci so the returned value will be either zero or one. 4805bd8deadSopenharmony_ci 4815bd8deadSopenharmony_ci wglChoosePixelFormatEx accepts WGL_SAMPLES_EXT in <attributes>, followed 4825bd8deadSopenharmony_ci by the minimum number of samples that can be accepted in the multisample 4835bd8deadSopenharmony_ci buffer. Visuals with the smallest number of samples that meets or 4845bd8deadSopenharmony_ci exceeds the specified minimum number are preferred. 4855bd8deadSopenharmony_ci 4865bd8deadSopenharmony_ci If the color samples in the multisample buffer store fewer bits than 4875bd8deadSopenharmony_ci are stored in the color buffers, this fact will not be reported 4885bd8deadSopenharmony_ci accurately. Presumably a compression scheme is being employed, and is 4895bd8deadSopenharmony_ci expected to maintain an aggregate resolution equal to that of the 4905bd8deadSopenharmony_ci color buffers. 4915bd8deadSopenharmony_ci 4925bd8deadSopenharmony_ciErrors 4935bd8deadSopenharmony_ci 4945bd8deadSopenharmony_ci INVALID_ENUM is generated if SamplePatternEXT parameter <pattern> is 4955bd8deadSopenharmony_ci not 1PASS_EXT, 2PASS_0_EXT, 2PASS_1_EXT, 4PASS_0_EXT, 4PASS_1_EXT, 4965bd8deadSopenharmony_ci 4PASS_2_EXT, or 4PASS_3_EXT. 4975bd8deadSopenharmony_ci 4985bd8deadSopenharmony_ci INVALID_OPERATION is generated if SampleMaskEXT or SamplePatternEXT 4995bd8deadSopenharmony_ci is called between the execution of Begin and the execution of the 5005bd8deadSopenharmony_ci corresponding End. 5015bd8deadSopenharmony_ci 5025bd8deadSopenharmony_ciNew State 5035bd8deadSopenharmony_ci 5045bd8deadSopenharmony_ci Get Value Get Command Type Initial Value Attribute 5055bd8deadSopenharmony_ci --------- ----------- ---- ------------- --------- 5065bd8deadSopenharmony_ci MULTISAMPLE_EXT IsEnabled B TRUE multisample/enable 5075bd8deadSopenharmony_ci SAMPLE_ALPHA_TO_MASK_EXT IsEnabled B FALSE multisample/enable 5085bd8deadSopenharmony_ci SAMPLE_ALPHA_TO_ONE_EXT IsEnabled B FALSE multisample/enable 5095bd8deadSopenharmony_ci SAMPLE_MASK_EXT IsEnabled B FALSE multisample/enable 5105bd8deadSopenharmony_ci SAMPLE_MASK_VALUE_EXT GetFloatv R+ 1 multisample 5115bd8deadSopenharmony_ci SAMPLE_MASK_INVERT_EXT GetBooleanv B FALSE multisample 5125bd8deadSopenharmony_ci SAMPLE_PATTERN_EXT GetIntegerv Z7 1PASS_EXT multisample 5135bd8deadSopenharmony_ci 5145bd8deadSopenharmony_ciNew Implementation Dependent State 5155bd8deadSopenharmony_ci 5165bd8deadSopenharmony_ci Get Value Get Command Type Minimum Value 5175bd8deadSopenharmony_ci --------- ----------- ---- ------------- 5185bd8deadSopenharmony_ci SAMPLE_BUFFERS_EXT GetIntegerv Z+ 0 5195bd8deadSopenharmony_ci SAMPLES_EXT GetIntegerv Z+ 0 5205bd8deadSopenharmony_ci 5215bd8deadSopenharmony_ciRevision History 5225bd8deadSopenharmony_ci 5235bd8deadSopenharmony_ci April 19, 2000 - assigned extension #209. 5245bd8deadSopenharmony_ci June 1999 - added to the OpenGL extension registry. 5255bd8deadSopenharmony_ci January 1999 - Written by Intergraph. 526