15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_fragment_coord_conventions 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_fragment_coord_conventions 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContributors 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Jason Green, TransGaming 125bd8deadSopenharmony_ci Daniel Koch, TransGaming 135bd8deadSopenharmony_ci Gavriel State, TransGaming 145bd8deadSopenharmony_ci Ryan Gordon, Destineer 155bd8deadSopenharmony_ci Nicholas Vining, Destineer 165bd8deadSopenharmony_ci John Kessenich, Intel 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciContact 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Mark Kilgard, NVIDIA (mjk 'at' nvidia.com) 215bd8deadSopenharmony_ci Daniel Koch, TransGaming (daniel 'at' transgaming.com) 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ciNotice 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ci Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at 265bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciSpecification Update Policy 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 315bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 325bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 335bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 345bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 355bd8deadSopenharmony_ci described in more detail at 365bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ciStatus 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci Complete. Approved by the ARB on July 3, 2009. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciVersion 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci Last Modified Date: August 2, 2009 455bd8deadSopenharmony_ci Version: 10 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ciNumber 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ci ARB Extension #63 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ciDependencies 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci This extension is written against the OpenGL 3.1 Specification but 545bd8deadSopenharmony_ci can apply to prior specifications. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci This extension interacts with ARB_fragment_program. 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci This extension interacts with ARB_fragment_shader. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci This extension interacts with NV_fragment_program. 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci This extension interacts with NV_fragment_program_option. 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci This extension interacts with NV_fragment_program2. 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci This extension interacts with NV_fragment_program4. 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ciOverview 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ci This extension provides alternative conventions for the fragment 715bd8deadSopenharmony_ci coordinate XY location available for programmable fragment processing. 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci The scope of this extension deals *only* with how the fragment 745bd8deadSopenharmony_ci coordinate XY location appears during programming fragment processing. 755bd8deadSopenharmony_ci Beyond the scope of this extension are coordinate conventions used 765bd8deadSopenharmony_ci for rasterization or transformation. 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci In the case of the coordinate conventions for rasterization and 795bd8deadSopenharmony_ci transformation, some combination of the viewport, depth range, culling 805bd8deadSopenharmony_ci state, and projection matrix state can be reconfigured to adopt other 815bd8deadSopenharmony_ci arbitrary clip-space and window-space coordinate space conventions. 825bd8deadSopenharmony_ci Adopting other clip-space and window-space conventions involves 835bd8deadSopenharmony_ci adjusting existing OpenGL state. However it is non-trivial to massage 845bd8deadSopenharmony_ci an arbitrary fragment shader or program to adopt a different 855bd8deadSopenharmony_ci window-space coordinate system because such shaders are encoded in 865bd8deadSopenharmony_ci various textual representations. 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci The dominant 2D and 3D rendering APIs make two basic choices of 895bd8deadSopenharmony_ci convention when locating fragments in window space. 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci The two choices are: 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci 1) Is the origin nearest the lower-left- or upper-left-most pixel 945bd8deadSopenharmony_ci of the window? 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci 2) Is the (x,y) location of the pixel nearest the origin at (0,0) 975bd8deadSopenharmony_ci or (0.5,0.5)? 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci OpenGL assumes a lower-left origin for window coordinates and assumes 1005bd8deadSopenharmony_ci pixel centers are located at half-pixel coordinates. This means 1015bd8deadSopenharmony_ci the XY location (0.5,0.5) corresponds to the lower-left-most pixel 1025bd8deadSopenharmony_ci in a window. 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci Other window coordinate conventions exist for other rendering APIs. 1055bd8deadSopenharmony_ci X11, GDI, and Direct3D version through DirectX 9 assume an upper-left 1065bd8deadSopenharmony_ci window origin and locate pixel centers at integer XY values. 1075bd8deadSopenharmony_ci By this alternative convention, the XY location (0,0) corresponds 1085bd8deadSopenharmony_ci to the upper-left-most pixel in a window. 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci Direct3D for DirectX 10 assumes an upper-left origin (as do prior 1115bd8deadSopenharmony_ci DirectX versions) yet assumes half-pixel coordinates (unlike prior 1125bd8deadSopenharmony_ci DirectX versions). By the DirectX 10 convention, the XY location 1135bd8deadSopenharmony_ci (0.5,0.5) corresponds to the upper-left-most pixel in a window. 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci Fragment shaders can directly access the location of a given 1165bd8deadSopenharmony_ci processed fragment in window space. We call this location the 1175bd8deadSopenharmony_ci "fragment coordinate". 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci This extension provides a means for fragment shaders written in GLSL 1205bd8deadSopenharmony_ci or OpenGL assembly extensions to specify alternative conventions 1215bd8deadSopenharmony_ci for determining the fragment coordinate value accessed during 1225bd8deadSopenharmony_ci programmable fragment processing. 1235bd8deadSopenharmony_ci 1245bd8deadSopenharmony_ci The motivation for this extension is to provide an easy, efficient 1255bd8deadSopenharmony_ci means for fragment shaders accessing a fragment's window-space 1265bd8deadSopenharmony_ci location to adopt the fragment coordinate convention for which the 1275bd8deadSopenharmony_ci shader was originally written. 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ciNew Procedures and Functions 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci None 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ciNew Tokens 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci None 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 3.1 Specification (OpenGL Operation) 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci None 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 3.1 Specification (Rasterization) 1425bd8deadSopenharmony_ci 1435bd8deadSopenharmony_ci Modify Section 3.9.2, "Shader Execution" 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci In subsection "Shader Inputs" replace the paragraph beginning "The 1465bd8deadSopenharmony_ci built-in variable gl_FragCoord ..." with: 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ci "The built-in variable gl_FragCoord holds the fragment coordinate 1495bd8deadSopenharmony_ci (x_f,y_f,z_f,w_f) for the fragment. Computing the fragment coordinate 1505bd8deadSopenharmony_ci depends on the fragment processing pixel-center and origin conventions 1515bd8deadSopenharmony_ci (discussed below) as follows: 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci { x_w - 0.5, if the fragment processing pixel-center 1545bd8deadSopenharmony_ci x_f = { convention is integer 1555bd8deadSopenharmony_ci { x_w, otherwise 1565bd8deadSopenharmony_ci 1575bd8deadSopenharmony_ci { H - y_w, if the fragment processing origin 1585bd8deadSopenharmony_ci y_f' = { convention is upper-left 1595bd8deadSopenharmony_ci { y_w, otherwise 1605bd8deadSopenharmony_ci 1615bd8deadSopenharmony_ci { y_f' - 0.5, if the fragment processing pixel-center 1625bd8deadSopenharmony_ci y_f = { convention is integer 1635bd8deadSopenharmony_ci { y_f', otherwise 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci z_f = z_w 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci w_f = 1 / w_c 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ci where (x_w, y_w, z_w) is the fragment's window-space position, w_c 1705bd8deadSopenharmony_ci is the w component of the fragment's clip-space position, and H is 1715bd8deadSopenharmony_ci the window's height in pixels. Note that the value of z_w already 1725bd8deadSopenharmony_ci has a polygon offset added in, if enabled (see section 3.6.4). Also 1735bd8deadSopenharmony_ci z_f must be precisely 0 or 1 in the case where z_w is either 0 or 1 1745bd8deadSopenharmony_ci respectively. The 1/w is computed from the w_c coordinate (see 1755bd8deadSopenharmony_ci section 2.12), which is the result of the product of the projection 1765bd8deadSopenharmony_ci matrix and the vertex's eye coordinates. 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci Unless otherwise specified by layout qualifiers in the fragment 1795bd8deadSopenharmony_ci shader (see section 4.3.x.1 "Input Layout Qualifier" of the OpenGL 1805bd8deadSopenharmony_ci Shading Language Specification), the fragment processing 1815bd8deadSopenharmony_ci pixel-center convention is half-integer and the fragment processing 1825bd8deadSopenharmony_ci origin convention is lower-left." 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 3.1 Specification (Per-Fragment 1855bd8deadSopenharmony_ciOperations and the Frame Buffer) 1865bd8deadSopenharmony_ci 1875bd8deadSopenharmony_ci None 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 3.1 Specification (Special 1905bd8deadSopenharmony_ciFunctions) 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci None 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 3.1 Specification (State and 1955bd8deadSopenharmony_ciState Requests) 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci None 1985bd8deadSopenharmony_ci 1995bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci None 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ciAdditions to version 1.40.07 of the OpenGL Shading Language Specification 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci "A new preprocessor #define is added to the OpenGL Shading Language: 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ci #define GL_ARB_fragment_coord_conventions 1 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 2105bd8deadSopenharmony_ci language features described in this extension: 2115bd8deadSopenharmony_ci 2125bd8deadSopenharmony_ci #extension GL_ARB_fragment_coord_conventions : <behavior> 2135bd8deadSopenharmony_ci 2145bd8deadSopenharmony_ci where <behavior> is as specified in section 3.3." 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL Shadering Language (Variables and Types) 2175bd8deadSopenharmony_civersion 1.40.07 2185bd8deadSopenharmony_ci 2195bd8deadSopenharmony_ci Add a new Section 4.3.x (Layout Qualifiers) as follows: 2205bd8deadSopenharmony_ci 2215bd8deadSopenharmony_ci "4.3.x Layout Qualifiers 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci Layout qualifiers can appear with an individual variable declared with 2245bd8deadSopenharmony_ci an interface qualifier: 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ci <layout-qualifier> <interface-qualifier> <declaration>; 2275bd8deadSopenharmony_ci 2285bd8deadSopenharmony_ci <layout-qualifier>: 2295bd8deadSopenharmony_ci layout( <layout-qualifier-id-list> ) 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ci <layout-qualifier-id-list>: 2325bd8deadSopenharmony_ci comma separated list of <layout-qualifier-id> 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci <interface-qualifier>: 2355bd8deadSopenharmony_ci in 2365bd8deadSopenharmony_ci out 2375bd8deadSopenharmony_ci uniform 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ci Declarations of layouts can only be made at global scope, and only 2405bd8deadSopenharmony_ci where indicated in the following subsection; their details are 2415bd8deadSopenharmony_ci specific to what the interface qualifier is, and are discussed 2425bd8deadSopenharmony_ci individually. 2435bd8deadSopenharmony_ci 2445bd8deadSopenharmony_ci The tokens in any <layout-qualifier-id-list> are identifiers, not 2455bd8deadSopenharmony_ci keywords. Generally they can be listed in any order. Order-dependent 2465bd8deadSopenharmony_ci meanings exist only if explicitly called out below. Similarily, 2475bd8deadSopenharmony_ci these identifiers are not case-sensitive, unless explicitly noted 2485bd8deadSopenharmony_ci otherwise. 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci 4.3.x.1 Input Layout Qualifiers 2515bd8deadSopenharmony_ci 2525bd8deadSopenharmony_ci Vertex shaders do not have any input layout qualifiers. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci Fragment shaders can have an input layout only for redeclaring the 2555bd8deadSopenharmony_ci built-in variable gl_FragCoord (see section 7.2). The layout 2565bd8deadSopenharmony_ci qualifier identifiers for gl_FragCoord are 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci <layout-qualifier-id> 2595bd8deadSopenharmony_ci origin_upper_left 2605bd8deadSopenharmony_ci pixel_center_integer 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci By default, gl_FragCoord assumes a lower-left origin for window 2635bd8deadSopenharmony_ci coordinates and assumes pixel centers are located at half-pixel 2645bd8deadSopenharmony_ci coordinates. For example, the (x, y) location (0.5, 0.5) is returned 2655bd8deadSopenharmony_ci for the lower-left-most pixel in a window. The origin can be changed 2665bd8deadSopenharmony_ci by redeclaring gl_FragCoord with the <origin_upper_left> identifier, 2675bd8deadSopenharmony_ci moving the origin of gl_FragCoord to the upper left of the window, 2685bd8deadSopenharmony_ci with y increasing in value toward the bottom of the window. The 2695bd8deadSopenharmony_ci values returned can also be shifted by half a pixel in both x and y 2705bd8deadSopenharmony_ci by the <pixel_center_integer> identifier so it appears the pixels 2715bd8deadSopenharmony_ci are centered at whole number pixel offsets. This moves the (x, y) 2725bd8deadSopenharmony_ci value returned by gl_FragCoord of (0.5, 0.5) by default, to (0.0, 2735bd8deadSopenharmony_ci 0.0) with <pixel_center_integer>. Redeclarations are done as follows 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ci in vec4 gl_FragCoord; // redeclaration that changes nothing is allowed 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci // All the following are allowed redeclarations that change behavior 2785bd8deadSopenharmony_ci layout(origin_upper_left) in vec4 gl_FragCoord; 2795bd8deadSopenharmony_ci layout(pixel_center_integer) in vec4 gl_FragCoord; 2805bd8deadSopenharmony_ci layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; 2815bd8deadSopenharmony_ci 2825bd8deadSopenharmony_ci If gl_FragCoord is redeclared in any fragment shader in a program, 2835bd8deadSopenharmony_ci it must be redeclared in all the fragment shaders in that program 2845bd8deadSopenharmony_ci that have a static use of gl_FragCoord. All redeclarations of 2855bd8deadSopenharmony_ci gl_FragCoord in all fragment shaders in a single program must have 2865bd8deadSopenharmony_ci the same set of qualifiers. Within any shader, the first 2875bd8deadSopenharmony_ci redeclarations of gl_FragCoord must appear before any use of 2885bd8deadSopenharmony_ci gl_FragCoord. The built-in gl_FragCoord is only predeclared in 2895bd8deadSopenharmony_ci fragment shaders, so redeclaring it in any other shader language 2905bd8deadSopenharmony_ci will be illegal. 2915bd8deadSopenharmony_ci 2925bd8deadSopenharmony_ci Redeclaring gl_FragCoord with <origin_upper_left> and/or 2935bd8deadSopenharmony_ci <pixel_center_integer> qualifiers only affects gl_FragCoord.x and 2945bd8deadSopenharmony_ci gl_FragCoord.y. It has no affect on rasterization, transformation, 2955bd8deadSopenharmony_ci or any other part of the OpenGL pipeline or language features." 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ciDependencies on ARB_fragment_program extension 2995bd8deadSopenharmony_ci 3005bd8deadSopenharmony_ci 3.11.3.1 Fragment Attributes 3015bd8deadSopenharmony_ci 3025bd8deadSopenharmony_ci Modify this paragraph: 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci "If a fragment attribute binding matches "fragment.position", the "x" 3055bd8deadSopenharmony_ci and "y" components of the fragment attribute variable are filled 3065bd8deadSopenharmony_ci with the (x,y) window coordinates of the fragment center, relative 3075bd8deadSopenharmony_ci to the lower left corner of the window. The "z" component is filled 3085bd8deadSopenharmony_ci with the fragment's z window coordinate. This z window coordinate 3095bd8deadSopenharmony_ci undergoes an implied conversion to floating point. This conversion 3105bd8deadSopenharmony_ci must leave the values 0 and 1 invariant. The "w" component is 3115bd8deadSopenharmony_ci filled with the reciprocal of the fragment's clip w coordinate." 3125bd8deadSopenharmony_ci 3135bd8deadSopenharmony_ci to read: 3145bd8deadSopenharmony_ci 3155bd8deadSopenharmony_ci "If a fragment attribute binding matches "fragment.position", the "x", 3165bd8deadSopenharmony_ci "y", "z", and "w" components of the fragment attribute variable are 3175bd8deadSopenharmony_ci filled with the (f_x,f_y,f_z,f_w) components respectively of the 3185bd8deadSopenharmony_ci fragment coordinate for the fragment." 3195bd8deadSopenharmony_ci 3205bd8deadSopenharmony_ci Add this section: 3215bd8deadSopenharmony_ci 3225bd8deadSopenharmony_ci "3.11.4.5.3 Fragment Coordinate Conventions Fragment Program Options 3235bd8deadSopenharmony_ci 3245bd8deadSopenharmony_ci These options affect the fragment coordinate conventions specified 3255bd8deadSopenharmony_ci in the "Shader Inputs" subsection of section 3.11. 3265bd8deadSopenharmony_ci 3275bd8deadSopenharmony_ci If a fragment program specifies one of the option 3285bd8deadSopenharmony_ci "ARB_fragment_coord_origin_upper_left", the fragment processing origin 3295bd8deadSopenharmony_ci convention is upper-left (and otherwise is lower-left) for purposes of 3305bd8deadSopenharmony_ci computing the fragment coordinate when the fragment program executes. 3315bd8deadSopenharmony_ci 3325bd8deadSopenharmony_ci If a fragment program specifies one of the option 3335bd8deadSopenharmony_ci "ARB_fragment_coord_pixel_center_integer", the fragment processing 3345bd8deadSopenharmony_ci pixel-center convention is integer (and otherwise is half-integer) 3355bd8deadSopenharmony_ci for purposes of computing the fragment coordinate when the fragment 3365bd8deadSopenharmony_ci program executes." 3375bd8deadSopenharmony_ci 3385bd8deadSopenharmony_ciDependencies on NV_fragment_program extension 3395bd8deadSopenharmony_ci 3405bd8deadSopenharmony_ci When this extension is supported, modify the NV_fragment_program 3415bd8deadSopenharmony_ci grammar to include: 3425bd8deadSopenharmony_ci 3435bd8deadSopenharmony_ci <program> ::= <progPrefix> <optionSequence> <instructionSequence> "END" 3445bd8deadSopenharmony_ci 3455bd8deadSopenharmony_ci <optionSequence> ::= <optionSequence> <option> 3465bd8deadSopenharmony_ci | "" 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ci <option> ::= "OPTION" "ARB_fragment_coord_origin_upper_left" ";" 3495bd8deadSopenharmony_ci | "OPTION" "ARB_fragment_coord_pixel_center_integer" ";" 3505bd8deadSopenharmony_ci 3515bd8deadSopenharmony_ci 3525bd8deadSopenharmony_ci Section 3.11.1.1, Fragment Program Attribute Registers 3535bd8deadSopenharmony_ci 3545bd8deadSopenharmony_ci Modify this paragraph: 3555bd8deadSopenharmony_ci 3565bd8deadSopenharmony_ci "f[WPOS].x and f[WPOS].y hold the (x,y) window coordinates of the 3575bd8deadSopenharmony_ci fragment center, and relative to the lower left corner of the window. 3585bd8deadSopenharmony_ci f[WPOS].z holds the associated z window coordinate, normally in the 3595bd8deadSopenharmony_ci range [0,1]. f[WPOS].w holds the reciprocal of the associated clip 3605bd8deadSopenharmony_ci w coordinate." 3615bd8deadSopenharmony_ci 3625bd8deadSopenharmony_ci to read: 3635bd8deadSopenharmony_ci 3645bd8deadSopenharmony_ci "The f[WPOS] register holds the components (x_f,y_f,z_f,w_f) 3655bd8deadSopenharmony_ci respectively of the fragment coordinate described in the "Shader 3665bd8deadSopenharmony_ci Inputs" subsection of section 3.11 (Fragment Shaders). 3675bd8deadSopenharmony_ci 3685bd8deadSopenharmony_ci If the ARB_fragment_coord_origin_upper_left OPTION is specified, the 3695bd8deadSopenharmony_ci fragment processing origin convention is upper-left (and otherwise 3705bd8deadSopenharmony_ci is lower-left) for purposes of computing the fragment coordinate 3715bd8deadSopenharmony_ci when the fragment program executes. 3725bd8deadSopenharmony_ci 3735bd8deadSopenharmony_ci If the ARB_fragment_coord_pixel_center_integer OPTION is specified, 3745bd8deadSopenharmony_ci the fragment processing pixel-center convention is integer (and 3755bd8deadSopenharmony_ci otherwise is half-integer) for purposes of computing the fragment 3765bd8deadSopenharmony_ci coordinate when the fragment program executes." 3775bd8deadSopenharmony_ci 3785bd8deadSopenharmony_ciDependencies on NV_fragment_program4 extension 3795bd8deadSopenharmony_ci 3805bd8deadSopenharmony_ci The language this extension adds for the ARB_fragment_program extension 3815bd8deadSopenharmony_ci also applies to the NV_fragment_program4 extension. Specifically: 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci The language added to section 3.11.3.1 (Fragment Attributes) 3845bd8deadSopenharmony_ci replaces corresponding language in section 2.X.3.2 (Program Attribute 3855bd8deadSopenharmony_ci Variables). 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ci The language added to section 3.11.4.5.3 (Fragment Coordinate 3885bd8deadSopenharmony_ci Conventions Fragment Program Options) belongs in section 2.X.5.Y 3895bd8deadSopenharmony_ci (Fragment Program Options) of the NV_fragment_program4 extension. 3905bd8deadSopenharmony_ci 3915bd8deadSopenharmony_ciDependencies on ARB_compatibility 3925bd8deadSopenharmony_ci 3935bd8deadSopenharmony_ci If ARB_compatibility is not supported, delete the clause 3945bd8deadSopenharmony_ci "which is the result of the product of the projection matrix and the 3955bd8deadSopenharmony_ci vertex's eye coordinates" in the sentence describing the computation of 3965bd8deadSopenharmony_ci 1/w, in section 3.9.2. 3975bd8deadSopenharmony_ci 3985bd8deadSopenharmony_ciErrors 3995bd8deadSopenharmony_ci 4005bd8deadSopenharmony_ci None 4015bd8deadSopenharmony_ci 4025bd8deadSopenharmony_ciNew State 4035bd8deadSopenharmony_ci 4045bd8deadSopenharmony_ci None 4055bd8deadSopenharmony_ci 4065bd8deadSopenharmony_ciNew Implementation Dependent State 4075bd8deadSopenharmony_ci 4085bd8deadSopenharmony_ci None 4095bd8deadSopenharmony_ci 4105bd8deadSopenharmony_ciIssues 4115bd8deadSopenharmony_ci 4125bd8deadSopenharmony_ci 1. What should this extension be called? 4135bd8deadSopenharmony_ci 4145bd8deadSopenharmony_ci RESOLVED: ARB_fragment_coord_conventions. 4155bd8deadSopenharmony_ci 4165bd8deadSopenharmony_ci We use "fragment" instead of "frag" in the name because other 4175bd8deadSopenharmony_ci extension names (ARB_fragment_program, ARB_fragment_shader) 4185bd8deadSopenharmony_ci use the term fragment. 4195bd8deadSopenharmony_ci 4205bd8deadSopenharmony_ci We use "coord" to match the EXT_fog_coord extension's naming. 4215bd8deadSopenharmony_ci 4225bd8deadSopenharmony_ci We use "conventions" because the extension provides two alternative 4235bd8deadSopenharmony_ci choices of convention: upper-left origin (instead of lower-left) 4245bd8deadSopenharmony_ci and integer pixel center locations (instead of half-integer). 4255bd8deadSopenharmony_ci 4265bd8deadSopenharmony_ci 2. To what scope of OpenGL functionality should this extension apply? 4275bd8deadSopenharmony_ci 4285bd8deadSopenharmony_ci RESOLVED: This extension is limited to how the XY window-space 4295bd8deadSopenharmony_ci coordinates available to fragment shaders and programs are 4305bd8deadSopenharmony_ci computed. 4315bd8deadSopenharmony_ci 4325bd8deadSopenharmony_ci This extension does NOT affect other 2D window coordinates such 4335bd8deadSopenharmony_ci as those passed to the glViewport, glReadPixels, glCopyPixels, 4345bd8deadSopenharmony_ci or glWindowsPos commands. 4355bd8deadSopenharmony_ci 4365bd8deadSopenharmony_ci 3. What is the primary goal of this extension have? 4375bd8deadSopenharmony_ci 4385bd8deadSopenharmony_ci RESOLVED: The goal is to increase the cross-API portability 4395bd8deadSopenharmony_ci of fragment shaders. Most fragment shader inputs (texture 4405bd8deadSopenharmony_ci coordinate sets, colors) are treated identically among OpenGL 4415bd8deadSopenharmony_ci and other 3D APIs such as the various versions of Direct3D. 4425bd8deadSopenharmony_ci The chief exception is the fragment coordinate XY values which 4435bd8deadSopenharmony_ci depend on the 3D API's particular window space conventions. 4445bd8deadSopenharmony_ci 4455bd8deadSopenharmony_ci We seek to avoid situations where shader source code must 4465bd8deadSopenharmony_ci be non-trivially modified to support differing window-space 4475bd8deadSopenharmony_ci conventions. We also want minimize the performance effect on 4485bd8deadSopenharmony_ci fragment shader execution. Rather than an application modifying 4495bd8deadSopenharmony_ci the shader source to add extra operations and parameters/uniforms 4505bd8deadSopenharmony_ci to adjust the native window coordinate origin, we want to control 4515bd8deadSopenharmony_ci the hardware's underlying convention for how the window origin 4525bd8deadSopenharmony_ci is provided to the shader. 4535bd8deadSopenharmony_ci 4545bd8deadSopenharmony_ci 4. Should this extension provide an API for programmatically 4555bd8deadSopenharmony_ci specifying a global or per-program/shader setting for the window 4565bd8deadSopenharmony_ci coordinate origin? 4575bd8deadSopenharmony_ci 4585bd8deadSopenharmony_ci RESOLVED: No, the fragment coordinate conventions are specified 4595bd8deadSopenharmony_ci within the GLSL fragment shader or assembly source text only. 4605bd8deadSopenharmony_ci 4615bd8deadSopenharmony_ci The choice of convention for the fragment coordinate is best 4625bd8deadSopenharmony_ci specified within the program. 4635bd8deadSopenharmony_ci 4645bd8deadSopenharmony_ci Having a hierarchy of alternative ways to specify the window 4655bd8deadSopenharmony_ci coordinate origin makes this extension more cumbersome than 4665bd8deadSopenharmony_ci necessary and increases driver validation overhead. 4675bd8deadSopenharmony_ci 4685bd8deadSopenharmony_ci The expectation is that a fragment shader authored for an API 4695bd8deadSopenharmony_ci with alternative fragment coordinate conventions is converted 4705bd8deadSopenharmony_ci into an OpenGL fragment shader. In this case, it's natural to 4715bd8deadSopenharmony_ci simply provide a way within the shader to express the originally 4725bd8deadSopenharmony_ci intended fragment coordinate convention. 4735bd8deadSopenharmony_ci 4745bd8deadSopenharmony_ci 5. Should this extension allow the pixel-center and origin choices 4755bd8deadSopenharmony_ci to be specified orthogonally? 4765bd8deadSopenharmony_ci 4775bd8deadSopenharmony_ci RESOLVED: Yes. 4785bd8deadSopenharmony_ci 4795bd8deadSopenharmony_ci Direct3D versions prior to DirectX 10 have an integer pixel-center 4805bd8deadSopenharmony_ci convention while DirectX 10 has a half-integer pixel-center 4815bd8deadSopenharmony_ci convention though all Direct3D versions use the upper-left origin. 4825bd8deadSopenharmony_ci 4835bd8deadSopenharmony_ci While RenderMan lacks access to a fragment coordinate during 4845bd8deadSopenharmony_ci shading, it uses an upper-left origin while the half-integer 4855bd8deadSopenharmony_ci pixel-center convention is most consistent with RenderMan's 4865bd8deadSopenharmony_ci rendering operation. 4875bd8deadSopenharmony_ci 4885bd8deadSopenharmony_ci The upper-left origin convention in combination with the 4895bd8deadSopenharmony_ci half-integer pixel-center convention is also interesting for 4905bd8deadSopenharmony_ci developing compositing window systems since window systems 4915bd8deadSopenharmony_ci typically assume an upper-left origin but compositing operations 4925bd8deadSopenharmony_ci based on texture mapping works best with half-integer pixel-center 4935bd8deadSopenharmony_ci convention. 4945bd8deadSopenharmony_ci 4955bd8deadSopenharmony_ci 6. Should there be pragmas and OPTIONs for specifying both the OpenGL 4965bd8deadSopenharmony_ci convention and the non-OpenGL convention? 4975bd8deadSopenharmony_ci 4985bd8deadSopenharmony_ci RESOLVED: Just provide pragmas and OPTIONS for the non-OpenGL 4995bd8deadSopenharmony_ci conventions. This avoids have to specify how multiple inconsistent 5005bd8deadSopenharmony_ci conventions are resolved. Inconsistent conventions are more 5015bd8deadSopenharmony_ci problematic for GLSL because multiple shader objects may be 5025bd8deadSopenharmony_ci specified with inconsistent conventions and the inconsistency is 5035bd8deadSopenharmony_ci then deferred until program object linking. 5045bd8deadSopenharmony_ci 5055bd8deadSopenharmony_ci Just allowing the non-OpenGL convention to be specified is simpler. 5065bd8deadSopenharmony_ci For GLSL, if any shader object has a non-OpenGL convention 5075bd8deadSopenharmony_ci specified, the convention applies to the linked program object. 5085bd8deadSopenharmony_ci 5095bd8deadSopenharmony_ci 7. Does this extension apply to the NV_fragment_program_option and 5105bd8deadSopenharmony_ci NV_fragment_program2 extensions? 5115bd8deadSopenharmony_ci 5125bd8deadSopenharmony_ci RESOLVED: Yes. These two extensions depend on the 5135bd8deadSopenharmony_ci ARB_fragment_program extension grammar which this extension 5145bd8deadSopenharmony_ci amends. 5155bd8deadSopenharmony_ci 5165bd8deadSopenharmony_ci 8. Should there be any API for querying the fragment coordinate 5175bd8deadSopenharmony_ci conventions a given GLSL fragment shader or assembly fragment 5185bd8deadSopenharmony_ci program requests? 5195bd8deadSopenharmony_ci 5205bd8deadSopenharmony_ci RESOLVED: No. 5215bd8deadSopenharmony_ci 5225bd8deadSopenharmony_ci There are not queries for other pragmas and OPTIONs. 5235bd8deadSopenharmony_ci 5245bd8deadSopenharmony_ci The text for the shader or program can be queried and it is easy 5255bd8deadSopenharmony_ci enough to parse the text to determine the behavior of the program. 5265bd8deadSopenharmony_ci 5275bd8deadSopenharmony_ci 9. This extension adds no new command or new tokens. Is that ok? 5285bd8deadSopenharmony_ci 5295bd8deadSopenharmony_ci RESOLVED: Yes. The functionality of this extension is exercised 5305bd8deadSopenharmony_ci by enabling extensions and OPTIONs in fragment shader/program source 5315bd8deadSopenharmony_ci text. If the extension string is advertised, you can assume the 5325bd8deadSopenharmony_ci specified syntax is parsed and put into effect. 5335bd8deadSopenharmony_ci 5345bd8deadSopenharmony_ci 10. Does the window origin convention apply to EXT_framebuffer_object 5355bd8deadSopenharmony_ci (FBO) and pixel buffer (pbuffer) rendering as well as window 5365bd8deadSopenharmony_ci rendering? 5375bd8deadSopenharmony_ci 5385bd8deadSopenharmony_ci RESOLVED: Yes. 5395bd8deadSopenharmony_ci 5405bd8deadSopenharmony_ci 11. Should this instead be a global state at the API level? This 5415bd8deadSopenharmony_ci means that, among other things, it will also affect the fixed 5425bd8deadSopenharmony_ci function pipeline? 5435bd8deadSopenharmony_ci 5445bd8deadSopenharmony_ci RESOLVED: The scope of this extension deals *only* with how the 5455bd8deadSopenharmony_ci fragment coordinate XY location appears during programming 5465bd8deadSopenharmony_ci fragment processing. 5475bd8deadSopenharmony_ci 5485bd8deadSopenharmony_ci See the Overview's third paragraph for the rationale for this 5495bd8deadSopenharmony_ci extension's scope. 5505bd8deadSopenharmony_ci 5515bd8deadSopenharmony_ci 12. For an implementation that does compile-time compilation (as 5525bd8deadSopenharmony_ci opposed to link-time or on-the-fly compilation), this would 5535bd8deadSopenharmony_ci appear to require the compiler to emit code to do the 5545bd8deadSopenharmony_ci transformation using internal uniforms regardless of whether it 5555bd8deadSopenharmony_ci is needed or not, because any other shader that it is linked 5565bd8deadSopenharmony_ci against may enable the pragma. 5575bd8deadSopenharmony_ci 5585bd8deadSopenharmony_ci Some possible alternatives, none of which is caveat-free: 5595bd8deadSopenharmony_ci a) Require all fragment shaders to be consistent in the presence 5605bd8deadSopenharmony_ci or absence of the pragma. That makes it impossible to link a 5615bd8deadSopenharmony_ci shader written with the pragma against a stock shader that 5625bd8deadSopenharmony_ci doesn't do anything with gl_FragCoord. 5635bd8deadSopenharmony_ci b) Apply the pragma only within the shader it appears in. That 5645bd8deadSopenharmony_ci removes the spooky action at a distance (where linking another 5655bd8deadSopenharmony_ci shader in changes the behaviour of an existing one) - but if 5665bd8deadSopenharmony_ci your hardware has some magic knobs to implement these pragmas, 5675bd8deadSopenharmony_ci that may no longer be sufficient if there are multiple 5685bd8deadSopenharmony_ci flavours of gl_FragCoord in the same program. 5695bd8deadSopenharmony_ci c) Make this global state. See Issue 11. 5705bd8deadSopenharmony_ci 5715bd8deadSopenharmony_ci RESOLVED: Because this extension's pragmas only support requesting 5725bd8deadSopenharmony_ci a half-pixel fragment coordinate system and/or an upper-left 5735bd8deadSopenharmony_ci coordinate system, there is no way for multiple fragment shader 5745bd8deadSopenharmony_ci objects to specify an inconsistent fragment coordinate system. 5755bd8deadSopenharmony_ci This means for a given set of fragment shaders being linked 5765bd8deadSopenharmony_ci into a program object, there is exactly one fragment coordinate 5775bd8deadSopenharmony_ci convention. 5785bd8deadSopenharmony_ci 5795bd8deadSopenharmony_ci (Fragment coordinate conventions are parsed and ignored for 5805bd8deadSopenharmony_ci non-fragment shader objects. Generating a warning in the info 5815bd8deadSopenharmony_ci log when the pragma is ignored by non-fragment shader objects is 5825bd8deadSopenharmony_ci a reasonable response in this situation.) 5835bd8deadSopenharmony_ci 5845bd8deadSopenharmony_ci Option b is not desirable because there should be exactly one 5855bd8deadSopenharmony_ci convention within a single linked program object. Each fragment 5865bd8deadSopenharmony_ci shader object linked within a program object should not be allowed 5875bd8deadSopenharmony_ci its own convention. The expected usage is shaders written for 5885bd8deadSopenharmony_ci DirectX 9 or 10 will be compiled with these pragmas appropriately; 5895bd8deadSopenharmony_ci such shaders only need one convention. This extension assumes 5905bd8deadSopenharmony_ci implementations supporting this extension likely have hardware 5915bd8deadSopenharmony_ci modes that support both the OpenGL, DirectX 9, and DirectX 10 5925bd8deadSopenharmony_ci conventions for a given fragment shader without require extra 5935bd8deadSopenharmony_ci hidden uniforms. 5945bd8deadSopenharmony_ci 5955bd8deadSopenharmony_ci Option c is not desirable because the fragment coordinate 5965bd8deadSopenharmony_ci convention really is a property of each shader rather than 5975bd8deadSopenharmony_ci global state. A shader assuming OpenGL's conventional lower-left 5985bd8deadSopenharmony_ci convention expects to be able to add (0,1) to the fragment's 5995bd8deadSopenharmony_ci (x,y) location and move "up" a pixel. Whereas a similar shader 6005bd8deadSopenharmony_ci coded for Direct3D would assume adding (0,1) to the fragment's 6015bd8deadSopenharmony_ci (x,y) would move "down" a pixel. Controlling the fragment 6025bd8deadSopenharmony_ci coordinate convention from a global state setting is irrelevant to 6035bd8deadSopenharmony_ci fixed-function processing (where the fragment coordinate position 6045bd8deadSopenharmony_ci is never available). 6055bd8deadSopenharmony_ci 6065bd8deadSopenharmony_ci NOTE: much of the above discussion is largely irrelevant now that 6075bd8deadSopenharmony_ci this extension uses layout qualifiers. As noted in the 6085bd8deadSopenharmony_ci shading language additions above, all redeclarations of gl_FragCoord 6095bd8deadSopenharmony_ci must use the same set of qualifiers. If a shader does not have a 6105bd8deadSopenharmony_ci static use of gl_FragCoord it doesn't need to redeclare it. It is 6115bd8deadSopenharmony_ci link-time error if multiple compilation units have inconsistent 6125bd8deadSopenharmony_ci qualifiers. 6135bd8deadSopenharmony_ci 6145bd8deadSopenharmony_ci 13. Is this "pragma" enough to provide DX compatibility? The 6155bd8deadSopenharmony_ci following items may need to be addressed as well: 6165bd8deadSopenharmony_ci a) edge rule: because of the y-inversion, rendering in DX mode or 6175bd8deadSopenharmony_ci OGL mode is not equivalent (upper and lower edges are not 6185bd8deadSopenharmony_ci rendered the same) 6195bd8deadSopenharmony_ci b) gl_FragCoord value: this is addressed by this proposal 6205bd8deadSopenharmony_ci c) viewport/scissor: if the shader is changed, it seems that 6215bd8deadSopenharmony_ci there will be a mismatch with the value given to 6225bd8deadSopenharmony_ci viewport/scissor which need to have the y-inversion as well. 6235bd8deadSopenharmony_ci d) face ordering: if this adjusts the viewport, it will 6245bd8deadSopenharmony_ci implicitly toggle the face ordering between CW and CCW. 6255bd8deadSopenharmony_ci e) sample position? 6265bd8deadSopenharmony_ci 6275bd8deadSopenharmony_ci RESOLVED: The scope of this extension deals *only* with how 6285bd8deadSopenharmony_ci the fragment coordinate XY location appears during programming 6295bd8deadSopenharmony_ci fragment processing. 6305bd8deadSopenharmony_ci 6315bd8deadSopenharmony_ci Trying to address these is a much bigger undertaking than was 6325bd8deadSopenharmony_ci intended here, and is precisely why it was speced this way (to 6335bd8deadSopenharmony_ci avoid touching these issues). 6345bd8deadSopenharmony_ci 6355bd8deadSopenharmony_ci See the Overview's third paragraph for the rationale for this 6365bd8deadSopenharmony_ci extension's scope. 6375bd8deadSopenharmony_ci 6385bd8deadSopenharmony_ci 14. Could this instead be done with functions (built-in or otherwise) 6395bd8deadSopenharmony_ci in GLSL? Since the purpose of this extension seems to be to 6405bd8deadSopenharmony_ci *ONLY* modify the gl_FragCoord when accessed in the fragment 6415bd8deadSopenharmony_ci shader, couldn't one just write a GLSL function which does the 6425bd8deadSopenharmony_ci same thing? 6435bd8deadSopenharmony_ci 6445bd8deadSopenharmony_ci RESOLVED: The scope of this extension is really limited to 6455bd8deadSopenharmony_ci support the straightforward translation of shaders written assuming 6465bd8deadSopenharmony_ci Direct3D's fragment coordinate conventions into OpenGL. 6475bd8deadSopenharmony_ci 6485bd8deadSopenharmony_ci The intent is NOT to allow multiple conventions to be used with 6495bd8deadSopenharmony_ci in the fragment domain of a single program object. 6505bd8deadSopenharmony_ci 6515bd8deadSopenharmony_ci The intent is also to support Direct3D's fragment coordinate 6525bd8deadSopenharmony_ci conventions in a way that can leverage existing hardware modes 6535bd8deadSopenharmony_ci used to support both OpenGL and Direct3D. This is desirable 6545bd8deadSopenharmony_ci because it avoids the introduction of extra "hidden" uniforms 6555bd8deadSopenharmony_ci (to store a value such as the current window height). 6565bd8deadSopenharmony_ci 6575bd8deadSopenharmony_ci If you support a "different" gl_FragCoord or provide a function 6585bd8deadSopenharmony_ci to return a Direct3D-style fragment coordinate, that introduces 6595bd8deadSopenharmony_ci the possibility that multiple fragment coordinate conventions can 6605bd8deadSopenharmony_ci exist in the same fragment shader program. The pragma approach 6615bd8deadSopenharmony_ci precludes this. 6625bd8deadSopenharmony_ci 6635bd8deadSopenharmony_ci 15. Is the intent that the window origin convention is automatically 6645bd8deadSopenharmony_ci adjusted for onscreen (in a window) vs offscreen rendering (FBOs 6655bd8deadSopenharmony_ci or pbuffers)? ie if you have a fragment shader which is used with 6665bd8deadSopenharmony_ci both onscreen and offscreen rendering is it the application's 6675bd8deadSopenharmony_ci responsibility to track this and specify the appropriate window 6685bd8deadSopenharmony_ci convention (and potentially recompile the shader), or does this 6695bd8deadSopenharmony_ci happen automatically. 6705bd8deadSopenharmony_ci 6715bd8deadSopenharmony_ci RESOLVED: The fragment coordinate convention is specified with 6725bd8deadSopenharmony_ci respect to OpenGL window coordinates. 6735bd8deadSopenharmony_ci 6745bd8deadSopenharmony_ci This means developers don't need to be aware if they are rendering 6755bd8deadSopenharmony_ci to a framebuffer object (FBO), pixel buffer (pbuffer), or window. 6765bd8deadSopenharmony_ci 6775bd8deadSopenharmony_ci The application doesn't have to "track" how the fragment shader 6785bd8deadSopenharmony_ci is used. 6795bd8deadSopenharmony_ci 6805bd8deadSopenharmony_ci The expectation is that there is no need to recompile a fragment 6815bd8deadSopenharmony_ci shader as the expectation is hardware modes exist to control the 6825bd8deadSopenharmony_ci window space origin appropriately. 6835bd8deadSopenharmony_ci 6845bd8deadSopenharmony_ci 16. Is there another way this could be specified other than a 6855bd8deadSopenharmony_ci #pragma? Some people aren't keen on the use of a pragma for this. 6865bd8deadSopenharmony_ci Other possibilities include providing a renamed gl_FragCoord with 6875bd8deadSopenharmony_ci the different semantics, or allowing gl_FragCoord to be redefined 6885bd8deadSopenharmony_ci in the shader with the desired qualifiers (similar to the 6895bd8deadSopenharmony_ci invariant qualifier)? 6905bd8deadSopenharmony_ci 6915bd8deadSopenharmony_ci RESOLVED: Yes. This has been recast to use layout qualifiers 6925bd8deadSopenharmony_ci originally introduced in GLSL 1.40 and extended in GLSL 1.50. 6935bd8deadSopenharmony_ci However note that it is the intent of this extension to stand 6945bd8deadSopenharmony_ci separately from the GLSL 1.40/1.50 and it is desinged to be 6955bd8deadSopenharmony_ci implementable against GLSL 1.10 or 1.20. 6965bd8deadSopenharmony_ci 6975bd8deadSopenharmony_ci 17. If this extension doesn't actually change how the window space 6985bd8deadSopenharmony_ci positions are calculated and *only* modifies the gl_FragCoord 6995bd8deadSopenharmony_ci which is visible in the fragment shader/program, how does this 7005bd8deadSopenharmony_ci actually help an application which is using shaders which have 7015bd8deadSopenharmony_ci the assumption of integer pixel centers baked in (and thus 7025bd8deadSopenharmony_ci manually adjusting for the 0.5 offset) and which aren't accessing 7035bd8deadSopenharmony_ci gl_FragCoord (or equivalent) directly? 7045bd8deadSopenharmony_ci 7055bd8deadSopenharmony_ci RESOLVED: The scope of this extension deals *only* with how 7065bd8deadSopenharmony_ci the fragment coordinate XY location appears during programming 7075bd8deadSopenharmony_ci fragment processing. 7085bd8deadSopenharmony_ci 7095bd8deadSopenharmony_ci See the Overview's third paragraph for the rationale for this 7105bd8deadSopenharmony_ci extension's scope. 7115bd8deadSopenharmony_ci 7125bd8deadSopenharmony_ci This extension simplifies the complicating task of converting 7135bd8deadSopenharmony_ci OpenGL-style (lower-left, half-pixel) fragment coordinates to 7145bd8deadSopenharmony_ci Direct3D-style fragment coordinates in a way that allows existing 7155bd8deadSopenharmony_ci hardware mechanisms to support both OpenGL and Direct3D's 7165bd8deadSopenharmony_ci conventions to be leveraged. In particular, "hidden" uniforms to 7175bd8deadSopenharmony_ci track the current window height can be avoided when this is often 7185bd8deadSopenharmony_ci already maintained by the hardware. 7195bd8deadSopenharmony_ci 7205bd8deadSopenharmony_ciRevision History 7215bd8deadSopenharmony_ci 7225bd8deadSopenharmony_ci Rev. Date Author Changes 7235bd8deadSopenharmony_ci ---- -------- --------- ---------------------------------------- 7245bd8deadSopenharmony_ci 1 1/08/07 mjk Initial version 7255bd8deadSopenharmony_ci 2 11/5/08 mjk Feedback from Destineer 7265bd8deadSopenharmony_ci 3 3/27/09 dgkoch Add issue 11 7275bd8deadSopenharmony_ci 4 5/01/09 dgkoch fix typo, add discussion on issue 11 7285bd8deadSopenharmony_ci add issues 12,13 based on comments from PB and BM 7295bd8deadSopenharmony_ci 5 5/07/09 dgkoch Update issue 13, add issues 14-17 7305bd8deadSopenharmony_ci 6 5/11/09 mjk Work with Daniel Koch too: 7315bd8deadSopenharmony_ci Improve overview to clarify the extension's scope 7325bd8deadSopenharmony_ci Add resolutions to issues 11 through 17 7335bd8deadSopenharmony_ci Change language to make clear that pragmas apply 7345bd8deadSopenharmony_ci to fragment shaders only; they are accepted but 7355bd8deadSopenharmony_ci totally ignored for other shader types 7365bd8deadSopenharmony_ci 7 5/15/09 dgkoch fix date and a few typos 7375bd8deadSopenharmony_ci 8 5/19/09 dgkoch renamed as ARB extension 7385bd8deadSopenharmony_ci 9 6/26/09 dgkoch add #extension mechanism 7395bd8deadSopenharmony_ci recast GLSL using layout qualifiers as in GLSL 1.50 7405bd8deadSopenharmony_ci synced up with GL3.2 changes/rebased on GL3.1 7415bd8deadSopenharmony_ci updated some issue resolutions 7425bd8deadSopenharmony_ci added interactions with ARB_compatibility 7435bd8deadSopenharmony_ci 10 8/02/09 Jon Leech Reformat to 80 columns and assign ARB 7445bd8deadSopenharmony_ci extension number. 7455bd8deadSopenharmony_ci 746