15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_viewport_swizzle 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_viewport_swizzle 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com) 125bd8deadSopenharmony_ci Pat Brown, NVIDIA Corporation (pbrown 'at' nvidia.com) 135bd8deadSopenharmony_ci 145bd8deadSopenharmony_ciContributors 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ci Mathias Heyer, NVIDIA 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciStatus 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Shipping. 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciVersion 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci Last Modified Date: April 7, 2015 255bd8deadSopenharmony_ci Revision: 1 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciNumber 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci OpenGL Extension #483 305bd8deadSopenharmony_ci OpenGL ES Extension #258 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciDependencies 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci This extension is written against the OpenGL 4.3 specification 355bd8deadSopenharmony_ci (Compatibility Profile). 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci This extension interacts with the OpenGL ES 3.1 (March 17, 2014) 385bd8deadSopenharmony_ci specification. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci This extension interacts with NV_viewport_array2. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ciOverview 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ci This extension provides a new per-viewport swizzle that can modify the 455bd8deadSopenharmony_ci position of primitives sent to each viewport. New viewport swizzle state 465bd8deadSopenharmony_ci is added for each viewport, and a new position vector is computed for each 475bd8deadSopenharmony_ci vertex by selecting from and optionally negating any of the four 485bd8deadSopenharmony_ci components of the original position vector. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci This new viewport swizzle is useful for a number of algorithms, including 515bd8deadSopenharmony_ci single-pass cubemap rendering (broadcasting a primitive to multiple faces 525bd8deadSopenharmony_ci and reorienting the vertex position for each face) and voxel 535bd8deadSopenharmony_ci rasterization. The per-viewport component remapping and negation provided 545bd8deadSopenharmony_ci by the swizzle allows application code to re-orient three-dimensional 555bd8deadSopenharmony_ci geometry with a view along any of the X, Y, or Z axes. If a perspective 565bd8deadSopenharmony_ci projection and depth buffering is required, 1/W buffering should be used, 575bd8deadSopenharmony_ci as described in the single-pass cubemap rendering example in the "Issues" 585bd8deadSopenharmony_ci section below. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ciNew Procedures and Functions 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci void ViewportSwizzleNV(uint index, 635bd8deadSopenharmony_ci enum swizzlex, enum swizzley, 645bd8deadSopenharmony_ci enum swizzlez, enum swizzlew); 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ciNew Tokens 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci Accepted by the <swizzlex>, <swizzley>, <swizzlez>, and <swizzlew> 695bd8deadSopenharmony_ci parameters of ViewportSwizzleNV: 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350 725bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351 735bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352 745bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353 755bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354 765bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355 775bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356 785bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleani_v, GetDoublei_v, 815bd8deadSopenharmony_ci GetIntegeri_v, GetFloati_v, and GetInteger64i_v: 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_X_NV 0x9358 845bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_Y_NV 0x9359 855bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_Z_NV 0x935A 865bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_W_NV 0x935B 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ciAdditions to Chapter 13 of the OpenGL 4.3 (Compatibility Profile) 895bd8deadSopenharmony_ciSpecification (Fixed-Function Vertex Post-Processing) 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci Modify Section 13.2 (Transform Feedback), p. 453 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci Modify the first paragraph: 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ci ...The vertices are fed back after vertex color clamping, but before 965bd8deadSopenharmony_ci viewport swizzling and viewport mask expansion, flatshading, and 975bd8deadSopenharmony_ci clipping. ... 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci Add a new Section 13.X (Viewport Swizzle) after 13.3 (Primitive Queries) 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci Each primitive sent to a given viewport has a swizzle and optional 1035bd8deadSopenharmony_ci negation applied to its clip coordinates. The swizzle that is applied 1045bd8deadSopenharmony_ci depends on the viewport index, and is controlled by the command 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci void ViewportSwizzleNV(uint index, 1075bd8deadSopenharmony_ci enum swizzlex, enum swizzley, 1085bd8deadSopenharmony_ci enum swizzlez, enum swizzlew); 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci The viewport specified by <index> has its x,y,z,w swizzle state set to the 1115bd8deadSopenharmony_ci corresponding <swizzlex>, <swizzley>, <swizzlez>, <swizzlew> value. If the 1125bd8deadSopenharmony_ci value of VIEWPORT_SWIZZLE_X_NV is denoted by <swizzlex>, swizzling computes 1135bd8deadSopenharmony_ci the new x component of the position as 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci if (swizzlex == VIEWPORT_SWIZZLE_POSITIVE_X_NV) x' = x; 1165bd8deadSopenharmony_ci if (swizzlex == VIEWPORT_SWIZZLE_NEGATIVE_X_NV) x' = -x; 1175bd8deadSopenharmony_ci if (swizzlex == VIEWPORT_SWIZZLE_POSITIVE_Y_NV) x' = y; 1185bd8deadSopenharmony_ci if (swizzlex == VIEWPORT_SWIZZLE_NEGATIVE_Y_NV) x' = -y; 1195bd8deadSopenharmony_ci if (swizzlex == VIEWPORT_SWIZZLE_POSITIVE_Z_NV) x' = z; 1205bd8deadSopenharmony_ci if (swizzlex == VIEWPORT_SWIZZLE_NEGATIVE_Z_NV) x' = -z; 1215bd8deadSopenharmony_ci if (swizzlex == VIEWPORT_SWIZZLE_POSITIVE_W_NV) x' = w; 1225bd8deadSopenharmony_ci if (swizzlex == VIEWPORT_SWIZZLE_NEGATIVE_W_NV) x' = -w; 1235bd8deadSopenharmony_ci 1245bd8deadSopenharmony_ci Similar selections are performed for the y, z, and w coordinates. This 1255bd8deadSopenharmony_ci swizzling is applied after transform feedback, but before clipping and 1265bd8deadSopenharmony_ci perspective divide. 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ci Errors: 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ci - The error INVALID_VALUE is generated if <index> is greater than or equal 1315bd8deadSopenharmony_ci to the value of MAX_VIEWPORTS. 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci - The error INVALID_ENUM is generated if any of <swizzlex>, <swizzley>, 1345bd8deadSopenharmony_ci <swizzlez>, or <swizzlew> are not one of 1355bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_{POSITIVE,NEGATIVE}_{X,Y,Z,W}. 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci Modify Section 13.6.1 (Controlling the Viewport) 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ci (modify the first paragraph, p. 470, as edited by NV_viewport_array2, 1415bd8deadSopenharmony_ci using "transformed and swizzled" instead of "transformed") 1425bd8deadSopenharmony_ci 1435bd8deadSopenharmony_ci Multiple viewports are available ... The primitive is transformed and 1445bd8deadSopenharmony_ci swizzled using the state of the selected viewport. ... 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ci ... If bit <i> is set in the mask, the primitive is emitted to viewport 1475bd8deadSopenharmony_ci <i> and transformed and swizzled using the state of viewport <i>. ... 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ciNew Implementation Dependent State 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ci None. 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ciNew State 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci Get Value Get Command Type Initial Value Description Sec. Attribute 1575bd8deadSopenharmony_ci --------- ----------- ---- ------------- ----------- ---- --------- 1585bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_X_NV GetIntegeri_v nxZ8 VIEWPORT_SWIZZLE- coordinate and sign for 13.X viewport 1595bd8deadSopenharmony_ci POSITIVE_X viewport swizzling 1605bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_Y_NV GetIntegeri_v nxZ8 VIEWPORT_SWIZZLE- coordinate and sign for 13.X viewport 1615bd8deadSopenharmony_ci POSITIVE_Y viewport swizzling 1625bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_Z_NV GetIntegeri_v nxZ8 VIEWPORT_SWIZZLE- coordinate and sign for 13.X viewport 1635bd8deadSopenharmony_ci POSITIVE_Z viewport swizzling 1645bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_W_NV GetIntegeri_v nxZ8 VIEWPORT_SWIZZLE- coordinate and sign for 13.X viewport 1655bd8deadSopenharmony_ci POSITIVE_W viewport swizzling 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ci None. 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ciGLX Protocol 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci None. 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ciErrors 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci The error INVALID_VALUE is generated by ViewportSwizzleNV if <index> is 1785bd8deadSopenharmony_ci greater than or equal to the value of MAX_VIEWPORTS. 1795bd8deadSopenharmony_ci 1805bd8deadSopenharmony_ci The error INVALID_ENUM is generated by ViewportSwizzleNV if any of 1815bd8deadSopenharmony_ci <swizzlex>, <swizzley>, <swizzlez>, or <swizzlew> are not one of 1825bd8deadSopenharmony_ci VIEWPORT_SWIZZLE_{POSITIVE,NEGATIVE}_{X,Y,Z,W}. 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ciInteractions with OpenGL ES 3.1 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci Remove references to GetDoublei_v and GetBooleani_v. Also remove the 1875bd8deadSopenharmony_ci reference to 'vertex color clamping'. 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ciInteractions with NV_viewport_array2 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci This specification modifies language added/changed by NV_viewport_array2. 1925bd8deadSopenharmony_ci There are no functional interactions between the two extensions, though we 1935bd8deadSopenharmony_ci expect that all implementations of this extension will support 1945bd8deadSopenharmony_ci NV_viewport_array2 or similar functionality. 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ciIssues 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci (1) Where does viewport swizzling occur in the pipeline? 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci RESOLVED: Despite being associated with the viewport, viewport swizzling 2015bd8deadSopenharmony_ci must happen prior to the viewport transform. In particular, it needs to 2025bd8deadSopenharmony_ci be performed before clipping and perspective division. 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci The viewport mask expansion (NV_viewport_array2) and the viewport swizzle 2055bd8deadSopenharmony_ci could potentially be performed before or after transform feedback, but 2065bd8deadSopenharmony_ci feeding back several viewports worth of primitives with different swizzles 2075bd8deadSopenharmony_ci doesn't seem particularly useful. This specification applies the viewport 2085bd8deadSopenharmony_ci mask and swizzle after transform feedback, and makes primitive queries 2095bd8deadSopenharmony_ci only count each primitive once. 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci (2) Any interesting examples of how this extension, NV_viewport_array2, 2125bd8deadSopenharmony_ci and NV_geometry_shader_passthrough can be used together in practice? 2135bd8deadSopenharmony_ci 2145bd8deadSopenharmony_ci RESOLVED: One interesting use case for this extension is for single-pass 2155bd8deadSopenharmony_ci rendering to a cubemap. In this example, the application would attach a 2165bd8deadSopenharmony_ci cubemap texture to a layered FBO where the six cube faces are treated as 2175bd8deadSopenharmony_ci layers. Vertices are sent through the vertex shader without applying a 2185bd8deadSopenharmony_ci projection matrix, where the gl_Position output is (x,y,z,1) and the 2195bd8deadSopenharmony_ci center of the cubemap is at (0,0,0). With unextended OpenGL, one could 2205bd8deadSopenharmony_ci have a conventional instanced geometry shader that looks something like 2215bd8deadSopenharmony_ci the following: 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci layout(invocations = 6) in; // separate invocation per face 2245bd8deadSopenharmony_ci layout(triangles) in; 2255bd8deadSopenharmony_ci layout(triangle_strip) out; 2265bd8deadSopenharmony_ci layout(max_vertices = 3) out; 2275bd8deadSopenharmony_ci 2285bd8deadSopenharmony_ci in Inputs { 2295bd8deadSopenharmony_ci vec2 texcoord; 2305bd8deadSopenharmony_ci vec3 normal; 2315bd8deadSopenharmony_ci vec4 baseColor; 2325bd8deadSopenharmony_ci } v[]; 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci out Outputs { 2355bd8deadSopenharmony_ci vec2 texcoord; 2365bd8deadSopenharmony_ci vec3 normal; 2375bd8deadSopenharmony_ci vec4 baseColor; 2385bd8deadSopenharmony_ci }; 2395bd8deadSopenharmony_ci 2405bd8deadSopenharmony_ci void main() 2415bd8deadSopenharmony_ci { 2425bd8deadSopenharmony_ci int face = gl_InvocationID; // which face am I? 2435bd8deadSopenharmony_ci 2445bd8deadSopenharmony_ci // Project gl_Position for each vertex onto the cube map face. 2455bd8deadSopenharmony_ci vec4 positions[3]; 2465bd8deadSopenharmony_ci for (int i = 0; i < 3; i++) { 2475bd8deadSopenharmony_ci positions[i] = rotate(gl_in[i].gl_Position, face); 2485bd8deadSopenharmony_ci } 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci // If the primitive doesn't project onto this face, we're done. 2515bd8deadSopenharmony_ci if (shouldCull(positions)) { 2525bd8deadSopenharmony_ci return; 2535bd8deadSopenharmony_ci } 2545bd8deadSopenharmony_ci 2555bd8deadSopenharmony_ci // Otherwise, emit a copy of the input primitive to the 2565bd8deadSopenharmony_ci // appropriate face (using gl_Layer). 2575bd8deadSopenharmony_ci for (int i = 0; i < 3; i++) { 2585bd8deadSopenharmony_ci gl_Layer = face; 2595bd8deadSopenharmony_ci gl_Position = positions[i]; 2605bd8deadSopenharmony_ci texcoord = v[i].texcoord; 2615bd8deadSopenharmony_ci normal = v[i].normal; 2625bd8deadSopenharmony_ci baseColor = v[i].baseColor; 2635bd8deadSopenharmony_ci EmitVertex(); 2645bd8deadSopenharmony_ci } 2655bd8deadSopenharmony_ci } 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ci With passthrough geometry shaders, this can be done using a much simpler 2685bd8deadSopenharmony_ci shader: 2695bd8deadSopenharmony_ci 2705bd8deadSopenharmony_ci layout(triangles) in; 2715bd8deadSopenharmony_ci layout(passthrough) in Inputs { 2725bd8deadSopenharmony_ci vec2 texcoord; 2735bd8deadSopenharmony_ci vec3 normal; 2745bd8deadSopenharmony_ci vec4 baseColor; 2755bd8deadSopenharmony_ci } 2765bd8deadSopenharmony_ci layout(passthrough) in gl_PerVertex { 2775bd8deadSopenharmony_ci vec4 gl_Position; 2785bd8deadSopenharmony_ci } gl_in[]; 2795bd8deadSopenharmony_ci layout(viewport_relative) out int gl_Layer; 2805bd8deadSopenharmony_ci 2815bd8deadSopenharmony_ci void main() 2825bd8deadSopenharmony_ci { 2835bd8deadSopenharmony_ci // Figure out which faces the primitive projects onto and 2845bd8deadSopenharmony_ci // generate a corresponding viewport mask. 2855bd8deadSopenharmony_ci uint mask = 0; 2865bd8deadSopenharmony_ci for (int i = 0; i < 6; i++) { 2875bd8deadSopenharmony_ci if (!shouldCull(face)) { 2885bd8deadSopenharmony_ci mask |= 1U << i; 2895bd8deadSopenharmony_ci } 2905bd8deadSopenharmony_ci } 2915bd8deadSopenharmony_ci gl_ViewportMask = mask; 2925bd8deadSopenharmony_ci gl_Layer = 0; 2935bd8deadSopenharmony_ci } 2945bd8deadSopenharmony_ci 2955bd8deadSopenharmony_ci The application code is set up so that each of the six cube faces has a 2965bd8deadSopenharmony_ci separate viewport (numbered 0..5). Each face also has a separate swizzle, 2975bd8deadSopenharmony_ci programmed via the ViewportSwizzleNV() command. The viewport swizzle 2985bd8deadSopenharmony_ci feature performs the coordinate transformation handled by the rotate() 2995bd8deadSopenharmony_ci function in the original shader. The "viewport_relative" layout qualifier 3005bd8deadSopenharmony_ci says that the viewport number (0..5) is added to the base gl_Layer value 3015bd8deadSopenharmony_ci of zero to determine which layer (cube face) the primitive should be sent 3025bd8deadSopenharmony_ci to. 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci Note that the use of the passed through input <normal> in this example 3055bd8deadSopenharmony_ci suggests that the fragment shader in this example would perform an 3065bd8deadSopenharmony_ci operation like per-fragment lighting. The viewport swizzle would 3075bd8deadSopenharmony_ci transform the position to be face-relative, but <normal> would remain in 3085bd8deadSopenharmony_ci the original coordinate system. It seems likely that the fragment shader 3095bd8deadSopenharmony_ci in either version of the example would want to perform lighting in the 3105bd8deadSopenharmony_ci original coordinate system. It would likely do this by reconstructing the 3115bd8deadSopenharmony_ci position of the fragment in the original coordinate system using 3125bd8deadSopenharmony_ci gl_FragCoord, a constant or uniform holding the size of the cube face, and 3135bd8deadSopenharmony_ci the input gl_ViewportIndex (or gl_Layer), which identifies the cube face. 3145bd8deadSopenharmony_ci Since the value of <normal> is in the original coordinate system, it would 3155bd8deadSopenharmony_ci not need to be modified as part of this coordinate transformation. 3165bd8deadSopenharmony_ci 3175bd8deadSopenharmony_ci Note that while the rotate() operation in the regular geometry shader 3185bd8deadSopenharmony_ci above could include an arbitrary post-rotation projection matrix, the 3195bd8deadSopenharmony_ci viewport swizzle does not support arbitrary math. To get proper 3205bd8deadSopenharmony_ci projection, 1/W buffering should be used. To do this: 3215bd8deadSopenharmony_ci 3225bd8deadSopenharmony_ci (1) Program the viewport swizzles to move the pre-projection W eye 3235bd8deadSopenharmony_ci coordinate (typically 1.0) into the Z coordinate of the swizzle output 3245bd8deadSopenharmony_ci and the eye coordinate component used for depth into the W coordinate. 3255bd8deadSopenharmony_ci For example, the viewport corresponding to the +Z face might use a 3265bd8deadSopenharmony_ci swizzle of (+X, -Y, +W, +Z). The Z normalized device coordinate 3275bd8deadSopenharmony_ci computed after swizzling would then be z'/w' = 1/Z_eye. 3285bd8deadSopenharmony_ci 3295bd8deadSopenharmony_ci (2a) On NVIDIA implementations supporting floating-point depth buffers 3305bd8deadSopenharmony_ci with values outside [0,1], prevent unwanted near plane clipping by 3315bd8deadSopenharmony_ci enabling DEPTH_CLAMP. Ensure that the depth clamp doesn't mess up depth 3325bd8deadSopenharmony_ci testing by programming the depth range to very large values, such as 3335bd8deadSopenharmony_ci glDepthRangedNV(-z, +z), where z == 2^127. It should be possible to use 3345bd8deadSopenharmony_ci IEEE infinity encodings also (0xFF800000 for -INF, 0x7F800000 for +INF). 3355bd8deadSopenharmony_ci Even when near/far clipping is disabled, primitives extending behind the 3365bd8deadSopenharmony_ci eye will still be clipped because one or more vertices will have a 3375bd8deadSopenharmony_ci negative W coordinate and fail X/Y clipping tests. 3385bd8deadSopenharmony_ci 3395bd8deadSopenharmony_ci (2b) On other implementations, scale X, Y, and Z eye coordinates so that 3405bd8deadSopenharmony_ci vertices on the near plane have a post-swizzle W coordinate of 1.0. For 3415bd8deadSopenharmony_ci example, if the near plane is at Z_eye = 1/256, scale X, Y, and Z by 3425bd8deadSopenharmony_ci 256. Also, ideally, program the depth range transformation to be a NOP 3435bd8deadSopenharmony_ci by using a clip control depth mode (OpenGL 4.5) of ZERO_TO_ONE. 3445bd8deadSopenharmony_ci 3455bd8deadSopenharmony_ci (3) Adjust depth testing to reflect the fact that 1/W values are large 3465bd8deadSopenharmony_ci near the eye and small away from the eye. Clear the depth buffer to 3475bd8deadSopenharmony_ci zero (infinitely far away) and use a depth test of GREATER instead of 3485bd8deadSopenharmony_ci LESS. 3495bd8deadSopenharmony_ci 3505bd8deadSopenharmony_ciRevision History 3515bd8deadSopenharmony_ci 3525bd8deadSopenharmony_ci Revision 1 3535bd8deadSopenharmony_ci - Internal revisions. 354