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