15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    ARB_half_float_pixel
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_ARB_half_float_pixel
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Pat Brown
125bd8deadSopenharmony_ci    Jon Leech
135bd8deadSopenharmony_ci    Rob Mace
145bd8deadSopenharmony_ci    Brian Paul
155bd8deadSopenharmony_ci
165bd8deadSopenharmony_ciContact
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ci    Dale Kirkland, NVIDIA (dkirkland 'at' nvidia.com)
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ciNotice
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ci    Copyright (c) 2004-2013 The Khronos Group Inc. Copyright terms at
235bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ciSpecification Update Policy
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
285bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
295bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
305bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
315bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
325bd8deadSopenharmony_ci    described in more detail at
335bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ciStatus
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci    Complete. Approved by the ARB on October 22, 2004.
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ciVersion
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ci    Last Modified Date:  October 1, 2004
425bd8deadSopenharmony_ci    Version:             6
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ciNumber
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    ARB Extension #40
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ciDependencies
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    This extension is written against the OpenGL 2.0 Specification
515bd8deadSopenharmony_ci    but will work with the OpenGL 1.5 Specification.
525bd8deadSopenharmony_ci
535bd8deadSopenharmony_ci    Based on the NV_half_float extension.
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    This extension interacts with ARB_color_buffer_float.
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ciOverview
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    This extension introduces a new data type for half-precision (16-bit)
605bd8deadSopenharmony_ci    floating-point quantities.  The floating-point format is very similar
615bd8deadSopenharmony_ci    to the IEEE single-precision floating-point standard, except that it
625bd8deadSopenharmony_ci    has only 5 exponent bits and 10 mantissa bits.  Half-precision floats
635bd8deadSopenharmony_ci    are smaller than full precision floats and provide a larger dynamic
645bd8deadSopenharmony_ci    range than similarly sized normalized scalar data types.
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    This extension allows applications to use half-precision floating-
675bd8deadSopenharmony_ci    point data when specifying pixel data.  It extends the existing image
685bd8deadSopenharmony_ci    specification commands to accept the new data type.
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci    Floating-point data is clamped to [0, 1] at various places in the
715bd8deadSopenharmony_ci    GL unless clamping is disabled with the ARB_color_buffer_float
725bd8deadSopenharmony_ci    extension.
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ciIP Status
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci    SGI owns US Patent #6,650,327, issued November 18, 2003. SGI
775bd8deadSopenharmony_ci    believes this patent contains necessary IP for graphics systems
785bd8deadSopenharmony_ci    implementing floating point (FP) rasterization and FP framebuffer
795bd8deadSopenharmony_ci    capabilities.
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    SGI will not grant the ARB royalty-free use of this IP for use in
825bd8deadSopenharmony_ci    OpenGL, but will discuss licensing on RAND terms, on an individual
835bd8deadSopenharmony_ci    basis with companies wishing to use this IP in the context of
845bd8deadSopenharmony_ci    conformant OpenGL implementations. SGI does not plan to make any
855bd8deadSopenharmony_ci    special exemption for open source implementations.
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    Contact Doug Crisman at SGI Legal for the complete IP disclosure.
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ciIssues
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci    1. How is this extension different from the NV_half_float extension?
925bd8deadSopenharmony_ci
935bd8deadSopenharmony_ci       This extension does not add new commands for specifying half-
945bd8deadSopenharmony_ci       precision vertex data, and all imaging functions have been listed
955bd8deadSopenharmony_ci       for supporting the "half" type.
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ci    2. What should the new data type be called?  "half"?  "hfloat"?
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci       RESOLVED:  half .  This convention builds on the convention of
1005bd8deadSopenharmony_ci       using the type "double" to describe double-precision floating-
1015bd8deadSopenharmony_ci       point numbers.  Here, "half" will refer to half-precision
1025bd8deadSopenharmony_ci       floating-point numbers.
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci       Even though the 16-bit float data type is a first-class data type,
1055bd8deadSopenharmony_ci       it is still more problematic than the other types in the sense
1065bd8deadSopenharmony_ci       that no native programming languages support the data type.
1075bd8deadSopenharmony_ci       "hfloat/hf" would have reflected a second-class status better
1085bd8deadSopenharmony_ci       than "half/h".
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci       Both names are not without conflicting precedents.  The name "half"
1115bd8deadSopenharmony_ci       is used to connote 16-bit scalar values on some 32-bit CPU
1125bd8deadSopenharmony_ci       architectures (e.g., PowerPC).  The name "hfloat" has been used to
1135bd8deadSopenharmony_ci       describe 128-bit floating-point data on VAX systems.
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci    3. Should half-precision data be accepted by commands in the imaging
1165bd8deadSopenharmony_ci       subset that accept pixel data?
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci       RESOLVED:  Yes, all functions in the core OpenGL and the imaging
1195bd8deadSopenharmony_ci       subset that accept pixel data accept half-precision data.
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci    4. Should the special representations NaN, INF, and denormal be
1225bd8deadSopenharmony_ci       supported?
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci       RESOLVED:  Implementation dependent.  The spec reflects that Nan
1255bd8deadSopenharmony_ci       and INF produce unspecified results.  Denormalized numbers can
1265bd8deadSopenharmony_ci       be treated as a value of 0.
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ciNew Tokens
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    Accepted by the <type> parameter of DrawPixels, ReadPixels,
1325bd8deadSopenharmony_ci    TexImage1D, TexImage2D, TexImage3D, GetTexImage, TexSubImage1D,
1335bd8deadSopenharmony_ci    TexSubImage2D, TexSubImage3D, GetHistogram, GetMinmax,
1345bd8deadSopenharmony_ci    ConvolutionFilter1D, ConvolutionFilter2D, GetConvolutionFilter,
1355bd8deadSopenharmony_ci    SeparableFilter2D, GetSeparableFilter, ColorTable, ColorSubTable,
1365bd8deadSopenharmony_ci    and GetColorTable:
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci        HALF_FLOAT_ARB                                0x140B
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation)
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    Add a new Section 2.1.2, (p. 6):
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    2.1.2  16-Bit Floating-Point Numbers
1455bd8deadSopenharmony_ci
1465bd8deadSopenharmony_ci    A 16-bit floating-point number has a 1-bit sign (S), a 5-bit
1475bd8deadSopenharmony_ci    exponent (E), and a 10-bit mantissa (M).  The value of a 16-bit
1485bd8deadSopenharmony_ci    floating-point number is determined by the following:
1495bd8deadSopenharmony_ci
1505bd8deadSopenharmony_ci        (-1)^S * 0.0,                        if E == 0 and M == 0,
1515bd8deadSopenharmony_ci        (-1)^S * 2^-14 * (M / 2^10),         if E == 0 and M != 0,
1525bd8deadSopenharmony_ci        (-1)^S * 2^(E-15) * (1 + M/2^10),    if 0 < E < 31,
1535bd8deadSopenharmony_ci        (-1)^S * INF,                        if E == 31 and M == 0, or
1545bd8deadSopenharmony_ci        NaN,                                 if E == 31 and M != 0,
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    where
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci        S = floor((N mod 65536) / 32768),
1595bd8deadSopenharmony_ci        E = floor((N mod 32768) / 1024), and
1605bd8deadSopenharmony_ci        M = N mod 1024.
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    Implementations are also allowed to use any of the following
1635bd8deadSopenharmony_ci    alternative encodings:
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ci        (-1)^S * 0.0,                        if E == 0 and M != 0,
1665bd8deadSopenharmony_ci        (-1)^S * 2^(E-15) * (1 + M/2^10),    if E == 31 and M == 0, or
1675bd8deadSopenharmony_ci        (-1)^S * 2^(E-15) * (1 + M/2^10),    if E == 31 and M != 0,
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci    Any representable 16-bit floating-point value is legal as input
1705bd8deadSopenharmony_ci    to a GL command that accepts 16-bit floating-point data.  The
1715bd8deadSopenharmony_ci    result of providing a value that is not a floating-point number
1725bd8deadSopenharmony_ci    (such as infinity or NaN) to such a command is unspecified, but
1735bd8deadSopenharmony_ci    must not lead to GL interruption or termination.  Providing a
1745bd8deadSopenharmony_ci    denormalized number or negative zero to GL must yield predictable
1755bd8deadSopenharmony_ci    results.
1765bd8deadSopenharmony_ci
1775bd8deadSopenharmony_ci    (modify Table 2.2, p. 9) -- add new row
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ci                   Minimum
1805bd8deadSopenharmony_ci       GL Type    Bit Width    Description
1815bd8deadSopenharmony_ci       -------    ---------    -----------------------------------
1825bd8deadSopenharmony_ci       half          16        half-precision floating-point value
1835bd8deadSopenharmony_ci                               encoded in an unsigned scalar
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci    Modify Section 2.14, (Colors and Coloring), p. 59
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci    (modify Table 2.9, p. 59)  Add new row to the table:
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci         GL Type    Conversion
1905bd8deadSopenharmony_ci         -------    ----------
1915bd8deadSopenharmony_ci         half          c
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ci    Modify Section 3.6.4, Rasterization of Pixel Rectangles (p. 126)
1975bd8deadSopenharmony_ci
1985bd8deadSopenharmony_ci    (modify Table 3.5, p. 128 -- add new row)
1995bd8deadSopenharmony_ci
2005bd8deadSopenharmony_ci        type Parameter     Corresponding       Special
2015bd8deadSopenharmony_ci        Token Name         GL Data Type     Interpretation
2025bd8deadSopenharmony_ci        --------------     -------------    --------------
2035bd8deadSopenharmony_ci        HALF_FLOAT_ARB         half               No
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci    (modify Unpacking, p. 129)  Data are taken from host memory as a
2065bd8deadSopenharmony_ci    sequence of signed or unsigned bytes (GL data types byte and ubyte),
2075bd8deadSopenharmony_ci    signed or unsigned integers (GL data types int and uint), or
2085bd8deadSopenharmony_ci    floating-point values (GL data types half and float).
2095bd8deadSopenharmony_ci
2105bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment
2115bd8deadSopenharmony_ciOperations and the Framebuffer)
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ci    Modify Section 4.3.2, Reading Pixels (p. 219)
2145bd8deadSopenharmony_ci
2155bd8deadSopenharmony_ci    (modify Final Conversion, p. 222) For an index, if the type is not
2165bd8deadSopenharmony_ci    FLOAT or HALF_FLOAT_ARB, final conversion consists of masking the
2175bd8deadSopenharmony_ci    index with the value given in Table 4.6; if the type is FLOAT or
2185bd8deadSopenharmony_ci    HALF_FLOAT_ARB, then the integer index is converted to a GL float
2195bd8deadSopenharmony_ci    or half data value.
2205bd8deadSopenharmony_ci
2215bd8deadSopenharmony_ci    (modify Table 4.7, p. 224 -- add new row)
2225bd8deadSopenharmony_ci
2235bd8deadSopenharmony_ci        type Parameter    GL Data Type    Component Conversion Formula
2245bd8deadSopenharmony_ci        --------------    ------------    ----------------------------
2255bd8deadSopenharmony_ci        HALF_FLOAT_ARB        half                  c = f
2265bd8deadSopenharmony_ci
2275bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci    None
2305bd8deadSopenharmony_ci
2315bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 2.0 Specification (State and
2325bd8deadSopenharmony_ciState Requests)
2335bd8deadSopenharmony_ci
2345bd8deadSopenharmony_ci    None
2355bd8deadSopenharmony_ci
2365bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ci    None
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ciGLX Protocol (Modification to the GLX 1.3 Protocol Encoding Specification)
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci    Modify Appendix A, Pixel Data (p. 148)
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci      (Modify Table A.1, p. 149 -- add new row for HALF_FLOAT_ARB data)
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci          type             Encoding    Protocol Type    nbytes
2475bd8deadSopenharmony_ci          -------------    --------    -------------    ------
2485bd8deadSopenharmony_ci          HALF_FLOAT_ARB    0x140B      CARD16           2
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ciErrors
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci    None
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ciNew State
2555bd8deadSopenharmony_ci
2565bd8deadSopenharmony_ci    None
2575bd8deadSopenharmony_ci
2585bd8deadSopenharmony_ciNew Implementation Dependent State
2595bd8deadSopenharmony_ci
2605bd8deadSopenharmony_ci    None
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ciRevision History
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    Rev.    Date    Author    Changes
2655bd8deadSopenharmony_ci    ----  -------- ---------  --------------------------------------------
2665bd8deadSopenharmony_ci      1   12/15/03 Kirkland   Initial version based on the NV_half_float
2675bd8deadSopenharmony_ci                              specification.
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci      2   2/26/04  Kirkland   Changed NVIDIA_xxx to NV_xxx.
2705bd8deadSopenharmony_ci                              Changed the issue resolution for INF and NaN.
2715bd8deadSopenharmony_ci
2725bd8deadSopenharmony_ci      3   3/11/04  Kirkland   Updated language for float16 number handling.
2735bd8deadSopenharmony_ci                              Added bit encodings for half values.
2745bd8deadSopenharmony_ci                              Added issue dealing with name "half".
2755bd8deadSopenharmony_ci
2765bd8deadSopenharmony_ci      4   7/23/04  Kirkland   Added alternative encodings options for
2775bd8deadSopenharmony_ci                              float16 format.
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ci      5   9/17/04  Kirkland   Updated to reference OpenGL 2.0 spec.
2805bd8deadSopenharmony_ci
2815bd8deadSopenharmony_ci      6   10/1/04  Kirkland   Updated IP section.
282