1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"packUnorm">
9 <holder>Khronos Group
</holder>
12 <refentrytitle>packUnorm
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>packUnorm
</refname>
17 <refpurpose>pack floating-point values into an unsigned integer
</refpurpose>
19 <refsynopsisdiv><title>Declaration
</title>
22 <funcdef>uint
<function>packUnorm2x16
</function></funcdef>
23 <paramdef>vec2
<parameter>v
</parameter></paramdef>
26 <funcdef>uint
<function>packSnorm2x16
</function></funcdef>
27 <paramdef>vec2
<parameter>v
</parameter></paramdef>
30 <funcdef>uint
<function>packUnorm4x8
</function></funcdef>
31 <paramdef>vec4
<parameter>v
</parameter></paramdef>
34 <funcdef>uint
<function>packSnorm4x8
</function></funcdef>
35 <paramdef>vec4
<parameter>v
</parameter></paramdef>
39 <refsect1 id=
"parameters"><title>Parameters
</title>
42 <term><parameter>v
</parameter></term>
45 Specifies a vector of values to be packed into an unsigned integer.
51 <refsect1 id=
"description"><title>Description
</title>
53 <function>packUnorm2x16
</function>,
<function>packSnorm2x16
</function>,
<function>packUnorm4x8
</function> and
<function>packSnorm4x8
</function> convert
54 each component of the normalized floating-ponit value
<parameter>v
</parameter> into
8- or
16-bit integer
55 values and then packs the results into a
32-bit unsigned intgeter.
58 The conversion for component
<parameter>c
</parameter> of
<parameter>v
</parameter> to fixed-point is
61 <listitem><function>packUnorm2x16
</function>:
<code><citerefentry><refentrytitle>round
</refentrytitle></citerefentry>(
<citerefentry><refentrytitle>clamp
</refentrytitle></citerefentry>(
<parameter>c
</parameter>,
0.0,
1.0) *
65535.0)
</code></listitem>
62 <listitem><function>packSnorm2x16
</function>:
<code><citerefentry><refentrytitle>round
</refentrytitle></citerefentry>(
<citerefentry><refentrytitle>clamp
</refentrytitle></citerefentry>(
<parameter>c
</parameter>, -
1.0,
1.0) *
32767.0)
</code></listitem>
63 <listitem><function>packUnorm4x8
</function>:
<code><citerefentry><refentrytitle>round
</refentrytitle></citerefentry>(
<citerefentry><refentrytitle>clamp
</refentrytitle></citerefentry>(
<parameter>c
</parameter>,
0.0,
1.0) *
255.0)
</code></listitem>
64 <listitem><function>packSnorm4x8
</function>:
<code><citerefentry><refentrytitle>round
</refentrytitle></citerefentry>(
<citerefentry><refentrytitle>clamp
</refentrytitle></citerefentry>(
<parameter>c
</parameter>, -
1.0,
1.0) *
127.0)
</code></listitem>
68 The first component of the vector will be written to the least significant bits of the output;
69 the last component will be written to the most significant bits.
72 <refsect1 id=
"versions"><title>Version Support
</title>
73 <informaltable frame=
"topbot">
78 <entry>packUnorm2x16
</entry>#newin41#
81 <entry>packSnorm2x16
</entry>#newin42#
84 <entry>packUnorm4x8
</entry>#newin41#
87 <entry>packSnorm4x8
</entry>#newin41#
93 <refsect1 id=
"seealso"><title>See Also
</title>
95 <citerefentry><refentrytitle>unpackUnorm2x16
</refentrytitle></citerefentry>,
96 <citerefentry><refentrytitle>unpackSnorm2x16
</refentrytitle></citerefentry>,
97 <citerefentry><refentrytitle>unpackUnorm4x8
</refentrytitle></citerefentry>,
98 <citerefentry><refentrytitle>unpackSnorm4x8
</refentrytitle></citerefentry>
101 <refsect1 id=
"Copyright"><title>Copyright
</title>
103 Copyright
<trademark class=
"copyright"></trademark> 2011 Khronos Group.
104 This material may be distributed subject to the terms and conditions set forth in
105 the Open Publication License, v
1.0,
8 June
1999.
106 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.