15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_fragment_program 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_fragment_program 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Bob Beretta 125bd8deadSopenharmony_ci Pat Brown 135bd8deadSopenharmony_ci Matt Craighead 145bd8deadSopenharmony_ci Cass Everitt 155bd8deadSopenharmony_ci Evan Hart 165bd8deadSopenharmony_ci Jon Leech 175bd8deadSopenharmony_ci Bill Licea-Kane 185bd8deadSopenharmony_ci Bimal Poddar 195bd8deadSopenharmony_ci Jeremy Sandmel 205bd8deadSopenharmony_ci Jon Paul Schelter 215bd8deadSopenharmony_ci Avinash Seetharamaiah 225bd8deadSopenharmony_ci Nick Triantos 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci and contributors to the ARB_vertex_program working group, 255bd8deadSopenharmony_ci the product of which provided the basis for this spec 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciContact 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci Benj Lipchak, AMD (benj.lipchak 'at' amd.com) 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ciNotice 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ci Copyright (c) 2002-2013 The Khronos Group Inc. Copyright terms at 345bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ciSpecification Update Policy 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 395bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 405bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 415bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 425bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 435bd8deadSopenharmony_ci described in more detail at 445bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ciIP Status 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci Microsoft claims to own intellectual property related to this 495bd8deadSopenharmony_ci extension. 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ciStatus 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci Complete. Approved by ARB on September 18, 2002 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ciVersion 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ci Last Modified Date: October 8, 2013 585bd8deadSopenharmony_ci Revision: 28 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ciNumber 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci ARB Extension #27 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ciDependencies 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci The extension is written against the OpenGL 1.3 Specification. 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci OpenGL 1.3 is required. 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ci EXT_texture_lod_bias or OpenGL 1.4 is required. 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ci OpenGL 1.4 affects the definition of this extension. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci ARB_vertex_blend and EXT_vertex_weighting affect the definition of 755bd8deadSopenharmony_ci this extension. 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci ARB_matrix_palette affects the definition of this extension. 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci ARB_transpose_matrix affects the definition of this extension. 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci EXT_fog_coord affects the definition of this extension. 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci EXT_texture_rectangle affects the definition of this extension. 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci ARB_shadow interacts with this extension. 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci ARB_vertex_program interacts with this extension. 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci ATI_fragment_shader interacts with this extension. 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci NV_fragment_program interacts with this extension. 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ciOverview 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci Unextended OpenGL mandates a certain set of configurable per- 975bd8deadSopenharmony_ci fragment computations defining texture application, texture 985bd8deadSopenharmony_ci environment, color sum, and fog operations. Several extensions have 995bd8deadSopenharmony_ci added further per-fragment computations to OpenGL. For example, 1005bd8deadSopenharmony_ci extensions have defined new texture environment capabilities 1015bd8deadSopenharmony_ci (ARB_texture_env_add, ARB_texture_env_combine, ARB_texture_env_dot3, 1025bd8deadSopenharmony_ci ARB_texture_env_crossbar), per-fragment depth comparisons 1035bd8deadSopenharmony_ci (ARB_depth_texture, ARB_shadow, ARB_shadow_ambient, 1045bd8deadSopenharmony_ci EXT_shadow_funcs), per-fragment lighting (EXT_fragment_lighting, 1055bd8deadSopenharmony_ci EXT_light_texture), and environment mapped bump mapping 1065bd8deadSopenharmony_ci (ATI_envmap_bumpmap). 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci Each such extension adds a small set of relatively inflexible per- 1095bd8deadSopenharmony_ci fragment computations. 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci This inflexibility is in contrast to the typical flexibility 1125bd8deadSopenharmony_ci provided by the underlying programmable floating point engines 1135bd8deadSopenharmony_ci (whether micro-coded fragment engines, DSPs, or CPUs) that are 1145bd8deadSopenharmony_ci traditionally used to implement OpenGL's texturing computations. 1155bd8deadSopenharmony_ci The purpose of this extension is to expose to the OpenGL application 1165bd8deadSopenharmony_ci writer a significant degree of per-fragment programmability for 1175bd8deadSopenharmony_ci computing fragment parameters. 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci For the purposes of discussing this extension, a fragment program is 1205bd8deadSopenharmony_ci a sequence of floating-point 4-component vector operations that 1215bd8deadSopenharmony_ci determines how a set of program parameters (not specific to an 1225bd8deadSopenharmony_ci individual fragment) and an input set of per-fragment parameters are 1235bd8deadSopenharmony_ci transformed to a set of per-fragment result parameters. 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci The per-fragment computations for standard OpenGL given a particular 1265bd8deadSopenharmony_ci set of texture and fog application modes (along with any state for 1275bd8deadSopenharmony_ci extensions defining per-fragment computations) is, in essence, a 1285bd8deadSopenharmony_ci fragment program. However, the sequence of operations is defined 1295bd8deadSopenharmony_ci implicitly by the current OpenGL state settings rather than defined 1305bd8deadSopenharmony_ci explicitly as a sequence of instructions. 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci This extension provides an explicit mechanism for defining fragment 1335bd8deadSopenharmony_ci program instruction sequences for application-defined fragment 1345bd8deadSopenharmony_ci programs. In order to define such fragment programs, this extension 1355bd8deadSopenharmony_ci defines a fragment programming model including a floating-point 1365bd8deadSopenharmony_ci 4-component vector instruction set and a relatively large set of 1375bd8deadSopenharmony_ci floating-point 4-component registers. 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci The extension's fragment programming model is designed for efficient 1405bd8deadSopenharmony_ci hardware implementation and to support a wide variety of fragment 1415bd8deadSopenharmony_ci programs. By design, the entire set of existing fragment programs 1425bd8deadSopenharmony_ci defined by existing OpenGL per-fragment computation extensions can 1435bd8deadSopenharmony_ci be implemented using the extension's fragment programming model. 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ciIssues 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci This extension is closely related to ARB_vertex_program, and is in 1485bd8deadSopenharmony_ci sync with revision 36 of that spec. ARB_fragment_program will 1495bd8deadSopenharmony_ci continue to track changes made to ARB_vertex_program. 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci (1) Should we provide precision queries? 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci RESOLVED: We've decided not to include precision queries. 1545bd8deadSopenharmony_ci Implementations are expected to meet or exceed the precision 1555bd8deadSopenharmony_ci guidelines set forth in the core GL spec, section 2.1.1, p. 6, 1565bd8deadSopenharmony_ci as ammended by this extension. 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci To summarize section 2.1.1, the maximum representable magnitude of 1595bd8deadSopenharmony_ci colors must be at least 2^10, while the maximum representable 1605bd8deadSopenharmony_ci magnitude of other floating-point values must be at least 2^32. 1615bd8deadSopenharmony_ci The individual results of floating-point operations must be 1625bd8deadSopenharmony_ci accurate to about 1 part in 10^5. 1635bd8deadSopenharmony_ci 1645bd8deadSopenharmony_ci Here are the reasons why precision queries were not included: 1655bd8deadSopenharmony_ci 1. It is unclear what the queries should be: 1665bd8deadSopenharmony_ci a) min, max, [0,1) granularity 1675bd8deadSopenharmony_ci b) min +, max +, min -, max -, [0,1) granularity 1685bd8deadSopenharmony_ci c) IEEE mantissa bits, IEEE exponent bits 1695bd8deadSopenharmony_ci 2. Due to instruction emulation, there is no way to query the 1705bd8deadSopenharmony_ci actual precision that can be expected. Should the query 1715bd8deadSopenharmony_ci return the best-case or worst-case precision? 1725bd8deadSopenharmony_ci 3. Implementations may support multiple precisions, on a per- 1735bd8deadSopenharmony_ci instruction basis or across the board. How would this be 1745bd8deadSopenharmony_ci exposed? 1755bd8deadSopenharmony_ci 4. Current implementations are able to meet the minimum 1765bd8deadSopenharmony_ci requirements specified in the core GL, thanks to its 1775bd8deadSopenharmony_ci sufficiently loose wording "... so that the individual 1785bd8deadSopenharmony_ci results of floating-point operations are accurate to ABOUT 1795bd8deadSopenharmony_ci 1 part in 10^5." (Emphasis added.) 1805bd8deadSopenharmony_ci 5. A conformance test can act as watchdog to ensure 1815bd8deadSopenharmony_ci implementations are not cutting corners on precision. 1825bd8deadSopenharmony_ci 6. Adding precision queries would require a new entrypoint. 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci See issue 22 regarding reduced-precision modes. 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci (2) Should the LOD biased texture sample be optional? 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci RESOLVED: TXB support is mandatory. This exposes useful 1895bd8deadSopenharmony_ci functionality which enables blurring and sharpening effects. It 1905bd8deadSopenharmony_ci will be more useful to entirely override derivatives (scale 1915bd8deadSopenharmony_ci factor) rather than just biasing the level-of-detail. This would 1925bd8deadSopenharmony_ci be a future extension to fragment programs. 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci It should be noted here that the bias introduced per-fragment by 1955bd8deadSopenharmony_ci TXB is added to any per-object or per-stage LOD bias. If per- 1965bd8deadSopenharmony_ci fragment LOD bias is not necessary, using the per-object and/or 1975bd8deadSopenharmony_ci per-stage LOD biases may perform better. 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ci (3) Should we include the ability to bind to the color matrix? How 2005bd8deadSopenharmony_ci about others? Program matrices? 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ci RESOLVED: We will not specifically add anything that depends on 2035bd8deadSopenharmony_ci the ARB_imaging subset. So we have not included matrix bindings 2045bd8deadSopenharmony_ci to the color matrix (or parameter bindings to the color biases, 2055bd8deadSopenharmony_ci etc.). However, we have included matrix binding support and 2065bd8deadSopenharmony_ci support for all of the matrices present in ARB_vertex_program. 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci (4) Should we include the ability to bind to just a texcoord 2095bd8deadSopenharmony_ci attribute's S,T components? (Or just S, or S,T,P for that matter?) 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci RESOLVED: No. Issue #15 below obviates this issue by making the 2125bd8deadSopenharmony_ci texture coordinate usage within a program explicit, thereby making 2135bd8deadSopenharmony_ci optimizations to reduce the number of interpolated texture 2145bd8deadSopenharmony_ci coordinates something an implementation can do at compile time 2155bd8deadSopenharmony_ci instead of having to do it during every texture target change. 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci (5) What other instructions should be added? Should any be removed? 2185bd8deadSopenharmony_ci 2195bd8deadSopenharmony_ci RESOLVED: The differences between the ARB_vertex_program 2205bd8deadSopenharmony_ci instruction set and the ARB_fragment_program instruction set are 2215bd8deadSopenharmony_ci minimal. ARB_fragment_program removes the LOG and EXP rough 2225bd8deadSopenharmony_ci approximation instructions and the ARL address register load 2235bd8deadSopenharmony_ci instruction. ARB_fragment_program adds the SIN/COS/SCS 2245bd8deadSopenharmony_ci trigonometric instructions, the LRP linear interpolation 2255bd8deadSopenharmony_ci instruction, the CMP compare instruction, and the TEX/TXP/TXB/KIL 2265bd8deadSopenharmony_ci texture instructions. 2275bd8deadSopenharmony_ci 2285bd8deadSopenharmony_ci (6) Should depth output be a program option or a mandatory feature? 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ci RESOLVED: Depth output capability should be mandatory. 2315bd8deadSopenharmony_ci 2325bd8deadSopenharmony_ci (6a) How should per-vertex geometric depth clipping be handled when 2335bd8deadSopenharmony_ci replacing depth in a fragment program? 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ci RESOLVED: Per-vertex geometric depth clipping should be performed 2365bd8deadSopenharmony_ci by the GL as usual, so no spec change is required. The ideal 2375bd8deadSopenharmony_ci behavior would be to disable near and far clipping planes when 2385bd8deadSopenharmony_ci replacing depth, but not all implementations can natively support 2395bd8deadSopenharmony_ci disabling individual clip planes. 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci (6b) How should depth output from the fragment program be further 2425bd8deadSopenharmony_ci processed before being handed to the per-fragment operations? 2435bd8deadSopenharmony_ci 2445bd8deadSopenharmony_ci RESOLVED: Depth gets clamped by GL to [0,1]. App has access to 2455bd8deadSopenharmony_ci depth range as a bindable parameter if it wants to either scale 2465bd8deadSopenharmony_ci and bias its depth to fall within the depth range, or to kill 2475bd8deadSopenharmony_ci fragments outside the depth range. 2485bd8deadSopenharmony_ci 2495bd8deadSopenharmony_ci (7) If a fragment program does not write a color value, what should 2505bd8deadSopenharmony_ci be the final color of the fragment? 2515bd8deadSopenharmony_ci 2525bd8deadSopenharmony_ci RESOLVED: The final fragment color is undefined. Note that it may 2535bd8deadSopenharmony_ci be perfectly reasonable to have a program that computes depth 2545bd8deadSopenharmony_ci values but not colors. Fragment colors are often irrelevant if 2555bd8deadSopenharmony_ci color writes are disabled (via ColorMask). 2565bd8deadSopenharmony_ci 2575bd8deadSopenharmony_ci (7a) If a fragment program does not write a depth value, what should 2585bd8deadSopenharmony_ci be the final depth value of the fragment? 2595bd8deadSopenharmony_ci 2605bd8deadSopenharmony_ci RESOLVED: "Depth fly-over" (using the conventional depth produced 2615bd8deadSopenharmony_ci by rasterization) should happen whenever a depth-replacing program 2625bd8deadSopenharmony_ci is not in use. A depth-replacing program is defined as a program 2635bd8deadSopenharmony_ci that writes to result.depth in at least one instruction. The 2645bd8deadSopenharmony_ci presence of a depth declaration alone DOES NOT designate a depth- 2655bd8deadSopenharmony_ci replacing program. The intention is that a future extension 2665bd8deadSopenharmony_ci introducing conditional execution will still consider a program to 2675bd8deadSopenharmony_ci be depth-replacing even if the instruction(s) writing to 2685bd8deadSopenharmony_ci result.depth do(es) not execute. 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ci Other considered definitions of depth-replacing program: 2715bd8deadSopenharmony_ci 1. The presence of a depth declaration -OR- the use of 2725bd8deadSopenharmony_ci result.depth as an instruction destination anywhere in the 2735bd8deadSopenharmony_ci program designates a depth-replacing program. 2745bd8deadSopenharmony_ci 2. Every program is a depth-replacing program, but the GL 2755bd8deadSopenharmony_ci initializes the depth output to be the depth produced by 2765bd8deadSopenharmony_ci rasterization. The app may then overwrite the depth output. 2775bd8deadSopenharmony_ci 3. Every program is a depth-replacing program, and the app is 2785bd8deadSopenharmony_ci solely responsible for copying the depth input to depth 2795bd8deadSopenharmony_ci output if desired. 2805bd8deadSopenharmony_ci 2815bd8deadSopenharmony_ci (8) Should relative addressing, like that defined in 2825bd8deadSopenharmony_ci ARB_vertex_program, be supported in this spec? 2835bd8deadSopenharmony_ci 2845bd8deadSopenharmony_ci RESOLVED: No, relative addressing won't be included in this spec. 2855bd8deadSopenharmony_ci 2865bd8deadSopenharmony_ci (9) Should full-featured operand component swizzling, like that 2875bd8deadSopenharmony_ci defined in ARB_vertex_program, be supported in this spec? 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci RESOLVED: Yes, full swizzling is mandatory. 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci (10) Should texture instructions contain specific limitations on 2925bd8deadSopenharmony_ci operations that can be performed? For example, should write masks 2935bd8deadSopenharmony_ci or operand component swizzling be disallowed? 2945bd8deadSopenharmony_ci 2955bd8deadSopenharmony_ci RESOLVED: Texture instructions are specified to be very similar to 2965bd8deadSopenharmony_ci ALU instructions. They have been given 3-letter names, they allow 2975bd8deadSopenharmony_ci writemasking and saturation (which would be useful for floating- 2985bd8deadSopenharmony_ci point texture formats), source swizzles and negates, and the 2995bd8deadSopenharmony_ci ability to use parameters as sources. 3005bd8deadSopenharmony_ci 3015bd8deadSopenharmony_ci (11) Should we standardize options for stencil or aux data buffer 3025bd8deadSopenharmony_ci outputs? 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci RESOLVED: Stencil and aux data buffers will be saved for a 3055bd8deadSopenharmony_ci possible future extension to fragment programs. 3065bd8deadSopenharmony_ci 3075bd8deadSopenharmony_ci (12) Should depth output be pulled from the 3rd or 4th component? 3085bd8deadSopenharmony_ci 3095bd8deadSopenharmony_ci RESOLVED: 3rd component, as the 3rd component is also used for 3105bd8deadSopenharmony_ci depth input from the "fragment.position" attribute. 3115bd8deadSopenharmony_ci 3125bd8deadSopenharmony_ci (13) Which stages are subsumed by fragment programs? 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci RESOLVED: Texturing, color sum, and fog. 3155bd8deadSopenharmony_ci 3165bd8deadSopenharmony_ci (14) What should the minimum resource limits be? 3175bd8deadSopenharmony_ci 3185bd8deadSopenharmony_ci RESOLVED: 10 attributes, 24 parameters, 4 texture indirections, 3195bd8deadSopenharmony_ci 48 ALU instructions, 24 texture instructions, and 16 temporaries. 3205bd8deadSopenharmony_ci 3215bd8deadSopenharmony_ci (15) OpenGL provides a hierarchy of texture enables (cube map, 3D, 3225bd8deadSopenharmony_ci 2D, 1D). Should the texture sampling instructions here override 3235bd8deadSopenharmony_ci that hierarchy and select specific texture targets? 3245bd8deadSopenharmony_ci 3255bd8deadSopenharmony_ci RESOLVED: Yes. This removes a potential pitfall for developers: 3265bd8deadSopenharmony_ci leaving the hierarchy of enables in an undesired state. It makes 3275bd8deadSopenharmony_ci programs more readable as the intent of the sample is more 3285bd8deadSopenharmony_ci obvious. Finally, it allows compilers to be more aggressive as 3295bd8deadSopenharmony_ci to which texcoord components are "don't cares" without having to 3305bd8deadSopenharmony_ci recompile programs when fixed-function texenables change. One 3315bd8deadSopenharmony_ci drawback is that programs cannot be reused for both 2D and 3D 3325bd8deadSopenharmony_ci texturing, for example, by simply changing the texture enables. 3335bd8deadSopenharmony_ci 3345bd8deadSopenharmony_ci Texture sampling can be specified by instructions like 3355bd8deadSopenharmony_ci 3365bd8deadSopenharmony_ci TEX myTexel, fragment.texcoord[1], texture[2], 3D; 3375bd8deadSopenharmony_ci 3385bd8deadSopenharmony_ci which would indicate to use texture coordinate set number 1 to 3395bd8deadSopenharmony_ci sample from the texture object bound to the TEXTURE_3D target on 3405bd8deadSopenharmony_ci texture image unit 2. 3415bd8deadSopenharmony_ci 3425bd8deadSopenharmony_ci Each texture unit can have only one "active" target. Programs are 3435bd8deadSopenharmony_ci not allowed to reference different texture targets in the same 3445bd8deadSopenharmony_ci texture image unit. In the example above, any other texture 3455bd8deadSopenharmony_ci instructions using texture image unit 2 must specify the 3D 3465bd8deadSopenharmony_ci texture target. 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ci Note that every texture image unit always has a texture bound to 3495bd8deadSopenharmony_ci every texture target, whether it is a named texture object or a 3505bd8deadSopenharmony_ci default texture. However, the texture may not be complete as 3515bd8deadSopenharmony_ci defined in section 3.8.9 of the core GL spec. See issue 23. 3525bd8deadSopenharmony_ci 3535bd8deadSopenharmony_ci (16) Should aux texture units be additional units on top of existing 3545bd8deadSopenharmony_ci full-featured texture units, or should this spec fully deprecate 3555bd8deadSopenharmony_ci "legacy" texture units and only expose texture coordinate sets and 3565bd8deadSopenharmony_ci texture image units? 3575bd8deadSopenharmony_ci 3585bd8deadSopenharmony_ci Background: Some implementations are able to expose more 3595bd8deadSopenharmony_ci "texture image units" (texture maps and associated parameters) 3605bd8deadSopenharmony_ci than "texture coordinate sets" (current texcoords, texgen, and 3615bd8deadSopenharmony_ci texture matrices). A conventional GL "texture unit" encompasses 3625bd8deadSopenharmony_ci both a texture image unit and a texture coordinate set as well as 3635bd8deadSopenharmony_ci texture environment state. 3645bd8deadSopenharmony_ci 3655bd8deadSopenharmony_ci RESOLVED: Yes, deprecate "legacy" texture units. This is a more 3665bd8deadSopenharmony_ci flexible model. 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ci (17) Should fragment programs affect all fragments, or just those 3695bd8deadSopenharmony_ci produced by the rasterization of points, lines, and triangles? 3705bd8deadSopenharmony_ci 3715bd8deadSopenharmony_ci RESOLVED: Every fragment generated by the GL is subject to 3725bd8deadSopenharmony_ci fragment program mode. This includes point, line, and polygon 3735bd8deadSopenharmony_ci primitives as well as pixel rectangles and bitmaps. 3745bd8deadSopenharmony_ci 3755bd8deadSopenharmony_ci (18) Should per-fragment position and fogcoord be bindable as 3765bd8deadSopenharmony_ci fragment attributes? 3775bd8deadSopenharmony_ci 3785bd8deadSopenharmony_ci RESOLVED: Yes, interpolated fogcoord will make per-fragment 3795bd8deadSopenharmony_ci fog application possible, in addition to full fog stage 3805bd8deadSopenharmony_ci subsummation. Interpolated window position, especially depth, 3815bd8deadSopenharmony_ci enables interesting depth-replacing algorithms. 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci (19) What characters should be used to identify individual 3845bd8deadSopenharmony_ci components in swizzle selectors and write masks? 3855bd8deadSopenharmony_ci 3865bd8deadSopenharmony_ci RESOLVED: ARB_vertex_program provides "xyzw". This extension 3875bd8deadSopenharmony_ci supports "xyzw" and also provides "rgba" for better readability 3885bd8deadSopenharmony_ci when dealing with RGBA color values. Adding support for special 3895bd8deadSopenharmony_ci identifiers for dealing with texture coordinates was considered 3905bd8deadSopenharmony_ci and rejected. "strq" could be used to identify texture coordinate 3915bd8deadSopenharmony_ci components, but the "r" would conflict with the "r" from "rgba". 3925bd8deadSopenharmony_ci "stpq" would be another possibility, but could be a source of 3935bd8deadSopenharmony_ci confusion. 3945bd8deadSopenharmony_ci 3955bd8deadSopenharmony_ci (20) Should implementations be required to support all programs that 3965bd8deadSopenharmony_ci fit within the exported limits on the number of resources (e.g., 3975bd8deadSopenharmony_ci instructions, temporaries) that can be present in a program, even if 3985bd8deadSopenharmony_ci it means falling back to software? Should implementations be 3995bd8deadSopenharmony_ci required to reject programs that could never be accelerated? 4005bd8deadSopenharmony_ci 4015bd8deadSopenharmony_ci RESOLVED: No and no. An implementation is allowed to fail 4025bd8deadSopenharmony_ci ProgramStringARB due to the program exceeding native resources. 4035bd8deadSopenharmony_ci Note that this failure must be invariant with respect to all other 4045bd8deadSopenharmony_ci OpenGL state. In other words, a program cannot succeed to load 4055bd8deadSopenharmony_ci with default state, but then fail to load when certain GL state 4065bd8deadSopenharmony_ci is altered. However, an implementation is not required to fail 4075bd8deadSopenharmony_ci when a program would exceed native resources, and is in fact 4085bd8deadSopenharmony_ci encouraged to fallback to a software path. See issue 21 for a way 4095bd8deadSopenharmony_ci of determining if this has happened. 4105bd8deadSopenharmony_ci 4115bd8deadSopenharmony_ci This notable departure from ARB_vertex_program was made as an 4125bd8deadSopenharmony_ci accommodation to vendors who could not justify implementing a 4135bd8deadSopenharmony_ci software fallback path which would be relatively slow even 4145bd8deadSopenharmony_ci compared to an ARB_vertex_program software fallback path. 4155bd8deadSopenharmony_ci 4165bd8deadSopenharmony_ci Two issues with this decision: 4175bd8deadSopenharmony_ci 1. The API limits become hints, and one can no longer tell by 4185bd8deadSopenharmony_ci visual inspection whether or not a program will load on 4195bd8deadSopenharmony_ci every implementation. 4205bd8deadSopenharmony_ci 2. Program loading will now depend on the optimizer, which may 4215bd8deadSopenharmony_ci vary from release to release of an implementation. A 4225bd8deadSopenharmony_ci program that succeeded to load when an ISV first wrote it 4235bd8deadSopenharmony_ci may fail to load in a future driver version, and vice versa. 4245bd8deadSopenharmony_ci 4255bd8deadSopenharmony_ci (21) How can applications determine if their programs are too large 4265bd8deadSopenharmony_ci to run on the native (likely hardware) implementation, and therefore may 4275bd8deadSopenharmony_ci run with reduced performance? 4285bd8deadSopenharmony_ci 4295bd8deadSopenharmony_ci RESOLVED: The following code snippet uses a native resource 4305bd8deadSopenharmony_ci query to guarantee a program is loaded natively (or not at all): 4315bd8deadSopenharmony_ci 4325bd8deadSopenharmony_ci GLboolean ProgramStringIsNative(GLenum target, GLenum format, 4335bd8deadSopenharmony_ci GLsizei len, const void *string) 4345bd8deadSopenharmony_ci { 4355bd8deadSopenharmony_ci GLint errorPos, isNative; 4365bd8deadSopenharmony_ci glProgramStringARB(target, format, len, string); 4375bd8deadSopenharmony_ci glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos); 4385bd8deadSopenharmony_ci glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, 4395bd8deadSopenharmony_ci GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB, &isNative); 4405bd8deadSopenharmony_ci if ((errorPos == -1) && (isNative == 1)) 4415bd8deadSopenharmony_ci return GL_TRUE; 4425bd8deadSopenharmony_ci else 4435bd8deadSopenharmony_ci return GL_FALSE; 4445bd8deadSopenharmony_ci } 4455bd8deadSopenharmony_ci 4465bd8deadSopenharmony_ci Note that a program that successfully loads, and falls under the 4475bd8deadSopenharmony_ci native limits, is still not guaranteed to execute in hardware. 4485bd8deadSopenharmony_ci Lack of other resources (e.g., texture memory) or the use of other 4495bd8deadSopenharmony_ci OpenGL features not natively supported by the implementation 4505bd8deadSopenharmony_ci (e.g., textures with borders) may also prevent the program from 4515bd8deadSopenharmony_ci executing in hardware. 4525bd8deadSopenharmony_ci 4535bd8deadSopenharmony_ci (22) Should we provide applications with a method to control the 4545bd8deadSopenharmony_ci level of precision used to carry out fragment program computations? 4555bd8deadSopenharmony_ci 4565bd8deadSopenharmony_ci RESOLVED: Yes. The GL implementation ultimately has control over 4575bd8deadSopenharmony_ci the level of precision used for fragment program computations. 4585bd8deadSopenharmony_ci However, the "ARB_precision_hint_fastest" and 4595bd8deadSopenharmony_ci "ARB_precision_hint_nicest" program options allow applications to 4605bd8deadSopenharmony_ci guide the GL implementation in its precision selection. The 4615bd8deadSopenharmony_ci "fastest" option encourages the GL to minimize execution time, 4625bd8deadSopenharmony_ci with possibly reduced precision. The "nicest" option encourages 4635bd8deadSopenharmony_ci the GL to maximize precision, with possibly increased execution 4645bd8deadSopenharmony_ci time. 4655bd8deadSopenharmony_ci 4665bd8deadSopenharmony_ci If the precision hint is not "fastest", GL implementations should 4675bd8deadSopenharmony_ci perform low-precision operations only if they could not 4685bd8deadSopenharmony_ci appreciably affect the final results of the program. Regardless 4695bd8deadSopenharmony_ci of the precision hint, GL implementations are discouraged from 4705bd8deadSopenharmony_ci reducing the precision of computations so aggressively that final 4715bd8deadSopenharmony_ci rendering results could be seriously compromised due to overflow 4725bd8deadSopenharmony_ci of intermediate values or insufficient number of mantissa bits. 4735bd8deadSopenharmony_ci 4745bd8deadSopenharmony_ci Some implementations may provide only a single level of precision, 4755bd8deadSopenharmony_ci in which case these hints may have no effect. However, all 4765bd8deadSopenharmony_ci implementations will accept these options, even if they are 4775bd8deadSopenharmony_ci silently ignored. 4785bd8deadSopenharmony_ci 4795bd8deadSopenharmony_ci More explicit control of precision, such as provided in "C" with 4805bd8deadSopenharmony_ci data types such as "short", "int", "float", "double", may also be 4815bd8deadSopenharmony_ci a desirable feature, but this level of detail is left to a 4825bd8deadSopenharmony_ci separate extension. 4835bd8deadSopenharmony_ci 4845bd8deadSopenharmony_ci (23) What is the result of a sample from an incomplete texture? 4855bd8deadSopenharmony_ci The definition of texture completeness can be found in section 3.8.9 4865bd8deadSopenharmony_ci of the core GL spec. 4875bd8deadSopenharmony_ci 4885bd8deadSopenharmony_ci RESOLVED: The result of a sample from an incomplete texture is the 4895bd8deadSopenharmony_ci constant vector (0,0,0,1). The benefit of defining the result to 4905bd8deadSopenharmony_ci be a constant is that broken apps are guaranteed to generate 4915bd8deadSopenharmony_ci unexpected (black) results from their bad samples. If we were to 4925bd8deadSopenharmony_ci leave the result undefined, some implementations may generate 4935bd8deadSopenharmony_ci expected results some of the time, for example when magfiltering, 4945bd8deadSopenharmony_ci giving app developers a false sense of correctness in their apps. 4955bd8deadSopenharmony_ci 4965bd8deadSopenharmony_ci (24) What is a texture indirection, and how is it counted? 4975bd8deadSopenharmony_ci 4985bd8deadSopenharmony_ci RESOLVED: On some implementations, fragment programs that have 4995bd8deadSopenharmony_ci complex texture dependency chains may not be supported, even if 5005bd8deadSopenharmony_ci the instruction counts fit within the exported limits. A texture 5015bd8deadSopenharmony_ci dependency occurs when a texture instruction depends on the 5025bd8deadSopenharmony_ci result of a previous instruction (ALU or texture) for use as its 5035bd8deadSopenharmony_ci texture coordinate. 5045bd8deadSopenharmony_ci 5055bd8deadSopenharmony_ci A texture indirection can be considered a node in the texture 5065bd8deadSopenharmony_ci dependency chain. Each node contains a set of texture 5075bd8deadSopenharmony_ci instructions which execute in parallel, followed by a sequence of 5085bd8deadSopenharmony_ci ALU instructions. A dependent texture instruction is one that 5095bd8deadSopenharmony_ci uses a temporary as an input coordinate rather than an attribute 5105bd8deadSopenharmony_ci or a parameter. A program with no dependent texture instructions 5115bd8deadSopenharmony_ci (or no texture instructions at all) will have a single node in 5125bd8deadSopenharmony_ci its texture dependency chain, and thus a single indirection. 5135bd8deadSopenharmony_ci 5145bd8deadSopenharmony_ci API-level texture indirections are counted by keeping track of 5155bd8deadSopenharmony_ci which temporaries are read and written within the current node in 5165bd8deadSopenharmony_ci the texture dependency chain. When a texture instruction is 5175bd8deadSopenharmony_ci encountered, an indirection may be added and a new node started 5185bd8deadSopenharmony_ci if either of the following two conditions is true: 5195bd8deadSopenharmony_ci 5205bd8deadSopenharmony_ci 1. the source coordinate of the texture instruction is a 5215bd8deadSopenharmony_ci temporary that has already been written in the current node, 5225bd8deadSopenharmony_ci either by a previous texture instruction or ALU instruction; 5235bd8deadSopenharmony_ci 5245bd8deadSopenharmony_ci 2. the result of the texture instruction is a temporary that 5255bd8deadSopenharmony_ci has already been read or written in the current node by an 5265bd8deadSopenharmony_ci ALU instruction. 5275bd8deadSopenharmony_ci 5285bd8deadSopenharmony_ci The texture instruction provoking a new indirection and all 5295bd8deadSopenharmony_ci subsequent instructions are added to the new node. This process 5305bd8deadSopenharmony_ci is repeated until the end of the program is encountered. Below 5315bd8deadSopenharmony_ci is some pseudo-code to describe this: 5325bd8deadSopenharmony_ci 5335bd8deadSopenharmony_ci indirections = 1; 5345bd8deadSopenharmony_ci tempsOutput = 0; 5355bd8deadSopenharmony_ci aluTemps = 0; 5365bd8deadSopenharmony_ci while (i = getInst()) 5375bd8deadSopenharmony_ci { 5385bd8deadSopenharmony_ci if (i.type == TEX) 5395bd8deadSopenharmony_ci { 5405bd8deadSopenharmony_ci if (((i.input.type == TEMP) && 5415bd8deadSopenharmony_ci (tempsOutput & (1 << i.input.index))) || 5425bd8deadSopenharmony_ci ((i.op != KILL) && (i.output.type == TEMP) && 5435bd8deadSopenharmony_ci (aluTemps & (1 << i.output.index)))) 5445bd8deadSopenharmony_ci { 5455bd8deadSopenharmony_ci indirections++; 5465bd8deadSopenharmony_ci tempsOutput = 0; 5475bd8deadSopenharmony_ci aluTemps = 0; 5485bd8deadSopenharmony_ci } 5495bd8deadSopenharmony_ci } else { 5505bd8deadSopenharmony_ci if (i.input1.type == TEMP) 5515bd8deadSopenharmony_ci aluTemps |= (1 << i.input1.index); 5525bd8deadSopenharmony_ci if (i.input2 && i.input2.type == TEMP) 5535bd8deadSopenharmony_ci aluTemps |= (1 << i.input2.index); 5545bd8deadSopenharmony_ci if (i.input3 && i.input3.type == TEMP) 5555bd8deadSopenharmony_ci aluTemps |= (1 << i.input3.index); 5565bd8deadSopenharmony_ci if (i.output.type == TEMP) 5575bd8deadSopenharmony_ci aluTemps |= (1 << i.output.index); 5585bd8deadSopenharmony_ci } 5595bd8deadSopenharmony_ci if ((i.op != KILL) && (i.output.type == TEMP)) 5605bd8deadSopenharmony_ci tempsOutput |= (1 << i.output.index); 5615bd8deadSopenharmony_ci } 5625bd8deadSopenharmony_ci 5635bd8deadSopenharmony_ci For example, the following programs would have 1, 2, and 3 5645bd8deadSopenharmony_ci texture indirections, respectively: 5655bd8deadSopenharmony_ci 5665bd8deadSopenharmony_ci !!ARBfp1.0 5675bd8deadSopenharmony_ci # No texture instructions, but always 1 indirection 5685bd8deadSopenharmony_ci MOV result.color, fragment.color; 5695bd8deadSopenharmony_ci END 5705bd8deadSopenharmony_ci 5715bd8deadSopenharmony_ci !!ARBfp1.0 5725bd8deadSopenharmony_ci # A simple dependent texture instruction, 2 indirections 5735bd8deadSopenharmony_ci TEMP myColor; 5745bd8deadSopenharmony_ci MUL myColor, fragment.texcoord[0], fragment.texcoord[1]; 5755bd8deadSopenharmony_ci TEX result.color, myColor, texture[0], 2D; 5765bd8deadSopenharmony_ci END 5775bd8deadSopenharmony_ci 5785bd8deadSopenharmony_ci !!ARBfp1.0 5795bd8deadSopenharmony_ci # A more complex example with 3 indirections 5805bd8deadSopenharmony_ci TEMP myColor1, myColor2; 5815bd8deadSopenharmony_ci TEX myColor1, fragment.texcoord[0], texture[0], 2D; 5825bd8deadSopenharmony_ci MUL myColor1, myColor1, myColor1; 5835bd8deadSopenharmony_ci TEX myColor2, fragment.texcoord[1], texture[1], 2D; 5845bd8deadSopenharmony_ci # so far we still only have 1 indirection 5855bd8deadSopenharmony_ci TEX myColor2, myColor1, texture[2], 2D; # This is #2 5865bd8deadSopenharmony_ci TEX result.color, myColor2, texture[3], 2D; # And #3 5875bd8deadSopenharmony_ci END 5885bd8deadSopenharmony_ci 5895bd8deadSopenharmony_ci Note that writemasks for the temporaries written and swizzles 5905bd8deadSopenharmony_ci for the temporaries read are not taken into consideration when 5915bd8deadSopenharmony_ci counting indirections. This makes hand-counting of indirections 5925bd8deadSopenharmony_ci by a developer an easier task. 5935bd8deadSopenharmony_ci 5945bd8deadSopenharmony_ci Native texture indirections may be counted differently by an 5955bd8deadSopenharmony_ci implementation to reflect its exact restrictions, to reflect the 5965bd8deadSopenharmony_ci true dependencies taking into account writemasks and swizzles, 5975bd8deadSopenharmony_ci and to reflect optimizations such as instruction reordering. 5985bd8deadSopenharmony_ci 5995bd8deadSopenharmony_ci For implementations with no restrictions on the number of 6005bd8deadSopenharmony_ci indirections, the maximum indirection count will equal the 6015bd8deadSopenharmony_ci maximum texture instruction count. 6025bd8deadSopenharmony_ci 6035bd8deadSopenharmony_ci (25) How can a program reduce SCS's scalar operand to the 6045bd8deadSopenharmony_ci fundamental period [-PI,PI]? 6055bd8deadSopenharmony_ci 6065bd8deadSopenharmony_ci RESOLVED: Unlike the individual SIN and COS instructions, SCS 6075bd8deadSopenharmony_ci requires that its argument be reduced ahead of time to the 6085bd8deadSopenharmony_ci fundamental period. The reason SCS doesn't perform this 6095bd8deadSopenharmony_ci operation automatically is that it may make unnecessary redundant 6105bd8deadSopenharmony_ci work for programs that already have their operand in the correct 6115bd8deadSopenharmony_ci range. Other programs that do need to reduce their operand 6125bd8deadSopenharmony_ci simply need to add a block of code before the SCS instruction: 6135bd8deadSopenharmony_ci 6145bd8deadSopenharmony_ci PARAM myParams = { 0.5, -3.14159, 6.28319, 0.15915 }; 6155bd8deadSopenharmony_ci MAD myOperand.x, myOperand.x, myParams.w, myParams.x; # a = (a/(2*PI))+0.5 6165bd8deadSopenharmony_ci FRC myOperand.x, myOperand.x; # a = frac(a) 6175bd8deadSopenharmony_ci MAD myOperand.x, myOperand.x, myParams.z, myParams.y # a = (a*2*PI)-PI 6185bd8deadSopenharmony_ci ... 6195bd8deadSopenharmony_ci SCS myResult, myOperand.x; 6205bd8deadSopenharmony_ci 6215bd8deadSopenharmony_ci (26) Is depth output from a fragment program guaranteed to be 6225bd8deadSopenharmony_ci invariant with respect to depth produced via conventional 6235bd8deadSopenharmony_ci rasterization? 6245bd8deadSopenharmony_ci 6255bd8deadSopenharmony_ci RESOLVED: No. The floating-point representation of depth values 6265bd8deadSopenharmony_ci output from a fragment program may lead to the output of depth 6275bd8deadSopenharmony_ci with less precision than the depth output by convention GL 6285bd8deadSopenharmony_ci rasterization. For example, a floating-point representation with 6295bd8deadSopenharmony_ci 16 bits of mantissa will certainly produce depth with lesser 6305bd8deadSopenharmony_ci precision than that of conventional rasterization used in 6315bd8deadSopenharmony_ci conjunction with a 24-bit depth buffer, where all values are 6325bd8deadSopenharmony_ci maintained as integers. Be aware of this when mixing conventional 6335bd8deadSopenharmony_ci GL rendering with fragment program rendering. 6345bd8deadSopenharmony_ci 6355bd8deadSopenharmony_ci (27) How can conventional GL fog application be achieved within a 6365bd8deadSopenharmony_ci fragment program? 6375bd8deadSopenharmony_ci 6385bd8deadSopenharmony_ci RESOLVED: Program options have been introduced that allow a 6395bd8deadSopenharmony_ci program to request fog to be applied to the final clamped fragment 6405bd8deadSopenharmony_ci color before being passed along to the antialiasing application 6415bd8deadSopenharmony_ci stage. This makes it easy for: 6425bd8deadSopenharmony_ci 1. developers to request conventional fog behavior 6435bd8deadSopenharmony_ci 2. implementations with dedicated fog hardware to use it 6445bd8deadSopenharmony_ci 3. implementations without dedicated fog hardware, so they need 6455bd8deadSopenharmony_ci not track fog state after compilation, and constantly 6465bd8deadSopenharmony_ci recompile when fog state changes. 6475bd8deadSopenharmony_ci 6485bd8deadSopenharmony_ci The three mandatory options are ARB_fog_exp, ARB_fog_exp2, and 6495bd8deadSopenharmony_ci ARB_fog_linear. As these options are mutually exclusive by 6505bd8deadSopenharmony_ci nature, specifying more than one is not useful. If more than one 6515bd8deadSopenharmony_ci is specified, the last one encountered in the <optionSequence> 6525bd8deadSopenharmony_ci will be the one to actually modify the execution environment. 6535bd8deadSopenharmony_ci 6545bd8deadSopenharmony_ci (28) Why have all of the enums, entrypoints, GLX protocol, and spec 6555bd8deadSopenharmony_ci language shared with ARB_vertex_program been reproduced here? 6565bd8deadSopenharmony_ci 6575bd8deadSopenharmony_ci RESOLVED: The two extensions are independent of one another, in 6585bd8deadSopenharmony_ci so far as an implementation need not support both of them in order 6595bd8deadSopenharmony_ci to support one of them. Everything needed to implement or make 6605bd8deadSopenharmony_ci use of ARB_fragment_program is present in this spec without the 6615bd8deadSopenharmony_ci need to refer to the ARB_vertex_program spec. When and if these 6625bd8deadSopenharmony_ci two extensions are incorporated into the core OpenGL, the 6635bd8deadSopenharmony_ci significant overlap of the two will be collapsed into a single 6645bd8deadSopenharmony_ci instance of the shared parts. 6655bd8deadSopenharmony_ci 6665bd8deadSopenharmony_ci (29) How might an implementation implement the fog options? To What 6675bd8deadSopenharmony_ci does the extra resource consumption described in 3.11.4.5.1 6685bd8deadSopenharmony_ci correspond? 6695bd8deadSopenharmony_ci 6705bd8deadSopenharmony_ci RESOLVED: The following code snippets reflect possible 6715bd8deadSopenharmony_ci implementations of the fog options. While an implementation may 6725bd8deadSopenharmony_ci use other instruction sequences to achieve the same result, or may 6735bd8deadSopenharmony_ci use external fog hardware if available, all implementations must 6745bd8deadSopenharmony_ci enforce the API-level resource consumption as described: 2 params, 6755bd8deadSopenharmony_ci 1 temp, 1 attribute, and 3, 4, or 2 instructions. "finalColor" in 6765bd8deadSopenharmony_ci the examples below is the color that would otherwise be 6775bd8deadSopenharmony_ci "result.color", with components clamped to the range [0,1]. 6785bd8deadSopenharmony_ci "result.color.a" is assumed to have already been written, as fog 6795bd8deadSopenharmony_ci blending does not affect the alpha component. 6805bd8deadSopenharmony_ci 6815bd8deadSopenharmony_ci EXP: 6825bd8deadSopenharmony_ci # Exponential fog 6835bd8deadSopenharmony_ci # f = exp(-d*z) 6845bd8deadSopenharmony_ci # 6855bd8deadSopenharmony_ci PARAM p = {DENSITY/LN(2), NOT USED, NOT USED, NOT USED}; 6865bd8deadSopenharmony_ci PARAM fogColor = state.fog.color; 6875bd8deadSopenharmony_ci TEMP fogFactor; 6885bd8deadSopenharmony_ci ATTRIB fogCoord = fragment.fogcoord.x; 6895bd8deadSopenharmony_ci MUL fogFactor.x, p.x, fogCoord.x; 6905bd8deadSopenharmony_ci EX2_SAT fogFactor.x, -fogFactor.x; 6915bd8deadSopenharmony_ci LRP result.color.rgb, fogFactor.x, finalColor, fogColor; 6925bd8deadSopenharmony_ci 6935bd8deadSopenharmony_ci EXP2: 6945bd8deadSopenharmony_ci # 6955bd8deadSopenharmony_ci # 2nd-order Exponential fog 6965bd8deadSopenharmony_ci # f = exp(-(d*z)^2) 6975bd8deadSopenharmony_ci # 6985bd8deadSopenharmony_ci PARAM p = {DENSITY/SQRT(LN(2)), NOT USED, NOT USED, NOT USED}; 6995bd8deadSopenharmony_ci PARAM fogColor = state.fog.color; 7005bd8deadSopenharmony_ci TEMP fogFactor; 7015bd8deadSopenharmony_ci ATTRIB fogCoord = fragment.fogcoord.x; 7025bd8deadSopenharmony_ci MUL fogFactor.x, p.x, fogCoord.x; 7035bd8deadSopenharmony_ci MUL fogFactor.x, fogFactor.x, fogFactor.x; 7045bd8deadSopenharmony_ci EX2_SAT fogFactor.x, -fogFactor.x; 7055bd8deadSopenharmony_ci LRP result.color.rgb, fogFactor.x, finalColor, fogColor; 7065bd8deadSopenharmony_ci 7075bd8deadSopenharmony_ci LINEAR: 7085bd8deadSopenharmony_ci # 7095bd8deadSopenharmony_ci # Linear fog 7105bd8deadSopenharmony_ci # f = (end-z)/(end-start) 7115bd8deadSopenharmony_ci # 7125bd8deadSopenharmony_ci PARAM p = {-1/(END-START), END/(END-START), NOT USED, NOT USED}; 7135bd8deadSopenharmony_ci PARAM fogColor = state.fog.color; 7145bd8deadSopenharmony_ci TEMP fogFactor; 7155bd8deadSopenharmony_ci ATTRIB fogCoord = fragment.fogcoord.x; 7165bd8deadSopenharmony_ci MAD_SAT fogFactor.x, p.x, fogCoord.x, p.y; 7175bd8deadSopenharmony_ci LRP result.color.rgb, fogFactor.x, finalColor, fogColor; 7185bd8deadSopenharmony_ci 7195bd8deadSopenharmony_ci (30) Why is the order of operands for the CMP instruction different 7205bd8deadSopenharmony_ci than the order used by another popular graphics API? 7215bd8deadSopenharmony_ci 7225bd8deadSopenharmony_ci RESOLVED: No other graphics API was used as a basis for the 7235bd8deadSopenharmony_ci design of ARB_fragment_program except ARB_vertex_program, which 7245bd8deadSopenharmony_ci did not have a CMP instruction. This independent evolution 7255bd8deadSopenharmony_ci naturally led to differences in minor details such as order of 7265bd8deadSopenharmony_ci operands. This discrepancy is noted here to help developers 7275bd8deadSopenharmony_ci familiar with the other API to avoid this potential pitfall. 7285bd8deadSopenharmony_ci 7295bd8deadSopenharmony_ci (31) Is depth offset applied to the window z value before it enters 7305bd8deadSopenharmony_ci the fragment program? 7315bd8deadSopenharmony_ci 7325bd8deadSopenharmony_ci RESOLVED: As in the base OpenGL specification, the depth offset 7335bd8deadSopenharmony_ci generated by polygon offset is added during polygon rasterization. 7345bd8deadSopenharmony_ci The depth value provided to shaders in the fragment.position.z 7355bd8deadSopenharmony_ci attribute already includes polygon offset, if enabled. If the 7365bd8deadSopenharmony_ci depth value is replaced by a fragment program, the polygon offset 7375bd8deadSopenharmony_ci value will NOT be recomputed and added back after fragment program 7385bd8deadSopenharmony_ci execution. 7395bd8deadSopenharmony_ci 7405bd8deadSopenharmony_ci NOTE: This is probably not desirable for fragment programs that 7415bd8deadSopenharmony_ci modify depth values since the partials used to generate the offset 7425bd8deadSopenharmony_ci may not match the partials of the computed depth value. 7435bd8deadSopenharmony_ci 7445bd8deadSopenharmony_ci 7455bd8deadSopenharmony_ciNew Procedures and Functions 7465bd8deadSopenharmony_ci 7475bd8deadSopenharmony_ci void ProgramStringARB(enum target, enum format, sizei len, 7485bd8deadSopenharmony_ci const void *string); 7495bd8deadSopenharmony_ci 7505bd8deadSopenharmony_ci void BindProgramARB(enum target, uint program); 7515bd8deadSopenharmony_ci 7525bd8deadSopenharmony_ci void DeleteProgramsARB(sizei n, const uint *programs); 7535bd8deadSopenharmony_ci 7545bd8deadSopenharmony_ci void GenProgramsARB(sizei n, uint *programs); 7555bd8deadSopenharmony_ci 7565bd8deadSopenharmony_ci void ProgramEnvParameter4dARB(enum target, uint index, 7575bd8deadSopenharmony_ci double x, double y, double z, double w); 7585bd8deadSopenharmony_ci void ProgramEnvParameter4dvARB(enum target, uint index, 7595bd8deadSopenharmony_ci const double *params); 7605bd8deadSopenharmony_ci void ProgramEnvParameter4fARB(enum target, uint index, 7615bd8deadSopenharmony_ci float x, float y, float z, float w); 7625bd8deadSopenharmony_ci void ProgramEnvParameter4fvARB(enum target, uint index, 7635bd8deadSopenharmony_ci const float *params); 7645bd8deadSopenharmony_ci 7655bd8deadSopenharmony_ci void ProgramLocalParameter4dARB(enum target, uint index, 7665bd8deadSopenharmony_ci double x, double y, double z, double w); 7675bd8deadSopenharmony_ci void ProgramLocalParameter4dvARB(enum target, uint index, 7685bd8deadSopenharmony_ci const double *params); 7695bd8deadSopenharmony_ci void ProgramLocalParameter4fARB(enum target, uint index, 7705bd8deadSopenharmony_ci float x, float y, float z, float w); 7715bd8deadSopenharmony_ci void ProgramLocalParameter4fvARB(enum target, uint index, 7725bd8deadSopenharmony_ci const float *params); 7735bd8deadSopenharmony_ci 7745bd8deadSopenharmony_ci void GetProgramEnvParameterdvARB(enum target, uint index, 7755bd8deadSopenharmony_ci double *params); 7765bd8deadSopenharmony_ci void GetProgramEnvParameterfvARB(enum target, uint index, 7775bd8deadSopenharmony_ci float *params); 7785bd8deadSopenharmony_ci 7795bd8deadSopenharmony_ci void GetProgramLocalParameterdvARB(enum target, uint index, 7805bd8deadSopenharmony_ci double *params); 7815bd8deadSopenharmony_ci void GetProgramLocalParameterfvARB(enum target, uint index, 7825bd8deadSopenharmony_ci float *params); 7835bd8deadSopenharmony_ci 7845bd8deadSopenharmony_ci void GetProgramivARB(enum target, enum pname, int *params); 7855bd8deadSopenharmony_ci 7865bd8deadSopenharmony_ci void GetProgramStringARB(enum target, enum pname, void *string); 7875bd8deadSopenharmony_ci 7885bd8deadSopenharmony_ci boolean IsProgramARB(uint program); 7895bd8deadSopenharmony_ci 7905bd8deadSopenharmony_ci 7915bd8deadSopenharmony_ciNew Tokens 7925bd8deadSopenharmony_ci 7935bd8deadSopenharmony_ci Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, 7945bd8deadSopenharmony_ci by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, 7955bd8deadSopenharmony_ci and GetDoublev, and by the <target> parameter of ProgramStringARB, 7965bd8deadSopenharmony_ci BindProgramARB, ProgramEnvParameter4[df][v]ARB, 7975bd8deadSopenharmony_ci ProgramLocalParameter4[df][v]ARB, GetProgramEnvParameter[df]vARB, 7985bd8deadSopenharmony_ci GetProgramLocalParameter[df]vARB, GetProgramivARB and 7995bd8deadSopenharmony_ci GetProgramStringARB. 8005bd8deadSopenharmony_ci 8015bd8deadSopenharmony_ci FRAGMENT_PROGRAM_ARB 0x8804 8025bd8deadSopenharmony_ci 8035bd8deadSopenharmony_ci Accepted by the <format> parameter of ProgramStringARB: 8045bd8deadSopenharmony_ci 8055bd8deadSopenharmony_ci PROGRAM_FORMAT_ASCII_ARB 0x8875 8065bd8deadSopenharmony_ci 8075bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetProgramivARB: 8085bd8deadSopenharmony_ci 8095bd8deadSopenharmony_ci PROGRAM_LENGTH_ARB 0x8627 8105bd8deadSopenharmony_ci PROGRAM_FORMAT_ARB 0x8876 8115bd8deadSopenharmony_ci PROGRAM_BINDING_ARB 0x8677 8125bd8deadSopenharmony_ci PROGRAM_INSTRUCTIONS_ARB 0x88A0 8135bd8deadSopenharmony_ci MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 8145bd8deadSopenharmony_ci PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 8155bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 8165bd8deadSopenharmony_ci PROGRAM_TEMPORARIES_ARB 0x88A4 8175bd8deadSopenharmony_ci MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 8185bd8deadSopenharmony_ci PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 8195bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 8205bd8deadSopenharmony_ci PROGRAM_PARAMETERS_ARB 0x88A8 8215bd8deadSopenharmony_ci MAX_PROGRAM_PARAMETERS_ARB 0x88A9 8225bd8deadSopenharmony_ci PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA 8235bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB 8245bd8deadSopenharmony_ci PROGRAM_ATTRIBS_ARB 0x88AC 8255bd8deadSopenharmony_ci MAX_PROGRAM_ATTRIBS_ARB 0x88AD 8265bd8deadSopenharmony_ci PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE 8275bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF 8285bd8deadSopenharmony_ci MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 8295bd8deadSopenharmony_ci MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 8305bd8deadSopenharmony_ci PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 8315bd8deadSopenharmony_ci 8325bd8deadSopenharmony_ci PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 8335bd8deadSopenharmony_ci PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 8345bd8deadSopenharmony_ci PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 8355bd8deadSopenharmony_ci PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 8365bd8deadSopenharmony_ci PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 8375bd8deadSopenharmony_ci PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A 8385bd8deadSopenharmony_ci MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B 8395bd8deadSopenharmony_ci MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C 8405bd8deadSopenharmony_ci MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D 8415bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E 8425bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F 8435bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 8445bd8deadSopenharmony_ci 8455bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetProgramStringARB: 8465bd8deadSopenharmony_ci 8475bd8deadSopenharmony_ci PROGRAM_STRING_ARB 0x8628 8485bd8deadSopenharmony_ci 8495bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, 8505bd8deadSopenharmony_ci GetFloatv, and GetDoublev: 8515bd8deadSopenharmony_ci 8525bd8deadSopenharmony_ci PROGRAM_ERROR_POSITION_ARB 0x864B 8535bd8deadSopenharmony_ci CURRENT_MATRIX_ARB 0x8641 8545bd8deadSopenharmony_ci TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 8555bd8deadSopenharmony_ci CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 8565bd8deadSopenharmony_ci MAX_PROGRAM_MATRICES_ARB 0x862F 8575bd8deadSopenharmony_ci MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E 8585bd8deadSopenharmony_ci 8595bd8deadSopenharmony_ci MAX_TEXTURE_COORDS_ARB 0x8871 8605bd8deadSopenharmony_ci MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 8615bd8deadSopenharmony_ci 8625bd8deadSopenharmony_ci Accepted by the <name> parameter of GetString: 8635bd8deadSopenharmony_ci 8645bd8deadSopenharmony_ci PROGRAM_ERROR_STRING_ARB 0x8874 8655bd8deadSopenharmony_ci 8665bd8deadSopenharmony_ci Accepted by the <mode> parameter of MatrixMode: 8675bd8deadSopenharmony_ci 8685bd8deadSopenharmony_ci MATRIX0_ARB 0x88C0 8695bd8deadSopenharmony_ci MATRIX1_ARB 0x88C1 8705bd8deadSopenharmony_ci MATRIX2_ARB 0x88C2 8715bd8deadSopenharmony_ci MATRIX3_ARB 0x88C3 8725bd8deadSopenharmony_ci MATRIX4_ARB 0x88C4 8735bd8deadSopenharmony_ci MATRIX5_ARB 0x88C5 8745bd8deadSopenharmony_ci MATRIX6_ARB 0x88C6 8755bd8deadSopenharmony_ci MATRIX7_ARB 0x88C7 8765bd8deadSopenharmony_ci MATRIX8_ARB 0x88C8 8775bd8deadSopenharmony_ci MATRIX9_ARB 0x88C9 8785bd8deadSopenharmony_ci MATRIX10_ARB 0x88CA 8795bd8deadSopenharmony_ci MATRIX11_ARB 0x88CB 8805bd8deadSopenharmony_ci MATRIX12_ARB 0x88CC 8815bd8deadSopenharmony_ci MATRIX13_ARB 0x88CD 8825bd8deadSopenharmony_ci MATRIX14_ARB 0x88CE 8835bd8deadSopenharmony_ci MATRIX15_ARB 0x88CF 8845bd8deadSopenharmony_ci MATRIX16_ARB 0x88D0 8855bd8deadSopenharmony_ci MATRIX17_ARB 0x88D1 8865bd8deadSopenharmony_ci MATRIX18_ARB 0x88D2 8875bd8deadSopenharmony_ci MATRIX19_ARB 0x88D3 8885bd8deadSopenharmony_ci MATRIX20_ARB 0x88D4 8895bd8deadSopenharmony_ci MATRIX21_ARB 0x88D5 8905bd8deadSopenharmony_ci MATRIX22_ARB 0x88D6 8915bd8deadSopenharmony_ci MATRIX23_ARB 0x88D7 8925bd8deadSopenharmony_ci MATRIX24_ARB 0x88D8 8935bd8deadSopenharmony_ci MATRIX25_ARB 0x88D9 8945bd8deadSopenharmony_ci MATRIX26_ARB 0x88DA 8955bd8deadSopenharmony_ci MATRIX27_ARB 0x88DB 8965bd8deadSopenharmony_ci MATRIX28_ARB 0x88DC 8975bd8deadSopenharmony_ci MATRIX29_ARB 0x88DD 8985bd8deadSopenharmony_ci MATRIX30_ARB 0x88DE 8995bd8deadSopenharmony_ci MATRIX31_ARB 0x88DF 9005bd8deadSopenharmony_ci 9015bd8deadSopenharmony_ci 9025bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.3 Specification (OpenGL 9035bd8deadSopenharmony_ciOperation) 9045bd8deadSopenharmony_ci 9055bd8deadSopenharmony_ci Modify Section 2.1.1, Floating-Point Computation (p. 6) 9065bd8deadSopenharmony_ci 9075bd8deadSopenharmony_ci (modify first paragraph, p. 6) ... The maximum representable 9085bd8deadSopenharmony_ci magnitude of a floating-point number used to represent position, 9095bd8deadSopenharmony_ci normal, or texture coordinates must be at least 2^32; the maximum 9105bd8deadSopenharmony_ci representable magnitude for colors must be at least 2^10. ... 9115bd8deadSopenharmony_ci 9125bd8deadSopenharmony_ci 9135bd8deadSopenharmony_ci Modify Section 2.7, Vertex Specification (p. 19) 9145bd8deadSopenharmony_ci 9155bd8deadSopenharmony_ci (modify second paragraph, p. 20) Implementations support more than 9165bd8deadSopenharmony_ci one set of texture coordinates. The commands 9175bd8deadSopenharmony_ci 9185bd8deadSopenharmony_ci void MultiTexCoord{1234}{sifd}(enum texture, T coords); 9195bd8deadSopenharmony_ci void MultiTexCoord{1234}{sifd}v(enum texture, T coords); 9205bd8deadSopenharmony_ci 9215bd8deadSopenharmony_ci take the coordinate set to be modified as the <texture> parameter. 9225bd8deadSopenharmony_ci <texture> is a symbolic constant of the form TEXTUREi, indicating 9235bd8deadSopenharmony_ci that texture coordinate set i is to be modified. The constants obey 9245bd8deadSopenharmony_ci TEXTUREi = TEXTURE0 + i (i is in the range 0 to k-1, where k is the 9255bd8deadSopenharmony_ci implementation-dependent number of texture units defined by 9265bd8deadSopenharmony_ci MAX_TEXTURE_COORDS_ARB). 9275bd8deadSopenharmony_ci 9285bd8deadSopenharmony_ci 9295bd8deadSopenharmony_ci Modify Section 2.8, Vertex Arrays (p. 21) 9305bd8deadSopenharmony_ci 9315bd8deadSopenharmony_ci (modify first paragraph, p. 21) ... The client may specify up to 5 9325bd8deadSopenharmony_ci plus the value of MAX_TEXTURE_COORDS_ARB arrays: one each to store 9335bd8deadSopenharmony_ci vertex coordinates... 9345bd8deadSopenharmony_ci 9355bd8deadSopenharmony_ci 9365bd8deadSopenharmony_ci (modify first paragraph, p. 23) The command 9375bd8deadSopenharmony_ci 9385bd8deadSopenharmony_ci void ClientActiveTexture(enum texture); 9395bd8deadSopenharmony_ci 9405bd8deadSopenharmony_ci is used to select the vertex array client state parameters to be 9415bd8deadSopenharmony_ci modified by the TexCoordPointer command and the array affected by 9425bd8deadSopenharmony_ci EnableClientState and DisableClientState with parameter 9435bd8deadSopenharmony_ci TEXTURE_COORD_ARRAY. This command sets the client state variable 9445bd8deadSopenharmony_ci CLIENT_ACTIVE_TEXTURE. Each texture coordinate set has a client 9455bd8deadSopenharmony_ci state vector which is selected when this command is invoked. This 9465bd8deadSopenharmony_ci state vector includes the vertex array state. This call also 9475bd8deadSopenharmony_ci selects the texture coordinate set state used for queries of client 9485bd8deadSopenharmony_ci state. 9495bd8deadSopenharmony_ci 9505bd8deadSopenharmony_ci 9515bd8deadSopenharmony_ci (modify first paragraph, p. 28) If the number of supported texture 9525bd8deadSopenharmony_ci coordinate sets (the value of MAX_TEXTURE_COORDS_ARB) is k, ... 9535bd8deadSopenharmony_ci 9545bd8deadSopenharmony_ci 9555bd8deadSopenharmony_ci Modify Section 2.10.2, Matrices (p. 31) 9565bd8deadSopenharmony_ci 9575bd8deadSopenharmony_ci (modify first paragraph, p. 31) The projection matrix and model-view 9585bd8deadSopenharmony_ci matrix are set and modified with a variety of commands. The 9595bd8deadSopenharmony_ci affected matrix is determined by the current matrix mode. The 9605bd8deadSopenharmony_ci current matrix mode is set with 9615bd8deadSopenharmony_ci 9625bd8deadSopenharmony_ci void MatrixMode(enum mode); 9635bd8deadSopenharmony_ci 9645bd8deadSopenharmony_ci which takes one of the pre-defined constants TEXTURE, MODELVIEW, 9655bd8deadSopenharmony_ci COLOR, PROJECTION, or MATRIX<i>_ARB as the argument. In the case of 9665bd8deadSopenharmony_ci MATRIX<i>_ARB, <i> is an integer between 0 and <n>-1 indicating one 9675bd8deadSopenharmony_ci of <n> program matrices where <n> is the value of the implementation 9685bd8deadSopenharmony_ci defined constant MAX_PROGRAM_MATRICES_ARB. Such program matrices 9695bd8deadSopenharmony_ci are described in section 3.11.7. TEXTURE is described later in 9705bd8deadSopenharmony_ci section 2.10.2, and COLOR is described in section 3.6.3. If the 9715bd8deadSopenharmony_ci current matrix mode is MODELVIEW, then matrix operations apply to 9725bd8deadSopenharmony_ci the model-view matrix; if PROJECTION, then they apply to the 9735bd8deadSopenharmony_ci projection matrix. 9745bd8deadSopenharmony_ci 9755bd8deadSopenharmony_ci 9765bd8deadSopenharmony_ci (modify first paragraph, p. 34) For each texture coordinate set, a 9775bd8deadSopenharmony_ci 4x4 matrix is applied to the corresponding texture coordinates... 9785bd8deadSopenharmony_ci 9795bd8deadSopenharmony_ci 9805bd8deadSopenharmony_ci (modify first and second paragraphs, p. 35) The command 9815bd8deadSopenharmony_ci 9825bd8deadSopenharmony_ci void ActiveTexture(enum texture); 9835bd8deadSopenharmony_ci 9845bd8deadSopenharmony_ci specifies the active texture unit selector, ACTIVE_TEXTURE. Each 9855bd8deadSopenharmony_ci texture unit contains up to two distinct sub-units: a texture 9865bd8deadSopenharmony_ci coordinate processing unit (consisting of a texture matrix stack and 9875bd8deadSopenharmony_ci texture coordinate generation state) and a texture image unit 9885bd8deadSopenharmony_ci (consisting of all the texture state defined in Section 3.8). In 9895bd8deadSopenharmony_ci implementations with a different number of supported texture 9905bd8deadSopenharmony_ci coordinate sets and texture image units, some texture units may 9915bd8deadSopenharmony_ci consist of only one of the two sub-units. 9925bd8deadSopenharmony_ci 9935bd8deadSopenharmony_ci The active texture unit selector specifies the texture coordinate 9945bd8deadSopenharmony_ci set accessed by commands involving texture coordinate processing. 9955bd8deadSopenharmony_ci Such commands include those accessing the current matrix stack (if 9965bd8deadSopenharmony_ci MATRIX_MODE is TEXTURE), TexGen (section 2.10.4), Enable/Disable (if 9975bd8deadSopenharmony_ci any texture coordinate generation enum is selected), as well as 9985bd8deadSopenharmony_ci queries of the current texture coordinates and current raster 9995bd8deadSopenharmony_ci texture coordinates. If the texture coordinate set number 10005bd8deadSopenharmony_ci corresponding to the current value of ACTIVE_TEXTURE is greater than 10015bd8deadSopenharmony_ci or equal to the implementation-dependent constant 10025bd8deadSopenharmony_ci MAX_TEXTURE_COORDS_ARB, the error INVALID_OPERATION is generated by 10035bd8deadSopenharmony_ci any such command. 10045bd8deadSopenharmony_ci 10055bd8deadSopenharmony_ci The active texture unit selector also selects the texture image unit 10065bd8deadSopenharmony_ci accessed by commands involving texture image processing (section 10075bd8deadSopenharmony_ci 3.8). Such commands include all variants of TexEnv, TexParameter, 10085bd8deadSopenharmony_ci and TexImage commands, BindTexture, Enable/Disable for any texture 10095bd8deadSopenharmony_ci target (e.g., TEXTURE_2D), and queries of all such state. If the 10105bd8deadSopenharmony_ci texture image unit number corresponding to the current value of 10115bd8deadSopenharmony_ci ACTIVE_TEXTURE is greater than or equal to the implementation- 10125bd8deadSopenharmony_ci dependent constant MAX_TEXTURE_IMAGE_UNITS_ARB, the error 10135bd8deadSopenharmony_ci INVALID_OPERATION is generated by any such command. 10145bd8deadSopenharmony_ci 10155bd8deadSopenharmony_ci ActiveTexture generates the error INVALID_ENUM if an invalid 10165bd8deadSopenharmony_ci <texture> is specified. <texture> is a symbolic constant of the 10175bd8deadSopenharmony_ci form TEXTUREi, indicating that texture unit i is to be modified. 10185bd8deadSopenharmony_ci The constants obey TEXTUREi = TEXTURE0 + i (i is in the range 0 to 10195bd8deadSopenharmony_ci k-1, where k is the larger of the MAX_TEXTURE_COORDS_ARB and 10205bd8deadSopenharmony_ci MAX_TEXTURE_IMAGE_UNITS_ARB). For compatibility with old OpenGL 10215bd8deadSopenharmony_ci specifications, the implementation-dependent constant 10225bd8deadSopenharmony_ci MAX_TEXTURE_UNITS specifies the number of conventional texture units 10235bd8deadSopenharmony_ci supported by the implementation. Its value must be no larger than 10245bd8deadSopenharmony_ci the minimum of MAX_TEXTURE_COORDS_ARB and 10255bd8deadSopenharmony_ci MAX_TEXTURE_IMAGE_UNITS_ARB. 10265bd8deadSopenharmony_ci 10275bd8deadSopenharmony_ci 10285bd8deadSopenharmony_ci (modify last paragraph, p. 35) The state required to implement 10295bd8deadSopenharmony_ci transformations consists of a <n>-value integer indicating the 10305bd8deadSopenharmony_ci current matrix mode (where <n> is 4 + the number of supported 10315bd8deadSopenharmony_ci texture and program matrices), a stack of at least two 4x4 matrices 10325bd8deadSopenharmony_ci for each of COLOR, PROJECTION, and TEXTURE with associated stack 10335bd8deadSopenharmony_ci pointers, <n> stacks (where <n> is at least 8) of at least one 4x4 10345bd8deadSopenharmony_ci matrix for each MATRIX<i>_ARB with associated stack pointers, and a 10355bd8deadSopenharmony_ci stack of at least 32 4x4 matrices with an associated stack pointer 10365bd8deadSopenharmony_ci for MODELVIEW. Initially, there is only one matrix on each stack, 10375bd8deadSopenharmony_ci and all matrices are set to the identity. The initial matrix mode 10385bd8deadSopenharmony_ci is MODELVIEW. The initial value of ACTIVE_TEXTURE is TEXTURE0. 10395bd8deadSopenharmony_ci 10405bd8deadSopenharmony_ci 10415bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.3 Specification (Rasterization) 10425bd8deadSopenharmony_ci 10435bd8deadSopenharmony_ci Modify Chapter 3, Introduction (p. 58) 10445bd8deadSopenharmony_ci 10455bd8deadSopenharmony_ci (modify first paragraph, p. 58) ... Figure 3.1 diagrams the 10465bd8deadSopenharmony_ci rasterization process. The color value assigned to a fragment is 10475bd8deadSopenharmony_ci initially determined by the rasterization operations (sections 3.3 10485bd8deadSopenharmony_ci through 3.7) and modified by either the execution of the texturing, 10495bd8deadSopenharmony_ci color sum, and fog operations as defined in sections 3.8, 3.9, and 10505bd8deadSopenharmony_ci 3.10, or of a fragment program defined in section 3.11. The final 10515bd8deadSopenharmony_ci depth value is initially determined by the rasterization operations 10525bd8deadSopenharmony_ci and may be modified or replaced by a fragment program. 10535bd8deadSopenharmony_ci 10545bd8deadSopenharmony_ci (modify Figure 3.1) 10555bd8deadSopenharmony_ci 10565bd8deadSopenharmony_ci _ +---------------+ FRAGMENT_PROGRAM_ARB 10575bd8deadSopenharmony_ci /|| Point | enable 10585bd8deadSopenharmony_ci / | Rasterization |\ | 10595bd8deadSopenharmony_ci / +---------------+ \ V o-------------+ 10605bd8deadSopenharmony_ci From / +---------------+ \ | 10615bd8deadSopenharmony_ci Primitive ---> | Line |---+++--->o o | 10625bd8deadSopenharmony_ci Assembly \ | Rasterization | / || | | 10635bd8deadSopenharmony_ci \ +---------------+ / || | | 10645bd8deadSopenharmony_ci \ +---------------+/ || +-----+-----+ +----+-----+ 10655bd8deadSopenharmony_ci \|| Polygon | || | Texturing | | Fragment | 10665bd8deadSopenharmony_ci - | Rasterization | / | +-----+-----+ | Program | 10675bd8deadSopenharmony_ci +---------------+ / | | +----+-----+ 10685bd8deadSopenharmony_ci +---------------+ / | +-----+-----+ | 10695bd8deadSopenharmony_ci | Pixel |/ | | Color Sum | | 10705bd8deadSopenharmony_ci DrawPixels --> | Rectangle | / +-----+-----+ | 10715bd8deadSopenharmony_ci | Rasterization | / | V 10725bd8deadSopenharmony_ci +---------------+ / +-----+-----+ 10735bd8deadSopenharmony_ci +---------------+ / | Fog |---> Fragments 10745bd8deadSopenharmony_ci Bitmap ----> | Bitmap |/ +-----------+ 10755bd8deadSopenharmony_ci | Rasterization | 10765bd8deadSopenharmony_ci +---------------+ 10775bd8deadSopenharmony_ci 10785bd8deadSopenharmony_ci 10795bd8deadSopenharmony_ci Modify Section 3.3, Points (p. 63) 10805bd8deadSopenharmony_ci 10815bd8deadSopenharmony_ci (modify first and second paragraphs, p. 64) All fragments produced 10825bd8deadSopenharmony_ci in rasterizing a non-antialiased point are assigned the same 10835bd8deadSopenharmony_ci associated data, which are those of the vertex corresponding to the 10845bd8deadSopenharmony_ci point. (delete reference to divide by q) 10855bd8deadSopenharmony_ci 10865bd8deadSopenharmony_ci If antialiasing is enabled, then ... The data associated with each 10875bd8deadSopenharmony_ci fragment are otherwise the data associated with the point being 10885bd8deadSopenharmony_ci rasterized. (delete reference to divide by q) 10895bd8deadSopenharmony_ci 10905bd8deadSopenharmony_ci 10915bd8deadSopenharmony_ci Modify Section 3.4.1, Basic Line Segment Rasterization (p. 66) 10925bd8deadSopenharmony_ci 10935bd8deadSopenharmony_ci (modify first paragraph, p. 68) ... (Note that t=0 at p_a and t=1 at 10945bd8deadSopenharmony_ci p_b). The value of an associated datum f from the fragment center, 10955bd8deadSopenharmony_ci whether it be R, G, B, or A (in RGBA mode) or a color index (in 10965bd8deadSopenharmony_ci color index mode) or the s, t, r, or q texture coordinate or the 10975bd8deadSopenharmony_ci clip w coordinate (the depth value, window z, must be found using 10985bd8deadSopenharmony_ci equation 3.3, below), is found as 10995bd8deadSopenharmony_ci 11005bd8deadSopenharmony_ci f = (1-t)*(f_a/w_a) + t*(f_b/w_b) (3.2) 11015bd8deadSopenharmony_ci ----------------------------- 11025bd8deadSopenharmony_ci (1-t)*(1/w_a) + t*(1/w_b) 11035bd8deadSopenharmony_ci 11045bd8deadSopenharmony_ci where f_a and f_b are the data associated with the starting and 11055bd8deadSopenharmony_ci ending endpoints of the segment, respectively; w_a and w_b are the 11065bd8deadSopenharmony_ci clip w coordinates of the starting and ending endpoints of the 11075bd8deadSopenharmony_ci segments, respectively. Note that linear interpolation would use 11085bd8deadSopenharmony_ci 11095bd8deadSopenharmony_ci f = (1-t)*f_a + t*f_b. (3.3) 11105bd8deadSopenharmony_ci 11115bd8deadSopenharmony_ci ... A GL implementation may choose to approximate equation 3.2 with 11125bd8deadSopenharmony_ci 3.3, but this will normally lead to inacceptable distortion effects 11135bd8deadSopenharmony_ci when interpolating texture coordinates or clip w coordinates. 11145bd8deadSopenharmony_ci 11155bd8deadSopenharmony_ci 11165bd8deadSopenharmony_ci Modify Section 3.5.1, Basic Polygon Rasterization (p. 73) 11175bd8deadSopenharmony_ci 11185bd8deadSopenharmony_ci (modify third and fourth paragraphs, p. 74) Denote a datum at p_a, 11195bd8deadSopenharmony_ci p_b, or p_c as f_a, f_b, or f_c, respectively. Then the value f of 11205bd8deadSopenharmony_ci a datum at a fragment produced by rasterizing a triangle is given by 11215bd8deadSopenharmony_ci 11225bd8deadSopenharmony_ci f = a*(f_a/w_a) + b*(f_b/w_b) + c*(f_c/w_c) (3.4) 11235bd8deadSopenharmony_ci --------------------------------------- 11245bd8deadSopenharmony_ci a*(1/w_a) + b*(1/w_b) + c*(1/w_c) 11255bd8deadSopenharmony_ci 11265bd8deadSopenharmony_ci where w_a, w_b, and w_c are the clip w coordinates of p_a, p_b, and 11275bd8deadSopenharmony_ci p_c, respectively. a, b, and c are the barycentric coordinates of 11285bd8deadSopenharmony_ci the fragment for which the data are produced. a, b, and c must 11295bd8deadSopenharmony_ci correspond precisely to the ... at the fragment's center. 11305bd8deadSopenharmony_ci 11315bd8deadSopenharmony_ci Just as with line segment rasterization, equation 3.4 may be 11325bd8deadSopenharmony_ci approximated by 11335bd8deadSopenharmony_ci 11345bd8deadSopenharmony_ci f = a*f_a + b*f_b + c*f_c; 11355bd8deadSopenharmony_ci 11365bd8deadSopenharmony_ci this may yield ... for texture coordinates or clip w coordinates. 11375bd8deadSopenharmony_ci 11385bd8deadSopenharmony_ci 11395bd8deadSopenharmony_ci Modify Section 3.6.4, Rasterization of Pixel Rectangles (p. 91) 11405bd8deadSopenharmony_ci 11415bd8deadSopenharmony_ci (modify third paragraph, p. 103) A fragment arising from a group ... 11425bd8deadSopenharmony_ci the color and texture coordinates are given by those associated with 11435bd8deadSopenharmony_ci the current raster position. (delete reference to divide by q) 11445bd8deadSopenharmony_ci Groups arising from DrawPixels... 11455bd8deadSopenharmony_ci 11465bd8deadSopenharmony_ci 11475bd8deadSopenharmony_ci Modify Section 3.7, Bitmaps (p. 113) 11485bd8deadSopenharmony_ci 11495bd8deadSopenharmony_ci (modify third paragraph, p. 114) Otherwise, a rectangular array ... 11505bd8deadSopenharmony_ci The associated data for each fragment are those associated with the 11515bd8deadSopenharmony_ci current raster position. (delete reference to divide by q) Once 11525bd8deadSopenharmony_ci the fragments have been produced ... 11535bd8deadSopenharmony_ci 11545bd8deadSopenharmony_ci 11555bd8deadSopenharmony_ci Modify Section 3.8, Texturing (p. 115) 11565bd8deadSopenharmony_ci 11575bd8deadSopenharmony_ci (add new paragraphs before first paragraph, p. 115) Texture 11585bd8deadSopenharmony_ci coordinate sets are mapped to RGBA colors for application to 11595bd8deadSopenharmony_ci primitives in one of two modes. The first mode, described in this 11605bd8deadSopenharmony_ci and subsequent sections, is GL's conventional multitexture pipeline, 11615bd8deadSopenharmony_ci describing texture environment and texture application. The second 11625bd8deadSopenharmony_ci mode, referred to as fragment program mode and described in section 11635bd8deadSopenharmony_ci 3.11, applies textures, color sum, and fog as specified in an 11645bd8deadSopenharmony_ci application-supplied fragment program. 11655bd8deadSopenharmony_ci 11665bd8deadSopenharmony_ci The fragment program mode is enabled and disabled using the generic 11675bd8deadSopenharmony_ci Enable and Disable commands, respectively, with the symbolic 11685bd8deadSopenharmony_ci constant FRAGMENT_PROGRAM_ARB. The required state is one bit 11695bd8deadSopenharmony_ci indicating whether the fragment program mode is enabled or disabled. 11705bd8deadSopenharmony_ci In the initial state, the fragment program mode is disabled. When 11715bd8deadSopenharmony_ci fragment program mode is enabled, texturing, color sum, and fog 11725bd8deadSopenharmony_ci application stages are ignored and a general purpose program is 11735bd8deadSopenharmony_ci executed instead. 11745bd8deadSopenharmony_ci 11755bd8deadSopenharmony_ci (modify first and second paragraph, p. 115) Conventional texturing 11765bd8deadSopenharmony_ci is employed when fragment program mode is disabled. Texturing maps 11775bd8deadSopenharmony_ci ... color of an image at the location indicated by a fragment's 11785bd8deadSopenharmony_ci texture coordinates to modify the fragment's primary RGBA color. 11795bd8deadSopenharmony_ci Texturing does not affect the secondary color. 11805bd8deadSopenharmony_ci 11815bd8deadSopenharmony_ci An implementation may support texturing using more than one image at 11825bd8deadSopenharmony_ci a time. In this case the fragment carries multiple sets of texture 11835bd8deadSopenharmony_ci coordinates which are used to index ... 11845bd8deadSopenharmony_ci 11855bd8deadSopenharmony_ci (add paragraph before 1st paragraph, p. 116) Except when in fragment 11865bd8deadSopenharmony_ci program mode (section 3.11), the (s,t,r) texture coordinates used 11875bd8deadSopenharmony_ci for texturing are the values s/q, t/q, and r/q, respectively, where 11885bd8deadSopenharmony_ci s, t, r, and q are the texture coordinates associated with the 11895bd8deadSopenharmony_ci fragment. When in fragment program mode, the (s,t,r) texture 11905bd8deadSopenharmony_ci coordinates are specified by the program. If q is less than or 11915bd8deadSopenharmony_ci equal to zero, the results of texturing are undefined. 11925bd8deadSopenharmony_ci 11935bd8deadSopenharmony_ci 11945bd8deadSopenharmony_ci Modify Section 3.8.7, Texture Minification (p. 135) 11955bd8deadSopenharmony_ci 11965bd8deadSopenharmony_ci (add new paragraph after first paragraph, p. 137) When fragment 11975bd8deadSopenharmony_ci program mode is enabled, the derivatives of the coordinates may be 11985bd8deadSopenharmony_ci ill-defined or non-existent. As a result, the implementation is 11995bd8deadSopenharmony_ci free to approximate these derivatives with such techniques as 12005bd8deadSopenharmony_ci differencing. The only requirement is that texture samples be 12015bd8deadSopenharmony_ci equivalent across the two modes. In other words, the texture sample 12025bd8deadSopenharmony_ci chosen for a fragment of a primitive must be invariant between 12035bd8deadSopenharmony_ci fragment program mode and conventional mode subject to the rules 12045bd8deadSopenharmony_ci set forth in Appendix A, Invariance. 12055bd8deadSopenharmony_ci 12065bd8deadSopenharmony_ci 12075bd8deadSopenharmony_ci Modify Section 3.8.13, Texture Application (p. 149) 12085bd8deadSopenharmony_ci 12095bd8deadSopenharmony_ci (modify fourth paragraph, p. 152) Texturing is enabled and disabled 12105bd8deadSopenharmony_ci individually for each texture unit. If texturing is disabled for 12115bd8deadSopenharmony_ci one of the units, then the fragment resulting from the previous unit 12125bd8deadSopenharmony_ci is passed unaltered to the following unit. Individual texture units 12135bd8deadSopenharmony_ci beyond those specified by MAX_TEXTURE_UNITS may be incomplete and 12145bd8deadSopenharmony_ci are always treated as disabled. 12155bd8deadSopenharmony_ci 12165bd8deadSopenharmony_ci 12175bd8deadSopenharmony_ci Insert a new Section 3.11, (p. 154), between existing sections 3.10 12185bd8deadSopenharmony_ci and 3.11. Renumber 3.11, Antialiasing Application, to 3.12. 12195bd8deadSopenharmony_ci 12205bd8deadSopenharmony_ci 3.11 Fragment Programs 12215bd8deadSopenharmony_ci 12225bd8deadSopenharmony_ci The conventional GL texturing model described in section 3.8 is a 12235bd8deadSopenharmony_ci configurable but essentially hard-wired sequence of per-fragment 12245bd8deadSopenharmony_ci computations based on a canonical set of per-fragment parameters 12255bd8deadSopenharmony_ci and texturing-related state such as texture images, texture 12265bd8deadSopenharmony_ci parameters, and texture environment parameters. The general success 12275bd8deadSopenharmony_ci and utility of the conventional GL texturing model reflects its 12285bd8deadSopenharmony_ci basic correspondence to the typical texturing requirements of 3D 12295bd8deadSopenharmony_ci applications. 12305bd8deadSopenharmony_ci 12315bd8deadSopenharmony_ci However when the conventional GL texturing model is not sufficient, 12325bd8deadSopenharmony_ci the fragment program mode provides a substantially more flexible 12335bd8deadSopenharmony_ci model for generating fragment colors. The fragment program mode 12345bd8deadSopenharmony_ci permits applications to define their own fragment programs. 12355bd8deadSopenharmony_ci 12365bd8deadSopenharmony_ci A fragment program is a character string that specifies a sequence 12375bd8deadSopenharmony_ci of operations to perform. Fragment program instructions are 12385bd8deadSopenharmony_ci typically 4-component vector operations that operate on per-fragment 12395bd8deadSopenharmony_ci attributes and program parameters. Fragment programs execute on a 12405bd8deadSopenharmony_ci per-fragment basis and operate on each fragment completely 12415bd8deadSopenharmony_ci independently from any other fragments. Fragment programs execute a 12425bd8deadSopenharmony_ci finite fixed sequence of instructions with no branching or looping. 12435bd8deadSopenharmony_ci Fragment programs execute without data hazards so results computed 12445bd8deadSopenharmony_ci in one instruction can be used immediately afterwards. The result 12455bd8deadSopenharmony_ci of a fragment program is a set of fragment result registers that 12465bd8deadSopenharmony_ci becomes the color used by antialiasing application and/or a depth 12475bd8deadSopenharmony_ci value used in place of the interpolated depth value generated by 12485bd8deadSopenharmony_ci conventional rasterization. 12495bd8deadSopenharmony_ci 12505bd8deadSopenharmony_ci In fragment program mode, the color sum is subsumed by the fragment 12515bd8deadSopenharmony_ci program. An application desiring the primary and secondary colors 12525bd8deadSopenharmony_ci to be summed must explicitly include this operation in its program. 12535bd8deadSopenharmony_ci 12545bd8deadSopenharmony_ci Fragment programs are defined to operate only in RGBA mode. The 12555bd8deadSopenharmony_ci results of fragment program execution are undefined if the GL is in 12565bd8deadSopenharmony_ci color index mode. 12575bd8deadSopenharmony_ci 12585bd8deadSopenharmony_ci 12595bd8deadSopenharmony_ci 3.11.1 Program Objects 12605bd8deadSopenharmony_ci 12615bd8deadSopenharmony_ci The GL provides one or more program targets, each identifying a 12625bd8deadSopenharmony_ci portion of the GL that can be controlled through application- 12635bd8deadSopenharmony_ci specified programs. The program target for fragment programs is 12645bd8deadSopenharmony_ci FRAGMENT_PROGRAM_ARB. Each program target has an associated program 12655bd8deadSopenharmony_ci object, called the current program object. Each program target also 12665bd8deadSopenharmony_ci has a default program object, which is initially the current program 12675bd8deadSopenharmony_ci object. 12685bd8deadSopenharmony_ci 12695bd8deadSopenharmony_ci Each program object has an associated program string. The command 12705bd8deadSopenharmony_ci 12715bd8deadSopenharmony_ci ProgramStringARB(enum target, enum format, sizei len, 12725bd8deadSopenharmony_ci const void *string); 12735bd8deadSopenharmony_ci 12745bd8deadSopenharmony_ci updates the program string for the current program object for 12755bd8deadSopenharmony_ci <target>. <format> describes the format of the program string, 12765bd8deadSopenharmony_ci which must currently be PROGRAM_FORMAT_ASCII_ARB. <string> is a 12775bd8deadSopenharmony_ci pointer to the array of bytes representing the program string being 12785bd8deadSopenharmony_ci loaded, which need not be null-terminated. The length of the array 12795bd8deadSopenharmony_ci is given by <len>. If <string> is null-terminated, <len> should not 12805bd8deadSopenharmony_ci include the terminator. 12815bd8deadSopenharmony_ci 12825bd8deadSopenharmony_ci When a program string is loaded, it is interpreted according to 12835bd8deadSopenharmony_ci syntactic and semantic rules corresponding to the program target 12845bd8deadSopenharmony_ci specified by <target>. If a program violates the syntactic or 12855bd8deadSopenharmony_ci semantic restrictions of the program target, ProgramStringARB 12865bd8deadSopenharmony_ci generates the error INVALID_OPERATION. An implementation may also 12875bd8deadSopenharmony_ci generate the error INVALID_OPERATION if the program would exceed 12885bd8deadSopenharmony_ci the native resource limits defined in section 6.1.12. A program 12895bd8deadSopenharmony_ci which fails to load due to exceeding native resource limits must 12905bd8deadSopenharmony_ci always fail, regardless of any other GL state. 12915bd8deadSopenharmony_ci 12925bd8deadSopenharmony_ci Additionally, ProgramString will update the program error position 12935bd8deadSopenharmony_ci (PROGRAM_ERROR_POSITION_ARB) and error string 12945bd8deadSopenharmony_ci (PROGRAM_ERROR_STRING_ARB). If a program fails to load, the value 12955bd8deadSopenharmony_ci of the program error position is set to the ubyte offset into the 12965bd8deadSopenharmony_ci specified program string indicating where the first program error 12975bd8deadSopenharmony_ci was detected. If the program fails to load because of a semantic 12985bd8deadSopenharmony_ci restriction that is not detected until the program is fully 12995bd8deadSopenharmony_ci scanned, the error position is set to the value of <len>. If a 13005bd8deadSopenharmony_ci program loads successfully, the error position is set to the value 13015bd8deadSopenharmony_ci negative one. The implementation-dependent program error string 13025bd8deadSopenharmony_ci contains one or more error or warning messages. If a program loads 13035bd8deadSopenharmony_ci succesfully, the error string may either contain warning messages or 13045bd8deadSopenharmony_ci be empty. 13055bd8deadSopenharmony_ci 13065bd8deadSopenharmony_ci Each program object has an associated array of program local 13075bd8deadSopenharmony_ci parameters. The number and type of program local parameters is 13085bd8deadSopenharmony_ci target- and implementation-dependent. For fragment programs, 13095bd8deadSopenharmony_ci program local parameters are four-component floating-point vectors. 13105bd8deadSopenharmony_ci The number of vectors is given by the implementation-dependent 13115bd8deadSopenharmony_ci constant MAX_PROGRAM_LOCAL_PARAMETERS_ARB, which must be at least 13125bd8deadSopenharmony_ci 24. The commands 13135bd8deadSopenharmony_ci 13145bd8deadSopenharmony_ci void ProgramLocalParameter4fARB(enum target, uint index, 13155bd8deadSopenharmony_ci float x, float y, float z, float w); 13165bd8deadSopenharmony_ci void ProgramLocalParameter4fvARB(enum target, uint index, 13175bd8deadSopenharmony_ci const float *params); 13185bd8deadSopenharmony_ci void ProgramLocalParameter4dARB(enum target, uint index, 13195bd8deadSopenharmony_ci double x, double y, double z, double w); 13205bd8deadSopenharmony_ci void ProgramLocalParameter4dvARB(enum target, uint index, 13215bd8deadSopenharmony_ci const double *params); 13225bd8deadSopenharmony_ci 13235bd8deadSopenharmony_ci update the values of the program local parameter numbered <index> 13245bd8deadSopenharmony_ci belonging to the program object currently bound to <target>. For 13255bd8deadSopenharmony_ci ProgramLocalParameter4fARB and ProgramLocalParameter4dARB, the four 13265bd8deadSopenharmony_ci components of the parameter are updated with the values of <x>, <y>, 13275bd8deadSopenharmony_ci <z>, and <w>, respectively. For ProgramLocalParameter4fvARB and 13285bd8deadSopenharmony_ci ProgramLocalParameter4dvARB, the four components of the parameter 13295bd8deadSopenharmony_ci are updated with the array of four values pointed to by <params>. 13305bd8deadSopenharmony_ci The error INVALID_VALUE is generated if <index> is greater than or 13315bd8deadSopenharmony_ci equal to the number of program local parameters supported by 13325bd8deadSopenharmony_ci <target>. 13335bd8deadSopenharmony_ci 13345bd8deadSopenharmony_ci Additionally, each program target has an associated array of program 13355bd8deadSopenharmony_ci environment parameters. Unlike program local parameters, program 13365bd8deadSopenharmony_ci environment parameters are shared by all program objects of a given 13375bd8deadSopenharmony_ci target. The number and type of program environment parameters is 13385bd8deadSopenharmony_ci target- and implementation-dependent. For fragment programs, 13395bd8deadSopenharmony_ci program environment parameters are four-component floating-point 13405bd8deadSopenharmony_ci vectors. The number of vectors is given by the implementation- 13415bd8deadSopenharmony_ci dependent constant MAX_PROGRAM_ENV_PARAMETERS_ARB, which must be at 13425bd8deadSopenharmony_ci least 24. The commands 13435bd8deadSopenharmony_ci 13445bd8deadSopenharmony_ci void ProgramEnvParameter4fARB(enum target, uint index, 13455bd8deadSopenharmony_ci float x, float y, float z, float w); 13465bd8deadSopenharmony_ci void ProgramEnvParameter4fvARB(enum target, uint index, 13475bd8deadSopenharmony_ci const float *params); 13485bd8deadSopenharmony_ci void ProgramEnvParameter4dARB(enum target, uint index, 13495bd8deadSopenharmony_ci double x, double y, double z, double w); 13505bd8deadSopenharmony_ci void ProgramEnvParameter4dvARB(enum target, uint index, 13515bd8deadSopenharmony_ci const double *params); 13525bd8deadSopenharmony_ci 13535bd8deadSopenharmony_ci update the values of the program environment parameter numbered 13545bd8deadSopenharmony_ci <index> for the given program target <target>. For 13555bd8deadSopenharmony_ci ProgramEnvParameter4fARB and ProgramEnvParameter4dARB, the four 13565bd8deadSopenharmony_ci components of the parameter are updated with the values of <x>, <y>, 13575bd8deadSopenharmony_ci <z>, and <w>, respectively. For ProgramEnvParameter4fvARB and 13585bd8deadSopenharmony_ci ProgramEnvParameter4dvARB, the four components of the parameter are 13595bd8deadSopenharmony_ci updated with the array of four values pointed to by <params>. The 13605bd8deadSopenharmony_ci error INVALID_VALUE is generated if <index> is greater than or equal 13615bd8deadSopenharmony_ci to the number of program environment parameters supported by 13625bd8deadSopenharmony_ci <target>. 13635bd8deadSopenharmony_ci 13645bd8deadSopenharmony_ci Each program target has a default program object. Additionally, 13655bd8deadSopenharmony_ci named program objects can be created and operated upon. The name 13665bd8deadSopenharmony_ci space for program objects is the positive integers and is shared by 13675bd8deadSopenharmony_ci programs of all targets. The name zero is reserved by the GL. 13685bd8deadSopenharmony_ci 13695bd8deadSopenharmony_ci A named program object is created by binding an unused program 13705bd8deadSopenharmony_ci object name to a valid program target. The binding is effected by 13715bd8deadSopenharmony_ci calling 13725bd8deadSopenharmony_ci 13735bd8deadSopenharmony_ci BindProgramARB(enum target, uint program); 13745bd8deadSopenharmony_ci 13755bd8deadSopenharmony_ci with <target> set to the desired program target and <program> set to 13765bd8deadSopenharmony_ci the unused program name. The resulting program object has a program 13775bd8deadSopenharmony_ci target given by <target> and is assigned target-specific default 13785bd8deadSopenharmony_ci values (see section 3.11.8 for fragment programs). BindProgramARB 13795bd8deadSopenharmony_ci may also be used to bind an existing program object to a program 13805bd8deadSopenharmony_ci target. If <program> is zero, the default program object for 13815bd8deadSopenharmony_ci <target> is bound. If <program> is the name of an existing program 13825bd8deadSopenharmony_ci object whose associated program target is <target>, the named 13835bd8deadSopenharmony_ci program object is bound. The error INVALID_OPERATION is generated 13845bd8deadSopenharmony_ci if <program> names an existing program object whose associated 13855bd8deadSopenharmony_ci program target is anything other than <target>. 13865bd8deadSopenharmony_ci 13875bd8deadSopenharmony_ci Programs objects are deleted by calling 13885bd8deadSopenharmony_ci 13895bd8deadSopenharmony_ci void DeleteProgramsARB(sizei n, const uint *programs); 13905bd8deadSopenharmony_ci 13915bd8deadSopenharmony_ci <programs> contains <n> names of programs to be deleted. After a 13925bd8deadSopenharmony_ci program object is deleted, its name is again unused. If a program 13935bd8deadSopenharmony_ci object that is bound to any target is deleted, it is as though 13945bd8deadSopenharmony_ci BindProgramARB is first executed with same target and a <program> of 13955bd8deadSopenharmony_ci zero. Unused names in <programs> are silently ignored, as is the 13965bd8deadSopenharmony_ci value zero. 13975bd8deadSopenharmony_ci 13985bd8deadSopenharmony_ci The command 13995bd8deadSopenharmony_ci 14005bd8deadSopenharmony_ci void GenProgramsARB(sizei n, uint *programs); 14015bd8deadSopenharmony_ci 14025bd8deadSopenharmony_ci returns <n> currently unused program names in <programs>. These 14035bd8deadSopenharmony_ci names are marked as used, for the purposes of GenProgramsARB only, 14045bd8deadSopenharmony_ci but objects are created only when they are first bound using 14055bd8deadSopenharmony_ci BindProgramARB. 14065bd8deadSopenharmony_ci 14075bd8deadSopenharmony_ci 14085bd8deadSopenharmony_ci 3.11.2 Fragment Program Grammar and Semantic Restrictions 14095bd8deadSopenharmony_ci 14105bd8deadSopenharmony_ci Fragment program strings are specified as an array of ASCII 14115bd8deadSopenharmony_ci characters containing the program text. When a fragment program is 14125bd8deadSopenharmony_ci loaded by a call to ProgramStringARB, the program string is parsed 14135bd8deadSopenharmony_ci into a set of tokens possibly separated by whitespace. Spaces, 14145bd8deadSopenharmony_ci tabs, newlines, carriage returns, and comments are considered 14155bd8deadSopenharmony_ci whitespace. Comments begin with the character "#" and are 14165bd8deadSopenharmony_ci terminated by a newline, a carriage return, or the end of the 14175bd8deadSopenharmony_ci program array. 14185bd8deadSopenharmony_ci 14195bd8deadSopenharmony_ci The Backus-Naur Form (BNF) grammar below specifies the syntactically 14205bd8deadSopenharmony_ci valid sequences for fragment programs. The set of valid tokens can 14215bd8deadSopenharmony_ci be inferred from the grammar. The token "" represents an empty 14225bd8deadSopenharmony_ci string and is used to indicate optional rules. A program is invalid 14235bd8deadSopenharmony_ci if it contains any undefined tokens or characters. 14245bd8deadSopenharmony_ci 14255bd8deadSopenharmony_ci A fragment program is required to begin with the header string 14265bd8deadSopenharmony_ci "!!ARBfp1.0", without any preceding whitespace. This string 14275bd8deadSopenharmony_ci identifies the subsequent program text as a fragment program 14285bd8deadSopenharmony_ci (version 1.0) that should be parsed according to the following 14295bd8deadSopenharmony_ci grammar and semantic rules. Program string parsing begins with the 14305bd8deadSopenharmony_ci character immediately following the header string. 14315bd8deadSopenharmony_ci 14325bd8deadSopenharmony_ci <program> ::= <optionSequence> <statementSequence> "END" 14335bd8deadSopenharmony_ci 14345bd8deadSopenharmony_ci <optionSequence> ::= <optionSequence> <option> 14355bd8deadSopenharmony_ci | "" 14365bd8deadSopenharmony_ci 14375bd8deadSopenharmony_ci <option> ::= "OPTION" <identifier> ";" 14385bd8deadSopenharmony_ci 14395bd8deadSopenharmony_ci <statementSequence> ::= <statementSequence> <statement> 14405bd8deadSopenharmony_ci | "" 14415bd8deadSopenharmony_ci 14425bd8deadSopenharmony_ci <statement> ::= <instruction> ";" 14435bd8deadSopenharmony_ci | <namingStatement> ";" 14445bd8deadSopenharmony_ci 14455bd8deadSopenharmony_ci <instruction> ::= <ALUInstruction> 14465bd8deadSopenharmony_ci | <TexInstruction> 14475bd8deadSopenharmony_ci 14485bd8deadSopenharmony_ci <ALUInstruction> ::= <VECTORop_instruction> 14495bd8deadSopenharmony_ci | <SCALARop_instruction> 14505bd8deadSopenharmony_ci | <BINSCop_instruction> 14515bd8deadSopenharmony_ci | <BINop_instruction> 14525bd8deadSopenharmony_ci | <TRIop_instruction> 14535bd8deadSopenharmony_ci | <SWZ_instruction> 14545bd8deadSopenharmony_ci 14555bd8deadSopenharmony_ci <TexInstruction> ::= <SAMPLE_instruction> 14565bd8deadSopenharmony_ci | <KIL_instruction> 14575bd8deadSopenharmony_ci 14585bd8deadSopenharmony_ci <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> "," 14595bd8deadSopenharmony_ci <vectorSrcReg> 14605bd8deadSopenharmony_ci 14615bd8deadSopenharmony_ci <VECTORop> ::= "ABS" | "ABS_SAT" 14625bd8deadSopenharmony_ci | "FLR" | "FLR_SAT" 14635bd8deadSopenharmony_ci | "FRC" | "FRC_SAT" 14645bd8deadSopenharmony_ci | "LIT" | "LIT_SAT" 14655bd8deadSopenharmony_ci | "MOV" | "MOV_SAT" 14665bd8deadSopenharmony_ci 14675bd8deadSopenharmony_ci <SCALARop_instruction> ::= <SCALARop> <maskedDstReg> "," 14685bd8deadSopenharmony_ci <scalarSrcReg> 14695bd8deadSopenharmony_ci 14705bd8deadSopenharmony_ci <SCALARop> ::= "COS" | "COS_SAT" 14715bd8deadSopenharmony_ci | "EX2" | "EX2_SAT" 14725bd8deadSopenharmony_ci | "LG2" | "LG2_SAT" 14735bd8deadSopenharmony_ci | "RCP" | "RCP_SAT" 14745bd8deadSopenharmony_ci | "RSQ" | "RSQ_SAT" 14755bd8deadSopenharmony_ci | "SIN" | "SIN_SAT" 14765bd8deadSopenharmony_ci | "SCS" | "SCS_SAT" 14775bd8deadSopenharmony_ci 14785bd8deadSopenharmony_ci <BINSCop_instruction> ::= <BINSCop> <maskedDstReg> "," 14795bd8deadSopenharmony_ci <scalarSrcReg> "," <scalarSrcReg> 14805bd8deadSopenharmony_ci 14815bd8deadSopenharmony_ci <BINSCop> ::= "POW" | "POW_SAT" 14825bd8deadSopenharmony_ci 14835bd8deadSopenharmony_ci <BINop_instruction> ::= <BINop> <maskedDstReg> "," 14845bd8deadSopenharmony_ci <vectorSrcReg> "," <vectorSrcReg> 14855bd8deadSopenharmony_ci 14865bd8deadSopenharmony_ci <BINop> ::= "ADD" | "ADD_SAT" 14875bd8deadSopenharmony_ci | "DP3" | "DP3_SAT" 14885bd8deadSopenharmony_ci | "DP4" | "DP4_SAT" 14895bd8deadSopenharmony_ci | "DPH" | "DPH_SAT" 14905bd8deadSopenharmony_ci | "DST" | "DST_SAT" 14915bd8deadSopenharmony_ci | "MAX" | "MAX_SAT" 14925bd8deadSopenharmony_ci | "MIN" | "MIN_SAT" 14935bd8deadSopenharmony_ci | "MUL" | "MUL_SAT" 14945bd8deadSopenharmony_ci | "SGE" | "SGE_SAT" 14955bd8deadSopenharmony_ci | "SLT" | "SLT_SAT" 14965bd8deadSopenharmony_ci | "SUB" | "SUB_SAT" 14975bd8deadSopenharmony_ci | "XPD" | "XPD_SAT" 14985bd8deadSopenharmony_ci 14995bd8deadSopenharmony_ci <TRIop_instruction> ::= <TRIop> <maskedDstReg> "," 15005bd8deadSopenharmony_ci <vectorSrcReg> "," <vectorSrcReg> "," 15015bd8deadSopenharmony_ci <vectorSrcReg> 15025bd8deadSopenharmony_ci 15035bd8deadSopenharmony_ci <TRIop> ::= "CMP" | "CMP_SAT" 15045bd8deadSopenharmony_ci | "LRP" | "LRP_SAT" 15055bd8deadSopenharmony_ci | "MAD" | "MAD_SAT" 15065bd8deadSopenharmony_ci 15075bd8deadSopenharmony_ci <SWZ_instruction> ::= <SWZop> <maskedDstReg> "," 15085bd8deadSopenharmony_ci <srcReg> "," <extendedSwizzle> 15095bd8deadSopenharmony_ci 15105bd8deadSopenharmony_ci <SWZop> ::= "SWZ" | "SWZ_SAT" 15115bd8deadSopenharmony_ci 15125bd8deadSopenharmony_ci <SAMPLE_instruction> ::= <SAMPLEop> <maskedDstReg> "," 15135bd8deadSopenharmony_ci <vectorSrcReg> "," <texImageUnit> "," 15145bd8deadSopenharmony_ci <texTarget> 15155bd8deadSopenharmony_ci 15165bd8deadSopenharmony_ci <SAMPLEop> ::= "TEX" | "TEX_SAT" 15175bd8deadSopenharmony_ci | "TXP" | "TXP_SAT" 15185bd8deadSopenharmony_ci | "TXB" | "TXB_SAT" 15195bd8deadSopenharmony_ci 15205bd8deadSopenharmony_ci <KIL_instruction> ::= "KIL" <vectorSrcReg> 15215bd8deadSopenharmony_ci 15225bd8deadSopenharmony_ci <texImageUnit> ::= "texture" <optTexImageUnitNum> 15235bd8deadSopenharmony_ci 15245bd8deadSopenharmony_ci <texTarget> ::= "1D" 15255bd8deadSopenharmony_ci | "2D" 15265bd8deadSopenharmony_ci | "3D" 15275bd8deadSopenharmony_ci | "CUBE" 15285bd8deadSopenharmony_ci | "RECT" 15295bd8deadSopenharmony_ci 15305bd8deadSopenharmony_ci <optTexImageUnitNum> ::= "" 15315bd8deadSopenharmony_ci | "[" <texImageUnitNum> "]" 15325bd8deadSopenharmony_ci 15335bd8deadSopenharmony_ci <texImageUnitNum> ::= <integer> from 0 to 15345bd8deadSopenharmony_ci MAX_TEXTURE_IMAGE_UNITS_ARB-1 15355bd8deadSopenharmony_ci 15365bd8deadSopenharmony_ci <scalarSrcReg> ::= <optionalSign> <srcReg> <scalarSuffix> 15375bd8deadSopenharmony_ci 15385bd8deadSopenharmony_ci <vectorSrcReg> ::= <optionalSign> <srcReg> <optionalSuffix> 15395bd8deadSopenharmony_ci 15405bd8deadSopenharmony_ci <maskedDstReg> ::= <dstReg> <optionalMask> 15415bd8deadSopenharmony_ci 15425bd8deadSopenharmony_ci <extendedSwizzle> ::= <xyzwExtendedSwizzle> 15435bd8deadSopenharmony_ci | <rgbaExtendedSwizzle> 15445bd8deadSopenharmony_ci 15455bd8deadSopenharmony_ci <xyzwExtendedSwizzle> ::= <xyzwExtSwizComp> "," <xyzwExtSwizComp> "," 15465bd8deadSopenharmony_ci <xyzwExtSwizComp> "," <xyzwExtSwizComp> 15475bd8deadSopenharmony_ci 15485bd8deadSopenharmony_ci <rgbaExtendedSwizzle> ::= <rgbaExtSwizComp> "," <rgbaExtSwizComp> "," 15495bd8deadSopenharmony_ci <rgbaExtSwizComp> "," <rgbaExtSwizComp> 15505bd8deadSopenharmony_ci 15515bd8deadSopenharmony_ci <xyzwExtSwizComp> ::= <optionalSign> <xyzwExtSwizSel> 15525bd8deadSopenharmony_ci 15535bd8deadSopenharmony_ci <rgbaExtSwizComp> ::= <optionalSign> <rgbaExtSwizSel> 15545bd8deadSopenharmony_ci 15555bd8deadSopenharmony_ci <xyzwExtSwizSel> ::= "0" 15565bd8deadSopenharmony_ci | "1" 15575bd8deadSopenharmony_ci | <xyzwComponent> 15585bd8deadSopenharmony_ci 15595bd8deadSopenharmony_ci <rgbaExtSwizSel> ::= "0" 15605bd8deadSopenharmony_ci | "1" 15615bd8deadSopenharmony_ci | <rgbaComponent> 15625bd8deadSopenharmony_ci 15635bd8deadSopenharmony_ci <srcReg> ::= <fragmentAttribReg> 15645bd8deadSopenharmony_ci | <temporaryReg> 15655bd8deadSopenharmony_ci | <progParamReg> 15665bd8deadSopenharmony_ci 15675bd8deadSopenharmony_ci <dstReg> ::= <temporaryReg> 15685bd8deadSopenharmony_ci | <fragmentResultReg> 15695bd8deadSopenharmony_ci 15705bd8deadSopenharmony_ci <fragmentAttribReg> ::= <establishedName> 15715bd8deadSopenharmony_ci | <fragAttribBinding> 15725bd8deadSopenharmony_ci 15735bd8deadSopenharmony_ci <temporaryReg> ::= <establishedName> 15745bd8deadSopenharmony_ci 15755bd8deadSopenharmony_ci <progParamReg> ::= <progParamSingle> 15765bd8deadSopenharmony_ci | <progParamArray> "[" <progParamArrayAbs> "]" 15775bd8deadSopenharmony_ci | <paramSingleItemUse> 15785bd8deadSopenharmony_ci 15795bd8deadSopenharmony_ci <progParamSingle> ::= <establishedName> 15805bd8deadSopenharmony_ci 15815bd8deadSopenharmony_ci <progParamArray> ::= <establishedName> 15825bd8deadSopenharmony_ci 15835bd8deadSopenharmony_ci <progParamArrayAbs> ::= <integer> 15845bd8deadSopenharmony_ci 15855bd8deadSopenharmony_ci <fragmentResultReg> ::= <establishedName> 15865bd8deadSopenharmony_ci | <resultBinding> 15875bd8deadSopenharmony_ci 15885bd8deadSopenharmony_ci <scalarSuffix> ::= "." <component> 15895bd8deadSopenharmony_ci 15905bd8deadSopenharmony_ci <optionalSuffix> ::= "" 15915bd8deadSopenharmony_ci | "." <component> 15925bd8deadSopenharmony_ci | "." <xyzwComponent> <xyzwComponent> 15935bd8deadSopenharmony_ci <xyzwComponent> <xyzwComponent> 15945bd8deadSopenharmony_ci | "." <rgbaComponent> <rgbaComponent> 15955bd8deadSopenharmony_ci <rgbaComponent> <rgbaComponent> 15965bd8deadSopenharmony_ci 15975bd8deadSopenharmony_ci <component> ::= <xyzwComponent> 15985bd8deadSopenharmony_ci | <rgbaComponent> 15995bd8deadSopenharmony_ci 16005bd8deadSopenharmony_ci <xyzwComponent> ::= "x" | "y" | "z" | "w" 16015bd8deadSopenharmony_ci 16025bd8deadSopenharmony_ci <rgbaComponent> ::= "r" | "g" | "b" | "a" 16035bd8deadSopenharmony_ci 16045bd8deadSopenharmony_ci <optionalMask> ::= "" 16055bd8deadSopenharmony_ci | <xyzwMask> 16065bd8deadSopenharmony_ci | <rgbaMask> 16075bd8deadSopenharmony_ci 16085bd8deadSopenharmony_ci <xyzwMask> ::= "." "x" 16095bd8deadSopenharmony_ci | "." "y" 16105bd8deadSopenharmony_ci | "." "xy" 16115bd8deadSopenharmony_ci | "." "z" 16125bd8deadSopenharmony_ci | "." "xz" 16135bd8deadSopenharmony_ci | "." "yz" 16145bd8deadSopenharmony_ci | "." "xyz" 16155bd8deadSopenharmony_ci | "." "w" 16165bd8deadSopenharmony_ci | "." "xw" 16175bd8deadSopenharmony_ci | "." "yw" 16185bd8deadSopenharmony_ci | "." "xyw" 16195bd8deadSopenharmony_ci | "." "zw" 16205bd8deadSopenharmony_ci | "." "xzw" 16215bd8deadSopenharmony_ci | "." "yzw" 16225bd8deadSopenharmony_ci | "." "xyzw" 16235bd8deadSopenharmony_ci 16245bd8deadSopenharmony_ci <rgbaMask> ::= "." "r" 16255bd8deadSopenharmony_ci | "." "g" 16265bd8deadSopenharmony_ci | "." "rg" 16275bd8deadSopenharmony_ci | "." "b" 16285bd8deadSopenharmony_ci | "." "rb" 16295bd8deadSopenharmony_ci | "." "gb" 16305bd8deadSopenharmony_ci | "." "rgb" 16315bd8deadSopenharmony_ci | "." "a" 16325bd8deadSopenharmony_ci | "." "ra" 16335bd8deadSopenharmony_ci | "." "ga" 16345bd8deadSopenharmony_ci | "." "rga" 16355bd8deadSopenharmony_ci | "." "ba" 16365bd8deadSopenharmony_ci | "." "rba" 16375bd8deadSopenharmony_ci | "." "gba" 16385bd8deadSopenharmony_ci | "." "rgba" 16395bd8deadSopenharmony_ci 16405bd8deadSopenharmony_ci <namingStatement> ::= <ATTRIB_statement> 16415bd8deadSopenharmony_ci | <PARAM_statement> 16425bd8deadSopenharmony_ci | <TEMP_statement> 16435bd8deadSopenharmony_ci | <OUTPUT_statement> 16445bd8deadSopenharmony_ci | <ALIAS_statement> 16455bd8deadSopenharmony_ci 16465bd8deadSopenharmony_ci <ATTRIB_statement> ::= "ATTRIB" <establishName> "=" 16475bd8deadSopenharmony_ci <fragAttribBinding> 16485bd8deadSopenharmony_ci 16495bd8deadSopenharmony_ci <fragAttribBinding> ::= "fragment" "." <fragAttribItem> 16505bd8deadSopenharmony_ci 16515bd8deadSopenharmony_ci <fragAttribItem> ::= "color" <optColorType> 16525bd8deadSopenharmony_ci | "texcoord" <optTexCoordNum> 16535bd8deadSopenharmony_ci | "fogcoord" 16545bd8deadSopenharmony_ci | "position" 16555bd8deadSopenharmony_ci 16565bd8deadSopenharmony_ci <PARAM_statement> ::= <PARAM_singleStmt> 16575bd8deadSopenharmony_ci | <PARAM_multipleStmt> 16585bd8deadSopenharmony_ci 16595bd8deadSopenharmony_ci <PARAM_singleStmt> ::= "PARAM" <establishName> <paramSingleInit> 16605bd8deadSopenharmony_ci 16615bd8deadSopenharmony_ci <PARAM_multipleStmt> ::= "PARAM" <establishName> "[" <optArraySize> "]" 16625bd8deadSopenharmony_ci <paramMultipleInit> 16635bd8deadSopenharmony_ci 16645bd8deadSopenharmony_ci <optArraySize> ::= "" 16655bd8deadSopenharmony_ci | <integer> from 1 to MAX_PROGRAM_PARAMETERS_ARB 16665bd8deadSopenharmony_ci (maximum number of allowed program 16675bd8deadSopenharmony_ci parameter bindings) 16685bd8deadSopenharmony_ci 16695bd8deadSopenharmony_ci <paramSingleInit> ::= "=" <paramSingleItemDecl> 16705bd8deadSopenharmony_ci 16715bd8deadSopenharmony_ci <paramMultipleInit> ::= "=" "{" <paramMultInitList> "}" 16725bd8deadSopenharmony_ci 16735bd8deadSopenharmony_ci <paramMultInitList> ::= <paramMultipleItem> 16745bd8deadSopenharmony_ci | <paramMultipleItem> "," <paramMultInitList> 16755bd8deadSopenharmony_ci 16765bd8deadSopenharmony_ci <paramSingleItemDecl> ::= <stateSingleItem> 16775bd8deadSopenharmony_ci | <programSingleItem> 16785bd8deadSopenharmony_ci | <paramConstDecl> 16795bd8deadSopenharmony_ci 16805bd8deadSopenharmony_ci <paramSingleItemUse> ::= <stateSingleItem> 16815bd8deadSopenharmony_ci | <programSingleItem> 16825bd8deadSopenharmony_ci | <paramConstUse> 16835bd8deadSopenharmony_ci 16845bd8deadSopenharmony_ci <paramMultipleItem> ::= <stateMultipleItem> 16855bd8deadSopenharmony_ci | <programMultipleItem> 16865bd8deadSopenharmony_ci | <paramConstDecl> 16875bd8deadSopenharmony_ci 16885bd8deadSopenharmony_ci <stateMultipleItem> ::= <stateSingleItem> 16895bd8deadSopenharmony_ci | "state" "." <stateMatrixRows> 16905bd8deadSopenharmony_ci 16915bd8deadSopenharmony_ci <stateSingleItem> ::= "state" "." <stateMaterialItem> 16925bd8deadSopenharmony_ci | "state" "." <stateLightItem> 16935bd8deadSopenharmony_ci | "state" "." <stateLightModelItem> 16945bd8deadSopenharmony_ci | "state" "." <stateLightProdItem> 16955bd8deadSopenharmony_ci | "state" "." <stateTexEnvItem> 16965bd8deadSopenharmony_ci | "state" "." <stateFogItem> 16975bd8deadSopenharmony_ci | "state" "." <stateDepthItem> 16985bd8deadSopenharmony_ci | "state" "." <stateMatrixRow> 16995bd8deadSopenharmony_ci 17005bd8deadSopenharmony_ci <stateMaterialItem> ::= "material" <optFaceType> "." <stateMatProperty> 17015bd8deadSopenharmony_ci 17025bd8deadSopenharmony_ci <stateMatProperty> ::= "ambient" 17035bd8deadSopenharmony_ci | "diffuse" 17045bd8deadSopenharmony_ci | "specular" 17055bd8deadSopenharmony_ci | "emission" 17065bd8deadSopenharmony_ci | "shininess" 17075bd8deadSopenharmony_ci 17085bd8deadSopenharmony_ci <stateLightItem> ::= "light" "[" <stateLightNumber> "]" "." 17095bd8deadSopenharmony_ci <stateLightProperty> 17105bd8deadSopenharmony_ci 17115bd8deadSopenharmony_ci <stateLightProperty> ::= "ambient" 17125bd8deadSopenharmony_ci | "diffuse" 17135bd8deadSopenharmony_ci | "specular" 17145bd8deadSopenharmony_ci | "position" 17155bd8deadSopenharmony_ci | "attenuation" 17165bd8deadSopenharmony_ci | "spot" "." <stateSpotProperty> 17175bd8deadSopenharmony_ci | "half" 17185bd8deadSopenharmony_ci 17195bd8deadSopenharmony_ci <stateSpotProperty> ::= "direction" 17205bd8deadSopenharmony_ci 17215bd8deadSopenharmony_ci <stateLightModelItem> ::= "lightmodel" <stateLModProperty> 17225bd8deadSopenharmony_ci 17235bd8deadSopenharmony_ci <stateLModProperty> ::= "." "ambient" 17245bd8deadSopenharmony_ci | <optFaceType> "." "scenecolor" 17255bd8deadSopenharmony_ci 17265bd8deadSopenharmony_ci <stateLightProdItem> ::= "lightprod" "[" <stateLightNumber> "]" 17275bd8deadSopenharmony_ci <optFaceType> "." <stateLProdProperty> 17285bd8deadSopenharmony_ci 17295bd8deadSopenharmony_ci <stateLProdProperty> ::= "ambient" 17305bd8deadSopenharmony_ci | "diffuse" 17315bd8deadSopenharmony_ci | "specular" 17325bd8deadSopenharmony_ci 17335bd8deadSopenharmony_ci <stateLightNumber> ::= <integer> from 0 to MAX_LIGHTS-1 17345bd8deadSopenharmony_ci 17355bd8deadSopenharmony_ci <stateTexEnvItem> ::= "texenv" <optLegacyTexUnitNum> "." 17365bd8deadSopenharmony_ci <stateTexEnvProperty> 17375bd8deadSopenharmony_ci 17385bd8deadSopenharmony_ci <stateTexEnvProperty> ::= "color" 17395bd8deadSopenharmony_ci 17405bd8deadSopenharmony_ci <optLegacyTexUnitNum> ::= "" 17415bd8deadSopenharmony_ci | "[" <legacyTexUnitNum> "]" 17425bd8deadSopenharmony_ci 17435bd8deadSopenharmony_ci <legacyTexUnitNum> ::= <integer> from 0 to MAX_TEXTURE_UNITS-1 17445bd8deadSopenharmony_ci 17455bd8deadSopenharmony_ci <stateFogItem> ::= "fog" "." <stateFogProperty> 17465bd8deadSopenharmony_ci 17475bd8deadSopenharmony_ci <stateFogProperty> ::= "color" 17485bd8deadSopenharmony_ci | "params" 17495bd8deadSopenharmony_ci 17505bd8deadSopenharmony_ci <stateDepthItem> ::= "depth" "." <stateDepthProperty> 17515bd8deadSopenharmony_ci 17525bd8deadSopenharmony_ci <stateDepthProperty> ::= "range" 17535bd8deadSopenharmony_ci 17545bd8deadSopenharmony_ci <stateMatrixRow> ::= <stateMatrixItem> "." "row" "[" 17555bd8deadSopenharmony_ci <stateMatrixRowNum> "]" 17565bd8deadSopenharmony_ci 17575bd8deadSopenharmony_ci <stateMatrixRows> ::= <stateMatrixItem> <optMatrixRows> 17585bd8deadSopenharmony_ci 17595bd8deadSopenharmony_ci <optMatrixRows> ::= "" 17605bd8deadSopenharmony_ci | "." "row" "[" <stateMatrixRowNum> ".." 17615bd8deadSopenharmony_ci <stateMatrixRowNum> "]" 17625bd8deadSopenharmony_ci 17635bd8deadSopenharmony_ci <stateMatrixItem> ::= "matrix" "." <stateMatrixName> 17645bd8deadSopenharmony_ci <stateOptMatModifier> 17655bd8deadSopenharmony_ci 17665bd8deadSopenharmony_ci <stateOptMatModifier> ::= "" 17675bd8deadSopenharmony_ci | "." <stateMatModifier> 17685bd8deadSopenharmony_ci 17695bd8deadSopenharmony_ci <stateMatModifier> ::= "inverse" 17705bd8deadSopenharmony_ci | "transpose" 17715bd8deadSopenharmony_ci | "invtrans" 17725bd8deadSopenharmony_ci 17735bd8deadSopenharmony_ci <stateMatrixRowNum> ::= <integer> from 0 to 3 17745bd8deadSopenharmony_ci 17755bd8deadSopenharmony_ci <stateMatrixName> ::= "modelview" <stateOptModMatNum> 17765bd8deadSopenharmony_ci | "projection" 17775bd8deadSopenharmony_ci | "mvp" 17785bd8deadSopenharmony_ci | "texture" <optTexCoordNum> 17795bd8deadSopenharmony_ci | "palette" "[" <statePaletteMatNum> "]" 17805bd8deadSopenharmony_ci | "program" "[" <stateProgramMatNum> "]" 17815bd8deadSopenharmony_ci 17825bd8deadSopenharmony_ci <stateOptModMatNum> ::= "" 17835bd8deadSopenharmony_ci | "[" <stateModMatNum> "]" 17845bd8deadSopenharmony_ci 17855bd8deadSopenharmony_ci <stateModMatNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1 17865bd8deadSopenharmony_ci 17875bd8deadSopenharmony_ci <optTexCoordNum> ::= "" 17885bd8deadSopenharmony_ci | "[" <texCoordNum> "]" 17895bd8deadSopenharmony_ci 17905bd8deadSopenharmony_ci <texCoordNum> ::= <integer> from 0 to MAX_TEXTURE_COORDS_ARB-1 17915bd8deadSopenharmony_ci 17925bd8deadSopenharmony_ci <statePaletteMatNum> ::= <integer> from 0 to MAX_PALETTE_MATRICES_ARB-1 17935bd8deadSopenharmony_ci 17945bd8deadSopenharmony_ci <stateProgramMatNum> ::= <integer> from 0 to MAX_PROGRAM_MATRICES_ARB-1 17955bd8deadSopenharmony_ci 17965bd8deadSopenharmony_ci <programSingleItem> ::= <progEnvParam> 17975bd8deadSopenharmony_ci | <progLocalParam> 17985bd8deadSopenharmony_ci 17995bd8deadSopenharmony_ci <programMultipleItem> ::= <progEnvParams> 18005bd8deadSopenharmony_ci | <progLocalParams> 18015bd8deadSopenharmony_ci 18025bd8deadSopenharmony_ci <progEnvParams> ::= "program" "." "env" 18035bd8deadSopenharmony_ci "[" <progEnvParamNums> "]" 18045bd8deadSopenharmony_ci 18055bd8deadSopenharmony_ci <progEnvParamNums> ::= <progEnvParamNum> 18065bd8deadSopenharmony_ci | <progEnvParamNum> ".." <progEnvParamNum> 18075bd8deadSopenharmony_ci 18085bd8deadSopenharmony_ci <progEnvParam> ::= "program" "." "env" 18095bd8deadSopenharmony_ci "[" <progEnvParamNum> "]" 18105bd8deadSopenharmony_ci 18115bd8deadSopenharmony_ci <progLocalParams> ::= "program" "." "local" 18125bd8deadSopenharmony_ci "[" <progLocalParamNums> "]" 18135bd8deadSopenharmony_ci 18145bd8deadSopenharmony_ci <progLocalParamNums> ::= <progLocalParamNum> 18155bd8deadSopenharmony_ci | <progLocalParamNum> ".." <progLocalParamNum> 18165bd8deadSopenharmony_ci 18175bd8deadSopenharmony_ci <progLocalParam> ::= "program" "." "local" 18185bd8deadSopenharmony_ci "[" <progLocalParamNum> "]" 18195bd8deadSopenharmony_ci 18205bd8deadSopenharmony_ci <progEnvParamNum> ::= <integer> from 0 to 18215bd8deadSopenharmony_ci MAX_PROGRAM_ENV_PARAMETERS_ARB - 1 18225bd8deadSopenharmony_ci 18235bd8deadSopenharmony_ci <progLocalParamNum> ::= <integer> from 0 to 18245bd8deadSopenharmony_ci MAX_PROGRAM_LOCAL_PARAMETERS_ARB - 1 18255bd8deadSopenharmony_ci 18265bd8deadSopenharmony_ci <paramConstDecl> ::= <paramConstScalarDecl> 18275bd8deadSopenharmony_ci | <paramConstVector> 18285bd8deadSopenharmony_ci 18295bd8deadSopenharmony_ci <paramConstUse> ::= <paramConstScalarUse> 18305bd8deadSopenharmony_ci | <paramConstVector> 18315bd8deadSopenharmony_ci 18325bd8deadSopenharmony_ci <paramConstScalarDecl> ::= <signedFloatConstant> 18335bd8deadSopenharmony_ci 18345bd8deadSopenharmony_ci <paramConstScalarUse> ::= <floatConstant> 18355bd8deadSopenharmony_ci 18365bd8deadSopenharmony_ci <paramConstVector> ::= "{" <signedFloatConstant> "}" 18375bd8deadSopenharmony_ci | "{" <signedFloatConstant> "," 18385bd8deadSopenharmony_ci <signedFloatConstant> "}" 18395bd8deadSopenharmony_ci | "{" <signedFloatConstant> "," 18405bd8deadSopenharmony_ci <signedFloatConstant> "," 18415bd8deadSopenharmony_ci <signedFloatConstant> "}" 18425bd8deadSopenharmony_ci | "{" <signedFloatConstant> "," 18435bd8deadSopenharmony_ci <signedFloatConstant> "," 18445bd8deadSopenharmony_ci <signedFloatConstant> "," 18455bd8deadSopenharmony_ci <signedFloatConstant> "}" 18465bd8deadSopenharmony_ci 18475bd8deadSopenharmony_ci <signedFloatConstant> ::= <optionalSign> <floatConstant> 18485bd8deadSopenharmony_ci 18495bd8deadSopenharmony_ci <floatConstant> ::= see text 18505bd8deadSopenharmony_ci 18515bd8deadSopenharmony_ci <optionalSign> ::= "" 18525bd8deadSopenharmony_ci | "-" 18535bd8deadSopenharmony_ci | "+" 18545bd8deadSopenharmony_ci 18555bd8deadSopenharmony_ci <TEMP_statement> ::= "TEMP" <varNameList> 18565bd8deadSopenharmony_ci 18575bd8deadSopenharmony_ci <varNameList> ::= <establishName> 18585bd8deadSopenharmony_ci | <establishName> "," <varNameList> 18595bd8deadSopenharmony_ci 18605bd8deadSopenharmony_ci <OUTPUT_statement> ::= "OUTPUT" <establishName> "=" 18615bd8deadSopenharmony_ci <resultBinding> 18625bd8deadSopenharmony_ci 18635bd8deadSopenharmony_ci <resultBinding> ::= "result" "." "color" 18645bd8deadSopenharmony_ci | "result" "." "depth" 18655bd8deadSopenharmony_ci 18665bd8deadSopenharmony_ci <optFaceType> ::= "" 18675bd8deadSopenharmony_ci | "." "front" 18685bd8deadSopenharmony_ci | "." "back" 18695bd8deadSopenharmony_ci 18705bd8deadSopenharmony_ci <optColorType> ::= "" 18715bd8deadSopenharmony_ci | "." "primary" 18725bd8deadSopenharmony_ci | "." "secondary" 18735bd8deadSopenharmony_ci 18745bd8deadSopenharmony_ci <ALIAS_statement> ::= "ALIAS" <establishName> "=" 18755bd8deadSopenharmony_ci <establishedName> 18765bd8deadSopenharmony_ci 18775bd8deadSopenharmony_ci <establishName> ::= <identifier> 18785bd8deadSopenharmony_ci 18795bd8deadSopenharmony_ci <establishedName> ::= <identifier> 18805bd8deadSopenharmony_ci 18815bd8deadSopenharmony_ci <identifier> ::= see text 18825bd8deadSopenharmony_ci 18835bd8deadSopenharmony_ci The <integer> rule matches an integer constant. The integer 18845bd8deadSopenharmony_ci consists of a sequence of one or more digits ("0" through "9"). 18855bd8deadSopenharmony_ci 18865bd8deadSopenharmony_ci The <floatConstant> rule matches a floating-point constant 18875bd8deadSopenharmony_ci consisting of an integer part, a decimal point, a fraction part, an 18885bd8deadSopenharmony_ci "e" or "E", and an optionally signed integer exponent. The integer 18895bd8deadSopenharmony_ci and fraction parts both consist of a sequence of one or more digits 18905bd8deadSopenharmony_ci ("0" through "9"). Either the integer part or the fraction parts 18915bd8deadSopenharmony_ci (not both) may be missing; either the decimal point or the "e" (or 18925bd8deadSopenharmony_ci "E") and the exponent (not both) may be missing. 18935bd8deadSopenharmony_ci 18945bd8deadSopenharmony_ci The <identifier> rule matches a sequence of one or more letters ("A" 18955bd8deadSopenharmony_ci through "Z", "a" through "z"), digits ("0" through "9), underscores 18965bd8deadSopenharmony_ci ("_"), or dollar signs ("$"); the first character must not be a 18975bd8deadSopenharmony_ci number. Upper and lower case letters are considered different 18985bd8deadSopenharmony_ci (names are case-sensitive). The following strings are reserved 18995bd8deadSopenharmony_ci keywords and may not be used as identifiers: 19005bd8deadSopenharmony_ci 19015bd8deadSopenharmony_ci ABS, ABS_SAT, ADD, ADD_SAT, ALIAS, ATTRIB, CMP, CMP_SAT, COS, 19025bd8deadSopenharmony_ci COS_SAT, DP3, DP3_SAT, DP4, DP4_SAT, DPH, DPH_SAT, DST, DST_SAT, 19035bd8deadSopenharmony_ci END, EX2, EX2_SAT, FLR, FLR_SAT, FRC, FRC_SAT, KIL, LG2, 19045bd8deadSopenharmony_ci LG2_SAT, LIT, LIT_SAT, LRP, LRP_SAT, MAD, MAD_SAT, MAX, MAX_SAT, 19055bd8deadSopenharmony_ci MIN, MIN_SAT, MOV, MOV_SAT, MUL, MUL_SAT, OPTION, OUTPUT, PARAM, 19065bd8deadSopenharmony_ci POW, POW_SAT, RCP, RCP_SAT, RSQ, RSQ_SAT, SIN, SIN_SAT, SCS, 19075bd8deadSopenharmony_ci SCS_SAT, SGE, SGE_SAT, SLT, SLT_SAT, SUB, SUB_SAT, SWZ, SWZ_SAT, 19085bd8deadSopenharmony_ci TEMP, TEX, TEX_SAT, TXB, TXB_SAT, TXP, TXP_SAT, XPD, XPD_SAT, 19095bd8deadSopenharmony_ci fragment, program, result, state, and texture. 19105bd8deadSopenharmony_ci 19115bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if a fragment program fails 19125bd8deadSopenharmony_ci to load because it is not syntactically correct or for one of the 19135bd8deadSopenharmony_ci semantic restrictions described in the following sections. 19145bd8deadSopenharmony_ci 19155bd8deadSopenharmony_ci A successfully loaded fragment program is parsed into a sequence of 19165bd8deadSopenharmony_ci instructions. Each instruction is identified by its tokenized name. 19175bd8deadSopenharmony_ci The operation of these instructions when executed is defined in 19185bd8deadSopenharmony_ci section 3.11.5. 19195bd8deadSopenharmony_ci 19205bd8deadSopenharmony_ci A successfully loaded program string replaces the program string 19215bd8deadSopenharmony_ci previously loaded into the specified program object. If the 19225bd8deadSopenharmony_ci OUT_OF_MEMORY error is generated by ProgramStringARB, no change is 19235bd8deadSopenharmony_ci made to the previous contents of the current program object. 19245bd8deadSopenharmony_ci 19255bd8deadSopenharmony_ci 19265bd8deadSopenharmony_ci 3.11.3 Fragment Program Variables 19275bd8deadSopenharmony_ci 19285bd8deadSopenharmony_ci Fragment programs may access a number of different variables during 19295bd8deadSopenharmony_ci their execution. The following sections define the variables that 19305bd8deadSopenharmony_ci can be declared and used by a fragment program. 19315bd8deadSopenharmony_ci 19325bd8deadSopenharmony_ci Explicit variable declarations allow a fragment program to establish 19335bd8deadSopenharmony_ci a variable name that can be used to refer to a specified resource in 19345bd8deadSopenharmony_ci subsequent instructions. A fragment program will fail to load if it 19355bd8deadSopenharmony_ci declares the same variable name more than once or if it refers to a 19365bd8deadSopenharmony_ci variable name that has not been previously declared in the program 19375bd8deadSopenharmony_ci string. 19385bd8deadSopenharmony_ci 19395bd8deadSopenharmony_ci Implicit variable declarations allow a fragment program to use the 19405bd8deadSopenharmony_ci name of certain available resources by name. 19415bd8deadSopenharmony_ci 19425bd8deadSopenharmony_ci 19435bd8deadSopenharmony_ci 3.11.3.1 Fragment Attributes 19445bd8deadSopenharmony_ci 19455bd8deadSopenharmony_ci Fragment program attribute variables are a set of four-component 19465bd8deadSopenharmony_ci floating-point vectors holding the attributes of the fragment being 19475bd8deadSopenharmony_ci processed. Fragment attribute variables are read-only during 19485bd8deadSopenharmony_ci fragment program execution. 19495bd8deadSopenharmony_ci 19505bd8deadSopenharmony_ci Fragment attribute variables can be declared explicitly using the 19515bd8deadSopenharmony_ci <ATTRIB_statement> grammar rule, or implicitly using the 19525bd8deadSopenharmony_ci <fragAttribBinding> grammar rule in an executable instruction. 19535bd8deadSopenharmony_ci 19545bd8deadSopenharmony_ci Each fragment attribute variable is bound to a single item of 19555bd8deadSopenharmony_ci fragment state according to the <fragAttrBinding> grammar rule. The 19565bd8deadSopenharmony_ci set of GL state that can be bound to a fragment attribute variable 19575bd8deadSopenharmony_ci is given in Table X.1. Fragment attribute variables are initialized 19585bd8deadSopenharmony_ci at each fragment program invocation with the current values of the 19595bd8deadSopenharmony_ci bound state. 19605bd8deadSopenharmony_ci 19615bd8deadSopenharmony_ci Fragment Attribute Binding Components Underlying State 19625bd8deadSopenharmony_ci -------------------------- ---------- ---------------------------- 19635bd8deadSopenharmony_ci fragment.color (r,g,b,a) primary color 19645bd8deadSopenharmony_ci fragment.color.primary (r,g,b,a) primary color 19655bd8deadSopenharmony_ci fragment.color.secondary (r,g,b,a) secondary color 19665bd8deadSopenharmony_ci fragment.texcoord (s,t,r,q) texture coordinate, unit 0 19675bd8deadSopenharmony_ci fragment.texcoord[n] (s,t,r,q) texture coordinate, unit n 19685bd8deadSopenharmony_ci fragment.fogcoord (f,0,0,1) fog distance/coordinate 19695bd8deadSopenharmony_ci fragment.position (x,y,z,1/w) window position 19705bd8deadSopenharmony_ci 19715bd8deadSopenharmony_ci Table X.1: Fragment Attribute Bindings. The "Components" column 19725bd8deadSopenharmony_ci indicates the mapping of the state in the "Underlying State" 19735bd8deadSopenharmony_ci column. Bindings containing "[n]" require an integer value of <n> 19745bd8deadSopenharmony_ci to select an individual item. 19755bd8deadSopenharmony_ci 19765bd8deadSopenharmony_ci If a fragment attribute binding matches "fragment.color" or 19775bd8deadSopenharmony_ci "fragment.color.primary", the "x", "y", "z", and "w" components of 19785bd8deadSopenharmony_ci the fragment attribute variable are filled with the "r", "g", "b", 19795bd8deadSopenharmony_ci and "a" components, respectively, of the fragment color. Each 19805bd8deadSopenharmony_ci fixed-point color component undergoes an implied conversion to 19815bd8deadSopenharmony_ci floating point. This conversion must leave the values 0 and 1 19825bd8deadSopenharmony_ci invariant. 19835bd8deadSopenharmony_ci 19845bd8deadSopenharmony_ci If a fragment attribute binding matches "fragment.color.secondary", 19855bd8deadSopenharmony_ci the "x", "y", "z", and "w" components of the fragment attribute 19865bd8deadSopenharmony_ci variable are filled with the "r", "g", "b", and "a" components, 19875bd8deadSopenharmony_ci respectively, of the fragment secondary color. Each fixed-point 19885bd8deadSopenharmony_ci color component undergoes an implied conversion to floating point. 19895bd8deadSopenharmony_ci This conversion must leave the values 0 and 1 invariant. 19905bd8deadSopenharmony_ci 19915bd8deadSopenharmony_ci If a fragment attribute binding matches "fragment.texcoord" or 19925bd8deadSopenharmony_ci "fragment.texcoord[n]", the "x", "y", "z", and "w" components of the 19935bd8deadSopenharmony_ci fragment attribute variable are filled with the "s", "t", "r", and 19945bd8deadSopenharmony_ci "q" components, respectively, of the fragment texture coordinates 19955bd8deadSopenharmony_ci for texture unit <n>. If "[n]" is omitted, texture unit zero is 19965bd8deadSopenharmony_ci used. 19975bd8deadSopenharmony_ci 19985bd8deadSopenharmony_ci If a fragment attribute binding matches "fragment.fogcoord", the "x" 19995bd8deadSopenharmony_ci component of the fragment attribute variable is filled with either 20005bd8deadSopenharmony_ci the fragment eye distance or the fog coordinate, depending on 20015bd8deadSopenharmony_ci whether the fog source is set to FRAGMENT_DEPTH_EXT or 20025bd8deadSopenharmony_ci FOG_COORDINATE_EXT, respectively. The "y", "z", and "w" coordinates 20035bd8deadSopenharmony_ci are filled with 0, 0, and 1, respectively. 20045bd8deadSopenharmony_ci 20055bd8deadSopenharmony_ci If a fragment attribute binding matches "fragment.position", the "x" 20065bd8deadSopenharmony_ci and "y" components of the fragment attribute variable are filled 20075bd8deadSopenharmony_ci with the (x,y) window coordinates of the fragment center, relative 20085bd8deadSopenharmony_ci to the lower left corner of the window. The "z" component is filled 20095bd8deadSopenharmony_ci with the fragment's z window coordinate. This z window coordinate 20105bd8deadSopenharmony_ci undergoes an implied conversion to floating point. This conversion 20115bd8deadSopenharmony_ci must leave the values 0 and 1 invariant. The "w" component is 20125bd8deadSopenharmony_ci filled with the reciprocal of the fragment's clip w coordinate. 20135bd8deadSopenharmony_ci 20145bd8deadSopenharmony_ci On some implementations, the components of fragment.position may be 20155bd8deadSopenharmony_ci generated by interpolating per-vertex position values. This may 20165bd8deadSopenharmony_ci produce x and y window coordinates that don't exactly match those of 20175bd8deadSopenharmony_ci the fragment center and z window coordinates that do not exactly 20185bd8deadSopenharmony_ci match those generated by fixed-function rasterization. Therefore, 20195bd8deadSopenharmony_ci there is no guaranteed invariance between the final z window 20205bd8deadSopenharmony_ci coordinates of fragments processed by fragment programs that write 20215bd8deadSopenharmony_ci depth values and fragments processed by any other means, even if the 20225bd8deadSopenharmony_ci fragment programs in question simply copy the z value from the 20235bd8deadSopenharmony_ci fragment.position binding. 20245bd8deadSopenharmony_ci 20255bd8deadSopenharmony_ci 20265bd8deadSopenharmony_ci 3.11.3.2 Fragment Program Parameters 20275bd8deadSopenharmony_ci 20285bd8deadSopenharmony_ci Fragment program parameter variables are a set of four-component 20295bd8deadSopenharmony_ci floating-point vectors used as constants during fragment program 20305bd8deadSopenharmony_ci execution. Fragment program parameters retain their values across 20315bd8deadSopenharmony_ci fragment program invocations, although their values can change 20325bd8deadSopenharmony_ci between invocations due to GL state changes. 20335bd8deadSopenharmony_ci 20345bd8deadSopenharmony_ci Single program parameter variables and arrays of program parameter 20355bd8deadSopenharmony_ci variables can be declared explicitly using the <PARAM_statement> 20365bd8deadSopenharmony_ci grammar rule. Single program parameter variables can also be 20375bd8deadSopenharmony_ci declared implicitly using the <paramSingleItemUse> grammar rule in 20385bd8deadSopenharmony_ci an executable instruction. 20395bd8deadSopenharmony_ci 20405bd8deadSopenharmony_ci Each single program parameter variable is bound to a constant vector 20415bd8deadSopenharmony_ci or to a GL state vector according to the <paramSingleInit> grammar 20425bd8deadSopenharmony_ci rule. Individual items of a program parameter array are bound to 20435bd8deadSopenharmony_ci constant vectors or GL state vectors according to the 20445bd8deadSopenharmony_ci <programMultipleInit> grammar rule. The set of GL state that can be 20455bd8deadSopenharmony_ci bound to program parameter variables are given in Tables X.2.1 20465bd8deadSopenharmony_ci through X.2.4. 20475bd8deadSopenharmony_ci 20485bd8deadSopenharmony_ci 20495bd8deadSopenharmony_ci Constant Bindings 20505bd8deadSopenharmony_ci 20515bd8deadSopenharmony_ci A program parameter variable can be bound to a scalar or vector 20525bd8deadSopenharmony_ci constant using the <paramConstDecl> grammar rule (explicit 20535bd8deadSopenharmony_ci declarations) or the <paramConstUse> grammar rule (implicit 20545bd8deadSopenharmony_ci declarations). 20555bd8deadSopenharmony_ci 20565bd8deadSopenharmony_ci If a program parameter binding matches the <paramConstScalarDecl> or 20575bd8deadSopenharmony_ci <paramConstScalarUse> grammar rules, the corresponding program 20585bd8deadSopenharmony_ci parameter variable is bound to the vector (X,X,X,X), where X is the 20595bd8deadSopenharmony_ci value of the specified constant. Note that the 20605bd8deadSopenharmony_ci <paramConstScalarUse> grammar rule, used only in implicit 20615bd8deadSopenharmony_ci declarations, allows only non-negative constants. This 20625bd8deadSopenharmony_ci disambiguates cases like "-2", which could conceivably be taken to 20635bd8deadSopenharmony_ci mean either the vector "(2,2,2,2)" with all components negated or 20645bd8deadSopenharmony_ci "(-2,-2,-2,-2)" without negation. Only the former interpretation is 20655bd8deadSopenharmony_ci allowed by the grammar. 20665bd8deadSopenharmony_ci 20675bd8deadSopenharmony_ci If a program parameter binding matches <paramConstVector>, the 20685bd8deadSopenharmony_ci corresponding program parameter variable is bound to the vector 20695bd8deadSopenharmony_ci (X,Y,Z,W), where X, Y, Z, and W are the values corresponding to the 20705bd8deadSopenharmony_ci first, second, third, and fourth match of <signedFloatConstant>. If 20715bd8deadSopenharmony_ci fewer than four constants are specified, Y, Z, and W assume the 20725bd8deadSopenharmony_ci values 0.0, 0.0, and 1.0, if their respective constants are not 20735bd8deadSopenharmony_ci specified. 20745bd8deadSopenharmony_ci 20755bd8deadSopenharmony_ci Program parameter variables initialized to constant values can never 20765bd8deadSopenharmony_ci be modified. 20775bd8deadSopenharmony_ci 20785bd8deadSopenharmony_ci 20795bd8deadSopenharmony_ci Program Environment/Local Parameter Bindings 20805bd8deadSopenharmony_ci 20815bd8deadSopenharmony_ci Binding Components Underlying State 20825bd8deadSopenharmony_ci ----------------------------- ---------- ---------------------------- 20835bd8deadSopenharmony_ci program.env[a] (x,y,z,w) program environment 20845bd8deadSopenharmony_ci parameter a 20855bd8deadSopenharmony_ci program.local[a] (x,y,z,w) program local parameter a 20865bd8deadSopenharmony_ci program.env[a..b] (x,y,z,w) program environment 20875bd8deadSopenharmony_ci parameters a through b 20885bd8deadSopenharmony_ci program.local[a..b] (x,y,z,w) program local parameters 20895bd8deadSopenharmony_ci a through b 20905bd8deadSopenharmony_ci 20915bd8deadSopenharmony_ci Table X.2.1: Program Environment/Local Parameter Bindings. <a> 20925bd8deadSopenharmony_ci and <b> indicate parameter numbers, where <a> must be less than or 20935bd8deadSopenharmony_ci equal to <b>. 20945bd8deadSopenharmony_ci 20955bd8deadSopenharmony_ci If a program parameter binding matches "program.env[a]" or 20965bd8deadSopenharmony_ci "program.local[a]", the four components of the program parameter 20975bd8deadSopenharmony_ci variable are filled with the four components of program environment 20985bd8deadSopenharmony_ci parameter <a> or program local parameter <a>, respectively. 20995bd8deadSopenharmony_ci 21005bd8deadSopenharmony_ci Additionally, for program parameter array bindings, 21015bd8deadSopenharmony_ci "program.env[a..b]" and "program.local[a..b]" are equivalent to 21025bd8deadSopenharmony_ci specifying program environment parameters <a> through <b> in order 21035bd8deadSopenharmony_ci or program local parameters <a> through <b> in order, respectively. 21045bd8deadSopenharmony_ci In either case, a program will fail to load if <a> is greater than 21055bd8deadSopenharmony_ci <b>. 21065bd8deadSopenharmony_ci 21075bd8deadSopenharmony_ci 21085bd8deadSopenharmony_ci Material Property Bindings 21095bd8deadSopenharmony_ci 21105bd8deadSopenharmony_ci Binding Components Underlying State 21115bd8deadSopenharmony_ci ----------------------------- ---------- ---------------------------- 21125bd8deadSopenharmony_ci state.material.ambient (r,g,b,a) front ambient material color 21135bd8deadSopenharmony_ci state.material.diffuse (r,g,b,a) front diffuse material color 21145bd8deadSopenharmony_ci state.material.specular (r,g,b,a) front specular material color 21155bd8deadSopenharmony_ci state.material.emission (r,g,b,a) front emissive material color 21165bd8deadSopenharmony_ci state.material.shininess (s,0,0,1) front material shininess 21175bd8deadSopenharmony_ci state.material.front.ambient (r,g,b,a) front ambient material color 21185bd8deadSopenharmony_ci state.material.front.diffuse (r,g,b,a) front diffuse material color 21195bd8deadSopenharmony_ci state.material.front.specular (r,g,b,a) front specular material color 21205bd8deadSopenharmony_ci state.material.front.emission (r,g,b,a) front emissive material color 21215bd8deadSopenharmony_ci state.material.front.shininess (s,0,0,1) front material shininess 21225bd8deadSopenharmony_ci state.material.back.ambient (r,g,b,a) back ambient material color 21235bd8deadSopenharmony_ci state.material.back.diffuse (r,g,b,a) back diffuse material color 21245bd8deadSopenharmony_ci state.material.back.specular (r,g,b,a) back specular material color 21255bd8deadSopenharmony_ci state.material.back.emission (r,g,b,a) back emissive material color 21265bd8deadSopenharmony_ci state.material.back.shininess (s,0,0,1) back material shininess 21275bd8deadSopenharmony_ci 21285bd8deadSopenharmony_ci Table X.2.2: Material Property Bindings. If a material face is 21295bd8deadSopenharmony_ci not specified in the binding, the front property is used. 21305bd8deadSopenharmony_ci 21315bd8deadSopenharmony_ci If a program parameter binding matches any of the material 21325bd8deadSopenharmony_ci properties listed in Table X.2.2, the program parameter variable is 21335bd8deadSopenharmony_ci filled according to the table. For ambient, diffuse, specular, or 21345bd8deadSopenharmony_ci emissive colors, the "x", "y", "z", and "w" components are filled 21355bd8deadSopenharmony_ci with the "r", "g", "b", and "a" components, respectively, of the 21365bd8deadSopenharmony_ci corresponding material color. For material shininess, the "x" 21375bd8deadSopenharmony_ci component is filled with the material's specular exponent, and the 21385bd8deadSopenharmony_ci "y", "z", and "w" components are filled with 0, 0, and 1, 21395bd8deadSopenharmony_ci respectively. Bindings containing ".back" refer to the back 21405bd8deadSopenharmony_ci material; all other bindings refer to the front material. 21415bd8deadSopenharmony_ci 21425bd8deadSopenharmony_ci Material properties can be changed inside a Begin/End pair, either 21435bd8deadSopenharmony_ci directly by calling Material, or indirectly through color material. 21445bd8deadSopenharmony_ci However, such property changes are not guaranteed to update program 21455bd8deadSopenharmony_ci parameter bindings until the following End command. Program 21465bd8deadSopenharmony_ci parameter variables bound to material properties changed inside a 21475bd8deadSopenharmony_ci Begin/End pair are undefined until the following End command. 21485bd8deadSopenharmony_ci 21495bd8deadSopenharmony_ci 21505bd8deadSopenharmony_ci Light Property Bindings 21515bd8deadSopenharmony_ci 21525bd8deadSopenharmony_ci Binding Components Underlying State 21535bd8deadSopenharmony_ci ----------------------------- ---------- ---------------------------- 21545bd8deadSopenharmony_ci state.light[n].ambient (r,g,b,a) light n ambient color 21555bd8deadSopenharmony_ci state.light[n].diffuse (r,g,b,a) light n diffuse color 21565bd8deadSopenharmony_ci state.light[n].specular (r,g,b,a) light n specular color 21575bd8deadSopenharmony_ci state.light[n].position (x,y,z,w) light n position 21585bd8deadSopenharmony_ci state.light[n].attenuation (a,b,c,e) light n attenuation constants 21595bd8deadSopenharmony_ci and spot light exponent 21605bd8deadSopenharmony_ci state.light[n].spot.direction (x,y,z,c) light n spot direction and 21615bd8deadSopenharmony_ci cutoff angle cosine 21625bd8deadSopenharmony_ci state.light[n].half (x,y,z,1) light n infinite half-angle 21635bd8deadSopenharmony_ci state.lightmodel.ambient (r,g,b,a) light model ambient color 21645bd8deadSopenharmony_ci state.lightmodel.scenecolor (r,g,b,a) light model front scene color 21655bd8deadSopenharmony_ci state.lightmodel . (r,g,b,a) light model front scene color 21665bd8deadSopenharmony_ci front.scenecolor 21675bd8deadSopenharmony_ci state.lightmodel . (r,g,b,a) light model back scene color 21685bd8deadSopenharmony_ci back.scenecolor 21695bd8deadSopenharmony_ci state.lightprod[n].ambient (r,g,b,a) light n / front material 21705bd8deadSopenharmony_ci ambient color product 21715bd8deadSopenharmony_ci state.lightprod[n].diffuse (r,g,b,a) light n / front material 21725bd8deadSopenharmony_ci diffuse color product 21735bd8deadSopenharmony_ci state.lightprod[n].specular (r,g,b,a) light n / front material 21745bd8deadSopenharmony_ci specular color product 21755bd8deadSopenharmony_ci state.lightprod[n]. (r,g,b,a) light n / front material 21765bd8deadSopenharmony_ci front.ambient ambient color product 21775bd8deadSopenharmony_ci state.lightprod[n]. (r,g,b,a) light n / front material 21785bd8deadSopenharmony_ci front.diffuse diffuse color product 21795bd8deadSopenharmony_ci state.lightprod[n]. (r,g,b,a) light n / front material 21805bd8deadSopenharmony_ci front.specular specular color product 21815bd8deadSopenharmony_ci state.lightprod[n]. (r,g,b,a) light n / back material 21825bd8deadSopenharmony_ci back.ambient ambient color product 21835bd8deadSopenharmony_ci state.lightprod[n]. (r,g,b,a) light n / back material 21845bd8deadSopenharmony_ci back.diffuse diffuse color product 21855bd8deadSopenharmony_ci state.lightprod[n]. (r,g,b,a) light n / back material 21865bd8deadSopenharmony_ci back.specular specular color product 21875bd8deadSopenharmony_ci 21885bd8deadSopenharmony_ci Table X.2.3: Light Property Bindings. <n> indicates a light 21895bd8deadSopenharmony_ci number. 21905bd8deadSopenharmony_ci 21915bd8deadSopenharmony_ci If a program parameter binding matches "state.light[n].ambient", 21925bd8deadSopenharmony_ci "state.light[n].diffuse", or "state.light[n].specular", the "x", 21935bd8deadSopenharmony_ci "y", "z", and "w" components of the program parameter variable are 21945bd8deadSopenharmony_ci filled with the "r", "g", "b", and "a" components, respectively, of 21955bd8deadSopenharmony_ci the corresponding light color. 21965bd8deadSopenharmony_ci 21975bd8deadSopenharmony_ci If a program parameter binding matches "state.light[n].position", 21985bd8deadSopenharmony_ci the "x", "y", "z", and "w" components of the program parameter 21995bd8deadSopenharmony_ci variable are filled with the "x", "y", "z", and "w" components, 22005bd8deadSopenharmony_ci respectively, of the light position. 22015bd8deadSopenharmony_ci 22025bd8deadSopenharmony_ci If a program parameter binding matches "state.light[n].attenuation", 22035bd8deadSopenharmony_ci the "x", "y", and "z" components of the program parameter variable 22045bd8deadSopenharmony_ci are filled with the constant, linear, and quadratic attenuation 22055bd8deadSopenharmony_ci parameters of the specified light, respectively (section 2.13.1). 22065bd8deadSopenharmony_ci The "w" component of the program parameter variable is filled with 22075bd8deadSopenharmony_ci the spot light exponent of the specified light. 22085bd8deadSopenharmony_ci 22095bd8deadSopenharmony_ci If a program parameter binding matches 22105bd8deadSopenharmony_ci "state.light[n].spot.direction", the "x", "y", and "z" components of 22115bd8deadSopenharmony_ci the program parameter variable are filled with the "x", "y", and "z" 22125bd8deadSopenharmony_ci components of the spot light direction of the specified light, 22135bd8deadSopenharmony_ci respectively (section 2.13.1). The "w" component of the program 22145bd8deadSopenharmony_ci parameter variable is filled with the cosine of the spot light 22155bd8deadSopenharmony_ci cutoff angle of the specified light. 22165bd8deadSopenharmony_ci 22175bd8deadSopenharmony_ci If a program parameter binding matches "state.light[n].half", the 22185bd8deadSopenharmony_ci "x", "y", and "z" components of the program parameter variable are 22195bd8deadSopenharmony_ci filled with the x, y, and z components, respectively, of the 22205bd8deadSopenharmony_ci normalized infinite half-angle vector 22215bd8deadSopenharmony_ci 22225bd8deadSopenharmony_ci h_inf = || P + (0, 0, 1) ||. 22235bd8deadSopenharmony_ci 22245bd8deadSopenharmony_ci The "w" component is filled with 1. In the computation of h_inf, P 22255bd8deadSopenharmony_ci consists of the x, y, and z coordinates of the normalized vector 22265bd8deadSopenharmony_ci from the eye position P_e to the eye-space light position P_pli 22275bd8deadSopenharmony_ci (section 2.13.1). h_inf is defined to correspond to the normalized 22285bd8deadSopenharmony_ci half-angle vector when using an infinite light (w coordinate of the 22295bd8deadSopenharmony_ci position is zero) and an infinite viewer (v_bs is FALSE). For local 22305bd8deadSopenharmony_ci lights or a local viewer, h_inf is well-defined but does not match 22315bd8deadSopenharmony_ci the normalized half-angle vector, which will vary depending on the 22325bd8deadSopenharmony_ci vertex position. 22335bd8deadSopenharmony_ci 22345bd8deadSopenharmony_ci If a program parameter binding matches "state.lightmodel.ambient", 22355bd8deadSopenharmony_ci the "x", "y", "z", and "w" components of the program parameter 22365bd8deadSopenharmony_ci variable are filled with the "r", "g", "b", and "a" components of 22375bd8deadSopenharmony_ci the light model ambient color, respectively. 22385bd8deadSopenharmony_ci 22395bd8deadSopenharmony_ci If a program parameter binding matches "state.lightmodel.scenecolor" 22405bd8deadSopenharmony_ci or "state.lightmodel.front.scenecolor", the "x", "y", and "z" 22415bd8deadSopenharmony_ci components of the program parameter variable are filled with the 22425bd8deadSopenharmony_ci "r", "g", and "b" components respectively of the "front scene color" 22435bd8deadSopenharmony_ci 22445bd8deadSopenharmony_ci c_scene = a_cs * a_cm + e_cm, 22455bd8deadSopenharmony_ci 22465bd8deadSopenharmony_ci where a_cs is the light model ambient color, a_cm is the front 22475bd8deadSopenharmony_ci ambient material color, and e_cm is the front emissive material 22485bd8deadSopenharmony_ci color. The "w" component of the program parameter variable is 22495bd8deadSopenharmony_ci filled with the alpha component of the front diffuse material color. 22505bd8deadSopenharmony_ci If a program parameter binding matches 22515bd8deadSopenharmony_ci "state.lightmodel.back.scenecolor", a similar back scene color, 22525bd8deadSopenharmony_ci computed using back-facing material properties, is used. The front 22535bd8deadSopenharmony_ci and back scene colors match the values that would be assigned to 22545bd8deadSopenharmony_ci vertices using conventional lighting if all lights were disabled. 22555bd8deadSopenharmony_ci 22565bd8deadSopenharmony_ci If a program parameter binding matches anything beginning with 22575bd8deadSopenharmony_ci "state.lightprod[n]", the "x", "y", and "z" components of the 22585bd8deadSopenharmony_ci program parameter variable are filled with the "r", "g", and "b" 22595bd8deadSopenharmony_ci components, respectively, of the corresponding light product. The 22605bd8deadSopenharmony_ci three light product components are the products of the corresponding 22615bd8deadSopenharmony_ci color components of the specified material property and the light 22625bd8deadSopenharmony_ci color of the specified light (see Table X.2.3). The "w" component 22635bd8deadSopenharmony_ci of the program parameter variable is filled with the alpha component 22645bd8deadSopenharmony_ci of the specified material property. 22655bd8deadSopenharmony_ci 22665bd8deadSopenharmony_ci Light products depend on material properties, which can be changed 22675bd8deadSopenharmony_ci inside a Begin/End pair. Such property changes are not guaranteed 22685bd8deadSopenharmony_ci to take effect until the following End command. Program parameter 22695bd8deadSopenharmony_ci variables bound to light products whose corresponding material 22705bd8deadSopenharmony_ci property changes inside a Begin/End pair are undefined until the 22715bd8deadSopenharmony_ci following End command. 22725bd8deadSopenharmony_ci 22735bd8deadSopenharmony_ci 22745bd8deadSopenharmony_ci Texture Environment Property Bindings 22755bd8deadSopenharmony_ci 22765bd8deadSopenharmony_ci Binding Components Underlying State 22775bd8deadSopenharmony_ci ------------------------- ---------- ---------------------------- 22785bd8deadSopenharmony_ci state.texenv[n].color (r,g,b,a) texture environment n color 22795bd8deadSopenharmony_ci 22805bd8deadSopenharmony_ci Table X.2.4: Texture Environment Property Bindings. "[n]" is 22815bd8deadSopenharmony_ci optional -- texture unit <n> is used if specified; texture unit 0 22825bd8deadSopenharmony_ci is used otherwise. 22835bd8deadSopenharmony_ci 22845bd8deadSopenharmony_ci If a program parameter binding matches "state.texenv[n].color", the 22855bd8deadSopenharmony_ci "x", "y", "z", and "w" components of the program parameter variable 22865bd8deadSopenharmony_ci are filled with the "r", "g", "b", and "a" components, respectively, 22875bd8deadSopenharmony_ci of the corresponding texture environment color. Note that only 22885bd8deadSopenharmony_ci "legacy" texture units, as queried by MAX_TEXTURE_UNITS, include 22895bd8deadSopenharmony_ci texture environment state. Texture image units and texture 22905bd8deadSopenharmony_ci coordinate sets do not have associated texture environment state. 22915bd8deadSopenharmony_ci 22925bd8deadSopenharmony_ci 22935bd8deadSopenharmony_ci Fog Property Bindings 22945bd8deadSopenharmony_ci 22955bd8deadSopenharmony_ci Binding Components Underlying State 22965bd8deadSopenharmony_ci --------------------------- ---------- ---------------------------- 22975bd8deadSopenharmony_ci state.fog.color (r,g,b,a) RGB fog color (section 3.11) 22985bd8deadSopenharmony_ci state.fog.params (d,s,e,r) fog density, linear start 22995bd8deadSopenharmony_ci and end, and 1/(end-start) 23005bd8deadSopenharmony_ci (section 3.11) 23015bd8deadSopenharmony_ci 23025bd8deadSopenharmony_ci Table X.2.5: Fog Property Bindings 23035bd8deadSopenharmony_ci 23045bd8deadSopenharmony_ci If a program parameter binding matches "state.fog.color", the "x", 23055bd8deadSopenharmony_ci "y", "z", and "w" components of the program parameter variable are 23065bd8deadSopenharmony_ci filled with the "r", "g", "b", and "a" components, respectively, of 23075bd8deadSopenharmony_ci the fog color (section 3.11). 23085bd8deadSopenharmony_ci 23095bd8deadSopenharmony_ci If a program parameter binding matches "state.fog.params", the "x", 23105bd8deadSopenharmony_ci "y", and "z" components of the program parameter variable are filled 23115bd8deadSopenharmony_ci with the fog density, linear fog start, and linear fog end 23125bd8deadSopenharmony_ci parameters (section 3.11), respectively. The "w" component is 23135bd8deadSopenharmony_ci filled with 1/(end-start), where end and start are the linear fog 23145bd8deadSopenharmony_ci end and start parameters, respectively. 23155bd8deadSopenharmony_ci 23165bd8deadSopenharmony_ci 23175bd8deadSopenharmony_ci Depth Property Bindings 23185bd8deadSopenharmony_ci 23195bd8deadSopenharmony_ci Binding Components Underlying State 23205bd8deadSopenharmony_ci --------------------------- ---------- ---------------------------- 23215bd8deadSopenharmony_ci state.depth.range (n,f,d,1) Depth range near, far, and 23225bd8deadSopenharmony_ci (far-near) (section 2.10.1) 23235bd8deadSopenharmony_ci 23245bd8deadSopenharmony_ci Table X.2.6: Depth Property Bindings 23255bd8deadSopenharmony_ci 23265bd8deadSopenharmony_ci If a program parameter binding matches "state.depth.range", the "x" 23275bd8deadSopenharmony_ci and "y" components of the program parameter variable are filled with 23285bd8deadSopenharmony_ci the mappings of near and far clipping planes to window coordinates, 23295bd8deadSopenharmony_ci respectively. The "z" component is filled with the difference of 23305bd8deadSopenharmony_ci the mappings of near and far clipping planes, far minus near. The 23315bd8deadSopenharmony_ci "w" component is filled with 1. 23325bd8deadSopenharmony_ci 23335bd8deadSopenharmony_ci 23345bd8deadSopenharmony_ci Matrix Property Bindings 23355bd8deadSopenharmony_ci 23365bd8deadSopenharmony_ci Binding Underlying State 23375bd8deadSopenharmony_ci ------------------------------------ --------------------------- 23385bd8deadSopenharmony_ci * state.matrix.modelview[n] modelview matrix n 23395bd8deadSopenharmony_ci state.matrix.projection projection matrix 23405bd8deadSopenharmony_ci state.matrix.mvp modelview-projection matrix 23415bd8deadSopenharmony_ci * state.matrix.texture[n] texture matrix n 23425bd8deadSopenharmony_ci state.matrix.palette[n] modelview palette matrix n 23435bd8deadSopenharmony_ci state.matrix.program[n] program matrix n 23445bd8deadSopenharmony_ci 23455bd8deadSopenharmony_ci Table X.2.7: Base Matrix Property Bindings. The "[n]" syntax 23465bd8deadSopenharmony_ci indicates a specific matrix number. For modelview and texture 23475bd8deadSopenharmony_ci matrices, a matrix number is optional, and matrix zero will be 23485bd8deadSopenharmony_ci used if the matrix number is omitted. These base bindings may 23495bd8deadSopenharmony_ci further be modified by a inverse/transpose selector and a row 23505bd8deadSopenharmony_ci selector. 23515bd8deadSopenharmony_ci 23525bd8deadSopenharmony_ci If the beginning of a program parameter binding matches any of the 23535bd8deadSopenharmony_ci matrix binding names listed in Table X.2.7, the binding corresponds 23545bd8deadSopenharmony_ci to a 4x4 matrix. If the parameter binding is followed by 23555bd8deadSopenharmony_ci ".inverse", ".transpose", or ".invtrans" (<stateMatModifier> grammar 23565bd8deadSopenharmony_ci rule), the inverse, transpose, or transpose of the inverse, 23575bd8deadSopenharmony_ci respectively, of the matrix specified in Table X.2.7 is selected. 23585bd8deadSopenharmony_ci Otherwise, the matrix specified in Table X.2.7 is selected. If the 23595bd8deadSopenharmony_ci specified matrix is poorly-conditioned (singular or nearly so), its 23605bd8deadSopenharmony_ci inverse matrix is undefined. The binding name "state.matrix.mvp" 23615bd8deadSopenharmony_ci refers to the product of modelview matrix zero and the projection 23625bd8deadSopenharmony_ci matrix, defined as 23635bd8deadSopenharmony_ci 23645bd8deadSopenharmony_ci MVP = P * M0, 23655bd8deadSopenharmony_ci 23665bd8deadSopenharmony_ci where P is the projection matrix and M0 is modelview matrix zero. 23675bd8deadSopenharmony_ci 23685bd8deadSopenharmony_ci If the selected matrix is followed by ".row[<a>]" (matching the 23695bd8deadSopenharmony_ci <stateMatrixRow> grammar rule), the "x", "y", "z", and "w" 23705bd8deadSopenharmony_ci components of the program parameter variable are filled with the 23715bd8deadSopenharmony_ci four entries of row <a> of the selected matrix. In the example, 23725bd8deadSopenharmony_ci 23735bd8deadSopenharmony_ci PARAM m0 = state.matrix.modelview[1].row[0]; 23745bd8deadSopenharmony_ci PARAM m1 = state.matrix.projection.transpose.row[3]; 23755bd8deadSopenharmony_ci 23765bd8deadSopenharmony_ci the variable "m0" is set to the first row (row 0) of modelview 23775bd8deadSopenharmony_ci matrix 1 and "m1" is set to the last row (row 3) of the transpose of 23785bd8deadSopenharmony_ci the projection matrix. 23795bd8deadSopenharmony_ci 23805bd8deadSopenharmony_ci For program parameter array bindings, multiple rows of the selected 23815bd8deadSopenharmony_ci matrix can be bound via the <stateMatrixRows> grammar rule. If the 23825bd8deadSopenharmony_ci selected matrix binding is followed by ".row[<a>..<b>]", the result 23835bd8deadSopenharmony_ci is equivalent to specifying matrix rows <a> through <b>, in order. 23845bd8deadSopenharmony_ci A program will fail to load if <a> is greater than <b>. If no row 23855bd8deadSopenharmony_ci selection is specified (<optMatrixRows> matches ""), matrix rows 0 23865bd8deadSopenharmony_ci through 3 are bound in order. In the example, 23875bd8deadSopenharmony_ci 23885bd8deadSopenharmony_ci PARAM m2[] = { state.matrix.program[0].row[1..2] }; 23895bd8deadSopenharmony_ci PARAM m3[] = { state.matrix.program[0].transpose }; 23905bd8deadSopenharmony_ci 23915bd8deadSopenharmony_ci the array "m2" has two entries, containing rows 1 and 2 of program 23925bd8deadSopenharmony_ci matrix zero, and "m3" has four entries, containing all four rows of 23935bd8deadSopenharmony_ci the transpose of program matrix zero. 23945bd8deadSopenharmony_ci 23955bd8deadSopenharmony_ci 23965bd8deadSopenharmony_ci Program Parameter Arrays 23975bd8deadSopenharmony_ci 23985bd8deadSopenharmony_ci A program parameter array variable can be declared explicitly by 23995bd8deadSopenharmony_ci matching the <PARAM_multipleStmt> grammar rule. Programs can 24005bd8deadSopenharmony_ci optionally specify the number of individual program parameters in 24015bd8deadSopenharmony_ci the array, using the <optArraySize> grammar rule. Program parameter 24025bd8deadSopenharmony_ci arrays may not be declared implicity. 24035bd8deadSopenharmony_ci 24045bd8deadSopenharmony_ci Individual parameter variables in a program parameter array are 24055bd8deadSopenharmony_ci bound to GL state vectors or constant vectors as specified by the 24065bd8deadSopenharmony_ci grammar rule <paramMultInitList>. Each individual parameter in the 24075bd8deadSopenharmony_ci array is bound in turn as described above. 24085bd8deadSopenharmony_ci 24095bd8deadSopenharmony_ci The total number of entries in the array is equal to the number of 24105bd8deadSopenharmony_ci parameters bound in the initializer list. A fragment program that 24115bd8deadSopenharmony_ci specifies an array size (<optArraySize> matches <integer>) that does 24125bd8deadSopenharmony_ci not match the number of parameter bindings in the initialization 24135bd8deadSopenharmony_ci list will fail to load. 24145bd8deadSopenharmony_ci 24155bd8deadSopenharmony_ci Program parameter array variables may only be accessed using 24165bd8deadSopenharmony_ci absolute addressing by matching the <progParamArrayAbs> grammar 24175bd8deadSopenharmony_ci rule. Array accesses are checked against the limits of the array. 24185bd8deadSopenharmony_ci If any fragment program instruction accesses a program parameter 24195bd8deadSopenharmony_ci array with an out-of-range index (greater than or equal to the size 24205bd8deadSopenharmony_ci of the array), the fragment program will fail to load. 24215bd8deadSopenharmony_ci 24225bd8deadSopenharmony_ci Individual state vectors can have no more than one unique binding in 24235bd8deadSopenharmony_ci any given program. The GL will automatically combine multiple 24245bd8deadSopenharmony_ci bindings of the same state vector into a single unique binding. 24255bd8deadSopenharmony_ci 24265bd8deadSopenharmony_ci 24275bd8deadSopenharmony_ci 3.11.3.3 Fragment Program Temporaries 24285bd8deadSopenharmony_ci 24295bd8deadSopenharmony_ci Fragment program temporary variables are a set of four-component 24305bd8deadSopenharmony_ci floating-point vectors used to hold temporary results during 24315bd8deadSopenharmony_ci fragment program execution. Temporaries do not persist between 24325bd8deadSopenharmony_ci program invocations, and are undefined at the beginning of each 24335bd8deadSopenharmony_ci fragment program invocation. 24345bd8deadSopenharmony_ci 24355bd8deadSopenharmony_ci Fragment program temporary variables can be declared explicitly 24365bd8deadSopenharmony_ci using the <TEMP_statement> grammar rule. Each such statement can 24375bd8deadSopenharmony_ci declare one or more temporaries. Fragment program temporary 24385bd8deadSopenharmony_ci variables can not be declared implicitly. 24395bd8deadSopenharmony_ci 24405bd8deadSopenharmony_ci 24415bd8deadSopenharmony_ci 3.11.3.4 Fragment Program Results 24425bd8deadSopenharmony_ci 24435bd8deadSopenharmony_ci Fragment program result variables are a set of four component 24445bd8deadSopenharmony_ci floating-point vectors used to hold the final results of a fragment 24455bd8deadSopenharmony_ci program. Fragment program result variables are write-only during 24465bd8deadSopenharmony_ci fragment program execution. 24475bd8deadSopenharmony_ci 24485bd8deadSopenharmony_ci Fragment program result variables can be declared explicitly using 24495bd8deadSopenharmony_ci the <OUTPUT_statement> grammar rule, or implicitly using the 24505bd8deadSopenharmony_ci <resultBinding> grammar rule in an executable instruction. Each 24515bd8deadSopenharmony_ci fragment program result variable is bound to a fragment attribute 24525bd8deadSopenharmony_ci used in subsequent back-end processing. The set of fragment program 24535bd8deadSopenharmony_ci result variable bindings is given in Table X.3. 24545bd8deadSopenharmony_ci 24555bd8deadSopenharmony_ci Binding Components Description 24565bd8deadSopenharmony_ci ----------------------------- ---------- ---------------------------- 24575bd8deadSopenharmony_ci result.color (r,g,b,a) color 24585bd8deadSopenharmony_ci result.depth (*,*,d,*) depth coordinate 24595bd8deadSopenharmony_ci 24605bd8deadSopenharmony_ci Table X.3: Fragment Result Variable Bindings. Components labeled 24615bd8deadSopenharmony_ci "*" are unused. 24625bd8deadSopenharmony_ci 24635bd8deadSopenharmony_ci If a result variable binding matches "result.color", updates to the 24645bd8deadSopenharmony_ci "x", "y", "z", and "w" components of the result variable modify the 24655bd8deadSopenharmony_ci "r", "g", "b", and "a" components, respectively, of the fragment's 24665bd8deadSopenharmony_ci output color. If "result.color" is not both bound by the fragment 24675bd8deadSopenharmony_ci program and written by some instruction of the program, the output 24685bd8deadSopenharmony_ci color of the fragment program is undefined. 24695bd8deadSopenharmony_ci 24705bd8deadSopenharmony_ci If a result variable binding matches "result.depth", updates to the 24715bd8deadSopenharmony_ci "z" component of the result variable modify the fragment's output 24725bd8deadSopenharmony_ci depth value. If "result.depth" is not both bound by the fragment 24735bd8deadSopenharmony_ci program and written by some instruction of the program, the 24745bd8deadSopenharmony_ci interpolated depth value produced by rasterization is used as if 24755bd8deadSopenharmony_ci fragment program mode is not enabled. Writes to any component of 24765bd8deadSopenharmony_ci depth other than the "z" component have no effect. 24775bd8deadSopenharmony_ci 24785bd8deadSopenharmony_ci 24795bd8deadSopenharmony_ci 3.11.3.5 Fragment Program Aliases 24805bd8deadSopenharmony_ci 24815bd8deadSopenharmony_ci Fragment programs can create aliases by matching the 24825bd8deadSopenharmony_ci <ALIAS_statement> grammar rule. Aliases allow programs to use 24835bd8deadSopenharmony_ci multiple variable names to refer to a single underlying variable. 24845bd8deadSopenharmony_ci For example, the statement 24855bd8deadSopenharmony_ci 24865bd8deadSopenharmony_ci ALIAS var1 = var0 24875bd8deadSopenharmony_ci 24885bd8deadSopenharmony_ci establishes a variable name named "var1". Subsequent references to 24895bd8deadSopenharmony_ci "var1" in the program text are treated as references to "var0". The 24905bd8deadSopenharmony_ci left hand side of an ALIAS statement must be a new variable name, 24915bd8deadSopenharmony_ci and the right hand side must be an established variable name. 24925bd8deadSopenharmony_ci 24935bd8deadSopenharmony_ci Aliases are not considered variable declarations, so do not count 24945bd8deadSopenharmony_ci against the limits on the number of variable declarations allowed in 24955bd8deadSopenharmony_ci the program text. 24965bd8deadSopenharmony_ci 24975bd8deadSopenharmony_ci 24985bd8deadSopenharmony_ci 3.11.3.6 Fragment Program Resource Limits 24995bd8deadSopenharmony_ci 25005bd8deadSopenharmony_ci The fragment program execution environment provides implementation- 25015bd8deadSopenharmony_ci dependent resource limits on the number of ALU instructions, texture 25025bd8deadSopenharmony_ci instructions, total instructions (ALU or texture), temporary 25035bd8deadSopenharmony_ci variable declarations, program parameter bindings, or texture 25045bd8deadSopenharmony_ci indirections. A program that exceeds any of these resource limits 25055bd8deadSopenharmony_ci will fail to load. The resource limits for fragment programs can be 25065bd8deadSopenharmony_ci queried by calling GetProgramiv (section 6.1.12) with a target of 25075bd8deadSopenharmony_ci FRAGMENT_PROGRAM_ARB. 25085bd8deadSopenharmony_ci 25095bd8deadSopenharmony_ci The limit on fragment program ALU instructions can be queried with 25105bd8deadSopenharmony_ci a <pname> of MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, and must be at least 25115bd8deadSopenharmony_ci 48. Each ALU instruction in the program (matches of the 25125bd8deadSopenharmony_ci <ALUInstruction> grammar rule) counts against this limit. 25135bd8deadSopenharmony_ci 25145bd8deadSopenharmony_ci The limit on fragment program texture instructions can be queried 25155bd8deadSopenharmony_ci with a <pname> of MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, and must be at 25165bd8deadSopenharmony_ci least 24. Each texture instruction in the program (matches of the 25175bd8deadSopenharmony_ci <TexInstruction> grammar rule) counts against this limit. 25185bd8deadSopenharmony_ci 25195bd8deadSopenharmony_ci The limit on fragment program total instructions can be queried with 25205bd8deadSopenharmony_ci a <pname> of MAX_PROGRAM_INSTRUCTIONS_ARB, and must be at least 72. 25215bd8deadSopenharmony_ci Each instruction in the program (matching the <instruction> grammar 25225bd8deadSopenharmony_ci rule) counts against this limit. Note that the limit on total 25235bd8deadSopenharmony_ci instructions is not necessarily equal to the sum of the limits on 25245bd8deadSopenharmony_ci ALU instructions and texture instructions. 25255bd8deadSopenharmony_ci 25265bd8deadSopenharmony_ci The limit on fragment program texture indirections can be queried 25275bd8deadSopenharmony_ci with a <pname> of MAX_PROGRAM_TEX_INDIRECTIONS_ARB, and must be at 25285bd8deadSopenharmony_ci least 4. Texture indirections are described in 3.11.6. If an 25295bd8deadSopenharmony_ci implementation has no limit on texture indirections, the limit will 25305bd8deadSopenharmony_ci be equal to the limit on texture instructions. 25315bd8deadSopenharmony_ci 25325bd8deadSopenharmony_ci The limit on fragment program temporary variable declarations can be 25335bd8deadSopenharmony_ci queried with a <pname> of MAX_PROGRAM_TEMPORARIES_ARB, and must be at 25345bd8deadSopenharmony_ci least 16. Each temporary declared in the program, using the 25355bd8deadSopenharmony_ci <TEMP_statement> grammar rule, counts against this limit. Aliases 25365bd8deadSopenharmony_ci of declared temporaries do not. 25375bd8deadSopenharmony_ci 25385bd8deadSopenharmony_ci The limit on fragment program attribute bindings can be queried with 25395bd8deadSopenharmony_ci a <pname> of MAX_PROGRAM_ATTRIBS_ARB and must be at least 10. Each 25405bd8deadSopenharmony_ci distinct vertex attribute bound explicitly or implicitly in the 25415bd8deadSopenharmony_ci program counts against this limit; vertex attributes bound multiple 25425bd8deadSopenharmony_ci times count only once. 25435bd8deadSopenharmony_ci 25445bd8deadSopenharmony_ci The limit on fragment program parameter bindings can be queried with 25455bd8deadSopenharmony_ci a <pname> of MAX_PROGRAM_PARAMETERS_ARB, and must be at least 24. 25465bd8deadSopenharmony_ci Each distinct GL state vector bound explicitly or implicitly in the 25475bd8deadSopenharmony_ci program counts against this limit; GL state vectors bound multiple 25485bd8deadSopenharmony_ci times count only once. Every other constant vector bound in the 25495bd8deadSopenharmony_ci program is counted if and only if an identical constant vector has 25505bd8deadSopenharmony_ci not already been counted. Two constant vectors are considered 25515bd8deadSopenharmony_ci identical if the four component values are numerically equivalent. 25525bd8deadSopenharmony_ci Recall that scalar constants bound in a program are treated as 25535bd8deadSopenharmony_ci vector constants with the scalar value replicated. 25545bd8deadSopenharmony_ci 25555bd8deadSopenharmony_ci In addition to the limits described above, the GL provides a similar 25565bd8deadSopenharmony_ci set of implementation-dependent native resource limits. These 25575bd8deadSopenharmony_ci limits, specified in Section 6.1.12, provide guidance as to whether 25585bd8deadSopenharmony_ci the program is small enough to use a "native" mode where fragment 25595bd8deadSopenharmony_ci programs may be executed with higher performance. The native 25605bd8deadSopenharmony_ci resource limits and usage counts are implementation-dependent and 25615bd8deadSopenharmony_ci may not exactly correspond to limits and counts described above. 25625bd8deadSopenharmony_ci A program's native resource consumption may be reduced by program 25635bd8deadSopenharmony_ci optimizations performed by the GL. Native resource consumption may 25645bd8deadSopenharmony_ci be increased due to emulation of instructions or any other program 25655bd8deadSopenharmony_ci features not natively supported by an implementation. Notably, an 25665bd8deadSopenharmony_ci additional texture indirection may be consumed due to an 25675bd8deadSopenharmony_ci implementation's lack of native support for texture instructions 25685bd8deadSopenharmony_ci with source coordinate swizzles or parameter source coordinates, 25695bd8deadSopenharmony_ci which may require emulation by prepending ALU instructions. An 25705bd8deadSopenharmony_ci implementation may also fail to natively support all combinations of 25715bd8deadSopenharmony_ci attributes described in Table X.1, even if the total number of 25725bd8deadSopenharmony_ci bound attributes is fewer than the native attribute limit. In this 25735bd8deadSopenharmony_ci case the program is still considered to exceed the native resource 25745bd8deadSopenharmony_ci limits, as queried by PROGRAM_UNDER_NATIVE_LIMITS_ARB (section 25755bd8deadSopenharmony_ci 6.1.12). 25765bd8deadSopenharmony_ci 25775bd8deadSopenharmony_ci To assist in resource counting, the GL additionally provides 25785bd8deadSopenharmony_ci GetProgram queries to determine the resource usage and native 25795bd8deadSopenharmony_ci resource usage of the currently bound program, and to determine 25805bd8deadSopenharmony_ci whether the bound program exceeds any native resource limit. 25815bd8deadSopenharmony_ci 25825bd8deadSopenharmony_ci Programs that exceed any native resource limit may or may not load 25835bd8deadSopenharmony_ci depending on the implementation. 25845bd8deadSopenharmony_ci 25855bd8deadSopenharmony_ci 25865bd8deadSopenharmony_ci 3.11.4 Fragment Program Execution Environment 25875bd8deadSopenharmony_ci 25885bd8deadSopenharmony_ci If fragment program mode is enabled, the currently bound fragment 25895bd8deadSopenharmony_ci program is executed when any fragment is produced by rasterization. 25905bd8deadSopenharmony_ci 25915bd8deadSopenharmony_ci If fragment program mode is enabled and the currently bound program 25925bd8deadSopenharmony_ci object does not contain a valid fragment program, the error 25935bd8deadSopenharmony_ci INVALID_OPERATION will be generated by Begin, RasterPos, and any 25945bd8deadSopenharmony_ci command that implicitly calls Begin (e.g., DrawArrays). 25955bd8deadSopenharmony_ci 25965bd8deadSopenharmony_ci Fragment programs execute a sequence of instructions without 25975bd8deadSopenharmony_ci branching. Fragment programs begin by executing the first 25985bd8deadSopenharmony_ci instruction in the program, and execute instructions in the order 25995bd8deadSopenharmony_ci specified in the program until the last instruction is completed. 26005bd8deadSopenharmony_ci 26015bd8deadSopenharmony_ci There are 33 fragment program instructions. The instructions and 26025bd8deadSopenharmony_ci their respective input and output parameters are summarized in 26035bd8deadSopenharmony_ci Table X.5. 26045bd8deadSopenharmony_ci 26055bd8deadSopenharmony_ci Instruction Inputs Output Description 26065bd8deadSopenharmony_ci ----------- ------ ------ -------------------------------- 26075bd8deadSopenharmony_ci ABS v v absolute value 26085bd8deadSopenharmony_ci ADD v,v v add 26095bd8deadSopenharmony_ci CMP v,v,v v compare 26105bd8deadSopenharmony_ci COS s ssss cosine with reduction to [-PI,PI] 26115bd8deadSopenharmony_ci DP3 v,v ssss 3-component dot product 26125bd8deadSopenharmony_ci DP4 v,v ssss 4-component dot product 26135bd8deadSopenharmony_ci DPH v,v ssss homogeneous dot product 26145bd8deadSopenharmony_ci DST v,v v distance vector 26155bd8deadSopenharmony_ci EX2 s ssss exponential base 2 26165bd8deadSopenharmony_ci FLR v v floor 26175bd8deadSopenharmony_ci FRC v v fraction 26185bd8deadSopenharmony_ci KIL v v kill fragment 26195bd8deadSopenharmony_ci LG2 s ssss logarithm base 2 26205bd8deadSopenharmony_ci LIT v v compute light coefficients 26215bd8deadSopenharmony_ci LRP v,v,v v linear interpolation 26225bd8deadSopenharmony_ci MAD v,v,v v multiply and add 26235bd8deadSopenharmony_ci MAX v,v v maximum 26245bd8deadSopenharmony_ci MIN v,v v minimum 26255bd8deadSopenharmony_ci MOV v v move 26265bd8deadSopenharmony_ci MUL v,v v multiply 26275bd8deadSopenharmony_ci POW s,s ssss exponentiate 26285bd8deadSopenharmony_ci RCP s ssss reciprocal 26295bd8deadSopenharmony_ci RSQ s ssss reciprocal square root 26305bd8deadSopenharmony_ci SCS s ss-- sine/cosine without reduction 26315bd8deadSopenharmony_ci SGE v,v v set on greater than or equal 26325bd8deadSopenharmony_ci SIN s ssss sine with reduction to [-PI,PI] 26335bd8deadSopenharmony_ci SLT v,v v set on less than 26345bd8deadSopenharmony_ci SUB v,v v subtract 26355bd8deadSopenharmony_ci SWZ v v extended swizzle 26365bd8deadSopenharmony_ci TEX v,u,t v texture sample 26375bd8deadSopenharmony_ci TXB v,u,t v texture sample with bias 26385bd8deadSopenharmony_ci TXP v,u,t v texture sample with projection 26395bd8deadSopenharmony_ci XPD v,v v cross product 26405bd8deadSopenharmony_ci 26415bd8deadSopenharmony_ci Table X.5: Summary of fragment program instructions. "v" 26425bd8deadSopenharmony_ci indicates a floating-point vector input or output, "s" indicates a 26435bd8deadSopenharmony_ci floating-point scalar input, "ssss" indicates a scalar output 26445bd8deadSopenharmony_ci replicated across a 4-component result vector, "ss--" indicates 26455bd8deadSopenharmony_ci two scalar outputs in the first two components, "u" indicates a 26465bd8deadSopenharmony_ci texture image unit identifier, and "t" indicates a texture target. 26475bd8deadSopenharmony_ci 26485bd8deadSopenharmony_ci 26495bd8deadSopenharmony_ci 3.11.4.1 Fragment Program Operands 26505bd8deadSopenharmony_ci 26515bd8deadSopenharmony_ci Most fragment program instructions operate on floating-point vectors 26525bd8deadSopenharmony_ci or scalars, as indicated by the grammar rules <vectorSrcReg> and 26535bd8deadSopenharmony_ci <scalarSrcReg>, respectively. 26545bd8deadSopenharmony_ci 26555bd8deadSopenharmony_ci Vector and scalar operands can be obtained from fragment attribute, 26565bd8deadSopenharmony_ci program parameter, or temporary registers, as indicated by the 26575bd8deadSopenharmony_ci <srcReg> rule. For scalar operands, a single vector component is 26585bd8deadSopenharmony_ci selected by the <scalarSuffix> rule, where the characters "x", "y", 26595bd8deadSopenharmony_ci "z", and "w", or "r", "g", "b", and "a" select the first, second, 26605bd8deadSopenharmony_ci third, and fourth components, respectively, of the vector. 26615bd8deadSopenharmony_ci 26625bd8deadSopenharmony_ci Vector operands can be swizzled according to the <optionalSuffix> 26635bd8deadSopenharmony_ci rule. In its most general form, the <optionalSuffix> rule matches 26645bd8deadSopenharmony_ci the pattern ".????" where each question mark is replaced with one of 26655bd8deadSopenharmony_ci "x", "y", "z", "w", "r", "g", "b", or "a". For such patterns, the 26665bd8deadSopenharmony_ci first, second, third, and fourth components of the operand are taken 26675bd8deadSopenharmony_ci from the vector components named by the first, second, third, and 26685bd8deadSopenharmony_ci fourth character of the pattern, respectively. For example, if the 26695bd8deadSopenharmony_ci swizzle suffix is ".yzzx" or ".gbbr" and the specified source 26705bd8deadSopenharmony_ci contains {2,8,9,0}, the swizzled operand used by the instruction is 26715bd8deadSopenharmony_ci {8,9,9,2}. 26725bd8deadSopenharmony_ci 26735bd8deadSopenharmony_ci If the <optionalSuffix> rule matches "", it is treated as though it 26745bd8deadSopenharmony_ci were ".xyzw". If the <optionalSuffix> rule matches (ignoring 26755bd8deadSopenharmony_ci whitespace) ".x", ".y", ".z", or ".w", these are treated the same as 26765bd8deadSopenharmony_ci ".xxxx", ".yyyy", ".zzzz", and ".wwww" respectively. Likewise, if 26775bd8deadSopenharmony_ci the <optionalSuffix> rule matches ".r", ".g", ".b", or ".a", these 26785bd8deadSopenharmony_ci are treated the same as ".rrrr", ".gggg", ".bbbb", and ".aaaa" 26795bd8deadSopenharmony_ci respectively. 26805bd8deadSopenharmony_ci 26815bd8deadSopenharmony_ci Floating-point scalar or vector operands can optionally be negated 26825bd8deadSopenharmony_ci according to the <optionalSign> rule in <scalarSrcReg> and 26835bd8deadSopenharmony_ci <vectorSrcReg>. If the <optionalSign> matches "-", each operand or 26845bd8deadSopenharmony_ci operand component is negated. 26855bd8deadSopenharmony_ci 26865bd8deadSopenharmony_ci The following pseudo-code spells out the operand generation process. 26875bd8deadSopenharmony_ci In the example, "float" is a floating-point scalar type, while 26885bd8deadSopenharmony_ci "floatVec" is a four-component vector. "source" refers to the 26895bd8deadSopenharmony_ci register used for the operand, matching the <srcReg> rule. "negate" 26905bd8deadSopenharmony_ci is TRUE if the <optionalSign> rule in <scalarSrcReg> or 26915bd8deadSopenharmony_ci <vectorSrcReg> matches "-" and FALSE otherwise. The ".c***", 26925bd8deadSopenharmony_ci ".*c**", ".**c*", ".***c" modifiers refer to the x, y, z, and w 26935bd8deadSopenharmony_ci components obtained by the swizzle operation; the ".c" modifier 26945bd8deadSopenharmony_ci refers to the single component selected for a scalar load. 26955bd8deadSopenharmony_ci 26965bd8deadSopenharmony_ci floatVec VectorLoad(floatVec source) 26975bd8deadSopenharmony_ci { 26985bd8deadSopenharmony_ci floatVec operand; 26995bd8deadSopenharmony_ci 27005bd8deadSopenharmony_ci operand.x = source.c***; 27015bd8deadSopenharmony_ci operand.y = source.*c**; 27025bd8deadSopenharmony_ci operand.z = source.**c*; 27035bd8deadSopenharmony_ci operand.w = source.***c; 27045bd8deadSopenharmony_ci if (negate) { 27055bd8deadSopenharmony_ci operand.x = -operand.x; 27065bd8deadSopenharmony_ci operand.y = -operand.y; 27075bd8deadSopenharmony_ci operand.z = -operand.z; 27085bd8deadSopenharmony_ci operand.w = -operand.w; 27095bd8deadSopenharmony_ci } 27105bd8deadSopenharmony_ci 27115bd8deadSopenharmony_ci return operand; 27125bd8deadSopenharmony_ci } 27135bd8deadSopenharmony_ci 27145bd8deadSopenharmony_ci float ScalarLoad(floatVec source) 27155bd8deadSopenharmony_ci { 27165bd8deadSopenharmony_ci float operand; 27175bd8deadSopenharmony_ci 27185bd8deadSopenharmony_ci operand = source.c; 27195bd8deadSopenharmony_ci if (negate) { 27205bd8deadSopenharmony_ci operand = -operand; 27215bd8deadSopenharmony_ci } 27225bd8deadSopenharmony_ci 27235bd8deadSopenharmony_ci return operand; 27245bd8deadSopenharmony_ci } 27255bd8deadSopenharmony_ci 27265bd8deadSopenharmony_ci 27275bd8deadSopenharmony_ci 3.11.4.2 Fragment Program Parameter Arrays 27285bd8deadSopenharmony_ci 27295bd8deadSopenharmony_ci A fragment program can load a single element of a program parameter 27305bd8deadSopenharmony_ci array using only absolute addressing. Program parameter arrays are 27315bd8deadSopenharmony_ci accessed when the <progParamArrayAbs> rule is matched. The offset 27325bd8deadSopenharmony_ci of the selected entry in the array is given by the number matching 27335bd8deadSopenharmony_ci <progParamRegNum>. If the offset exceeds the size of the 27345bd8deadSopenharmony_ci array, the results of the access are undefined, but may not lead to 27355bd8deadSopenharmony_ci program or GL termination. 27365bd8deadSopenharmony_ci 27375bd8deadSopenharmony_ci 27385bd8deadSopenharmony_ci 3.11.4.3 Fragment Program Destination Register Update 27395bd8deadSopenharmony_ci 27405bd8deadSopenharmony_ci Fragment program instructions write a 4-component result vector to a 27415bd8deadSopenharmony_ci single temporary or fragment result register. Writes to individual 27425bd8deadSopenharmony_ci components of the destination register are controlled by individual 27435bd8deadSopenharmony_ci component write masks specified as part of the instruction. 27445bd8deadSopenharmony_ci Optional clamping of each component of the destination register to 27455bd8deadSopenharmony_ci the range [0,1] is controlled by an opcode modifier. 27465bd8deadSopenharmony_ci 27475bd8deadSopenharmony_ci The component write mask is specified by the <optionalMask> rule 27485bd8deadSopenharmony_ci found in the <maskedDstReg> rule. If the optional mask is "", all 27495bd8deadSopenharmony_ci components are enabled. Otherwise, the optional mask names the 27505bd8deadSopenharmony_ci individual components to enable. The characters "x", "y", "z", and 27515bd8deadSopenharmony_ci "w", or "r", "g", "b", and "a" match the first, second, third, and 27525bd8deadSopenharmony_ci fourth components, respectively. For example, an optional mask of 27535bd8deadSopenharmony_ci ".xzw" indicates that the x, z, and w components should be enabled 27545bd8deadSopenharmony_ci for writing but the y component should not. The grammar requires 27555bd8deadSopenharmony_ci that the destination register mask components must be listed in 27565bd8deadSopenharmony_ci "xyzw", or "rgba" order. Component names from one set (xyzw or 27575bd8deadSopenharmony_ci rgba) cannot be mixed with component names from another set. For 27585bd8deadSopenharmony_ci example, ".rgw" is not a valid writemask. 27595bd8deadSopenharmony_ci 27605bd8deadSopenharmony_ci Each component of the destination register is updated with the 27615bd8deadSopenharmony_ci result of the fragment program instruction if and only if the 27625bd8deadSopenharmony_ci component is enabled for writes by the component write mask. 27635bd8deadSopenharmony_ci Otherwise, the component of the destination register remains 27645bd8deadSopenharmony_ci unchanged. 27655bd8deadSopenharmony_ci 27665bd8deadSopenharmony_ci If the instruction opcode has the "_SAT" suffix, requesting 27675bd8deadSopenharmony_ci saturated result vectors, each component of the result vector 27685bd8deadSopenharmony_ci enabled in the writemask is clamped to the range [0,1] before being 27695bd8deadSopenharmony_ci updated in the destination register. 27705bd8deadSopenharmony_ci 27715bd8deadSopenharmony_ci The following pseudocode illustrates the process of writing a result 27725bd8deadSopenharmony_ci vector to the destination register. In the pseudocode, "instrmask" 27735bd8deadSopenharmony_ci refers to the component write mask given by the <optionalMask> rule. 27745bd8deadSopenharmony_ci "clamp" is TRUE if the instruction specifies that the result should 27755bd8deadSopenharmony_ci be clamped. "result" and "destination" refer to the result vector 27765bd8deadSopenharmony_ci and the register selected by <dstReg>, respectively. 27775bd8deadSopenharmony_ci 27785bd8deadSopenharmony_ci void UpdateDestination(floatVec destination, floatVec result) 27795bd8deadSopenharmony_ci { 27805bd8deadSopenharmony_ci floatVec merged; 27815bd8deadSopenharmony_ci 27825bd8deadSopenharmony_ci // Clamp the result vector components to [0,1], if requested. 27835bd8deadSopenharmony_ci if (instrClamp) { 27845bd8deadSopenharmony_ci if (result.x < 0) result.x = 0; 27855bd8deadSopenharmony_ci else if (result.x > 1) result.x = 1; 27865bd8deadSopenharmony_ci if (result.y < 0) result.y = 0; 27875bd8deadSopenharmony_ci else if (result.y > 1) result.y = 1; 27885bd8deadSopenharmony_ci if (result.z < 0) result.z = 0; 27895bd8deadSopenharmony_ci else if (result.z > 1) result.z = 1; 27905bd8deadSopenharmony_ci if (result.w < 0) result.w = 0; 27915bd8deadSopenharmony_ci else if (result.w > 1) result.w = 1; 27925bd8deadSopenharmony_ci } 27935bd8deadSopenharmony_ci 27945bd8deadSopenharmony_ci // Merge the converted result into the destination register, 27955bd8deadSopenharmony_ci // under control of the compile-time write mask. 27965bd8deadSopenharmony_ci merged = destination; 27975bd8deadSopenharmony_ci if (instrMask.x) { 27985bd8deadSopenharmony_ci merged.x = result.x; 27995bd8deadSopenharmony_ci } 28005bd8deadSopenharmony_ci if (instrMask.y) { 28015bd8deadSopenharmony_ci merged.y = result.y; 28025bd8deadSopenharmony_ci } 28035bd8deadSopenharmony_ci if (instrMask.z) { 28045bd8deadSopenharmony_ci merged.z = result.z; 28055bd8deadSopenharmony_ci } 28065bd8deadSopenharmony_ci if (instrMask.w) { 28075bd8deadSopenharmony_ci merged.w = result.w; 28085bd8deadSopenharmony_ci } 28095bd8deadSopenharmony_ci 28105bd8deadSopenharmony_ci // Write out the new destination register. 28115bd8deadSopenharmony_ci destination = merged; 28125bd8deadSopenharmony_ci } 28135bd8deadSopenharmony_ci 28145bd8deadSopenharmony_ci 28155bd8deadSopenharmony_ci 3.11.4.4 Fragment Program Result Processing 28165bd8deadSopenharmony_ci 28175bd8deadSopenharmony_ci As a fragment program executes, it will write to either one or two 28185bd8deadSopenharmony_ci result registers that are mapped to the fragment's color and depth. 28195bd8deadSopenharmony_ci 28205bd8deadSopenharmony_ci The fragment's color components are first clamped to the range [0,1] 28215bd8deadSopenharmony_ci then converted to fixed point as in section 2.13.9. If the fragment 28225bd8deadSopenharmony_ci program does not write result.color, the color will be undefined in 28235bd8deadSopenharmony_ci subsequent stages. 28245bd8deadSopenharmony_ci 28255bd8deadSopenharmony_ci If the fragment program contains an instruction to write to 28265bd8deadSopenharmony_ci result.depth, the fragment's depth is replaced by the value of the 28275bd8deadSopenharmony_ci "z" component of result.depth. This z value is first clamped to the 28285bd8deadSopenharmony_ci range [0,1] then converted to fixed-point as if it were a window z 28295bd8deadSopenharmony_ci value (section 2.10.1). If the fragment program does not write 28305bd8deadSopenharmony_ci result.depth, the fragment's original depth is unmodified. 28315bd8deadSopenharmony_ci 28325bd8deadSopenharmony_ci 28335bd8deadSopenharmony_ci 3.11.4.5 Fragment Program Options 28345bd8deadSopenharmony_ci 28355bd8deadSopenharmony_ci The <optionSequence> grammar rule provides a mechanism for programs 28365bd8deadSopenharmony_ci to indicate that one or more extended language features are used by 28375bd8deadSopenharmony_ci the program. All program options used by the program must be 28385bd8deadSopenharmony_ci declared at the beginning of the program string. Each program 28395bd8deadSopenharmony_ci option specified in a program string will modify the syntactic or 28405bd8deadSopenharmony_ci semantic rules used to interpet the program and the execution 28415bd8deadSopenharmony_ci environment used to execute the program. Program options not 28425bd8deadSopenharmony_ci present in the program string are ignored, even if they are 28435bd8deadSopenharmony_ci supported by the GL. 28445bd8deadSopenharmony_ci 28455bd8deadSopenharmony_ci The <identifier> token in the <option> rule must match the name of a 28465bd8deadSopenharmony_ci program option supported by the implementation. To avoid option 28475bd8deadSopenharmony_ci name conflicts, option identifiers are required to begin with a 28485bd8deadSopenharmony_ci vendor prefix. A program will fail to load if it specifies a 28495bd8deadSopenharmony_ci program option not supported by the GL. 28505bd8deadSopenharmony_ci 28515bd8deadSopenharmony_ci Fragment program options should confine their semantic changes to 28525bd8deadSopenharmony_ci the domain of fragment programs. Support for a fragment program 28535bd8deadSopenharmony_ci option should not change the specification and behavior of fragment 28545bd8deadSopenharmony_ci programs not requesting use of that option. 28555bd8deadSopenharmony_ci 28565bd8deadSopenharmony_ci 28575bd8deadSopenharmony_ci 3.11.4.5.1 Fog Application Fragment Program Options 28585bd8deadSopenharmony_ci 28595bd8deadSopenharmony_ci If a fragment program specifies one of the options "ARB_fog_exp", 28605bd8deadSopenharmony_ci "ARB_fog_exp2", or "ARB_fog_linear", the program will apply fog to 28615bd8deadSopenharmony_ci the program's final clamped color using a fog mode of EXP, EXP2, or 28625bd8deadSopenharmony_ci LINEAR, respectively, as described in section 3.10. 28635bd8deadSopenharmony_ci 28645bd8deadSopenharmony_ci When a fog option is specified in a fragment program, semantic 28655bd8deadSopenharmony_ci restrictions are added to indicate that a fragment program 28665bd8deadSopenharmony_ci will fail to load if the number of temporaries it contains exceeds 28675bd8deadSopenharmony_ci the implementation-dependent limit minus 1, if the number of 28685bd8deadSopenharmony_ci attributes it contains exceeds the implementation-dependent limit 28695bd8deadSopenharmony_ci minus 1, or if the number of parameters it contains exceeds the 28705bd8deadSopenharmony_ci implementation-dependent limit minus 2. 28715bd8deadSopenharmony_ci 28725bd8deadSopenharmony_ci Additionally, when the ARB_fog_exp option is specified in a fragment 28735bd8deadSopenharmony_ci program, a semantic restriction is added to indicate that a fragment 28745bd8deadSopenharmony_ci program will fail to load if the number of instructions or ALU 28755bd8deadSopenharmony_ci instructions it contains exceeds the implementation-dependent limit 28765bd8deadSopenharmony_ci minus 3. When the ARB_fog_exp2 option is specified in a fragment 28775bd8deadSopenharmony_ci program, a semantic restriction is added to indicate that a fragment 28785bd8deadSopenharmony_ci program will fail to load if the number of instructions or ALU 28795bd8deadSopenharmony_ci instructions it contains exceeds the implementation-dependent limit 28805bd8deadSopenharmony_ci minus 4. When the ARB_fog_linear option is specified in a fragment 28815bd8deadSopenharmony_ci program, a semantic restriction is added to indicate that a fragment 28825bd8deadSopenharmony_ci program will fail to load if the number of instructions or ALU 28835bd8deadSopenharmony_ci instructions it contains exceeds the implementation-dependent limit 28845bd8deadSopenharmony_ci minus 2. 28855bd8deadSopenharmony_ci 28865bd8deadSopenharmony_ci Only one fog application option may be specified by any given 28875bd8deadSopenharmony_ci fragment program. A fragment program that specifies more than one 28885bd8deadSopenharmony_ci of the program options "ARB_fog_exp", "ARB_fog_exp2", and 28895bd8deadSopenharmony_ci "ARB_fog_linear", will fail to load. 28905bd8deadSopenharmony_ci 28915bd8deadSopenharmony_ci 28925bd8deadSopenharmony_ci 3.11.4.5.2 Precision Hint Options 28935bd8deadSopenharmony_ci 28945bd8deadSopenharmony_ci Fragment program computations are carried out at an implementation- 28955bd8deadSopenharmony_ci dependent precision. However, some implementations may be able to 28965bd8deadSopenharmony_ci perform fragment program computations at more than one precision, 28975bd8deadSopenharmony_ci and may be able to trade off computation precision for performance. 28985bd8deadSopenharmony_ci 28995bd8deadSopenharmony_ci If a fragment program specifies the "ARB_precision_hint_fastest" 29005bd8deadSopenharmony_ci program option, implementations should select precision to minimize 29015bd8deadSopenharmony_ci program execution time, with possibly reduced precision. If a 29025bd8deadSopenharmony_ci fragment program specifies the "ARB_precision_hint_nicest" program 29035bd8deadSopenharmony_ci option, implementations should maximize the precision, with possibly 29045bd8deadSopenharmony_ci increased execution time. 29055bd8deadSopenharmony_ci 29065bd8deadSopenharmony_ci Only one precision control option may be specified by any given 29075bd8deadSopenharmony_ci fragment program. A fragment program that specifies both the 29085bd8deadSopenharmony_ci "ARB_precision_hint_fastest" and "ARB_precision_hint_nicest" program 29095bd8deadSopenharmony_ci options will fail to load. 29105bd8deadSopenharmony_ci 29115bd8deadSopenharmony_ci 29125bd8deadSopenharmony_ci 3.11.5 Fragment Program ALU Instruction Set 29135bd8deadSopenharmony_ci 29145bd8deadSopenharmony_ci The following sections describe the set of supported fragment 29155bd8deadSopenharmony_ci program instructions. Each section contains pseudocode describing 29165bd8deadSopenharmony_ci the instruction. Instructions will have up to three operands, 29175bd8deadSopenharmony_ci referred to as "op0", "op1", and "op2". The operands are loaded 29185bd8deadSopenharmony_ci using the mechanisms specified in section 3.11.4.1. The variables 29195bd8deadSopenharmony_ci "tmp", "tmp0", "tmp1", and "tmp2" describe scalars or vectors used 29205bd8deadSopenharmony_ci to hold intermediate results in the instruction. Instructions will 29215bd8deadSopenharmony_ci generate a result vector called "result". The result vector is then 29225bd8deadSopenharmony_ci written to the destination register specified in the instruction as 29235bd8deadSopenharmony_ci described in section 3.11.4.3. 29245bd8deadSopenharmony_ci 29255bd8deadSopenharmony_ci 29265bd8deadSopenharmony_ci 3.11.5.1 ABS: Absolute Value 29275bd8deadSopenharmony_ci 29285bd8deadSopenharmony_ci The ABS instruction performs a component-wise absolute value 29295bd8deadSopenharmony_ci operation on the single operand to yield a result vector. 29305bd8deadSopenharmony_ci 29315bd8deadSopenharmony_ci tmp = VectorLoad(op0); 29325bd8deadSopenharmony_ci result.x = fabs(tmp.x); 29335bd8deadSopenharmony_ci result.y = fabs(tmp.y); 29345bd8deadSopenharmony_ci result.z = fabs(tmp.z); 29355bd8deadSopenharmony_ci result.w = fabs(tmp.w); 29365bd8deadSopenharmony_ci 29375bd8deadSopenharmony_ci 29385bd8deadSopenharmony_ci 3.11.5.2 ADD: Add 29395bd8deadSopenharmony_ci 29405bd8deadSopenharmony_ci The ADD instruction performs a component-wise add of the two 29415bd8deadSopenharmony_ci operands to yield a result vector. 29425bd8deadSopenharmony_ci 29435bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 29445bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 29455bd8deadSopenharmony_ci result.x = tmp0.x + tmp1.x; 29465bd8deadSopenharmony_ci result.y = tmp0.y + tmp1.y; 29475bd8deadSopenharmony_ci result.z = tmp0.z + tmp1.z; 29485bd8deadSopenharmony_ci result.w = tmp0.w + tmp1.w; 29495bd8deadSopenharmony_ci 29505bd8deadSopenharmony_ci The following rules apply to addition: 29515bd8deadSopenharmony_ci 29525bd8deadSopenharmony_ci 1. <x> + <y> == <y> + <x>, for all <x> and <y>. 29535bd8deadSopenharmony_ci 2. <x> + 0.0 == <x>, for all <x>. 29545bd8deadSopenharmony_ci 29555bd8deadSopenharmony_ci 29565bd8deadSopenharmony_ci 3.11.5.3 CMP: Compare 29575bd8deadSopenharmony_ci 29585bd8deadSopenharmony_ci The CMP instructions performs a component-wise comparison of the 29595bd8deadSopenharmony_ci first operand against zero, and copies the values of the second or 29605bd8deadSopenharmony_ci third operands based on the results of the compare. 29615bd8deadSopenharmony_ci 29625bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 29635bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 29645bd8deadSopenharmony_ci tmp2 = VectorLoad(op2); 29655bd8deadSopenharmony_ci result.x = (tmp0.x < 0.0) ? tmp1.x : tmp2.x; 29665bd8deadSopenharmony_ci result.y = (tmp0.y < 0.0) ? tmp1.y : tmp2.y; 29675bd8deadSopenharmony_ci result.z = (tmp0.z < 0.0) ? tmp1.z : tmp2.z; 29685bd8deadSopenharmony_ci result.w = (tmp0.w < 0.0) ? tmp1.w : tmp2.w; 29695bd8deadSopenharmony_ci 29705bd8deadSopenharmony_ci 29715bd8deadSopenharmony_ci 3.11.5.4 COS: Cosine 29725bd8deadSopenharmony_ci 29735bd8deadSopenharmony_ci The COS instruction approximates the trigonometric cosine of the 29745bd8deadSopenharmony_ci angle specified by the scalar operand and replicates it to all four 29755bd8deadSopenharmony_ci components of the result vector. The angle is specified in radians 29765bd8deadSopenharmony_ci and does not have to be in the range [-PI,PI]. 29775bd8deadSopenharmony_ci 29785bd8deadSopenharmony_ci tmp = ScalarLoad(op0); 29795bd8deadSopenharmony_ci result.x = ApproxCosine(tmp); 29805bd8deadSopenharmony_ci result.y = ApproxCosine(tmp); 29815bd8deadSopenharmony_ci result.z = ApproxCosine(tmp); 29825bd8deadSopenharmony_ci result.w = ApproxCosine(tmp); 29835bd8deadSopenharmony_ci 29845bd8deadSopenharmony_ci 29855bd8deadSopenharmony_ci 3.11.5.5 DP3: Three-Component Dot Product 29865bd8deadSopenharmony_ci 29875bd8deadSopenharmony_ci The DP3 instruction computes a three-component dot product of the 29885bd8deadSopenharmony_ci two operands (using the first three components) and replicates the 29895bd8deadSopenharmony_ci dot product to all four components of the result vector. 29905bd8deadSopenharmony_ci 29915bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 29925bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 29935bd8deadSopenharmony_ci dot = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + (tmp0.z * tmp1.z); 29945bd8deadSopenharmony_ci result.x = dot; 29955bd8deadSopenharmony_ci result.y = dot; 29965bd8deadSopenharmony_ci result.z = dot; 29975bd8deadSopenharmony_ci result.w = dot; 29985bd8deadSopenharmony_ci 29995bd8deadSopenharmony_ci 30005bd8deadSopenharmony_ci 3.11.5.6 DP4: Four-Component Dot Product 30015bd8deadSopenharmony_ci 30025bd8deadSopenharmony_ci The DP4 instruction computes a four-component dot product of the two 30035bd8deadSopenharmony_ci operands and replicates the dot product to all four components of 30045bd8deadSopenharmony_ci the result vector. 30055bd8deadSopenharmony_ci 30065bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 30075bd8deadSopenharmony_ci tmp1 = VectorLoad(op1): 30085bd8deadSopenharmony_ci dot = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 30095bd8deadSopenharmony_ci (tmp0.z * tmp1.z) + (tmp0.w * tmp1.w); 30105bd8deadSopenharmony_ci result.x = dot; 30115bd8deadSopenharmony_ci result.y = dot; 30125bd8deadSopenharmony_ci result.z = dot; 30135bd8deadSopenharmony_ci result.w = dot; 30145bd8deadSopenharmony_ci 30155bd8deadSopenharmony_ci 30165bd8deadSopenharmony_ci 3.11.5.7 DPH: Homogeneous Dot Product 30175bd8deadSopenharmony_ci 30185bd8deadSopenharmony_ci The DPH instruction computes a three-component dot product of the 30195bd8deadSopenharmony_ci two operands (using the x, y, and z components), adds the w 30205bd8deadSopenharmony_ci component of the second operand, and replicates the sum to all four 30215bd8deadSopenharmony_ci components of the result vector. This is equivalent to a four- 30225bd8deadSopenharmony_ci component dot product where the w component of the first operand is 30235bd8deadSopenharmony_ci forced to 1.0. 30245bd8deadSopenharmony_ci 30255bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 30265bd8deadSopenharmony_ci tmp1 = VectorLoad(op1): 30275bd8deadSopenharmony_ci dot = (tmp0.x * tmp1.x) + (tmp0.y * tmp1.y) + 30285bd8deadSopenharmony_ci (tmp0.z * tmp1.z) + tmp1.w; 30295bd8deadSopenharmony_ci result.x = dot; 30305bd8deadSopenharmony_ci result.y = dot; 30315bd8deadSopenharmony_ci result.z = dot; 30325bd8deadSopenharmony_ci result.w = dot; 30335bd8deadSopenharmony_ci 30345bd8deadSopenharmony_ci 30355bd8deadSopenharmony_ci 3.11.5.8 DST: Distance Vector 30365bd8deadSopenharmony_ci 30375bd8deadSopenharmony_ci The DST instruction computes a distance vector from two specially- 30385bd8deadSopenharmony_ci formatted operands. The first operand should be of the form [NA, 30395bd8deadSopenharmony_ci d^2, d^2, NA] and the second operand should be of the form [NA, 1/d, 30405bd8deadSopenharmony_ci NA, 1/d], where NA values are not relevant to the calculation and d 30415bd8deadSopenharmony_ci is a vector length. If both vectors satisfy these conditions, the 30425bd8deadSopenharmony_ci result vector will be of the form [1.0, d, d^2, 1/d]. 30435bd8deadSopenharmony_ci 30445bd8deadSopenharmony_ci The exact behavior is specified in the following pseudo-code: 30455bd8deadSopenharmony_ci 30465bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 30475bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 30485bd8deadSopenharmony_ci result.x = 1.0; 30495bd8deadSopenharmony_ci result.y = tmp0.y * tmp1.y; 30505bd8deadSopenharmony_ci result.z = tmp0.z; 30515bd8deadSopenharmony_ci result.w = tmp1.w; 30525bd8deadSopenharmony_ci 30535bd8deadSopenharmony_ci Given an arbitrary vector, d^2 can be obtained using the DP3 30545bd8deadSopenharmony_ci instruction (using the same vector for both operands) and 1/d can be 30555bd8deadSopenharmony_ci obtained from d^2 using the RSQ instruction. 30565bd8deadSopenharmony_ci 30575bd8deadSopenharmony_ci This distance vector is useful for per-fragment light attenuation 30585bd8deadSopenharmony_ci calculations: a DP3 operation using the distance vector and an 30595bd8deadSopenharmony_ci attenuation constants vector as operands will yield the attenuation 30605bd8deadSopenharmony_ci factor. 30615bd8deadSopenharmony_ci 30625bd8deadSopenharmony_ci 30635bd8deadSopenharmony_ci 3.11.5.9 EX2: Exponential Base 2 30645bd8deadSopenharmony_ci 30655bd8deadSopenharmony_ci The EX2 instruction approximates 2 raised to the power of the scalar 30665bd8deadSopenharmony_ci operand and replicates the approximation to all four components of 30675bd8deadSopenharmony_ci the result vector. 30685bd8deadSopenharmony_ci 30695bd8deadSopenharmony_ci tmp = ScalarLoad(op0); 30705bd8deadSopenharmony_ci result.x = Approx2ToX(tmp); 30715bd8deadSopenharmony_ci result.y = Approx2ToX(tmp); 30725bd8deadSopenharmony_ci result.z = Approx2ToX(tmp); 30735bd8deadSopenharmony_ci result.w = Approx2ToX(tmp); 30745bd8deadSopenharmony_ci 30755bd8deadSopenharmony_ci 30765bd8deadSopenharmony_ci 3.11.5.10 FLR: Floor 30775bd8deadSopenharmony_ci 30785bd8deadSopenharmony_ci The FLR instruction performs a component-wise floor operation on the 30795bd8deadSopenharmony_ci operand to generate a result vector. The floor of a value is 30805bd8deadSopenharmony_ci defined as the largest integer less than or equal to the value. The 30815bd8deadSopenharmony_ci floor of 2.3 is 2.0; the floor of -3.6 is -4.0. 30825bd8deadSopenharmony_ci 30835bd8deadSopenharmony_ci tmp = VectorLoad(op0); 30845bd8deadSopenharmony_ci result.x = floor(tmp.x); 30855bd8deadSopenharmony_ci result.y = floor(tmp.y); 30865bd8deadSopenharmony_ci result.z = floor(tmp.z); 30875bd8deadSopenharmony_ci result.w = floor(tmp.w); 30885bd8deadSopenharmony_ci 30895bd8deadSopenharmony_ci 30905bd8deadSopenharmony_ci 3.11.5.11 FRC: Fraction 30915bd8deadSopenharmony_ci 30925bd8deadSopenharmony_ci The FRC instruction extracts the fractional portion of each 30935bd8deadSopenharmony_ci component of the operand to generate a result vector. The 30945bd8deadSopenharmony_ci fractional portion of a component is defined as the result after 30955bd8deadSopenharmony_ci subtracting off the floor of the component (see FLR), and is always 30965bd8deadSopenharmony_ci in the range [0.0, 1.0). 30975bd8deadSopenharmony_ci 30985bd8deadSopenharmony_ci For negative values, the fractional portion is NOT the number 30995bd8deadSopenharmony_ci written to the right of the decimal point -- the fractional portion 31005bd8deadSopenharmony_ci of -1.7 is not 0.7 -- it is 0.3. 0.3 is produced by subtracting the 31015bd8deadSopenharmony_ci floor of -1.7 (-2.0) from -1.7. 31025bd8deadSopenharmony_ci 31035bd8deadSopenharmony_ci tmp = VectorLoad(op0); 31045bd8deadSopenharmony_ci result.x = fraction(tmp.x); 31055bd8deadSopenharmony_ci result.y = fraction(tmp.y); 31065bd8deadSopenharmony_ci result.z = fraction(tmp.z); 31075bd8deadSopenharmony_ci result.w = fraction(tmp.w); 31085bd8deadSopenharmony_ci 31095bd8deadSopenharmony_ci 31105bd8deadSopenharmony_ci 3.11.5.12 LG2: Logarithm Base 2 31115bd8deadSopenharmony_ci 31125bd8deadSopenharmony_ci The LG2 instruction approximates the base 2 logarithm of the scalar 31135bd8deadSopenharmony_ci operand and replicates it to all four components of the result 31145bd8deadSopenharmony_ci vector. 31155bd8deadSopenharmony_ci 31165bd8deadSopenharmony_ci tmp = ScalarLoad(op0); 31175bd8deadSopenharmony_ci result.x = ApproxLog2(tmp); 31185bd8deadSopenharmony_ci result.y = ApproxLog2(tmp); 31195bd8deadSopenharmony_ci result.z = ApproxLog2(tmp); 31205bd8deadSopenharmony_ci result.w = ApproxLog2(tmp); 31215bd8deadSopenharmony_ci 31225bd8deadSopenharmony_ci If the scalar operand is zero or negative, the result is undefined. 31235bd8deadSopenharmony_ci 31245bd8deadSopenharmony_ci 31255bd8deadSopenharmony_ci 3.11.5.13 LIT: Light Coefficients 31265bd8deadSopenharmony_ci 31275bd8deadSopenharmony_ci The LIT instruction accelerates per-fragment lighting by computing 31285bd8deadSopenharmony_ci lighting coefficients for ambient, diffuse, and specular light 31295bd8deadSopenharmony_ci contributions. The "x" component of the single operand is assumed 31305bd8deadSopenharmony_ci to hold a diffuse dot product (n dot VP_pli, as in the vertex 31315bd8deadSopenharmony_ci lighting equations in Section 2.13.1). The "y" component of the 31325bd8deadSopenharmony_ci operand is assumed to hold a specular dot product (n dot h_i). The 31335bd8deadSopenharmony_ci "w" component of the operand is assumed to hold the specular 31345bd8deadSopenharmony_ci exponent of the material (s_rm), and is clamped to the range (-128, 31355bd8deadSopenharmony_ci +128) exclusive. 31365bd8deadSopenharmony_ci 31375bd8deadSopenharmony_ci The "x" component of the result vector receives the value that 31385bd8deadSopenharmony_ci should be multiplied by the ambient light/material product (always 31395bd8deadSopenharmony_ci 1.0). The "y" component of the result vector receives the value 31405bd8deadSopenharmony_ci that should be multiplied by the diffuse light/material product 31415bd8deadSopenharmony_ci (n dot VP_pli). The "z" component of the result vector receives the 31425bd8deadSopenharmony_ci value that should be multiplied by the specular light/material 31435bd8deadSopenharmony_ci product (f_i * (n dot h_i) ^ s_rm). The "w" component of the result 31445bd8deadSopenharmony_ci is the constant 1.0. 31455bd8deadSopenharmony_ci 31465bd8deadSopenharmony_ci Negative diffuse and specular dot products are clamped to 0.0, as is 31475bd8deadSopenharmony_ci done in the standard per-vertex lighting operations. In addition, 31485bd8deadSopenharmony_ci if the diffuse dot product is zero or negative, the specular 31495bd8deadSopenharmony_ci coefficient is forced to zero. 31505bd8deadSopenharmony_ci 31515bd8deadSopenharmony_ci tmp = VectorLoad(op0); 31525bd8deadSopenharmony_ci if (tmp.x < 0) tmp.x = 0; 31535bd8deadSopenharmony_ci if (tmp.y < 0) tmp.y = 0; 31545bd8deadSopenharmony_ci if (tmp.w < -(128.0-epsilon)) tmp.w = -(128.0-epsilon); 31555bd8deadSopenharmony_ci else if (tmp.w > 128-epsilon) tmp.w = 128-epsilon; 31565bd8deadSopenharmony_ci result.x = 1.0; 31575bd8deadSopenharmony_ci result.y = tmp.x; 31585bd8deadSopenharmony_ci result.z = (tmp.x > 0) ? RoughApproxPower(tmp.y, tmp.w) : 0.0; 31595bd8deadSopenharmony_ci result.w = 1.0; 31605bd8deadSopenharmony_ci 31615bd8deadSopenharmony_ci The exponentiation approximation function may be defined in terms of 31625bd8deadSopenharmony_ci the base 2 exponentiation and logarithm approximation operations in 31635bd8deadSopenharmony_ci the EX2 and LG2 instructions, where 31645bd8deadSopenharmony_ci 31655bd8deadSopenharmony_ci ApproxPower(a,b) = ApproxExp2(b * ApproxLog2(a)). 31665bd8deadSopenharmony_ci 31675bd8deadSopenharmony_ci In particular, the approximation may not be any more accurate than 31685bd8deadSopenharmony_ci the underlying EX2 and LG2 operations. 31695bd8deadSopenharmony_ci 31705bd8deadSopenharmony_ci Also, since 0^0 is defined to be 1, RoughApproxPower(0.0, 0.0) will 31715bd8deadSopenharmony_ci produce 1.0. 31725bd8deadSopenharmony_ci 31735bd8deadSopenharmony_ci 31745bd8deadSopenharmony_ci 3.11.5.14 LRP: Linear Interpolation 31755bd8deadSopenharmony_ci 31765bd8deadSopenharmony_ci The LRP instruction performs a component-wise linear interpolation 31775bd8deadSopenharmony_ci between the second and third operands using the first operand as the 31785bd8deadSopenharmony_ci blend factor. 31795bd8deadSopenharmony_ci 31805bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 31815bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 31825bd8deadSopenharmony_ci tmp2 = VectorLoad(op2); 31835bd8deadSopenharmony_ci result.x = tmp0.x * tmp1.x + (1 - tmp0.x) * tmp2.x; 31845bd8deadSopenharmony_ci result.y = tmp0.y * tmp1.y + (1 - tmp0.y) * tmp2.y; 31855bd8deadSopenharmony_ci result.z = tmp0.z * tmp1.z + (1 - tmp0.z) * tmp2.z; 31865bd8deadSopenharmony_ci result.w = tmp0.w * tmp1.w + (1 - tmp0.w) * tmp2.w; 31875bd8deadSopenharmony_ci 31885bd8deadSopenharmony_ci 31895bd8deadSopenharmony_ci 3.11.5.15 MAD: Multiply and Add 31905bd8deadSopenharmony_ci 31915bd8deadSopenharmony_ci The MAD instruction performs a component-wise multiply of the first two 31925bd8deadSopenharmony_ci operands, and then does a component-wise add of the product to the 31935bd8deadSopenharmony_ci third operand to yield a result vector. 31945bd8deadSopenharmony_ci 31955bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 31965bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 31975bd8deadSopenharmony_ci tmp2 = VectorLoad(op2); 31985bd8deadSopenharmony_ci result.x = tmp0.x * tmp1.x + tmp2.x; 31995bd8deadSopenharmony_ci result.y = tmp0.y * tmp1.y + tmp2.y; 32005bd8deadSopenharmony_ci result.z = tmp0.z * tmp1.z + tmp2.z; 32015bd8deadSopenharmony_ci result.w = tmp0.w * tmp1.w + tmp2.w; 32025bd8deadSopenharmony_ci 32035bd8deadSopenharmony_ci The multiplication and addition operations in this instruction are 32045bd8deadSopenharmony_ci subject to the same rules as described for the MUL and ADD 32055bd8deadSopenharmony_ci instructions. 32065bd8deadSopenharmony_ci 32075bd8deadSopenharmony_ci 32085bd8deadSopenharmony_ci 3.11.5.16 MAX: Maximum 32095bd8deadSopenharmony_ci 32105bd8deadSopenharmony_ci The MAX instruction computes component-wise maximums of the values 32115bd8deadSopenharmony_ci in the two operands to yield a result vector. 32125bd8deadSopenharmony_ci 32135bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 32145bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 32155bd8deadSopenharmony_ci result.x = (tmp0.x > tmp1.x) ? tmp0.x : tmp1.x; 32165bd8deadSopenharmony_ci result.y = (tmp0.y > tmp1.y) ? tmp0.y : tmp1.y; 32175bd8deadSopenharmony_ci result.z = (tmp0.z > tmp1.z) ? tmp0.z : tmp1.z; 32185bd8deadSopenharmony_ci result.w = (tmp0.w > tmp1.w) ? tmp0.w : tmp1.w; 32195bd8deadSopenharmony_ci 32205bd8deadSopenharmony_ci 32215bd8deadSopenharmony_ci 3.11.5.17 MIN: Minimum 32225bd8deadSopenharmony_ci 32235bd8deadSopenharmony_ci The MIN instruction computes component-wise minimums of the values 32245bd8deadSopenharmony_ci in the two operands to yield a result vector. 32255bd8deadSopenharmony_ci 32265bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 32275bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 32285bd8deadSopenharmony_ci result.x = (tmp0.x > tmp1.x) ? tmp1.x : tmp0.x; 32295bd8deadSopenharmony_ci result.y = (tmp0.y > tmp1.y) ? tmp1.y : tmp0.y; 32305bd8deadSopenharmony_ci result.z = (tmp0.z > tmp1.z) ? tmp1.z : tmp0.z; 32315bd8deadSopenharmony_ci result.w = (tmp0.w > tmp1.w) ? tmp1.w : tmp0.w; 32325bd8deadSopenharmony_ci 32335bd8deadSopenharmony_ci 32345bd8deadSopenharmony_ci 3.11.5.18 MOV: Move 32355bd8deadSopenharmony_ci 32365bd8deadSopenharmony_ci The MOV instruction copies the value of the operand to yield a 32375bd8deadSopenharmony_ci result vector. 32385bd8deadSopenharmony_ci 32395bd8deadSopenharmony_ci result = VectorLoad(op0); 32405bd8deadSopenharmony_ci 32415bd8deadSopenharmony_ci 32425bd8deadSopenharmony_ci 3.11.5.19 MUL: Multiply 32435bd8deadSopenharmony_ci 32445bd8deadSopenharmony_ci The MUL instruction performs a component-wise multiply of the two 32455bd8deadSopenharmony_ci operands to yield a result vector. 32465bd8deadSopenharmony_ci 32475bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 32485bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 32495bd8deadSopenharmony_ci result.x = tmp0.x * tmp1.x; 32505bd8deadSopenharmony_ci result.y = tmp0.y * tmp1.y; 32515bd8deadSopenharmony_ci result.z = tmp0.z * tmp1.z; 32525bd8deadSopenharmony_ci result.w = tmp0.w * tmp1.w; 32535bd8deadSopenharmony_ci 32545bd8deadSopenharmony_ci The following rules apply to multiplication: 32555bd8deadSopenharmony_ci 32565bd8deadSopenharmony_ci 1. <x> * <y> == <y> * <x>, for all <x> and <y>. 32575bd8deadSopenharmony_ci 2. +/-0.0 * <x> = +/-0.0, at least for all <x> that correspond to 32585bd8deadSopenharmony_ci representable numbers (IEEE "not a number" and "infinity" 32595bd8deadSopenharmony_ci encodings may be exceptions). 32605bd8deadSopenharmony_ci 3. +1.0 * <x> = <x>, for all <x>. 32615bd8deadSopenharmony_ci 32625bd8deadSopenharmony_ci Multiplication by zero and one should be invariant, as it may be 32635bd8deadSopenharmony_ci used to evaluate conditional expressions without branching. 32645bd8deadSopenharmony_ci 32655bd8deadSopenharmony_ci 32665bd8deadSopenharmony_ci 3.11.5.20 POW: Exponentiate 32675bd8deadSopenharmony_ci 32685bd8deadSopenharmony_ci The POW instruction approximates the value of the first scalar 32695bd8deadSopenharmony_ci operand raised to the power of the second scalar operand and 32705bd8deadSopenharmony_ci replicates it to all four components of the result vector. 32715bd8deadSopenharmony_ci 32725bd8deadSopenharmony_ci tmp0 = ScalarLoad(op0); 32735bd8deadSopenharmony_ci tmp1 = ScalarLoad(op1); 32745bd8deadSopenharmony_ci result.x = ApproxPower(tmp0, tmp1); 32755bd8deadSopenharmony_ci result.y = ApproxPower(tmp0, tmp1); 32765bd8deadSopenharmony_ci result.z = ApproxPower(tmp0, tmp1); 32775bd8deadSopenharmony_ci result.w = ApproxPower(tmp0, tmp1); 32785bd8deadSopenharmony_ci 32795bd8deadSopenharmony_ci The exponentiation approximation function may be implemented using 32805bd8deadSopenharmony_ci the base 2 exponentiation and logarithm approximation operations in 32815bd8deadSopenharmony_ci the EX2 and LG2 instructions. In particular, 32825bd8deadSopenharmony_ci 32835bd8deadSopenharmony_ci ApproxPower(a,b) = ApproxExp2(b * ApproxLog2(a)). 32845bd8deadSopenharmony_ci 32855bd8deadSopenharmony_ci Note that a logarithm may be involved even for cases where the 32865bd8deadSopenharmony_ci exponent is an integer. This means that it may not be possible to 32875bd8deadSopenharmony_ci exponentiate correctly with a negative base. In constrast, it is 32885bd8deadSopenharmony_ci possible in a "normal" mathematical formulation to raise negative 32895bd8deadSopenharmony_ci numbers to integral powers (e.g., (-3)^2== 9, and (-0.5)^-2==4). 32905bd8deadSopenharmony_ci 32915bd8deadSopenharmony_ci 32925bd8deadSopenharmony_ci 3.11.5.21 RCP: Reciprocal 32935bd8deadSopenharmony_ci 32945bd8deadSopenharmony_ci The RCP instruction approximates the reciprocal of the scalar 32955bd8deadSopenharmony_ci operand and replicates it to all four components of the result 32965bd8deadSopenharmony_ci vector. 32975bd8deadSopenharmony_ci 32985bd8deadSopenharmony_ci tmp = ScalarLoad(op0); 32995bd8deadSopenharmony_ci result.x = ApproxReciprocal(tmp); 33005bd8deadSopenharmony_ci result.y = ApproxReciprocal(tmp); 33015bd8deadSopenharmony_ci result.z = ApproxReciprocal(tmp); 33025bd8deadSopenharmony_ci result.w = ApproxReciprocal(tmp); 33035bd8deadSopenharmony_ci 33045bd8deadSopenharmony_ci The following rule applies to reciprocation: 33055bd8deadSopenharmony_ci 33065bd8deadSopenharmony_ci 1. ApproxReciprocal(+1.0) = +1.0. 33075bd8deadSopenharmony_ci 33085bd8deadSopenharmony_ci 33095bd8deadSopenharmony_ci 3.11.5.22 RSQ: Reciprocal Square Root 33105bd8deadSopenharmony_ci 33115bd8deadSopenharmony_ci The RSQ instruction approximates the reciprocal of the square root 33125bd8deadSopenharmony_ci of the absolute value of the scalar operand and replicates it to all 33135bd8deadSopenharmony_ci four components of the result vector. 33145bd8deadSopenharmony_ci 33155bd8deadSopenharmony_ci tmp = fabs(ScalarLoad(op0)); 33165bd8deadSopenharmony_ci result.x = ApproxRSQRT(tmp); 33175bd8deadSopenharmony_ci result.y = ApproxRSQRT(tmp); 33185bd8deadSopenharmony_ci result.z = ApproxRSQRT(tmp); 33195bd8deadSopenharmony_ci result.w = ApproxRSQRT(tmp); 33205bd8deadSopenharmony_ci 33215bd8deadSopenharmony_ci 33225bd8deadSopenharmony_ci 3.11.5.23 SCS: Sine/Cosine 33235bd8deadSopenharmony_ci 33245bd8deadSopenharmony_ci The SCS instruction approximates the trigonometric sine and cosine 33255bd8deadSopenharmony_ci of the angle specified by the scalar operand and places the cosine 33265bd8deadSopenharmony_ci in the x component and the sine in the y component of the result 33275bd8deadSopenharmony_ci vector. The z and w components of the result vector are undefined. 33285bd8deadSopenharmony_ci The angle is specified in radians and must be in the range [-PI,PI]. 33295bd8deadSopenharmony_ci 33305bd8deadSopenharmony_ci tmp = ScalarLoad(op0); 33315bd8deadSopenharmony_ci result.x = ApproxCosine(tmp); 33325bd8deadSopenharmony_ci result.y = ApproxSine(tmp); 33335bd8deadSopenharmony_ci 33345bd8deadSopenharmony_ci If the scalar operand is not in the range [-PI,PI], the result 33355bd8deadSopenharmony_ci vector is undefined. 33365bd8deadSopenharmony_ci 33375bd8deadSopenharmony_ci 33385bd8deadSopenharmony_ci 3.11.5.24 SGE: Set On Greater or Equal Than 33395bd8deadSopenharmony_ci 33405bd8deadSopenharmony_ci The SGE instruction performs a component-wise comparison of the two 33415bd8deadSopenharmony_ci operands. Each component of the result vector is 1.0 if the 33425bd8deadSopenharmony_ci corresponding component of the first operands is greater than or 33435bd8deadSopenharmony_ci equal that of the second, and 0.0 otherwise. 33445bd8deadSopenharmony_ci 33455bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 33465bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 33475bd8deadSopenharmony_ci result.x = (tmp0.x >= tmp1.x) ? 1.0 : 0.0; 33485bd8deadSopenharmony_ci result.y = (tmp0.y >= tmp1.y) ? 1.0 : 0.0; 33495bd8deadSopenharmony_ci result.z = (tmp0.z >= tmp1.z) ? 1.0 : 0.0; 33505bd8deadSopenharmony_ci result.w = (tmp0.w >= tmp1.w) ? 1.0 : 0.0; 33515bd8deadSopenharmony_ci 33525bd8deadSopenharmony_ci 33535bd8deadSopenharmony_ci 3.11.5.25 SIN: Sine 33545bd8deadSopenharmony_ci 33555bd8deadSopenharmony_ci The SIN instruction approximates the trigonometric sine of the angle 33565bd8deadSopenharmony_ci specified by the scalar operand and replicates it to all four 33575bd8deadSopenharmony_ci components of the result vector. The angle is specified in radians 33585bd8deadSopenharmony_ci and does not have to be in the range [-PI,PI]. 33595bd8deadSopenharmony_ci 33605bd8deadSopenharmony_ci tmp = ScalarLoad(op0); 33615bd8deadSopenharmony_ci result.x = ApproxSine(tmp); 33625bd8deadSopenharmony_ci result.y = ApproxSine(tmp); 33635bd8deadSopenharmony_ci result.z = ApproxSine(tmp); 33645bd8deadSopenharmony_ci result.w = ApproxSine(tmp); 33655bd8deadSopenharmony_ci 33665bd8deadSopenharmony_ci 33675bd8deadSopenharmony_ci 3.11.5.26 SLT: Set On Less Than 33685bd8deadSopenharmony_ci 33695bd8deadSopenharmony_ci The SLT instruction performs a component-wise comparison of the two 33705bd8deadSopenharmony_ci operands. Each component of the result vector is 1.0 if the 33715bd8deadSopenharmony_ci corresponding component of the first operand is less than that of 33725bd8deadSopenharmony_ci the second, and 0.0 otherwise. 33735bd8deadSopenharmony_ci 33745bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 33755bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 33765bd8deadSopenharmony_ci result.x = (tmp0.x < tmp1.x) ? 1.0 : 0.0; 33775bd8deadSopenharmony_ci result.y = (tmp0.y < tmp1.y) ? 1.0 : 0.0; 33785bd8deadSopenharmony_ci result.z = (tmp0.z < tmp1.z) ? 1.0 : 0.0; 33795bd8deadSopenharmony_ci result.w = (tmp0.w < tmp1.w) ? 1.0 : 0.0; 33805bd8deadSopenharmony_ci 33815bd8deadSopenharmony_ci 33825bd8deadSopenharmony_ci 3.11.5.27 SUB: Subtract 33835bd8deadSopenharmony_ci 33845bd8deadSopenharmony_ci The SUB instruction performs a component-wise subtraction of the 33855bd8deadSopenharmony_ci second operand from the first to yield a result vector. 33865bd8deadSopenharmony_ci 33875bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 33885bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 33895bd8deadSopenharmony_ci result.x = tmp0.x - tmp1.x; 33905bd8deadSopenharmony_ci result.y = tmp0.y - tmp1.y; 33915bd8deadSopenharmony_ci result.z = tmp0.z - tmp1.z; 33925bd8deadSopenharmony_ci result.w = tmp0.w - tmp1.w; 33935bd8deadSopenharmony_ci 33945bd8deadSopenharmony_ci 33955bd8deadSopenharmony_ci 3.11.5.28 SWZ: Extended Swizzle 33965bd8deadSopenharmony_ci 33975bd8deadSopenharmony_ci The SWZ instruction loads the single vector operand, and performs a 33985bd8deadSopenharmony_ci swizzle operation more powerful than that provided for loading 33995bd8deadSopenharmony_ci normal vector operands to yield an instruction vector. 34005bd8deadSopenharmony_ci 34015bd8deadSopenharmony_ci After the operand is loaded, the "x", "y", "z", and "w" components 34025bd8deadSopenharmony_ci of the result vector are selected by the first, second, third, and 34035bd8deadSopenharmony_ci fourth matches of the <xyzwExtSwizComp> or <rgbaExtSwizComp> pattern 34045bd8deadSopenharmony_ci in the <extendedSwizzle> rule. 34055bd8deadSopenharmony_ci 34065bd8deadSopenharmony_ci A result component can be selected from any of the four components 34075bd8deadSopenharmony_ci of the operand or the constants 0.0 and 1.0. The result component 34085bd8deadSopenharmony_ci can also be optionally negated. The following pseudocode describes 34095bd8deadSopenharmony_ci the component selection method. "operand" refers to the vector 34105bd8deadSopenharmony_ci operand. "select" is an enumerant where the values ZERO, ONE, X, Y, 34115bd8deadSopenharmony_ci Z, and W correspond to the <xyzwExtSwizSel> rule matching "0", "1", "x", 34125bd8deadSopenharmony_ci "y", "z", and "w", respectively, or the <rgbaExtSwizSel> rule 34135bd8deadSopenharmony_ci matching "0", 1", "r", "g", "b", and "a", respectively. "negate" is 34145bd8deadSopenharmony_ci TRUE if and only if the <optionalSign> rule in <xyzwExtSwizComp> 34155bd8deadSopenharmony_ci or <rgbaExtSwizComp> matches "-". 34165bd8deadSopenharmony_ci 34175bd8deadSopenharmony_ci float ExtSwizComponent(floatVec operand, enum select, boolean negate) 34185bd8deadSopenharmony_ci { 34195bd8deadSopenharmony_ci float result; 34205bd8deadSopenharmony_ci switch (select) { 34215bd8deadSopenharmony_ci case ZERO: result = 0.0; break; 34225bd8deadSopenharmony_ci case ONE: result = 1.0; break; 34235bd8deadSopenharmony_ci case X: result = operand.x; break; 34245bd8deadSopenharmony_ci case Y: result = operand.y; break; 34255bd8deadSopenharmony_ci case Z: result = operand.z; break; 34265bd8deadSopenharmony_ci case W: result = operand.w; break; 34275bd8deadSopenharmony_ci } 34285bd8deadSopenharmony_ci if (negate) { 34295bd8deadSopenharmony_ci result = -result; 34305bd8deadSopenharmony_ci } 34315bd8deadSopenharmony_ci return result; 34325bd8deadSopenharmony_ci } 34335bd8deadSopenharmony_ci 34345bd8deadSopenharmony_ci The entire extended swizzle operation is then defined using the 34355bd8deadSopenharmony_ci following pseudocode: 34365bd8deadSopenharmony_ci 34375bd8deadSopenharmony_ci tmp = VectorLoad(op0); 34385bd8deadSopenharmony_ci result.x = ExtSwizComponent(tmp, xSelect, xNegate); 34395bd8deadSopenharmony_ci result.y = ExtSwizComponent(tmp, ySelect, yNegate); 34405bd8deadSopenharmony_ci result.z = ExtSwizComponent(tmp, zSelect, zNegate); 34415bd8deadSopenharmony_ci result.w = ExtSwizComponent(tmp, wSelect, wNegate); 34425bd8deadSopenharmony_ci 34435bd8deadSopenharmony_ci "xSelect", "xNegate", "ySelect", "yNegate", "zSelect", "zNegate", 34445bd8deadSopenharmony_ci "wSelect", and "wNegate" correspond to the "select" and "negate" 34455bd8deadSopenharmony_ci values above for the four <xyzwExtSwizComp> or <rgbaExtSwizComp> 34465bd8deadSopenharmony_ci matches. 34475bd8deadSopenharmony_ci 34485bd8deadSopenharmony_ci Since this instruction allows for component selection and negation 34495bd8deadSopenharmony_ci for each individual component, the grammar does not allow the use of 34505bd8deadSopenharmony_ci the normal swizzle and negation operations allowed for vector 34515bd8deadSopenharmony_ci operands in other instructions. 34525bd8deadSopenharmony_ci 34535bd8deadSopenharmony_ci 34545bd8deadSopenharmony_ci 3.11.5.29 XPD: Cross Product 34555bd8deadSopenharmony_ci 34565bd8deadSopenharmony_ci The XPD instruction computes the cross product using the first three 34575bd8deadSopenharmony_ci components of its two vector operands to generate the x, y, and z 34585bd8deadSopenharmony_ci components of the result vector. The w component of the result 34595bd8deadSopenharmony_ci vector is undefined. 34605bd8deadSopenharmony_ci 34615bd8deadSopenharmony_ci tmp0 = VectorLoad(op0); 34625bd8deadSopenharmony_ci tmp1 = VectorLoad(op1); 34635bd8deadSopenharmony_ci result.x = tmp0.y * tmp1.z - tmp0.z * tmp1.y; 34645bd8deadSopenharmony_ci result.y = tmp0.z * tmp1.x - tmp0.x * tmp1.z; 34655bd8deadSopenharmony_ci result.z = tmp0.x * tmp1.y - tmp0.y * tmp1.x; 34665bd8deadSopenharmony_ci 34675bd8deadSopenharmony_ci 34685bd8deadSopenharmony_ci 3.11.6 Fragment Program Texture Instruction Set 34695bd8deadSopenharmony_ci 34705bd8deadSopenharmony_ci The first three texture instructions described below specify the 34715bd8deadSopenharmony_ci mapping of 4-tuple vectors to colors of an image. The sampling of 34725bd8deadSopenharmony_ci the texture works as described in section 3.8, except that texture 34735bd8deadSopenharmony_ci environments and texture functions are not applicable, and the 34745bd8deadSopenharmony_ci texture enables hierarchy is replaced by explicit references to 34755bd8deadSopenharmony_ci the desired texture target (i.e., 1D, 2D, 3D, cube map, rectangle). 34765bd8deadSopenharmony_ci These texture instructions specify how the 4-tuple is mapped into 34775bd8deadSopenharmony_ci the coordinates used for sampling. The following function is used 34785bd8deadSopenharmony_ci to describe the texture sampling in the descriptions below: 34795bd8deadSopenharmony_ci 34805bd8deadSopenharmony_ci vec4 TextureSample(float s, float t, float r, float lodBias, 34815bd8deadSopenharmony_ci int texImageUnit, enum texTarget); 34825bd8deadSopenharmony_ci 34835bd8deadSopenharmony_ci Note that not all three texture coordinates, s, t, and r, are 34845bd8deadSopenharmony_ci used by all texture targets. In particular, 1D texture targets only 34855bd8deadSopenharmony_ci use the s component, and 2D and rectangle (non-power-of-two) texture 34865bd8deadSopenharmony_ci targets only use the s and t components. The descriptions of the 34875bd8deadSopenharmony_ci texture instructions below supply all three components, as would be 34885bd8deadSopenharmony_ci the case with 3D or cube map targets. 34895bd8deadSopenharmony_ci 34905bd8deadSopenharmony_ci If a fragment program samples from a texture target on a texture 34915bd8deadSopenharmony_ci image unit where the bound texture object is not complete, as 34925bd8deadSopenharmony_ci defined in section 3.8.9, the result will be the vector 34935bd8deadSopenharmony_ci (R, G, B, A) = (0, 0, 0, 1). 34945bd8deadSopenharmony_ci 34955bd8deadSopenharmony_ci A fragment program will fail to load if it attempts to sample from 34965bd8deadSopenharmony_ci multiple texture targets on the same texture image unit. For 34975bd8deadSopenharmony_ci example, the following program would fail to load: 34985bd8deadSopenharmony_ci 34995bd8deadSopenharmony_ci !!ARBfp1.0 35005bd8deadSopenharmony_ci TEX result.color, fragment.texcoord[0], texture[0], 2D; 35015bd8deadSopenharmony_ci TEX result.depth, fragment.texcoord[1], texture[0], 3D; 35025bd8deadSopenharmony_ci END 35035bd8deadSopenharmony_ci 35045bd8deadSopenharmony_ci The fourth texture instruction described below, KIL, does not sample 35055bd8deadSopenharmony_ci from a texture, but rather prevents further processing of the 35065bd8deadSopenharmony_ci current fragment if any component of its 4-tuple vector is less than 35075bd8deadSopenharmony_ci zero. 35085bd8deadSopenharmony_ci 35095bd8deadSopenharmony_ci A dependent texture instruction is one that samples using a texture 35105bd8deadSopenharmony_ci coordinate residing in a temporary, rather than in an attribute or 35115bd8deadSopenharmony_ci a parameter. A program may have a chain of dependent texture 35125bd8deadSopenharmony_ci instructions, where the result of the first texture instruction is 35135bd8deadSopenharmony_ci used as the coordinate for a second texture instruction, which is in 35145bd8deadSopenharmony_ci turn used as the coordinate for a third texture instruction, and so 35155bd8deadSopenharmony_ci on. Each node in this chain is termed an indirection, and can be 35165bd8deadSopenharmony_ci thought of as a set of texture samples that execute in parallel 35175bd8deadSopenharmony_ci followed by a sequence of ALU instructions. 35185bd8deadSopenharmony_ci 35195bd8deadSopenharmony_ci Some implementations may have limitations on how long the dependency 35205bd8deadSopenharmony_ci chain may be, and so indirections are counted as a resource just 35215bd8deadSopenharmony_ci like instructions or temporaries are counted. All programs have at 35225bd8deadSopenharmony_ci least one indirection, or one node in this chain, even if the 35235bd8deadSopenharmony_ci program performs no texture operation. Each instruction encountered 35245bd8deadSopenharmony_ci is included in this node until a texture instruction is encountered 35255bd8deadSopenharmony_ci 35265bd8deadSopenharmony_ci - whose texture coordinate is a temporary that has been previously 35275bd8deadSopenharmony_ci written in the current node; or 35285bd8deadSopenharmony_ci 35295bd8deadSopenharmony_ci - whose result vector is a temporary that is also the operand or 35305bd8deadSopenharmony_ci result vector of a previous ALU instruction in the current node. 35315bd8deadSopenharmony_ci 35325bd8deadSopenharmony_ci A new node is then started, including the texture instruction and 35335bd8deadSopenharmony_ci all subsequent instructions, and the process repeats for all 35345bd8deadSopenharmony_ci instructions in the program. Note that for simplicity in counting, 35355bd8deadSopenharmony_ci result writemasks and operand suffixes are not taken into 35365bd8deadSopenharmony_ci consideration when counting indirections. 35375bd8deadSopenharmony_ci 35385bd8deadSopenharmony_ci 35395bd8deadSopenharmony_ci 3.11.6.1 TEX: Map coordinate to color 35405bd8deadSopenharmony_ci 35415bd8deadSopenharmony_ci The TEX instruction takes the first three components of 35425bd8deadSopenharmony_ci its source vector, and maps them to s, t, and r. These coordinates 35435bd8deadSopenharmony_ci are used to sample from the specified texture target on the 35445bd8deadSopenharmony_ci specified texture image unit in a manner consistent with its 35455bd8deadSopenharmony_ci parameters. The resulting sample is mapped to RGBA as described in 35465bd8deadSopenharmony_ci table 3.21 and written to the result vector. 35475bd8deadSopenharmony_ci 35485bd8deadSopenharmony_ci tmp = VectorLoad(op0); 35495bd8deadSopenharmony_ci result = TextureSample(tmp.x, tmp.y, tmp.z, 0.0, op1, op2); 35505bd8deadSopenharmony_ci 35515bd8deadSopenharmony_ci 35525bd8deadSopenharmony_ci 3.11.6.2 TXP: Project coordinate and map to color 35535bd8deadSopenharmony_ci 35545bd8deadSopenharmony_ci The TXP instruction divides the first three components of its source 35555bd8deadSopenharmony_ci vector by the fourth component and maps the results to s, t, and r. 35565bd8deadSopenharmony_ci These coordinates are used to sample from the specified texture 35575bd8deadSopenharmony_ci target on the specified texture image unit in a manner consistent 35585bd8deadSopenharmony_ci with its parameters. The resulting sample is mapped to RGBA as 35595bd8deadSopenharmony_ci described in table 3.21 and written to the result vector. If the 35605bd8deadSopenharmony_ci value of the fourth component of the source vector is less than or 35615bd8deadSopenharmony_ci equal to zero, the result vector is undefined. 35625bd8deadSopenharmony_ci 35635bd8deadSopenharmony_ci tmp = VectorLoad(op0); 35645bd8deadSopenharmony_ci tmp.x = tmp.x / tmp.w; 35655bd8deadSopenharmony_ci tmp.y = tmp.y / tmp.w; 35665bd8deadSopenharmony_ci tmp.z = tmp.z / tmp.w; 35675bd8deadSopenharmony_ci result = TextureSample(tmp.x, tmp.y, tmp.z, 0.0, op1, op2); 35685bd8deadSopenharmony_ci 35695bd8deadSopenharmony_ci 35705bd8deadSopenharmony_ci 3.11.6.3 TXB: Map coordinate to color while biasing its LOD 35715bd8deadSopenharmony_ci 35725bd8deadSopenharmony_ci The TXB instruction takes the first three components of its source 35735bd8deadSopenharmony_ci vector and maps them to s, t, and r. These coordinates are used to 35745bd8deadSopenharmony_ci sample from the specified texture target on the specified texture 35755bd8deadSopenharmony_ci image unit in a manner consistent with its parameters. 35765bd8deadSopenharmony_ci Additionally, the fourth component of the source vector is applied 35775bd8deadSopenharmony_ci to equation 3.14 as fragment_bias below to further bias the level of 35785bd8deadSopenharmony_ci detail. 35795bd8deadSopenharmony_ci 35805bd8deadSopenharmony_ci lambda'(x,y) = log2[p(x,y)] + 35815bd8deadSopenharmony_ci clamp(texobj_bias + texunit_bias + fragment_bias) 35825bd8deadSopenharmony_ci 35835bd8deadSopenharmony_ci The resulting sample is mapped to RGBA as described in table 3.21 35845bd8deadSopenharmony_ci and written to the result vector. 35855bd8deadSopenharmony_ci 35865bd8deadSopenharmony_ci tmp = VectorLoad(op0); 35875bd8deadSopenharmony_ci result = TextureSample(tmp.x, tmp.y, tmp.z, tmp.w, op1, op2); 35885bd8deadSopenharmony_ci 35895bd8deadSopenharmony_ci 35905bd8deadSopenharmony_ci 3.11.6.4 KIL: Kill fragment 35915bd8deadSopenharmony_ci 35925bd8deadSopenharmony_ci Rather than mapping a coordinate set to a color, this function 35935bd8deadSopenharmony_ci prevents a fragment from receiving any future processing. If any 35945bd8deadSopenharmony_ci component of its source vector is negative, the processing of this 35955bd8deadSopenharmony_ci fragment will be discontinued and no further outputs to this 35965bd8deadSopenharmony_ci fragment will occur. Subsequent stages of the GL pipeline will be 35975bd8deadSopenharmony_ci skipped for this fragment. 35985bd8deadSopenharmony_ci 35995bd8deadSopenharmony_ci tmp = VectorLoad(op0); 36005bd8deadSopenharmony_ci if ((tmp.x < 0) || (tmp.y < 0) || 36015bd8deadSopenharmony_ci (tmp.z < 0) || (tmp.w < 0)) 36025bd8deadSopenharmony_ci { 36035bd8deadSopenharmony_ci exit; 36045bd8deadSopenharmony_ci } 36055bd8deadSopenharmony_ci 36065bd8deadSopenharmony_ci 36075bd8deadSopenharmony_ci 3.11.7 Program Matrices 36085bd8deadSopenharmony_ci 36095bd8deadSopenharmony_ci In addition to GL's conventional matrices, several additional 36105bd8deadSopenharmony_ci program matrices are available for use as program parameters. These 36115bd8deadSopenharmony_ci matrices have names of the form MATRIX<i>_ARB where <i> is between 36125bd8deadSopenharmony_ci zero and <n>-1 where <n> is the value of the implementation- 36135bd8deadSopenharmony_ci dependent constant MAX_PROGRAM_MATRICES_ARB. The MATRIX<i>_ARB 36145bd8deadSopenharmony_ci constants obey MATRIX<i>_ARB = MATRIX0_ARB + <i>. The value of 36155bd8deadSopenharmony_ci MAX_PROGRAM_MATRICES_ARB must be at least eight. The maximum stack 36165bd8deadSopenharmony_ci depth for program matrices is defined by the 36175bd8deadSopenharmony_ci MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB and must be at least 1. 36185bd8deadSopenharmony_ci 36195bd8deadSopenharmony_ci 36205bd8deadSopenharmony_ci 3.11.8 Required Fragment Program State 36215bd8deadSopenharmony_ci 36225bd8deadSopenharmony_ci The state required to support program objects of all targets 36235bd8deadSopenharmony_ci consists of: 36245bd8deadSopenharmony_ci 36255bd8deadSopenharmony_ci an integer for the program error position, initially -1; 36265bd8deadSopenharmony_ci 36275bd8deadSopenharmony_ci an array of ubytes for the program error string, initially empty; 36285bd8deadSopenharmony_ci 36295bd8deadSopenharmony_ci and the state that must be maintained to indicate which integers 36305bd8deadSopenharmony_ci are currently in use as program object names. 36315bd8deadSopenharmony_ci 36325bd8deadSopenharmony_ci The state required to support the fragment program target consists 36335bd8deadSopenharmony_ci of: 36345bd8deadSopenharmony_ci 36355bd8deadSopenharmony_ci a bit indicating whether or not fragment program mode is enabled, 36365bd8deadSopenharmony_ci initially disabled; 36375bd8deadSopenharmony_ci 36385bd8deadSopenharmony_ci a set of MAX_PROGRAM_ENV_PARAMETERS_ARB four-component floating- 36395bd8deadSopenharmony_ci point program environment parameters, initially set to (0,0,0,0); 36405bd8deadSopenharmony_ci 36415bd8deadSopenharmony_ci an unsigned integer naming the currently bound fragment program, 36425bd8deadSopenharmony_ci initially zero; 36435bd8deadSopenharmony_ci 36445bd8deadSopenharmony_ci The state required for each fragment program object consists of: 36455bd8deadSopenharmony_ci 36465bd8deadSopenharmony_ci an unsigned integer indicating the program object name; 36475bd8deadSopenharmony_ci 36485bd8deadSopenharmony_ci an array of type ubyte containing the program string, initially 36495bd8deadSopenharmony_ci empty; 36505bd8deadSopenharmony_ci 36515bd8deadSopenharmony_ci an unsigned integer holding the length of the program string, 36525bd8deadSopenharmony_ci initially zero; 36535bd8deadSopenharmony_ci 36545bd8deadSopenharmony_ci an enum indicating the program string format, initially 36555bd8deadSopenharmony_ci PROGRAM_FORMAT_ASCII_ARB; 36565bd8deadSopenharmony_ci 36575bd8deadSopenharmony_ci a bit indicating whether or not the program exceeds the native 36585bd8deadSopenharmony_ci limits; 36595bd8deadSopenharmony_ci 36605bd8deadSopenharmony_ci six unsigned integers holding the number of instruction (ALU, 36615bd8deadSopenharmony_ci texture, and total), texture indirection, temporary variable, and 36625bd8deadSopenharmony_ci program parameter binding resources used by the program, initially 36635bd8deadSopenharmony_ci all zero; 36645bd8deadSopenharmony_ci 36655bd8deadSopenharmony_ci six unsigned integers holding the number of native instruction 36665bd8deadSopenharmony_ci (ALU, texture, and total), texture indirection, temporary 36675bd8deadSopenharmony_ci variable, and program parameter binding resources used by the 36685bd8deadSopenharmony_ci program, initially all zero; 36695bd8deadSopenharmony_ci 36705bd8deadSopenharmony_ci and a set of MAX_PROGRAM_LOCAL_PARAMETERS_ARB four-component 36715bd8deadSopenharmony_ci floating-point program local parameters, initially set to 36725bd8deadSopenharmony_ci (0,0,0,0). 36735bd8deadSopenharmony_ci 36745bd8deadSopenharmony_ci Initially, no fragment program objects exist. 36755bd8deadSopenharmony_ci 36765bd8deadSopenharmony_ci 36775bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.3 Specification (Per-Fragment 36785bd8deadSopenharmony_ciOperations and the Frame Buffer) 36795bd8deadSopenharmony_ci 36805bd8deadSopenharmony_ci None 36815bd8deadSopenharmony_ci 36825bd8deadSopenharmony_ci 36835bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.3 Specification (Special 36845bd8deadSopenharmony_ciFunctions) 36855bd8deadSopenharmony_ci 36865bd8deadSopenharmony_ci Modify Section 5.4, Display Lists (p. 191) 36875bd8deadSopenharmony_ci 36885bd8deadSopenharmony_ci (modify third paragraph, p. 195) ... These are IsList, GenLists, 36895bd8deadSopenharmony_ci ..., IsProgramARB, GenProgramsARB, and DeleteProgramsARB, as well as 36905bd8deadSopenharmony_ci IsEnabled and all the Get commands (chapter 6). 36915bd8deadSopenharmony_ci 36925bd8deadSopenharmony_ci 36935bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.3 Specification (State and 36945bd8deadSopenharmony_ciState Requests) 36955bd8deadSopenharmony_ci 36965bd8deadSopenharmony_ci Modify Section 6.1.2, Data Conversions (p. 198) 36975bd8deadSopenharmony_ci 36985bd8deadSopenharmony_ci (add before last paragraph, p. 198) The matrix selected by the 36995bd8deadSopenharmony_ci current matrix mode can be queried by calling GetBooleanv, 37005bd8deadSopenharmony_ci GetIntegerv, GetFloatv, and GetDoublev with <pname> set to 37015bd8deadSopenharmony_ci CURRENT_MATRIX_ARB; the matrix will be returned in transposed form 37025bd8deadSopenharmony_ci with <pname> set to TRANSPOSE_CURRENT_MATRIX_ARB. The depth of the 37035bd8deadSopenharmony_ci selected matrix stack can be queried with <pname> set to 37045bd8deadSopenharmony_ci CURRENT_MATRIX_STACK_DEPTH_ARB. Querying CURRENT_MATRIX_ARB and 37055bd8deadSopenharmony_ci CURRENT_MATRIX_STACK_DEPTH_ARB is the only means for querying the 37065bd8deadSopenharmony_ci matrix and matrix stack depth of the program matrices described in 37075bd8deadSopenharmony_ci section 3.11.7. 37085bd8deadSopenharmony_ci 37095bd8deadSopenharmony_ci 37105bd8deadSopenharmony_ci (add to end of last paragraph, p. 199) Queries of texture state 37115bd8deadSopenharmony_ci variables corresponding to texture coordinate processing unit 37125bd8deadSopenharmony_ci (namely, TexGen state and enables, and matrices) will produce an 37135bd8deadSopenharmony_ci INVALID_OPERATION error if the value of ACTIVE_TEXTURE is greater 37145bd8deadSopenharmony_ci than or equal to MAX_TEXTURE_COORDS_ARB. All other texture state 37155bd8deadSopenharmony_ci queries will result in an INVALID_OPERATION error if the value of 37165bd8deadSopenharmony_ci ACTIVE_TEXTURE is greater than or equal to 37175bd8deadSopenharmony_ci MAX_TEXTURE_IMAGE_UNITS_ARB. 37185bd8deadSopenharmony_ci 37195bd8deadSopenharmony_ci 37205bd8deadSopenharmony_ci Modify Section 6.1.11, Pointer and String Queries (p. 206) 37215bd8deadSopenharmony_ci 37225bd8deadSopenharmony_ci (modify last paragraph, p. 206) ... The possible values for <name> 37235bd8deadSopenharmony_ci are VENDOR, RENDERER, VERSION, EXTENSIONS, and 37245bd8deadSopenharmony_ci PROGRAM_ERROR_STRING_ARB. 37255bd8deadSopenharmony_ci 37265bd8deadSopenharmony_ci 37275bd8deadSopenharmony_ci (add after last paragraph of section, p. 207) Queries of 37285bd8deadSopenharmony_ci PROGRAM_ERROR_STRING_ARB return a pointer to an implementation- 37295bd8deadSopenharmony_ci dependent program load error string. If the last call to 37305bd8deadSopenharmony_ci ProgramStringARB failed to load a program, the returned string 37315bd8deadSopenharmony_ci describes at least one reason why the program failed to load. If 37325bd8deadSopenharmony_ci the last call to ProgramStringARB successfully loaded a program, the 37335bd8deadSopenharmony_ci returned string may be empty (containing only a zero terminator) or 37345bd8deadSopenharmony_ci may contain one or more implementation-dependent warning messages. 37355bd8deadSopenharmony_ci The contents of the error string are guaranteed to remain constant 37365bd8deadSopenharmony_ci only until the next ProgramStringARB command, which may overwrite 37375bd8deadSopenharmony_ci the error string. 37385bd8deadSopenharmony_ci 37395bd8deadSopenharmony_ci 37405bd8deadSopenharmony_ci Insert a new Section 6.1.12, Program Queries (p. 207), between 37415bd8deadSopenharmony_ci existing sections 6.1.11 and 6.1.12. 37425bd8deadSopenharmony_ci 37435bd8deadSopenharmony_ci 6.1.12 Program Queries 37445bd8deadSopenharmony_ci 37455bd8deadSopenharmony_ci The commands 37465bd8deadSopenharmony_ci 37475bd8deadSopenharmony_ci void GetProgramEnvParameterdvARB(enum target, uint index, 37485bd8deadSopenharmony_ci double *params); 37495bd8deadSopenharmony_ci void GetProgramEnvParameterfvARB(enum target, uint index, 37505bd8deadSopenharmony_ci float *params); 37515bd8deadSopenharmony_ci 37525bd8deadSopenharmony_ci obtain the current value for the program environment parameter 37535bd8deadSopenharmony_ci numbered <index> for the given program target <target>, and places 37545bd8deadSopenharmony_ci the information in the array <params>. The error INVALID_ENUM is 37555bd8deadSopenharmony_ci generated if <target> specifies a nonexistent program target or a 37565bd8deadSopenharmony_ci program target that does not support program environment parameters. 37575bd8deadSopenharmony_ci The error INVALID_VALUE is generated if <index> is greater than or 37585bd8deadSopenharmony_ci equal to the implementation-dependent number of supported program 37595bd8deadSopenharmony_ci environment parameters for the program target. 37605bd8deadSopenharmony_ci 37615bd8deadSopenharmony_ci When <target> is FRAGMENT_PROGRAM_ARB, each program parameter 37625bd8deadSopenharmony_ci returned is an array of four values. 37635bd8deadSopenharmony_ci 37645bd8deadSopenharmony_ci The commands 37655bd8deadSopenharmony_ci 37665bd8deadSopenharmony_ci void GetProgramLocalParameterdvARB(enum target, uint index, 37675bd8deadSopenharmony_ci double *params); 37685bd8deadSopenharmony_ci void GetProgramLocalParameterfvARB(enum target, uint index, 37695bd8deadSopenharmony_ci float *params); 37705bd8deadSopenharmony_ci 37715bd8deadSopenharmony_ci obtain the current value for the program local parameter numbered 37725bd8deadSopenharmony_ci <index> belonging to the program object currently bound to <target>, 37735bd8deadSopenharmony_ci and places the information in the array <params>. The error 37745bd8deadSopenharmony_ci INVALID_ENUM is generated if <target> specifies a nonexistent 37755bd8deadSopenharmony_ci program target or a program target that does not support program 37765bd8deadSopenharmony_ci local parameters. The error INVALID_VALUE is generated if <index> 37775bd8deadSopenharmony_ci is greater than or equal to the implementation-dependent number of 37785bd8deadSopenharmony_ci supported program local parameters for the program target. 37795bd8deadSopenharmony_ci 37805bd8deadSopenharmony_ci When the program target type is FRAGMENT_PROGRAM_ARB, each program 37815bd8deadSopenharmony_ci local parameter returned is an array of four values. 37825bd8deadSopenharmony_ci 37835bd8deadSopenharmony_ci The command 37845bd8deadSopenharmony_ci 37855bd8deadSopenharmony_ci void GetProgramivARB(enum target, enum pname, int *params); 37865bd8deadSopenharmony_ci 37875bd8deadSopenharmony_ci obtains program state for the program target <target>, writing the 37885bd8deadSopenharmony_ci state into the array given by <params>. GetProgramivARB can be used 37895bd8deadSopenharmony_ci to determine the properties of the currently bound program object or 37905bd8deadSopenharmony_ci implementation limits for <target>. 37915bd8deadSopenharmony_ci 37925bd8deadSopenharmony_ci If <pname> is PROGRAM_LENGTH_ARB, PROGRAM_FORMAT_ARB, or 37935bd8deadSopenharmony_ci PROGRAM_BINDING_ARB, GetProgramivARB returns one integer holding the 37945bd8deadSopenharmony_ci program string length (in bytes), program string format, and program 37955bd8deadSopenharmony_ci name, respectively, for the program object currently bound to 37965bd8deadSopenharmony_ci <target>. 37975bd8deadSopenharmony_ci 37985bd8deadSopenharmony_ci If <pname> is MAX_PROGRAM_LOCAL_PARAMETERS_ARB or 37995bd8deadSopenharmony_ci MAX_PROGRAM_ENV_PARAMETERS_ARB, GetProgramivARB returns one integer 38005bd8deadSopenharmony_ci holding the maximum number of program local parameters or program 38015bd8deadSopenharmony_ci environment parameters, respectively, supported for the program 38025bd8deadSopenharmony_ci target <target>. 38035bd8deadSopenharmony_ci 38045bd8deadSopenharmony_ci If <pname> is MAX_PROGRAM_INSTRUCTIONS_ARB, 38055bd8deadSopenharmony_ci MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, 38065bd8deadSopenharmony_ci MAX_PROGRAM_TEX_INDIRECTIONS_ARB, MAX_PROGRAM_TEMPORARIES_ARB, 38075bd8deadSopenharmony_ci MAX_PROGRAM_PARAMETERS_ARB, or MAX_PROGRAM_ATTRIBS_ARB, 38085bd8deadSopenharmony_ci GetProgramivARB returns a single integer giving the maximum number 38095bd8deadSopenharmony_ci of total instructions, ALU instructions, texture instructions, 38105bd8deadSopenharmony_ci texture indirections, temporaries, parameters, and attributes that 38115bd8deadSopenharmony_ci can be used by a program of type <target>. If <pname> is 38125bd8deadSopenharmony_ci PROGRAM_INSTRUCTIONS_ARB, PROGRAM_ALU_INSTRUCTIONS_ARB, 38135bd8deadSopenharmony_ci PROGRAM_TEX_INSTRUCTIONS_ARB, PROGRAM_TEX_INDIRECTIONS_ARB, 38145bd8deadSopenharmony_ci PROGRAM_TEMPORARIES_ARB, PROGRAM_PARAMETERS_ARB, or 38155bd8deadSopenharmony_ci PROGRAM_ATTRIBS_ARB, GetProgramivARB returns a single integer giving 38165bd8deadSopenharmony_ci the number of total instructions, ALU instructions, texture 38175bd8deadSopenharmony_ci instructions, texture indirections, temporaries, parameters, and 38185bd8deadSopenharmony_ci attributes used by the current program for <target>. 38195bd8deadSopenharmony_ci 38205bd8deadSopenharmony_ci If <pname> is MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, 38215bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, 38225bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB, 38235bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB, 38245bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, 38255bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_PARAMETERS_ARB, or 38265bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_ATTRIBS_ARB, GetProgramivARB returns a single 38275bd8deadSopenharmony_ci integer giving the maximum number of native instruction, ALU 38285bd8deadSopenharmony_ci instruction, texture instruction, texture indirection, temporary, 38295bd8deadSopenharmony_ci parameter, and attribute resources available to a program of type 38305bd8deadSopenharmony_ci <target>. If <pname> is PROGRAM_NATIVE_INSTRUCTIONS_ARB, 38315bd8deadSopenharmony_ci PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, 38325bd8deadSopenharmony_ci PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB, 38335bd8deadSopenharmony_ci PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB, 38345bd8deadSopenharmony_ci PROGRAM_NATIVE_TEMPORARIES_ARB, PROGRAM_NATIVE_PARAMETERS_ARB, or 38355bd8deadSopenharmony_ci PROGRAM_NATIVE_ATTRIBS_ARB, GetProgramivARB returns a single integer 38365bd8deadSopenharmony_ci giving the number of native instruction, ALU instruction, texture 38375bd8deadSopenharmony_ci instruction, texture indirection, temporary, parameter, and 38385bd8deadSopenharmony_ci attribute resources consumed by the program currently bound to 38395bd8deadSopenharmony_ci <target>. Native resource counts will reflect the results of 38405bd8deadSopenharmony_ci implementation-dependent scheduling and optimization algorithms 38415bd8deadSopenharmony_ci applied by the GL, as well as emulation of non-native features. If 38425bd8deadSopenharmony_ci <pname> is PROGRAM_UNDER_NATIVE_LIMITS_ARB, GetProgramivARB returns 38435bd8deadSopenharmony_ci 0 if the native resource consumption of the program currently bound 38445bd8deadSopenharmony_ci to <target> exceeds the number of available resources for any 38455bd8deadSopenharmony_ci resource type, and 1 otherwise. 38465bd8deadSopenharmony_ci 38475bd8deadSopenharmony_ci The command 38485bd8deadSopenharmony_ci 38495bd8deadSopenharmony_ci void GetProgramStringARB(enum target, enum pname, void *string); 38505bd8deadSopenharmony_ci 38515bd8deadSopenharmony_ci obtains the program string for the program object bound to <target> 38525bd8deadSopenharmony_ci and places the information in the array <string>. <pname> must be 38535bd8deadSopenharmony_ci PROGRAM_STRING_ARB. <n> ubytes are returned into the array program 38545bd8deadSopenharmony_ci where <n> is the length of the program in ubytes, as returned by 38555bd8deadSopenharmony_ci GetProgramivARB when <pname> is PROGRAM_LENGTH_ARB. The program 38565bd8deadSopenharmony_ci string is always returned using the format given when the program 38575bd8deadSopenharmony_ci string was specified. 38585bd8deadSopenharmony_ci 38595bd8deadSopenharmony_ci The command 38605bd8deadSopenharmony_ci 38615bd8deadSopenharmony_ci boolean IsProgramARB(uint program); 38625bd8deadSopenharmony_ci 38635bd8deadSopenharmony_ci returns TRUE if <program> is the name of a program object. If 38645bd8deadSopenharmony_ci <program> is zero or is a non-zero value that is not the name of a 38655bd8deadSopenharmony_ci program object, or if an error condition occurs, IsProgramARB 38665bd8deadSopenharmony_ci returns FALSE. A name returned by GenProgramsARB, but not yet 38675bd8deadSopenharmony_ci bound, is not the name of a program object. 38685bd8deadSopenharmony_ci 38695bd8deadSopenharmony_ci 38705bd8deadSopenharmony_ci Modify Section 6.2, State Tables (p. 216) 38715bd8deadSopenharmony_ci 38725bd8deadSopenharmony_ci (add to caption of Table 6.5) When accessing the current texture 38735bd8deadSopenharmony_ci coordinates (CURRENT_TEXTURE_COORDS) or the texture coordinates 38745bd8deadSopenharmony_ci associated with raster position (CURRENT_RASTER_TEXTURE_COORDS), the 38755bd8deadSopenharmony_ci active texture unit selector (ACTIVE_TEXTURE) must be less than the 38765bd8deadSopenharmony_ci implementation dependent maximum number of texture coordinate sets 38775bd8deadSopenharmony_ci (MAX_TEXTURE_COORDS_ARB). 38785bd8deadSopenharmony_ci 38795bd8deadSopenharmony_ci (add to caption of Table 6.8) When accessing the texture matrix 38805bd8deadSopenharmony_ci stack (TEXTURE_MATRIX, TRANSPOSE_TEXTURE_MATRIX) or the texture 38815bd8deadSopenharmony_ci matrix stack pointer (TEXTURE_STACK_DEPTH), the active texture unit 38825bd8deadSopenharmony_ci selector (ACTIVE_TEXTURE) must be less than the implementation 38835bd8deadSopenharmony_ci dependent maximum number of texture coordinate sets 38845bd8deadSopenharmony_ci (MAX_TEXTURE_COORDS_ARB). 38855bd8deadSopenharmony_ci 38865bd8deadSopenharmony_ci (split Table 6.17 into two tables, Texture Environment and Texture 38875bd8deadSopenharmony_ci Coordinate Generation; move active texture unit selector and texture 38885bd8deadSopenharmony_ci coordinate generation state to table 6.18; renumber subsequent 38895bd8deadSopenharmony_ci tables) 38905bd8deadSopenharmony_ci 38915bd8deadSopenharmony_ci (add to captions of Tables 6.14, 6.15, 6.16) The active texture unit 38925bd8deadSopenharmony_ci selector (ACTIVE_TEXTURE) identifies which texture object is 38935bd8deadSopenharmony_ci accessed, and must be less than the implementation dependent maximum 38945bd8deadSopenharmony_ci number of texture image units (MAX_TEXTURE_IMAGE_UNITS_ARB). 38955bd8deadSopenharmony_ci 38965bd8deadSopenharmony_ci (add to caption of Table 6.18) With the exception of ACTIVE_TEXTURE, 38975bd8deadSopenharmony_ci the active texture unit selector (ACTIVE_TEXTURE) identifies which 38985bd8deadSopenharmony_ci texture coordinate set is accessed, and must be less than the 38995bd8deadSopenharmony_ci implementation dependent maximum number of texture coordinate sets 39005bd8deadSopenharmony_ci (MAX_TEXTURE_COORDS_ARB). 39015bd8deadSopenharmony_ci 39025bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 1.3 Specification (Invariance) 39035bd8deadSopenharmony_ci 39045bd8deadSopenharmony_ci Add to end of Section A.3 (p. 242): 39055bd8deadSopenharmony_ci 39065bd8deadSopenharmony_ci Rule 4. Fragment program instructions not relevant to the 39075bd8deadSopenharmony_ci calculation of any result must have no effect on that result. 39085bd8deadSopenharmony_ci 39095bd8deadSopenharmony_ci Rule 5. Fragment program instructions relevant to the calculation 39105bd8deadSopenharmony_ci of any result must always produce the identical result. 39115bd8deadSopenharmony_ci 39125bd8deadSopenharmony_ci Instructions relevant to the calculation of a result are any 39135bd8deadSopenharmony_ci instructions in a sequence of instructions that eventually determine 39145bd8deadSopenharmony_ci the source values for the calculation under consideration. 39155bd8deadSopenharmony_ci 39165bd8deadSopenharmony_ci There is no guaranteed invariance between fragment colors generated 39175bd8deadSopenharmony_ci by conventional GL texturing mode and fragment colors generated by 39185bd8deadSopenharmony_ci fragment program mode. Multi-pass rendering algorithms that require 39195bd8deadSopenharmony_ci rendering invariances to operate correctly should not mix 39205bd8deadSopenharmony_ci conventional GL fragment texturing mode with fragment program mode 39215bd8deadSopenharmony_ci for different rendering passes. However, such algorithms will 39225bd8deadSopenharmony_ci operate correctly if the algorithms limit themselves to a single 39235bd8deadSopenharmony_ci mode of fragment color generation. 39245bd8deadSopenharmony_ci 39255bd8deadSopenharmony_ci There is no guaranteed invariance between the final z window 39265bd8deadSopenharmony_ci coordinates of fragments processed by fragment programs that write 39275bd8deadSopenharmony_ci depth values and fragments processed by any other means, even if the 39285bd8deadSopenharmony_ci fragment programs in question simply copy the z value from the 39295bd8deadSopenharmony_ci "fragment.position" binding. Multi-pass rendering algorithms that 39305bd8deadSopenharmony_ci use depth-replacing fragment programs should use depth-replacing 39315bd8deadSopenharmony_ci fragment programs on each pass to guarantee identical z values. 39325bd8deadSopenharmony_ci 39335bd8deadSopenharmony_ci The texture sample chosen for a fragment of a primitive must be 39345bd8deadSopenharmony_ci invariant between fragment program mode and conventional texture 39355bd8deadSopenharmony_ci application mode subject to these conditions: 39365bd8deadSopenharmony_ci 39375bd8deadSopenharmony_ci 1. All state with the exception of fragment program state is 39385bd8deadSopenharmony_ci identical 39395bd8deadSopenharmony_ci 39405bd8deadSopenharmony_ci 2. The primitives generating the fragments are identical 39415bd8deadSopenharmony_ci 39425bd8deadSopenharmony_ci 3. The sample in the fragment program mode is the result of a 39435bd8deadSopenharmony_ci 'TEX' instruction (or a 'TXP' instruction with a unity q) 39445bd8deadSopenharmony_ci 39455bd8deadSopenharmony_ci 4. The texture coordinate operand for the texture instruction uses 39465bd8deadSopenharmony_ci the same texture coordinate set as the conventional mode sample 39475bd8deadSopenharmony_ci 39485bd8deadSopenharmony_ci 5. The texture coordinate operand for the texture instruction has 39495bd8deadSopenharmony_ci not been the result of any other operations in the fragment 39505bd8deadSopenharmony_ci program 39515bd8deadSopenharmony_ci 39525bd8deadSopenharmony_ci 39535bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 39545bd8deadSopenharmony_ci 39555bd8deadSopenharmony_ci Program objects are shared between AGL/GLX/WGL rendering contexts if 39565bd8deadSopenharmony_ci and only if the rendering contexts share display lists. No change 39575bd8deadSopenharmony_ci is made to the AGL/GLX/WGL API. 39585bd8deadSopenharmony_ci 39595bd8deadSopenharmony_ci Changes to program objects shared between multiple rendering 39605bd8deadSopenharmony_ci contexts will be serialized (i.e., the changes will occur in a 39615bd8deadSopenharmony_ci specific order). 39625bd8deadSopenharmony_ci 39635bd8deadSopenharmony_ci Changes to a program object made by one rendering context are not 39645bd8deadSopenharmony_ci guaranteed to take effect in another rendering context until the 39655bd8deadSopenharmony_ci other calls BindProgram to bind the program object. 39665bd8deadSopenharmony_ci 39675bd8deadSopenharmony_ci When a program object is deleted by one rendering context, the 39685bd8deadSopenharmony_ci object itself is not destroyed until it is no longer the current 39695bd8deadSopenharmony_ci program object in any context. However, the name of the deleted 39705bd8deadSopenharmony_ci object is removed from the program object name space, so the next 39715bd8deadSopenharmony_ci attempt to bind a program using the same name will create a new 39725bd8deadSopenharmony_ci program object. Recall that destroying a program object bound in 39735bd8deadSopenharmony_ci the current rendering context effectively unbinds the object being 39745bd8deadSopenharmony_ci destroyed. 39755bd8deadSopenharmony_ci 39765bd8deadSopenharmony_ci 39775bd8deadSopenharmony_ciDependencies on OpenGL 1.4 39785bd8deadSopenharmony_ci 39795bd8deadSopenharmony_ci If OpenGL 1.4 is not supported, the modified equation for the 39805bd8deadSopenharmony_ci calculation of level of detail by the TXB instruction in 3.11.6.3 39815bd8deadSopenharmony_ci should read 39825bd8deadSopenharmony_ci 39835bd8deadSopenharmony_ci lambda'(x,y) = log2[p(x,y)] + 39845bd8deadSopenharmony_ci clamp(texunit_bias + fragment_bias) 39855bd8deadSopenharmony_ci 39865bd8deadSopenharmony_ciDependencies on EXT_vertex_weighting and ARB_vertex_blend 39875bd8deadSopenharmony_ci 39885bd8deadSopenharmony_ci If EXT_vertex_weighting and ARB_vertex_blend are both not supported, 39895bd8deadSopenharmony_ci all discussions of multiple modelview matrices should be removed. 39905bd8deadSopenharmony_ci 39915bd8deadSopenharmony_ci In particular, the line in the grammar 39925bd8deadSopenharmony_ci 39935bd8deadSopenharmony_ci <stateMatrixName> ::= "modelview" <stateOptModMatNum> 39945bd8deadSopenharmony_ci 39955bd8deadSopenharmony_ci should be changed to 39965bd8deadSopenharmony_ci 39975bd8deadSopenharmony_ci <stateMatrixName> ::= "modelview" 39985bd8deadSopenharmony_ci 39995bd8deadSopenharmony_ci and the rules <stateOptModMatNum> and <stateModMatNum> should be 40005bd8deadSopenharmony_ci deleted. The first line of Table X.2.7 should be modified to read: 40015bd8deadSopenharmony_ci 40025bd8deadSopenharmony_ci Binding Underlying State 40035bd8deadSopenharmony_ci ------------------------------------ --------------------------- 40045bd8deadSopenharmony_ci state.matrix.modelview modelview matrix 40055bd8deadSopenharmony_ci 40065bd8deadSopenharmony_ci The caption for Table X.2.7 should be modified to exclude optional 40075bd8deadSopenharmony_ci modelview matrix number. Subsequent references to "modelview matrix 40085bd8deadSopenharmony_ci zero" and "modelview matrix 1" should be changed to "modelview 40095bd8deadSopenharmony_ci matrix" and the example "state.matrix.modelview[1].row[0]" should be 40105bd8deadSopenharmony_ci changed to "state.matrix.modelview.row[0]". 40115bd8deadSopenharmony_ci 40125bd8deadSopenharmony_ci 40135bd8deadSopenharmony_ciDependencies on ARB_matrix_palette: 40145bd8deadSopenharmony_ci 40155bd8deadSopenharmony_ci If ARB_matrix_palette is not supported, all discussions of the 40165bd8deadSopenharmony_ci matrix palette should be removed. 40175bd8deadSopenharmony_ci 40185bd8deadSopenharmony_ci In particular, the line 40195bd8deadSopenharmony_ci 40205bd8deadSopenharmony_ci "palette" "[" <statePaletteMatNum> "]" 40215bd8deadSopenharmony_ci 40225bd8deadSopenharmony_ci should be removed from the <stateMatrixName> grammar rule, and the 40235bd8deadSopenharmony_ci <statePaletteMatNum> grammar rule should be removed entirely. 40245bd8deadSopenharmony_ci "state.matrix.palette[n]" should be removed from Table X.2.7. 40255bd8deadSopenharmony_ci 40265bd8deadSopenharmony_ci 40275bd8deadSopenharmony_ciDependencies on ARB_transpose_matrix 40285bd8deadSopenharmony_ci 40295bd8deadSopenharmony_ci If ARB_transpose_matrix is not supported, the discussion of 40305bd8deadSopenharmony_ci TRANSPOSE_CURRENT_MATRIX_ARB in the edits to section 6.1.2 should be 40315bd8deadSopenharmony_ci removed. 40325bd8deadSopenharmony_ci 40335bd8deadSopenharmony_ci 40345bd8deadSopenharmony_ciDependencies on EXT_fog_coord 40355bd8deadSopenharmony_ci 40365bd8deadSopenharmony_ci If EXT_fog_coord is not supported, references to "fog coordinate" 40375bd8deadSopenharmony_ci in the definition of the "fragment.fogcoord" attribute should be 40385bd8deadSopenharmony_ci removed. 40395bd8deadSopenharmony_ci 40405bd8deadSopenharmony_ciDependencies on EXT_texture_rectangle 40415bd8deadSopenharmony_ci 40425bd8deadSopenharmony_ci If NV_texture_rectangle is not supported, the discussion of the 40435bd8deadSopenharmony_ci rectangle (non-power-of-two) texture target in section 3.11.6 should 40445bd8deadSopenharmony_ci be removed, and the line 40455bd8deadSopenharmony_ci 40465bd8deadSopenharmony_ci "RECT" 40475bd8deadSopenharmony_ci 40485bd8deadSopenharmony_ci should be removed from the <texTarget> grammar rule. 40495bd8deadSopenharmony_ci 40505bd8deadSopenharmony_ci 40515bd8deadSopenharmony_ciInteractions with ARB_shadow 40525bd8deadSopenharmony_ci 40535bd8deadSopenharmony_ci The texture comparison introduced by ARB_shadow can be expressed in 40545bd8deadSopenharmony_ci terms of a fragment program, and in fact use the same internal 40555bd8deadSopenharmony_ci resources on some implementations. Therefore, if fragment program 40565bd8deadSopenharmony_ci mode is enabled, the GL behaves as if TEXTURE_COMPARE_MODE_ARB is 40575bd8deadSopenharmony_ci NONE. 40585bd8deadSopenharmony_ci 40595bd8deadSopenharmony_ci 40605bd8deadSopenharmony_ciInteractions with ARB_vertex_program 40615bd8deadSopenharmony_ci 40625bd8deadSopenharmony_ci The program object management entrypoints described in sections 40635bd8deadSopenharmony_ci 2.14.1 (for vertex programs) and 3.11.1 (for fragment programs) 40645bd8deadSopenharmony_ci are shared by both program targets. The PROGRAM_ERROR_STRING_ARB 40655bd8deadSopenharmony_ci and program queries in sections 6.1.11 and 6.1.12 are also shared, 40665bd8deadSopenharmony_ci as are all common tokens. 40675bd8deadSopenharmony_ci 40685bd8deadSopenharmony_ci The Errors section should be modified to generate INVALID_OPERATION 40695bd8deadSopenharmony_ci from the Get command with argument CURRENT_MATRIX_ARB, 40705bd8deadSopenharmony_ci TRANSPOSE_CURRENT_MATRIX_ARB, and CURRENT_MATRIX_STACK_DEPTH_ARB 40715bd8deadSopenharmony_ci when the current matrix mode is TEXTURE. 40725bd8deadSopenharmony_ci 40735bd8deadSopenharmony_ci In the presence of ARB_vertex_program, ARB_fragment_program must 40745bd8deadSopenharmony_ci recognize and return appropriate values for the GetProgram <pname> 40755bd8deadSopenharmony_ci tokens introduced in that spec but not otherwise shared by 40765bd8deadSopenharmony_ci ARB_fragment_program: 40775bd8deadSopenharmony_ci 40785bd8deadSopenharmony_ci PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 40795bd8deadSopenharmony_ci MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 40805bd8deadSopenharmony_ci PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 40815bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 40825bd8deadSopenharmony_ci 40835bd8deadSopenharmony_ci The following tables list new program object state and 40845bd8deadSopenharmony_ci implementation-dependent state: 40855bd8deadSopenharmony_ci 40865bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec Attrib 40875bd8deadSopenharmony_ci -------------------- ----- ------------------- --------------- ---------------------- -------- ------ 40885bd8deadSopenharmony_ci PROGRAM_ADDRESS_REGISTERS_ARB Z+ GetProgramivARB 0 bound program 6.1.12 - 40895bd8deadSopenharmony_ci address registers 40905bd8deadSopenharmony_ci PROGRAM_NATIVE_ADDRESS_ Z+ GetProgramivARB 0 bound program native 6.1.12 - 40915bd8deadSopenharmony_ci REGISTERS_ARB address registers 40925bd8deadSopenharmony_ci 40935bd8deadSopenharmony_ci Table X.7. Program Object State. Program object queries return attributes of 40945bd8deadSopenharmony_ci the program object currently bound to the program target <target>. 40955bd8deadSopenharmony_ci 40965bd8deadSopenharmony_ci 40975bd8deadSopenharmony_ci Minimum 40985bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. Attrib 40995bd8deadSopenharmony_ci --------- ---- ----------- ------- ----------- ---- ------ 41005bd8deadSopenharmony_ci MAX_PROGRAM_ADDRESS_REGISTERS_ARB Z+ GetProgramivARB 0 maximum program 6.1.12 - 41015bd8deadSopenharmony_ci address registers 41025bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_ADDRESS_ Z+ GetProgramivARB 0 maximum program native 6.1.12 - 41035bd8deadSopenharmony_ci REGISTERS_ARB address registers 41045bd8deadSopenharmony_ci 41055bd8deadSopenharmony_ci Table X.10. New Implementation-Dependent Values Introduced by 41065bd8deadSopenharmony_ci ARB_vertex_program. 41075bd8deadSopenharmony_ci 41085bd8deadSopenharmony_ci 41095bd8deadSopenharmony_ci In the presence of ARB_fragment_program, ARB_vertex_program must 41105bd8deadSopenharmony_ci recognize and return appropriate values for the GetProgram <pname> 41115bd8deadSopenharmony_ci tokens introduced in this spec. The following tables list new 41125bd8deadSopenharmony_ci program object state and implementation-dependent state: 41135bd8deadSopenharmony_ci 41145bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec Attrib 41155bd8deadSopenharmony_ci -------------------- ----- ------------------- --------------- ---------------------- -------- ------ 41165bd8deadSopenharmony_ci PROGRAM_ALU_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 maximum program 6.1.12 - 41175bd8deadSopenharmony_ci ALU instructions 41185bd8deadSopenharmony_ci PROGRAM_TEX_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 maximum program 6.1.12 - 41195bd8deadSopenharmony_ci texture instructions 41205bd8deadSopenharmony_ci PROGRAM_TEX_INDIRECTIONS_ARB Z+ GetProgramivARB 0 maximum program 6.1.12 - 41215bd8deadSopenharmony_ci texture indirections 41225bd8deadSopenharmony_ci PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 maximum program native 6.1.12 - 41235bd8deadSopenharmony_ci ALU instructions 41245bd8deadSopenharmony_ci PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 maximum program native 6.1.12 - 41255bd8deadSopenharmony_ci texture instructions 41265bd8deadSopenharmony_ci PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB Z+ GetProgramivARB 0 maximum program native 6.1.12 - 41275bd8deadSopenharmony_ci texture indirections 41285bd8deadSopenharmony_ci 41295bd8deadSopenharmony_ci Table X.7. Program Object State. Program object queries return attributes of 41305bd8deadSopenharmony_ci the program object currently bound to the program target <target>. 41315bd8deadSopenharmony_ci 41325bd8deadSopenharmony_ci 41335bd8deadSopenharmony_ci Minimum 41345bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. Attrib 41355bd8deadSopenharmony_ci --------- ---- ----------- ------- ----------- ---- ------ 41365bd8deadSopenharmony_ci MAX_PROGRAM_ALU_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 Number of frag. prg. 6.1.12 - 41375bd8deadSopenharmony_ci ALU instructions 41385bd8deadSopenharmony_ci MAX_PROGRAM_TEX_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 Number of frag. prg. 6.1.12 - 41395bd8deadSopenharmony_ci texture instructions 41405bd8deadSopenharmony_ci MAX_PROGRAM_TEX_INDIRECTIONS_ARB Z+ GetProgramivARB 0 Number of frag. prg. 6.1.12 - 41415bd8deadSopenharmony_ci texture indirections 41425bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 maximum program native 6.1.12 - 41435bd8deadSopenharmony_ci ALU instructions 41445bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 maximum program native 6.1.12 - 41455bd8deadSopenharmony_ci texture instructions 41465bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB Z+ GetProgramivARB 0 maximum program native 6.1.12 - 41475bd8deadSopenharmony_ci texture indirections 41485bd8deadSopenharmony_ci 41495bd8deadSopenharmony_ci Table X.10. New Implementation-Dependent Values Introduced by 41505bd8deadSopenharmony_ci ARB_fragment_program. 41515bd8deadSopenharmony_ci 41525bd8deadSopenharmony_ci 41535bd8deadSopenharmony_ciInteractions with ATI_fragment_shader 41545bd8deadSopenharmony_ci 41555bd8deadSopenharmony_ci The existing ATI_fragment_shader extension, if supported, also 41565bd8deadSopenharmony_ci provides a similar fragment programming model. Mixing the two 41575bd8deadSopenharmony_ci models in a single application is possible but not recommended. 41585bd8deadSopenharmony_ci FRAGMENT_PROGRAM_ARB has priority over FRAGMENT_SHADER_ATI if 41595bd8deadSopenharmony_ci both are enabled. 41605bd8deadSopenharmony_ci 41615bd8deadSopenharmony_ci 41625bd8deadSopenharmony_ciInteractions with NV_fragment_program 41635bd8deadSopenharmony_ci 41645bd8deadSopenharmony_ci The NV_fragment_program extension, if supported, also provides a 41655bd8deadSopenharmony_ci similar programming model. This extension is incompatible with 41665bd8deadSopenharmony_ci NV_fragment_program in a number of different ways. Mixing the two 41675bd8deadSopenharmony_ci models in a single application is possible but not recommended. The 41685bd8deadSopenharmony_ci interactions between the extensions are defined below. 41695bd8deadSopenharmony_ci 41705bd8deadSopenharmony_ci Functions, enumerants, and programs defined in NV_fragment_program 41715bd8deadSopenharmony_ci are called "NV functions", "NV enumerants", and "NV programs," 41725bd8deadSopenharmony_ci respectively. Functions, enumerants, and programs defined in 41735bd8deadSopenharmony_ci ARB_fragment_program are called "ARB functions", "ARB enumerants", 41745bd8deadSopenharmony_ci and "ARB programs," respectively. 41755bd8deadSopenharmony_ci 41765bd8deadSopenharmony_ci The following GL state is identical in the two extensions: 41775bd8deadSopenharmony_ci 41785bd8deadSopenharmony_ci - Fragment program mode enable. The NV and ARB enumerants have 41795bd8deadSopenharmony_ci different values, but the same effect. 41805bd8deadSopenharmony_ci 41815bd8deadSopenharmony_ci - Program error position. 41825bd8deadSopenharmony_ci 41835bd8deadSopenharmony_ci - Program error string. 41845bd8deadSopenharmony_ci 41855bd8deadSopenharmony_ci - NV_fragment_program and ARB_fragment_program "program local 41865bd8deadSopenharmony_ci parameters." 41875bd8deadSopenharmony_ci 41885bd8deadSopenharmony_ci - Fragment program names, targets, formats, program string, 41895bd8deadSopenharmony_ci program string lengths, and residency information. The ARB and 41905bd8deadSopenharmony_ci NV query functions operate differently. The ARB query function 41915bd8deadSopenharmony_ci does not allow queries of target (passed in to the query) and 41925bd8deadSopenharmony_ci residency information. The NV query function does not allow 41935bd8deadSopenharmony_ci queries of program name (passed in to the query) or format. The 41945bd8deadSopenharmony_ci format of NV programs is always PROGRAM_FORMAT_ASCII_ARB. 41955bd8deadSopenharmony_ci 41965bd8deadSopenharmony_ci - Program object name space. Program objects are created 41975bd8deadSopenharmony_ci differently in the NV and ARB specs. Under the NV spec, program 41985bd8deadSopenharmony_ci objects are created by calling LoadProgramNV. Under the ARB 41995bd8deadSopenharmony_ci spec, program objects are created by calling BindProgramARB with 42005bd8deadSopenharmony_ci an unused program name. 42015bd8deadSopenharmony_ci 42025bd8deadSopenharmony_ci The following state is provided only by ARB_fragment_program: 42035bd8deadSopenharmony_ci 42045bd8deadSopenharmony_ci - Program environment parameters. 42055bd8deadSopenharmony_ci 42065bd8deadSopenharmony_ci - Implementation-dependent limits on the number of instructions, 42075bd8deadSopenharmony_ci ALU instructions, texture instructions, texture indirections, 42085bd8deadSopenharmony_ci program parameters, fragment attributes, resource counts, and 42095bd8deadSopenharmony_ci native resource counts. The instruction limit is baked into the 42105bd8deadSopenharmony_ci NV spec. Implementations supporting NV_fragment_program have no 42115bd8deadSopenharmony_ci specific restrictions on the number of ALU instructions, texture 42125bd8deadSopenharmony_ci instructions, texture indirections, or fragment attributes used. 42135bd8deadSopenharmony_ci Such implementations also have no limit on program parameters 42145bd8deadSopenharmony_ci used, except that no more than one may be used by any single 42155bd8deadSopenharmony_ci program instruction. 42165bd8deadSopenharmony_ci 42175bd8deadSopenharmony_ci The following state is provided only by NV_fragment_program: 42185bd8deadSopenharmony_ci 42195bd8deadSopenharmony_ci - Named program parameters (variables defined in the program text 42205bd8deadSopenharmony_ci and updated by name). 42215bd8deadSopenharmony_ci 42225bd8deadSopenharmony_ci The following are additional functional differences between 42235bd8deadSopenharmony_ci ARB_fragment_program and NV_fragment_program: 42245bd8deadSopenharmony_ci 42255bd8deadSopenharmony_ci - NV programs use a set of register names, with no support for 42265bd8deadSopenharmony_ci user-defined variables (other than parameters in the program). 42275bd8deadSopenharmony_ci ARB programs provide no support for fixed variable names; all 42285bd8deadSopenharmony_ci variables must be declared, explicitly or implicitly, in the 42295bd8deadSopenharmony_ci program. 42305bd8deadSopenharmony_ci 42315bd8deadSopenharmony_ci - ARB programs support parameter variables that can be bound to 42325bd8deadSopenharmony_ci selected GL state variables, and are updated automatically when 42335bd8deadSopenharmony_ci the underlying state changes. NV programs provide no such 42345bd8deadSopenharmony_ci support; applications must set program parameters themselves. 42355bd8deadSopenharmony_ci 42365bd8deadSopenharmony_ci - ARB_fragment_program doesn't provide explicit support for 42375bd8deadSopenharmony_ci multiple data types (fx12, fp16, fp32) described in 42385bd8deadSopenharmony_ci NV_fragment_program, and provides no mechanism for controlling 42395bd8deadSopenharmony_ci the precision used to carry out arithmetic operations. 42405bd8deadSopenharmony_ci 42415bd8deadSopenharmony_ci - ARB_fragment_program doesn't support condition codes, 42425bd8deadSopenharmony_ci conditional writemasks, or the "C" instruction suffix that 42435bd8deadSopenharmony_ci specifies a condition code update. 42445bd8deadSopenharmony_ci 42455bd8deadSopenharmony_ci - ARB_fragment_program doesn't support an absolute value operator 42465bd8deadSopenharmony_ci that can be applied to a source vector as it is loaded. 42475bd8deadSopenharmony_ci 42485bd8deadSopenharmony_ci - ARB_fragment_program doesn't define behavior for many floating- 42495bd8deadSopenharmony_ci point special cases. On platforms where NV_fragment_program is 42505bd8deadSopenharmony_ci supported, ARB programs will have the same special-case 42515bd8deadSopenharmony_ci behavior. 42525bd8deadSopenharmony_ci 42535bd8deadSopenharmony_ci - Language to declare program parameters is slightly different 42545bd8deadSopenharmony_ci (NV_fragment_program has "DECLARE" and "DEFINE"; 42555bd8deadSopenharmony_ci ARB_fragment_program has "PARAM"). 42565bd8deadSopenharmony_ci 42575bd8deadSopenharmony_ci - NV_fragment_program provides a number of instructions not found 42585bd8deadSopenharmony_ci in ARB_fragment_program: 42595bd8deadSopenharmony_ci 42605bd8deadSopenharmony_ci * DDX, DDY: partial derivatives relative to x and y. 42615bd8deadSopenharmony_ci 42625bd8deadSopenharmony_ci * "PK*" and "UP*": packing and unpacking instructions. 42635bd8deadSopenharmony_ci 42645bd8deadSopenharmony_ci * RFL: reflection vector. 42655bd8deadSopenharmony_ci 42665bd8deadSopenharmony_ci * SEQ, SFL, SGT, SLE, SNE, STR: set on equal, false, greater 42675bd8deadSopenharmony_ci than, less than or equal, not equal, and true, respectively. 42685bd8deadSopenharmony_ci 42695bd8deadSopenharmony_ci * TXD: texture lookup w/partials. 42705bd8deadSopenharmony_ci 42715bd8deadSopenharmony_ci * X2D: 2D coordinate transformation. 42725bd8deadSopenharmony_ci 42735bd8deadSopenharmony_ci - ARB_fragment_program provides several instructions not found in 42745bd8deadSopenharmony_ci NV_fragment_program, and there are a few instruction set 42755bd8deadSopenharmony_ci differences: 42765bd8deadSopenharmony_ci 42775bd8deadSopenharmony_ci * ABS: absolute value. ABS instructions are unnecessary in 42785bd8deadSopenharmony_ci NV_fragment_program because of the free absolute value on 42795bd8deadSopenharmony_ci input operator. Equivalent to: 42805bd8deadSopenharmony_ci 42815bd8deadSopenharmony_ci MOV dst, |src|; 42825bd8deadSopenharmony_ci 42835bd8deadSopenharmony_ci * CMP: compare. Roughly equivalent to the following 42845bd8deadSopenharmony_ci sequence, but may be optimized further: 42855bd8deadSopenharmony_ci 42865bd8deadSopenharmony_ci SLT tmp, src0; 42875bd8deadSopenharmony_ci LRP dst, tmp, src1, src2; 42885bd8deadSopenharmony_ci 42895bd8deadSopenharmony_ci * DPH: homogenous dot product. Equivalent to: 42905bd8deadSopenharmony_ci 42915bd8deadSopenharmony_ci DP3 tmp, src0, src1; 42925bd8deadSopenharmony_ci ADD dst, tmp, src0.w; 42935bd8deadSopenharmony_ci 42945bd8deadSopenharmony_ci * KIL: kill fragment. Both extensions support this 42955bd8deadSopenharmony_ci instruction, but the ARB instruction takes a vector 42965bd8deadSopenharmony_ci operand rather than a condition code. 42975bd8deadSopenharmony_ci 42985bd8deadSopenharmony_ci * SCS: sine/cosine. Emulated using the separate SIN and COS 42995bd8deadSopenharmony_ci instructions in NV_fragment_program, which also have no 43005bd8deadSopenharmony_ci restriction on the input values. 43015bd8deadSopenharmony_ci 43025bd8deadSopenharmony_ci * SWZ: extended swizzle. On NV_fragment_program platforms, 43035bd8deadSopenharmony_ci this instruction will be emulated using a single MAD 43045bd8deadSopenharmony_ci instruction and a program parameter constant. 43055bd8deadSopenharmony_ci 43065bd8deadSopenharmony_ci * TXB: texture sample with bias. Not exposed in the 43075bd8deadSopenharmony_ci NV_fragment_program API. 43085bd8deadSopenharmony_ci 43095bd8deadSopenharmony_ci * XPD: cross product. Emulated using a MUL and a MAD 43105bd8deadSopenharmony_ci instruction. 43115bd8deadSopenharmony_ci 43125bd8deadSopenharmony_ci 43135bd8deadSopenharmony_ciGLX Protocol 43145bd8deadSopenharmony_ci 43155bd8deadSopenharmony_ci The following rendering commands are sent to the server as part of 43165bd8deadSopenharmony_ci a glXRender request: 43175bd8deadSopenharmony_ci 43185bd8deadSopenharmony_ci BindProgramARB 43195bd8deadSopenharmony_ci 2 12 rendering command length 43205bd8deadSopenharmony_ci 2 4180 rendering command opcode 43215bd8deadSopenharmony_ci 4 ENUM target 43225bd8deadSopenharmony_ci 4 CARD32 program 43235bd8deadSopenharmony_ci 43245bd8deadSopenharmony_ci ProgramEnvParameter4fvARB 43255bd8deadSopenharmony_ci 2 32 rendering command length 43265bd8deadSopenharmony_ci 2 4184 rendering command opcode 43275bd8deadSopenharmony_ci 4 ENUM target 43285bd8deadSopenharmony_ci 4 CARD32 index 43295bd8deadSopenharmony_ci 4 FLOAT32 params[0] 43305bd8deadSopenharmony_ci 4 FLOAT32 params[1] 43315bd8deadSopenharmony_ci 4 FLOAT32 params[2] 43325bd8deadSopenharmony_ci 4 FLOAT32 params[3] 43335bd8deadSopenharmony_ci 43345bd8deadSopenharmony_ci ProgramEnvParameter4dvARB 43355bd8deadSopenharmony_ci 2 44 rendering command length 43365bd8deadSopenharmony_ci 2 4185 rendering command opcode 43375bd8deadSopenharmony_ci 4 ENUM target 43385bd8deadSopenharmony_ci 4 CARD32 index 43395bd8deadSopenharmony_ci 8 FLOAT64 params[0] 43405bd8deadSopenharmony_ci 8 FLOAT64 params[1] 43415bd8deadSopenharmony_ci 8 FLOAT64 params[2] 43425bd8deadSopenharmony_ci 8 FLOAT64 params[3] 43435bd8deadSopenharmony_ci 43445bd8deadSopenharmony_ci ProgramLocalParameter4fvARB 43455bd8deadSopenharmony_ci 2 32 rendering command length 43465bd8deadSopenharmony_ci 2 4215 rendering command opcode 43475bd8deadSopenharmony_ci 4 ENUM target 43485bd8deadSopenharmony_ci 4 CARD32 index 43495bd8deadSopenharmony_ci 4 FLOAT32 params[0] 43505bd8deadSopenharmony_ci 4 FLOAT32 params[1] 43515bd8deadSopenharmony_ci 4 FLOAT32 params[2] 43525bd8deadSopenharmony_ci 4 FLOAT32 params[3] 43535bd8deadSopenharmony_ci 43545bd8deadSopenharmony_ci ProgramLocalParameter4dvARB 43555bd8deadSopenharmony_ci 2 44 rendering command length 43565bd8deadSopenharmony_ci 2 4216 rendering command opcode 43575bd8deadSopenharmony_ci 4 ENUM target 43585bd8deadSopenharmony_ci 4 CARD32 index 43595bd8deadSopenharmony_ci 8 FLOAT64 params[0] 43605bd8deadSopenharmony_ci 8 FLOAT64 params[1] 43615bd8deadSopenharmony_ci 8 FLOAT64 params[2] 43625bd8deadSopenharmony_ci 8 FLOAT64 params[3] 43635bd8deadSopenharmony_ci 43645bd8deadSopenharmony_ci The ProgramStringARB is potentially large, and hence can be sent in 43655bd8deadSopenharmony_ci a glXRender or glXRenderLarge request. 43665bd8deadSopenharmony_ci 43675bd8deadSopenharmony_ci ProgramStringARB 43685bd8deadSopenharmony_ci 2 16+len+p rendering command length 43695bd8deadSopenharmony_ci 2 4217 rendering command opcode 43705bd8deadSopenharmony_ci 4 ENUM target 43715bd8deadSopenharmony_ci 4 ENUM format 43725bd8deadSopenharmony_ci 4 sizei len 43735bd8deadSopenharmony_ci len LISTofBYTE program 43745bd8deadSopenharmony_ci p unused, p=pad(len) 43755bd8deadSopenharmony_ci 43765bd8deadSopenharmony_ci If the command is encoded in a glxRenderLarge request, the 43775bd8deadSopenharmony_ci command opcode and command length fields above are expanded to 43785bd8deadSopenharmony_ci 4 bytes each: 43795bd8deadSopenharmony_ci 43805bd8deadSopenharmony_ci 4 16+len+p rendering command length 43815bd8deadSopenharmony_ci 4 4217 rendering command opcode 43825bd8deadSopenharmony_ci 43835bd8deadSopenharmony_ci The remaining commands are non-rendering commands. These commands 43845bd8deadSopenharmony_ci are sent separately (i.e., not as part of a glXRender or 43855bd8deadSopenharmony_ci glXRenderLarge request), using the glXVendorPrivateWithReply 43865bd8deadSopenharmony_ci request: 43875bd8deadSopenharmony_ci 43885bd8deadSopenharmony_ci DeleteProgramsARB 43895bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 43905bd8deadSopenharmony_ci 1 17 GLX opcode (glXVendorPrivateWithReply) 43915bd8deadSopenharmony_ci 2 4+n request length 43925bd8deadSopenharmony_ci 4 1294 vendor specific opcode 43935bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 43945bd8deadSopenharmony_ci 4 INT32 n 43955bd8deadSopenharmony_ci n*4 LISTofCARD32 programs 43965bd8deadSopenharmony_ci 43975bd8deadSopenharmony_ci GenProgramsARB 43985bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 43995bd8deadSopenharmony_ci 1 17 GLX opcode (glXVendorPrivateWithReply) 44005bd8deadSopenharmony_ci 2 4 request length 44015bd8deadSopenharmony_ci 4 1295 vendor specific opcode 44025bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 44035bd8deadSopenharmony_ci 4 INT32 n 44045bd8deadSopenharmony_ci => 44055bd8deadSopenharmony_ci 1 1 reply 44065bd8deadSopenharmony_ci 1 unused 44075bd8deadSopenharmony_ci 2 CARD16 sequence number 44085bd8deadSopenharmony_ci 4 n reply length 44095bd8deadSopenharmony_ci 24 unused 44105bd8deadSopenharmony_ci n*4 LISTofCARD322 programs 44115bd8deadSopenharmony_ci 44125bd8deadSopenharmony_ci GetProgramEnvParameterfvARB 44135bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 44145bd8deadSopenharmony_ci 1 17 GLX opcode (glXVendorPrivateWithReply) 44155bd8deadSopenharmony_ci 2 6 request length 44165bd8deadSopenharmony_ci 4 1296 vendor specific opcode 44175bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 44185bd8deadSopenharmony_ci 4 ENUM target 44195bd8deadSopenharmony_ci 4 CARD32 index 44205bd8deadSopenharmony_ci 4 ENUM pname 44215bd8deadSopenharmony_ci => 44225bd8deadSopenharmony_ci 1 1 reply 44235bd8deadSopenharmony_ci 1 unused 44245bd8deadSopenharmony_ci 2 CARD16 sequence number 44255bd8deadSopenharmony_ci 4 m reply length, m=(n==1?0:n) 44265bd8deadSopenharmony_ci 4 unused 44275bd8deadSopenharmony_ci 4 CARD32 n (number of parameter components) 44285bd8deadSopenharmony_ci 44295bd8deadSopenharmony_ci if (n=1) this follows: 44305bd8deadSopenharmony_ci 44315bd8deadSopenharmony_ci 4 FLOAT32 params 44325bd8deadSopenharmony_ci 12 unused 44335bd8deadSopenharmony_ci 44345bd8deadSopenharmony_ci otherwise this follows: 44355bd8deadSopenharmony_ci 44365bd8deadSopenharmony_ci 16 unused 44375bd8deadSopenharmony_ci n*4 LISTofFLOAT32 params 44385bd8deadSopenharmony_ci 44395bd8deadSopenharmony_ci GetProgramEnvParameterdvARB 44405bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 44415bd8deadSopenharmony_ci 1 17 GLX opcode (glXVendorPrivateWithReply) 44425bd8deadSopenharmony_ci 2 6 request length 44435bd8deadSopenharmony_ci 4 1297 vendor specific opcode 44445bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 44455bd8deadSopenharmony_ci 4 ENUM target 44465bd8deadSopenharmony_ci 4 CARD32 index 44475bd8deadSopenharmony_ci 4 ENUM pname 44485bd8deadSopenharmony_ci => 44495bd8deadSopenharmony_ci 1 1 reply 44505bd8deadSopenharmony_ci 1 unused 44515bd8deadSopenharmony_ci 2 CARD16 sequence number 44525bd8deadSopenharmony_ci 4 m reply length, m=(n==1?0:n*2) 44535bd8deadSopenharmony_ci 4 unused 44545bd8deadSopenharmony_ci 4 CARD32 n (number of parameter components) 44555bd8deadSopenharmony_ci 44565bd8deadSopenharmony_ci if (n=1) this follows: 44575bd8deadSopenharmony_ci 44585bd8deadSopenharmony_ci 8 FLOAT64 params 44595bd8deadSopenharmony_ci 8 unused 44605bd8deadSopenharmony_ci 44615bd8deadSopenharmony_ci otherwise this follows: 44625bd8deadSopenharmony_ci 44635bd8deadSopenharmony_ci 16 unused 44645bd8deadSopenharmony_ci n*8 LISTofFLOAT64 params 44655bd8deadSopenharmony_ci 44665bd8deadSopenharmony_ci GetProgramLocalParameterfvARB 44675bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 44685bd8deadSopenharmony_ci 1 17 GLX opcode (glXVendorPrivateWithReply) 44695bd8deadSopenharmony_ci 2 6 request length 44705bd8deadSopenharmony_ci 4 1305 vendor specific opcode 44715bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 44725bd8deadSopenharmony_ci 4 ENUM target 44735bd8deadSopenharmony_ci 4 CARD32 index 44745bd8deadSopenharmony_ci 4 ENUM pname 44755bd8deadSopenharmony_ci => 44765bd8deadSopenharmony_ci 1 1 reply 44775bd8deadSopenharmony_ci 1 unused 44785bd8deadSopenharmony_ci 2 CARD16 sequence number 44795bd8deadSopenharmony_ci 4 m reply length, m=(n==1?0:n) 44805bd8deadSopenharmony_ci 4 unused 44815bd8deadSopenharmony_ci 4 CARD32 n (number of parameter components) 44825bd8deadSopenharmony_ci 44835bd8deadSopenharmony_ci if (n=1) this follows: 44845bd8deadSopenharmony_ci 44855bd8deadSopenharmony_ci 4 FLOAT32 params 44865bd8deadSopenharmony_ci 12 unused 44875bd8deadSopenharmony_ci 44885bd8deadSopenharmony_ci otherwise this follows: 44895bd8deadSopenharmony_ci 44905bd8deadSopenharmony_ci 16 unused 44915bd8deadSopenharmony_ci n*4 LISTofFLOAT32 params 44925bd8deadSopenharmony_ci 44935bd8deadSopenharmony_ci GetProgramLocalParameterdvARB 44945bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 44955bd8deadSopenharmony_ci 1 17 GLX opcode (glXVendorPrivateWithReply) 44965bd8deadSopenharmony_ci 2 6 request length 44975bd8deadSopenharmony_ci 4 1306 vendor specific opcode 44985bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 44995bd8deadSopenharmony_ci 4 ENUM target 45005bd8deadSopenharmony_ci 4 CARD32 index 45015bd8deadSopenharmony_ci 4 ENUM pname 45025bd8deadSopenharmony_ci => 45035bd8deadSopenharmony_ci 1 1 reply 45045bd8deadSopenharmony_ci 1 unused 45055bd8deadSopenharmony_ci 2 CARD16 sequence number 45065bd8deadSopenharmony_ci 4 m reply length, m=(n==1?0:n*2) 45075bd8deadSopenharmony_ci 4 unused 45085bd8deadSopenharmony_ci 4 CARD32 n (number of parameter components) 45095bd8deadSopenharmony_ci 45105bd8deadSopenharmony_ci if (n=1) this follows: 45115bd8deadSopenharmony_ci 45125bd8deadSopenharmony_ci 8 FLOAT64 params 45135bd8deadSopenharmony_ci 8 unused 45145bd8deadSopenharmony_ci 45155bd8deadSopenharmony_ci otherwise this follows: 45165bd8deadSopenharmony_ci 45175bd8deadSopenharmony_ci 16 unused 45185bd8deadSopenharmony_ci n*8 LISTofFLOAT64 params 45195bd8deadSopenharmony_ci 45205bd8deadSopenharmony_ci GetProgramivARB 45215bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 45225bd8deadSopenharmony_ci 1 17 GLX opcode (glXVendorPrivateWithReply) 45235bd8deadSopenharmony_ci 2 5 request length 45245bd8deadSopenharmony_ci 4 1307 vendor specific opcode 45255bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 45265bd8deadSopenharmony_ci 4 ENUM target 45275bd8deadSopenharmony_ci 4 ENUM pname 45285bd8deadSopenharmony_ci => 45295bd8deadSopenharmony_ci 1 1 reply 45305bd8deadSopenharmony_ci 1 unused 45315bd8deadSopenharmony_ci 2 CARD16 sequence number 45325bd8deadSopenharmony_ci 4 m reply length, m=(n==1?0:n) 45335bd8deadSopenharmony_ci 4 unused 45345bd8deadSopenharmony_ci 4 CARD32 n 45355bd8deadSopenharmony_ci 45365bd8deadSopenharmony_ci if (n=1) this follows: 45375bd8deadSopenharmony_ci 45385bd8deadSopenharmony_ci 4 INT32 params 45395bd8deadSopenharmony_ci 12 unused 45405bd8deadSopenharmony_ci 45415bd8deadSopenharmony_ci otherwise this follows: 45425bd8deadSopenharmony_ci 45435bd8deadSopenharmony_ci 16 unused 45445bd8deadSopenharmony_ci n*4 LISTofINT32 params 45455bd8deadSopenharmony_ci 45465bd8deadSopenharmony_ci GetProgramStringARB 45475bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 45485bd8deadSopenharmony_ci 1 17 GLX opcode (glXVendorPrivateWithReply) 45495bd8deadSopenharmony_ci 2 5 request length 45505bd8deadSopenharmony_ci 4 1308 vendor specific opcode 45515bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 45525bd8deadSopenharmony_ci 4 ENUM target 45535bd8deadSopenharmony_ci 4 ENUM pname 45545bd8deadSopenharmony_ci => 45555bd8deadSopenharmony_ci 1 1 reply 45565bd8deadSopenharmony_ci 1 unused 45575bd8deadSopenharmony_ci 2 CARD16 sequence number 45585bd8deadSopenharmony_ci 4 (n+p)/4 reply length 45595bd8deadSopenharmony_ci 4 unused 45605bd8deadSopenharmony_ci 4 CARD32 n 45615bd8deadSopenharmony_ci 16 unused 45625bd8deadSopenharmony_ci n STRING program 45635bd8deadSopenharmony_ci p unused, p=pad(n) 45645bd8deadSopenharmony_ci 45655bd8deadSopenharmony_ci IsProgramARB 45665bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 45675bd8deadSopenharmony_ci 1 17 GLX opcode (glXVendorPrivateWithReply) 45685bd8deadSopenharmony_ci 2 4 request length 45695bd8deadSopenharmony_ci 4 1304 vendor specific opcode 45705bd8deadSopenharmony_ci 4 GLX_CONTEXT_TAG context tag 45715bd8deadSopenharmony_ci 4 INT32 n 45725bd8deadSopenharmony_ci => 45735bd8deadSopenharmony_ci 1 1 reply 45745bd8deadSopenharmony_ci 1 unused 45755bd8deadSopenharmony_ci 2 CARD16 sequence number 45765bd8deadSopenharmony_ci 4 0 reply length 45775bd8deadSopenharmony_ci 4 BOOL32 return value 45785bd8deadSopenharmony_ci 20 unused 45795bd8deadSopenharmony_ci 45805bd8deadSopenharmony_ci 45815bd8deadSopenharmony_ciErrors 45825bd8deadSopenharmony_ci 45835bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by ProgramStringARB if the 45845bd8deadSopenharmony_ci program string <string> is syntactically incorrect or violates any 45855bd8deadSopenharmony_ci semantic restriction of the execution environment of the specified 45865bd8deadSopenharmony_ci program target <target>. The error INVALID_OPERATION may also be 45875bd8deadSopenharmony_ci generated by ProgramStringARB if the specified program would exceed 45885bd8deadSopenharmony_ci native resource limits of the implementation. 45895bd8deadSopenharmony_ci 45905bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by BindProgramARB if 45915bd8deadSopenharmony_ci <program> is the name of a program whose target does not match 45925bd8deadSopenharmony_ci <target>. 45935bd8deadSopenharmony_ci 45945bd8deadSopenharmony_ci The error INVALID_VALUE is generated by commands 45955bd8deadSopenharmony_ci ProgramEnvParameter{fd}ARB, ProgramEnvParameter{fd}vARB, and 45965bd8deadSopenharmony_ci GetProgramEnvParameter{fd}vARB if <index> is greater than or equal 45975bd8deadSopenharmony_ci to the value of MAX_PROGRAM_ENV_PARAMETERS_ARB corresponding to the 45985bd8deadSopenharmony_ci program target <target>. 45995bd8deadSopenharmony_ci 46005bd8deadSopenharmony_ci The error INVALID_VALUE is generated by commands 46015bd8deadSopenharmony_ci ProgramLocalParameter4{fd}ARB, ProgramLocalParameter4{fd}vARB, and 46025bd8deadSopenharmony_ci GetProgramLocalParameter{fd}vARB if <index> is greater than or equal 46035bd8deadSopenharmony_ci to the value of MAX_PROGRAM_LOCAL_PARAMETERS_ARB corresponding to 46045bd8deadSopenharmony_ci the program target <target>. 46055bd8deadSopenharmony_ci 46065bd8deadSopenharmony_ci The error INVALID_OPERATION is generated if Begin, RasterPos, or any 46075bd8deadSopenharmony_ci command that performs an explicit Begin is called when fragment 46085bd8deadSopenharmony_ci program mode is enabled and the currently bound fragment program 46095bd8deadSopenharmony_ci object does not contain a valid fragment program. 46105bd8deadSopenharmony_ci 46115bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by any command accessing 46125bd8deadSopenharmony_ci texture coordinate processing state if the texture unit number 46135bd8deadSopenharmony_ci corresponding to the current value of ACTIVE_TEXTURE is greater than 46145bd8deadSopenharmony_ci or equal to the implementation-dependent constant 46155bd8deadSopenharmony_ci MAX_TEXTURE_COORDS_ARB. Such commands include: GetTexGen{if}v; 46165bd8deadSopenharmony_ci TexGen{ifd}, TexGen{ifd}v; Disable, Enable, IsEnabled with argument 46175bd8deadSopenharmony_ci TEXTURE_GEN_{STRQ}; Get with argument CURRENT_TEXTURE_COORDS, 46185bd8deadSopenharmony_ci CURRENT_RASTER_TEXTURE_COORDS, TEXTURE_STACK_DEPTH, TEXTURE_MATRIX, 46195bd8deadSopenharmony_ci TRANSPOSE_TEXTURE_MATRIX; when the current matrix mode is TEXTURE, 46205bd8deadSopenharmony_ci Frustum, LoadIdentity, LoadMatrix{fd}, LoadTransposeMatrix{fd}, 46215bd8deadSopenharmony_ci MultMatrix{fd}, MultTransposeMatrix{fd}, Ortho, PopMatrix, 46225bd8deadSopenharmony_ci PushMatrix, Rotate{fd}, Scale{fd}, Translate{fd}. 46235bd8deadSopenharmony_ci 46245bd8deadSopenharmony_ci The error INVALID_OPERATION is generated by any command accessing 46255bd8deadSopenharmony_ci texture image processing state if the texture unit number 46265bd8deadSopenharmony_ci corresponding to the current value of ACTIVE_TEXTURE is greater than 46275bd8deadSopenharmony_ci or equal to the implementation-dependent constant 46285bd8deadSopenharmony_ci MAX_TEXTURE_IMAGE_UNITS_ARB. Such commands include: BindTexture; 46295bd8deadSopenharmony_ci GetCompressedTexImage, GetTexEnv{if}v, GetTexImage, 46305bd8deadSopenharmony_ci GetTexLevelParameter{if}v, GetTexParameter{if}v; TexEnv{if}, 46315bd8deadSopenharmony_ci TexEnv{if}v, TexParameter{if}, TexParameter{if}v; Disable, Enable, 46325bd8deadSopenharmony_ci IsEnabled with argument TEXTURE_{123}D, TEXTURE_CUBE_MAP; Get with 46335bd8deadSopenharmony_ci argument TEXTURE_BINDING_{123}D, TEXTURE_BINDING_CUBE_MAP; 46345bd8deadSopenharmony_ci CompressedTexImage{123}D, CompressedTexSubImage{123}D, 46355bd8deadSopenharmony_ci CopyTexImage{12}D, CopyTexSubImage{123}D, TexImage{123}D, 46365bd8deadSopenharmony_ci TexSubImage{123}D. 46375bd8deadSopenharmony_ci 46385bd8deadSopenharmony_ci 46395bd8deadSopenharmony_ciNew State 46405bd8deadSopenharmony_ci 46415bd8deadSopenharmony_ci 46425bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Section Attribute 46435bd8deadSopenharmony_ci ------------------------------- ------ ------------- ------------- ------------------ ------------ ------------ 46445bd8deadSopenharmony_ci FRAGMENT_PROGRAM_ARB B IsEnabled False fragment program 3.8 enable 46455bd8deadSopenharmony_ci enable 46465bd8deadSopenharmony_ci - 24+xR4 GetProgramEnv- (0,0,0,0) program environment 3.11.1 - 46475bd8deadSopenharmony_ci ParameterARB parameters 46485bd8deadSopenharmony_ci PROGRAM_ERROR_POSITION_ARB Z GetIntegerv -1 last program error 3.11.1 - 46495bd8deadSopenharmony_ci position 46505bd8deadSopenharmony_ci PROGRAM_ERROR_STRING_ARB 0+xub GetString "" last program error 3.11.1 - 46515bd8deadSopenharmony_ci string 46525bd8deadSopenharmony_ci 46535bd8deadSopenharmony_ci Table X.6. New Accessible State Introduced by ARB_fragment_program. 46545bd8deadSopenharmony_ci 46555bd8deadSopenharmony_ci 46565bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec Attrib 46575bd8deadSopenharmony_ci -------------------- ----- ------------------- --------------- ---------------------- -------- ------ 46585bd8deadSopenharmony_ci PROGRAM_BINDING_ARB Z+ GetProgramivARB object-specific bound program name 6.1.12 - 46595bd8deadSopenharmony_ci PROGRAM_LENGTH_ARB Z+ GetProgramivARB 0 bound program length 6.1.12 - 46605bd8deadSopenharmony_ci PROGRAM_FORMAT_ARB Z1 GetProgramivARB PROGRAM_FORMAT_ bound program format 6.1.12 - 46615bd8deadSopenharmony_ci ASCII_ARB 46625bd8deadSopenharmony_ci PROGRAM_STRING_ARB ubxn GetProgramStringARB (empty) bound program string 6.1.12 - 46635bd8deadSopenharmony_ci PROGRAM_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 bound program 6.1.12 - 46645bd8deadSopenharmony_ci total instructions 46655bd8deadSopenharmony_ci PROGRAM_ALU_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 bound program 6.1.12 - 46665bd8deadSopenharmony_ci ALU instructions 46675bd8deadSopenharmony_ci PROGRAM_TEX_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 bound program 6.1.12 - 46685bd8deadSopenharmony_ci texture instructions 46695bd8deadSopenharmony_ci PROGRAM_TEX_INDIRECTIONS_ARB Z+ GetProgramivARB 0 bound program 6.1.12 - 46705bd8deadSopenharmony_ci texture indirections 46715bd8deadSopenharmony_ci PROGRAM_TEMPORARIES_ARB Z+ GetProgramivARB 0 bound program 6.1.12 - 46725bd8deadSopenharmony_ci temporaries 46735bd8deadSopenharmony_ci PROGRAM_PARAMETERS_ARB Z+ GetProgramivARB 0 bound program 6.1.12 - 46745bd8deadSopenharmony_ci parameter bindings 46755bd8deadSopenharmony_ci PROGRAM_ATTRIBS_ARB Z+ GetProgramivARB 0 bound program 6.1.12 - 46765bd8deadSopenharmony_ci attribute bindings 46775bd8deadSopenharmony_ci PROGRAM_NATIVE_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 bound program native 6.1.12 - 46785bd8deadSopenharmony_ci instructions 46795bd8deadSopenharmony_ci PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 bound program native 6.1.12 - 46805bd8deadSopenharmony_ci ALU instructions 46815bd8deadSopenharmony_ci PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB Z+ GetProgramivARB 0 bound program native 6.1.12 - 46825bd8deadSopenharmony_ci texture instructions 46835bd8deadSopenharmony_ci PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB Z+ GetProgramivARB 0 bound program native 6.1.12 - 46845bd8deadSopenharmony_ci texture indirections 46855bd8deadSopenharmony_ci PROGRAM_NATIVE_TEMPORARIES_ARB Z+ GetProgramivARB 0 bound program native 6.1.12 - 46865bd8deadSopenharmony_ci temporaries 46875bd8deadSopenharmony_ci PROGRAM_NATIVE_PARAMETERS_ARB Z+ GetProgramivARB 0 bound program native 6.1.12 - 46885bd8deadSopenharmony_ci parameter bindings 46895bd8deadSopenharmony_ci PROGRAM_NATIVE_ATTRIBS_ARB Z+ GetProgramivARB 0 bound program native 6.1.12 - 46905bd8deadSopenharmony_ci attribute bindings 46915bd8deadSopenharmony_ci PROGRAM_UNDER_NATIVE_LIMITS_ARB B GetProgramivARB 0 bound program under 6.1.12 - 46925bd8deadSopenharmony_ci native resource limits 46935bd8deadSopenharmony_ci - 24+xR4 GetProgramLocal- (0,0,0,0) bound program local 3.11.1 - 46945bd8deadSopenharmony_ci ParameterARB parameter value 46955bd8deadSopenharmony_ci 46965bd8deadSopenharmony_ci Table X.7. Program Object State. Program object queries return attributes of 46975bd8deadSopenharmony_ci the program object currently bound to the program target <target>. 46985bd8deadSopenharmony_ci 46995bd8deadSopenharmony_ci 47005bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec Attribute 47015bd8deadSopenharmony_ci --------- ------ ----------- ------------- ------------------------- -------- --------- 47025bd8deadSopenharmony_ci - 16+xR4 - undefined temporary registers 3.11.3.3 - 47035bd8deadSopenharmony_ci - 2xR4 - undefined fragment result registers 3.11.3.4 - 47045bd8deadSopenharmony_ci 47055bd8deadSopenharmony_ci Table X.8. Fragment Program Per-fragment Execution State. All per-fragment 47065bd8deadSopenharmony_ci execution state registers are uninitialized at the beginning of program 47075bd8deadSopenharmony_ci execution. 47085bd8deadSopenharmony_ci 47095bd8deadSopenharmony_ci 47105bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec Attribute 47115bd8deadSopenharmony_ci ------------------------------ -------- -------------- ------------- ------------------- ------- --------- 47125bd8deadSopenharmony_ci CURRENT_MATRIX_ARB m*n*xM^4 GetFloatv Identity current matrix 6.1.2 - 47135bd8deadSopenharmony_ci CURRENT_MATRIX_STACK_DEPTH_ARB m*Z+ GetIntegerv 1 current stack depth 6.1.2 - 47145bd8deadSopenharmony_ci 47155bd8deadSopenharmony_ci Table X.9. Current matrix state where m is the total number of matrices 47165bd8deadSopenharmony_ci including texture matrices and program matrices and n is the number of 47175bd8deadSopenharmony_ci matrices on each particular matrix stack. Note that this state is aliased 47185bd8deadSopenharmony_ci with existing matrix state. 47195bd8deadSopenharmony_ci 47205bd8deadSopenharmony_ci 47215bd8deadSopenharmony_ciNew Implementation Dependent State 47225bd8deadSopenharmony_ci Minimum 47235bd8deadSopenharmony_ci Get Value Type Get Command Value Description Sec. Attrib 47245bd8deadSopenharmony_ci --------- ---- ----------- ------- ----------- ---- ------ 47255bd8deadSopenharmony_ci MAX_TEXTURE_COORDS_ARB Z+ GetIntegerv 2 number of texture 2.7 - 47265bd8deadSopenharmony_ci coordinate sets 47275bd8deadSopenharmony_ci MAX_TEXTURE_IMAGE_UNITS_ARB Z+ GetIntegerv 2 number of texture 2.10.2 - 47285bd8deadSopenharmony_ci image units 47295bd8deadSopenharmony_ci MAX_PROGRAM_ENV_PARAMETERS_ARB Z+ GetProgramivARB 24 maximum program 3.11.1 - 47305bd8deadSopenharmony_ci env parameters 47315bd8deadSopenharmony_ci MAX_PROGRAM_LOCAL_PARAMETERS_ARB Z+ GetProgramivARB 24 maximum program 3.11.1 - 47325bd8deadSopenharmony_ci local parameters 47335bd8deadSopenharmony_ci MAX_PROGRAM_MATRICES_ARB Z+ GetIntegerv 8 (not to maximum number of 3.11.7 - 47345bd8deadSopenharmony_ci exceed 32) program matrices 47355bd8deadSopenharmony_ci MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB Z+ GetIntegerv 1 maximum program 3.11.7 - 47365bd8deadSopenharmony_ci matrix stack depth 47375bd8deadSopenharmony_ci MAX_PROGRAM_INSTRUCTIONS_ARB Z+ GetProgramivARB 72 maximum program 6.1.12 - 47385bd8deadSopenharmony_ci total instructions 47395bd8deadSopenharmony_ci MAX_PROGRAM_ALU_INSTRUCTIONS_ARB Z+ GetProgramivARB 48 number of frag. prg. 6.1.12 - 47405bd8deadSopenharmony_ci ALU instructions 47415bd8deadSopenharmony_ci MAX_PROGRAM_TEX_INSTRUCTIONS_ARB Z+ GetProgramivARB 24 number of frag. prg. 6.1.12 - 47425bd8deadSopenharmony_ci texture instructions 47435bd8deadSopenharmony_ci MAX_PROGRAM_TEX_INDIRECTIONS_ARB Z+ GetProgramivARB 4 number of frag. prg. 6.1.12 - 47445bd8deadSopenharmony_ci texture indirections 47455bd8deadSopenharmony_ci MAX_PROGRAM_TEMPORARIES_ARB Z+ GetProgramivARB 16 maximum program 6.1.12 - 47465bd8deadSopenharmony_ci temporaries 47475bd8deadSopenharmony_ci MAX_PROGRAM_PARAMETERS_ARB Z+ GetProgramivARB 24 maximum program 6.1.12 - 47485bd8deadSopenharmony_ci parameter bindings 47495bd8deadSopenharmony_ci MAX_PROGRAM_ATTRIBS_ARB Z+ GetProgramivARB 10 maximum program 6.1.12 - 47505bd8deadSopenharmony_ci attribute bindings 47515bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB Z+ GetProgramivARB - maximum program native 6.1.12 - 47525bd8deadSopenharmony_ci total instructions 47535bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB Z+ GetProgramivARB - maximum program native 6.1.12 - 47545bd8deadSopenharmony_ci ALU instructions 47555bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB Z+ GetProgramivARB - maximum program native 6.1.12 - 47565bd8deadSopenharmony_ci texture instructions 47575bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB Z+ GetProgramivARB - maximum program native 6.1.12 - 47585bd8deadSopenharmony_ci texture indirections 47595bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_TEMPORARIES_ARB Z+ GetProgramivARB - maximum program native 6.1.12 - 47605bd8deadSopenharmony_ci temporaries 47615bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_PARAMETERS_ARB Z+ GetProgramivARB - maximum program native 6.1.12 - 47625bd8deadSopenharmony_ci parameter bindings 47635bd8deadSopenharmony_ci MAX_PROGRAM_NATIVE_ATTRIBS_ARB Z+ GetProgramivARB - maximum program native 6.1.12 - 47645bd8deadSopenharmony_ci attribute bindings 47655bd8deadSopenharmony_ci 47665bd8deadSopenharmony_ci Table X.10. New Implementation-Dependent Values Introduced by 47675bd8deadSopenharmony_ci ARB_fragment_program. Values queried by GetProgram require a <pname> of 47685bd8deadSopenharmony_ci FRAGMENT_PROGRAM_ARB. 47695bd8deadSopenharmony_ci 47705bd8deadSopenharmony_ci 47715bd8deadSopenharmony_ciSample Usage 47725bd8deadSopenharmony_ci 47735bd8deadSopenharmony_ci The following program shows how to perform a simple modulation 47745bd8deadSopenharmony_ci between the interpolated color and a single texture: 47755bd8deadSopenharmony_ci 47765bd8deadSopenharmony_ci !!ARBfp1.0 47775bd8deadSopenharmony_ci # Simple program to show how to code up the default texture environment 47785bd8deadSopenharmony_ci 47795bd8deadSopenharmony_ci ATTRIB tex = fragment.texcoord; #first set of texture coordinates 47805bd8deadSopenharmony_ci ATTRIB col = fragment.color.primary; #diffuse interpolated color 47815bd8deadSopenharmony_ci 47825bd8deadSopenharmony_ci OUTPUT outColor = result.color; 47835bd8deadSopenharmony_ci 47845bd8deadSopenharmony_ci TEMP tmp; 47855bd8deadSopenharmony_ci 47865bd8deadSopenharmony_ci TXP tmp, tex, texture, 2D; #sample the texture 47875bd8deadSopenharmony_ci 47885bd8deadSopenharmony_ci MUL outColor, tmp, col; #perform the modulation 47895bd8deadSopenharmony_ci 47905bd8deadSopenharmony_ci END 47915bd8deadSopenharmony_ci 47925bd8deadSopenharmony_ci The following is an example the simulates a chrome surface: 47935bd8deadSopenharmony_ci 47945bd8deadSopenharmony_ci !!ARBfp1.0 47955bd8deadSopenharmony_ci 47965bd8deadSopenharmony_ci ######################## 47975bd8deadSopenharmony_ci # Input Textures: 47985bd8deadSopenharmony_ci #----------------------- 47995bd8deadSopenharmony_ci # Texture 0 contains the default 2D texture used for general mapping 48005bd8deadSopenharmony_ci # Texture 2 contains a 1D pointlight falloff map 48015bd8deadSopenharmony_ci # Texture 3 contains a 2D map for calculating specular lighting 48025bd8deadSopenharmony_ci # Texture 4 contains normalizer cube map 48035bd8deadSopenharmony_ci # 48045bd8deadSopenharmony_ci # Input Texture Coordinates: 48055bd8deadSopenharmony_ci #----------------------- 48065bd8deadSopenharmony_ci # TexCoord1 contains the calculated normal 48075bd8deadSopenharmony_ci # TexCoord2 contains the light to vertex vector 48085bd8deadSopenharmony_ci # TexCoord3 contains the half-vector in tangent space 48095bd8deadSopenharmony_ci # TexCoord4 contains the light vector in tangent space 48105bd8deadSopenharmony_ci # TexCoord5 contains the eye vector in tangent space 48115bd8deadSopenharmony_ci ######################## 48125bd8deadSopenharmony_ci 48135bd8deadSopenharmony_ci TEMP NdotH, lV, L; 48145bd8deadSopenharmony_ci 48155bd8deadSopenharmony_ci ALIAS diffuse = L; 48165bd8deadSopenharmony_ci PARAM half = { 0.5, 0.5, 0.5, 0.5 }; 48175bd8deadSopenharmony_ci ATTRIB norm_tc = fragment.texcoord[1]; 48185bd8deadSopenharmony_ci ATTRIB lv_tc = fragment.texcoord[2]; 48195bd8deadSopenharmony_ci ATTRIB half_tc = fragment.texcoord[3]; 48205bd8deadSopenharmony_ci ATTRIB light_tc = fragment.texcoord[4]; 48215bd8deadSopenharmony_ci ATTRIB eye_tc = fragment.texcoord[5]; 48225bd8deadSopenharmony_ci OUTPUT oCol = result.color; 48235bd8deadSopenharmony_ci 48245bd8deadSopenharmony_ci TEX L, light_tc, texture[4], CUBE; # Sample cube map normalizer 48255bd8deadSopenharmony_ci 48265bd8deadSopenharmony_ci # Calculate diffuse lighting (N.L) 48275bd8deadSopenharmony_ci SUB L, L, half; # Bias L and then multiply by 2 48285bd8deadSopenharmony_ci ADD L, L, L; 48295bd8deadSopenharmony_ci DP3 diffuse, norm_tc, L; # N.L 48305bd8deadSopenharmony_ci 48315bd8deadSopenharmony_ci # Calculate specular lighting component { (N.H), |H|^2 } 48325bd8deadSopenharmony_ci DP3 NdotH.x, norm_tc, half_tc; 48335bd8deadSopenharmony_ci DP3 NdotH.y, half_tc, half_tc; 48345bd8deadSopenharmony_ci 48355bd8deadSopenharmony_ci DP3 lV.x, lv_tc, lv_tc; # lV = (|light to vertex|)^2 48365bd8deadSopenharmony_ci 48375bd8deadSopenharmony_ci 48385bd8deadSopenharmony_ci ############# 48395bd8deadSopenharmony_ci # Pass 2 48405bd8deadSopenharmony_ci ############# 48415bd8deadSopenharmony_ci 48425bd8deadSopenharmony_ci TEMP base, specular; 48435bd8deadSopenharmony_ci ALIAS atten = lV; 48445bd8deadSopenharmony_ci 48455bd8deadSopenharmony_ci TEX base, eye_tc, texture[0], 2D; # sample enviroment map using eye vector 48465bd8deadSopenharmony_ci TEX atten, lV, texture[2], 1D; # Sample attenuation map 48475bd8deadSopenharmony_ci TEX specular, NdotH, texture[3], 2D; # Sample specular NHHH map= (N.H)^256 48485bd8deadSopenharmony_ci 48495bd8deadSopenharmony_ci # specular = (N.H)^256 * (N.L) 48505bd8deadSopenharmony_ci # this ensures a pixel is only lit if facing the light (since the specular 48515bd8deadSopenharmony_ci # exponent makes negative N.H positive we must do this) 48525bd8deadSopenharmony_ci MUL specular, specular, diffuse; 48535bd8deadSopenharmony_ci 48545bd8deadSopenharmony_ci # specular = specular * environment map 48555bd8deadSopenharmony_ci MUL specular, base, specular; 48565bd8deadSopenharmony_ci 48575bd8deadSopenharmony_ci # diffuse = diffuse * environment map 48585bd8deadSopenharmony_ci MUL diffuse, base, diffuse; 48595bd8deadSopenharmony_ci 48605bd8deadSopenharmony_ci # outColor = (specular * environment map) + (diffuse * environment map) 48615bd8deadSopenharmony_ci ADD base, specular, diffuse; 48625bd8deadSopenharmony_ci 48635bd8deadSopenharmony_ci # Apply point light attenutaion 48645bd8deadSopenharmony_ci MUL oCol, base, atten.r; 48655bd8deadSopenharmony_ci 48665bd8deadSopenharmony_ci END 48675bd8deadSopenharmony_ci 48685bd8deadSopenharmony_ci 48695bd8deadSopenharmony_ciRevision History 48705bd8deadSopenharmony_ci 48715bd8deadSopenharmony_ci Date: 10/08/2013 48725bd8deadSopenharmony_ci Revision: 28 48735bd8deadSopenharmony_ci - Change GLvoid -> void (Bug 10412). 48745bd8deadSopenharmony_ci 48755bd8deadSopenharmony_ci Date: 11/04/2006 48765bd8deadSopenharmony_ci Revision: 27 48775bd8deadSopenharmony_ci - Updated contact info after ATI/AMD merger. 48785bd8deadSopenharmony_ci 48795bd8deadSopenharmony_ci Date: 8/22/2003 48805bd8deadSopenharmony_ci Revision: 26 48815bd8deadSopenharmony_ci - Added list of commands generating errors when active texture 48825bd8deadSopenharmony_ci unit selector is out of range. 48835bd8deadSopenharmony_ci - Fixed typo in <stateMatrixItem> rule. 48845bd8deadSopenharmony_ci - Clarified behavior of fragment.position.z with respect to depth 48855bd8deadSopenharmony_ci offset. 48865bd8deadSopenharmony_ci 48875bd8deadSopenharmony_ci Date: 2/26/2003 48885bd8deadSopenharmony_ci Revision: 25 48895bd8deadSopenharmony_ci - Fixed description of KIL instruction to reflect less than zero 48905bd8deadSopenharmony_ci test, not less than or equal to zero. 48915bd8deadSopenharmony_ci - Clarified the processing of incoming and outgoing depths and 48925bd8deadSopenharmony_ci colors to reflect the conversion to floating-point on input and 48935bd8deadSopenharmony_ci the conversion to fixed-point on output. 48945bd8deadSopenharmony_ci 48955bd8deadSopenharmony_ci Date: 1/10/2003 48965bd8deadSopenharmony_ci Revision: 24 48975bd8deadSopenharmony_ci - Fixed bug where "state.matrix.mvp" was specified incorrectly. 48985bd8deadSopenharmony_ci It should be P*M0 rather than M0*P. 48995bd8deadSopenharmony_ci - Added issue warning about CMP opcode's order of operands. 49005bd8deadSopenharmony_ci 49015bd8deadSopenharmony_ci Date: 10/22/2002 49025bd8deadSopenharmony_ci Revision: 23 49035bd8deadSopenharmony_ci - Fixed reference to <extSwizComp> rule in 3.11.5.28. Instead 49045bd8deadSopenharmony_ci reference both <xyzwExtSwizComp> and <rgbaExtSwizComp> rules. 49055bd8deadSopenharmony_ci 49065bd8deadSopenharmony_ci Date: 10/02/2002 49075bd8deadSopenharmony_ci Revision: 22 49085bd8deadSopenharmony_ci - Fixed typo in section 3.11.1, where 8 program environment and 49095bd8deadSopenharmony_ci 8 program local parameters are listed as the minimums instead 49105bd8deadSopenharmony_ci of 24 of each. Table X.10 had the correct values. 49115bd8deadSopenharmony_ci - Fixed <stateTexEnvItem> to refer to legacy texture units. 49125bd8deadSopenharmony_ci - Fixed typos in issue 29 pseudo-code, added some clarification. 49135bd8deadSopenharmony_ci 49145bd8deadSopenharmony_ci Date: 9/19/2002 49155bd8deadSopenharmony_ci Revision: 21 49165bd8deadSopenharmony_ci - Added clarifying paragraph for native texture indirection 49175bd8deadSopenharmony_ci counting, offering examples of possible cases where texture 49185bd8deadSopenharmony_ci indirections may be increased. 49195bd8deadSopenharmony_ci - Fixed typos in issues 25 and 29. 49205bd8deadSopenharmony_ci 49215bd8deadSopenharmony_ci Date: 9/16/2002 49225bd8deadSopenharmony_ci Revision: 20 49235bd8deadSopenharmony_ci - Added precision hint program options. 49245bd8deadSopenharmony_ci - Fixed various typos, reworded some parts for consistency. 49255bd8deadSopenharmony_ci - Updated issues list. 49265bd8deadSopenharmony_ci 49275bd8deadSopenharmony_ci Date: 9/13/2002 49285bd8deadSopenharmony_ci Revision: 19 49295bd8deadSopenharmony_ci - Promoted minimum precision of texture coordinates in 2.1.1. 49305bd8deadSopenharmony_ci - Added ARB_fog_* program options. 49315bd8deadSopenharmony_ci - Removed modification to 3.9, put clamps in 3.11.4.4. 49325bd8deadSopenharmony_ci - Made 'texture' a reserved keyword in the grammar. 49335bd8deadSopenharmony_ci - Fixed various typos. 49345bd8deadSopenharmony_ci - Updated section 3.11.6. 49355bd8deadSopenharmony_ci - Updated issues list. 49365bd8deadSopenharmony_ci 49375bd8deadSopenharmony_ci Date: 9/11/2002 49385bd8deadSopenharmony_ci Revision: 18 49395bd8deadSopenharmony_ci - Updated for consistency with ARB_vertex_program revision 36. 49405bd8deadSopenharmony_ci - Depth output moved to 3rd component of result.depth. 49415bd8deadSopenharmony_ci - Fixed various typos, reworded things in many places. 49425bd8deadSopenharmony_ci - Added NV_fragment_program interactions. 49435bd8deadSopenharmony_ci - Updated issues list. 49445bd8deadSopenharmony_ci 49455bd8deadSopenharmony_ci Date: 9/09/2002 49465bd8deadSopenharmony_ci Revision: 17 49475bd8deadSopenharmony_ci - Added fogcoord and position attributes. 49485bd8deadSopenharmony_ci - Moved fragment program section to 3.11, after fog. 49495bd8deadSopenharmony_ci - Changed MAX_TEXTURE_UNITS/MAX_AUX_TEXTURE_UNITS to 49505bd8deadSopenharmony_ci MAX_TEXTURE_COORDS/MAX_TEXTURE_IMAGE_UNITS. 49515bd8deadSopenharmony_ci - Removed TRC and MOD instructions. 49525bd8deadSopenharmony_ci - Added SIN and COS instructions. 49535bd8deadSopenharmony_ci - Added more clarity to resource consumption wording. 49545bd8deadSopenharmony_ci - Added invariance wording concerning depth-replacement. 49555bd8deadSopenharmony_ci - Added rule that a program that fails to load must always fail to 49565bd8deadSopenharmony_ci load, regardless of GL state. 49575bd8deadSopenharmony_ci - Updated issues list. 49585bd8deadSopenharmony_ci 49595bd8deadSopenharmony_ci Date: 8/30/2002 49605bd8deadSopenharmony_ci Revision: 16 49615bd8deadSopenharmony_ci - Improved texture indirection description. 49625bd8deadSopenharmony_ci - Defined result of sample from incomplete texture as (0,0,0,1). 49635bd8deadSopenharmony_ci - Removed PROGRAMS_LOAD_OVER_NATIVE_LIMITS_ARB per-target query. 49645bd8deadSopenharmony_ci - Allowed ProgramStringARB to fail on non-native programs. 49655bd8deadSopenharmony_ci - Updated issues list. 49665bd8deadSopenharmony_ci 49675bd8deadSopenharmony_ci Date: 8/28/2002 49685bd8deadSopenharmony_ci Revision: 15 49695bd8deadSopenharmony_ci - Updated for consistency with ARB_vertex_program revision 35. 49705bd8deadSopenharmony_ci - Added PROGRAMS_LOAD_OVER_NATIVE_LIMITS_ARB per-target query. 49715bd8deadSopenharmony_ci - Changed MAX_AUX_TEXTURE_UNITS_ARB enum value. 49725bd8deadSopenharmony_ci - Updated issues list. 49735bd8deadSopenharmony_ci 49745bd8deadSopenharmony_ci Date: 8/22/2002 49755bd8deadSopenharmony_ci Revision: 14 49765bd8deadSopenharmony_ci - Added sine/cosine instruction (SCS). 49775bd8deadSopenharmony_ci - Updated texture sample grammar, replaced texenables hierarchy. 49785bd8deadSopenharmony_ci - Added EXT_vertex_weighting and ARB_vertex_blend dependency. 49795bd8deadSopenharmony_ci - Updated issues list. 49805bd8deadSopenharmony_ci 49815bd8deadSopenharmony_ci Date: 8/14/2002 49825bd8deadSopenharmony_ci Revision: 13 49835bd8deadSopenharmony_ci - Fixed <paramConstant> grammar rule. 49845bd8deadSopenharmony_ci - Updated issues list. 49855bd8deadSopenharmony_ci 49865bd8deadSopenharmony_ci Date: 8/06/2002 49875bd8deadSopenharmony_ci Revision: 12 49885bd8deadSopenharmony_ci - Fixed various typos. 49895bd8deadSopenharmony_ci - Updated issues list. 49905bd8deadSopenharmony_ci - Added wording to 3.10.3.6 to reflect that native resource 49915bd8deadSopenharmony_ci consumption may increase due to emulated instructions. 49925bd8deadSopenharmony_ci 49935bd8deadSopenharmony_ci Date: 7/29/2002 49945bd8deadSopenharmony_ci Revision: 11 49955bd8deadSopenharmony_ci - Updated for consistency with ARB_vertex_program revision 34. 49965bd8deadSopenharmony_ci - Added support for matrix binding. 49975bd8deadSopenharmony_ci - Removed precision queries. 49985bd8deadSopenharmony_ci - Updated issues list. 49995bd8deadSopenharmony_ci 50005bd8deadSopenharmony_ci Date: 7/16/2002 50015bd8deadSopenharmony_ci Revision: 10 50025bd8deadSopenharmony_ci - Updated for consistency with ARB_vertex_program revision 31. 50035bd8deadSopenharmony_ci - Added fog params and depth range bindings to grammar. 50045bd8deadSopenharmony_ci - Removed stpq writemasks and swizzles from grammar. 50055bd8deadSopenharmony_ci - Required swizzle components to come from same set, xyzw or rgba. 50065bd8deadSopenharmony_ci 50075bd8deadSopenharmony_ci Date: 7/10/2002 50085bd8deadSopenharmony_ci Revision: 9 50095bd8deadSopenharmony_ci - Made fog params and depth range bindable. 50105bd8deadSopenharmony_ci - Changed texture instruction names to match 3-letter format. 50115bd8deadSopenharmony_ci - Made texture instructions more consistent with ALU instructions. 50125bd8deadSopenharmony_ci - Increased minimums for implementation-dependent values. 50135bd8deadSopenharmony_ci - Re-introduced 4-components swizzles and the SWZ instruction. 50145bd8deadSopenharmony_ci - Updated issues list. 50155bd8deadSopenharmony_ci 50165bd8deadSopenharmony_ci Date: 7/03/2002 50175bd8deadSopenharmony_ci Revision: 8 50185bd8deadSopenharmony_ci - Fixed typos. 50195bd8deadSopenharmony_ci - Added DST, LIT, SGE, SLT instructions. 50205bd8deadSopenharmony_ci - Changed FRC definition to match ARB_vertex_program, added MOD 50215bd8deadSopenharmony_ci instruction to expose fmod(arg, 1.0) behavior. 50225bd8deadSopenharmony_ci 50235bd8deadSopenharmony_ci Date: 6/25/2002 50245bd8deadSopenharmony_ci Revision: 7 50255bd8deadSopenharmony_ci - Updated for consistency with ARB_vertex_program revision 29. 50265bd8deadSopenharmony_ci 50275bd8deadSopenharmony_ci Date: 6/19/2002 50285bd8deadSopenharmony_ci Revision: 6 50295bd8deadSopenharmony_ci - Updated for consistency with ARB_vertex_program revision 28. 50305bd8deadSopenharmony_ci - Changed from ATI to ARB prefix/suffix. 50315bd8deadSopenharmony_ci - Started using single integer revision number. 50325bd8deadSopenharmony_ci - Added a few more issues to the list. 50335bd8deadSopenharmony_ci 50345bd8deadSopenharmony_ci Date: 6/14/2002 50355bd8deadSopenharmony_ci Revision: 1.4 50365bd8deadSopenharmony_ci - Updated for consistency with ARB_vertex_program revision 27. 50375bd8deadSopenharmony_ci - Added a few more issues to the list. 50385bd8deadSopenharmony_ci 50395bd8deadSopenharmony_ci Date: 6/05/2002 50405bd8deadSopenharmony_ci Revision: 1.3 50415bd8deadSopenharmony_ci - Updated for consistency with ARB_vertex_program revision 26. 50425bd8deadSopenharmony_ci - Incorporated program object management, removing dependency on 50435bd8deadSopenharmony_ci ARB_vertex_program. 50445bd8deadSopenharmony_ci - Added interaction with ARB_shadow. 50455bd8deadSopenharmony_ci 50465bd8deadSopenharmony_ci Date: 6/03/2002 50475bd8deadSopenharmony_ci Revision: 1.2 50485bd8deadSopenharmony_ci - Updated for consistency with ARB_vertex_program revision 25. 50495bd8deadSopenharmony_ci - Fixed TexInstructions to use <texSrcReg>, i.e. no parameters. 50505bd8deadSopenharmony_ci - Added TRC, POW, DPH instructions, updated FRC and LRP. 50515bd8deadSopenharmony_ci - Added fog color parameter binding. 50525bd8deadSopenharmony_ci 50535bd8deadSopenharmony_ci Date: 5/23/2002 50545bd8deadSopenharmony_ci Revision: 1.1 50555bd8deadSopenharmony_ci - Updated for consistency with ARB_vertex_program revision 24. 50565bd8deadSopenharmony_ci - Added GetProgramfvATI entrypoint for querying precision values. 50575bd8deadSopenharmony_ci 50585bd8deadSopenharmony_ci Date: 5/10/2002 50595bd8deadSopenharmony_ci Revision: 1.0 50605bd8deadSopenharmony_ci - First draft for circulation. 5061