logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

unpackUnorm2x16,_unpackUnorm4x8,_unpackSnorm4x8 - unpack floating-point values from an unsigned integer

Declaration

vec2unpackUnorm2x16(uintp);vec2unpackSnorm2x16(uintp);vec4unpackUnorm4x8(uintp);vec4unpackSnorm4x8(uintp);

Description

unpackUnorm2x16, unpackSnorm2x16, unpackUnorm4x8 and unpackSnorm4x8 unpack single 32-bit unsigned
       integers, specified in the parameter p into a pair of 16-bit unsigned integers, four 8-bit unsigned
       integers or four 8-bit signed integers. Then, each component is converted to a normalized floating-point
       value to generate the returned two- or four-component vector.

       The conversion for unpacked fixed point value f to floating-point is performed as follows:

       •   packUnorm2x16: f / 65535.0

       •   packSnorm2x16: clamp(f / 32727.0, -1.0, 1.0)

       •   packUnorm4x8: f / 255.0

       •   packSnorm4x8: clamp(f / 127.0, -1.0, 1.0)

       The first component of the returned vector will be extracted from the least significant bits of the
       input; the last component will be extracted from the most significant bits.

Name

       unpackUnorm2x16,_unpackUnorm4x8,_unpackSnorm4x8 - unpack floating-point values from an unsigned integer

Parameters

p
           Specifies an unsigned integer containing packed floating-point values.

See Also

packUnorm2x16,

       packUnorm4x8,

       packSnorm4x8

Version Support

       ┌─────────────────┬───────────────────────────────────────────────────────────────────────────────────┐
       │                 │        OpenGLShadingLanguageVersion                                            │
       ├─────────────────┼──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┤
       │ Function1.101.201.301.401.503.304.004.104.204.304.404.50 │
       │ Name            │      │      │      │      │      │      │      │      │      │      │      │      │
       ├─────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
       │ unpackUnorm2x16 │  -   │  -   │  -   │  -   │  -   │  -   │  -   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │
       ├─────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
       │ unpackSnorm2x16 │  -   │  -   │  -   │  -   │  -   │  -   │  -   │  -   │  ✔   │  ✔   │  ✔   │  ✔   │
       ├─────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
       │ unpackUnorm4x8  │  -   │  -   │  -   │  -   │  -   │  -   │  -   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │
       ├─────────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┤
       │ unpackSnorm4x8  │  -   │  -   │  -   │  -   │  -   │  -   │  -   │  ✔   │  ✔   │  ✔   │  ✔   │  ✔   │
       └─────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘

See Also