rename upstream-man-pages to upstream-doc
[clinton/guile-figl.git] / upstream-doc / man3 / glMapBufferRange.xml
CommitLineData
7faf1d71
AW
1<?xml version="1.0" encoding="UTF-8"?>\r
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"\r
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">\r
4<refentry id="glMapBufferRange">\r
5 <refmeta>\r
6 <refmetainfo>\r
7 <copyright>\r
8 <year>2010</year>\r
9 <holder>Khronos Group</holder>\r
10 </copyright>\r
11 </refmetainfo>\r
12 <refentrytitle>glMapBufferRange</refentrytitle>\r
13 <manvolnum>3G</manvolnum>\r
14 </refmeta>\r
15 <refnamediv>\r
16 <refname>glMapBufferRange</refname>\r
17 <refpurpose>map a section of a buffer object's data store</refpurpose>\r
18 </refnamediv>\r
19 <refsynopsisdiv><title>C Specification</title>\r
20 <funcsynopsis>\r
21 <funcprototype>\r
22 <funcdef>void *<function>glMapBufferRange</function></funcdef>\r
23 <paramdef>GLenum <parameter>target</parameter></paramdef>\r
24 <paramdef>GLintptr <parameter>offset</parameter></paramdef>\r
25 <paramdef>GLsizeiptr <parameter>length</parameter></paramdef>\r
26 <paramdef>GLbitfield <parameter>access</parameter></paramdef>\r
27 </funcprototype>\r
28 </funcsynopsis>\r
29 </refsynopsisdiv>\r
30 <refsect1 id="parameters"><title>Parameters</title>\r
31 <variablelist>\r
32 <varlistentry>\r
33 <term><parameter>target</parameter></term>\r
34 <listitem>\r
35 <para>\r
36 Specifies a binding to which the target buffer is bound.\r
37 </para>\r
38 </listitem>\r
39 </varlistentry>\r
40 <varlistentry>\r
41 <term><parameter>offset</parameter></term>\r
42 <listitem>\r
43 <para>\r
44 Specifies a the starting offset within the buffer of the range to be mapped.\r
45 </para>\r
46 </listitem>\r
47 </varlistentry>\r
48 <varlistentry>\r
49 <term><parameter>length</parameter></term>\r
50 <listitem>\r
51 <para>\r
52 Specifies a length of the range to be mapped.\r
53 </para>\r
54 </listitem>\r
55 </varlistentry>\r
56 <varlistentry>\r
57 <term><parameter>access</parameter></term>\r
58 <listitem>\r
59 <para>\r
60 Specifies a combination of access flags indicating the desired access to the range.\r
61 </para>\r
62 </listitem>\r
63 </varlistentry>\r
64 </variablelist>\r
65 </refsect1>\r
66 <refsect1 id="description"><title>Description</title>\r
67 <para>\r
68 <function>glMapBufferRange</function> maps all or part of the data store of a buffer object into the client's address\r
69 space. <parameter>target</parameter> specifies the target to which the buffer is bound and must be one of <constant>GL_ARRAY_BUFFER</constant>,\r
70 <constant>GL_COPY_READ_BUFFER</constant>, <constant>GL_COPY_WRITE_BUFFER</constant>, <constant>GL_ELEMENT_ARRAY_BUFFER</constant>,\r
71 <constant>GL_PIXEL_PACK_BUFFER</constant>, <constant>GL_PIXEL_UNPACK_BUFFER</constant>, <constant>GL_TEXTURE_BUFFER</constant>,\r
72 <constant>GL_TRANSFORM_FEEDBACK_BUFFER</constant>, or <constant>GL_UNIFORM_BUFFER</constant>. <parameter>offset</parameter> and\r
73 <parameter>length</parameter> indicate the range of data in the buffer object htat is to be mapped, in terms of basic machine units.\r
74 <parameter>access</parameter> is a bitfield containing flags which describe the requested mapping. These flags are described below.\r
75 </para>\r
76 <para>\r
77 If no error occurs, a pointer to the beginning of the mapped range is returned once all pending operations on that buffer have\r
78 completed, and may be used to modify and/or query the corresponding range of the buffer, according to the following flag bits set\r
79 in <parameter>access</parameter>:\r
80 <itemizedlist>\r
81 <listitem>\r
82 <para>\r
83 <constant>GL_MAP_READ_BIT</constant> indicates that the returned pointer may be used to read\r
84 buffer object data. No GL error is generated if the pointer is used to query\r
85 a mapping which excludes this flag, but the result is undefined and system\r
86 errors (possibly including program termination) may occur.\r
87 </para>\r
88 </listitem>\r
89 <listitem>\r
90 <para>\r
91 <constant>GL_MAP_WRITE_BIT</constant> indicates that the returned pointer may be used to modify\r
92 buffer object data. No GL error is generated if the pointer is used to modify\r
93 a mapping which excludes this flag, but the result is undefined and system\r
94 errors (possibly including program termination) may occur.\r
95 </para>\r
96 </listitem>\r
97 </itemizedlist>\r
98 </para>\r
99 <para>\r
100 Furthermore, the following <emphasis>optional</emphasis> flag bits in <parameter>access</parameter> may be used to modify the mapping:\r
101 <itemizedlist>\r
102 <listitem>\r
103 <para>\r
104 <constant>GL_MAP_INVALIDATE_RANGE_BIT</constant> indicates that the previous contents of the\r
105 specified range may be discarded. Data within this range are undefined with\r
106 the exception of subsequently written data. No GL error is generated if sub-\r
107 sequent GL operations access unwritten data, but the result is undefined and\r
108 system errors (possibly including program termination) may occur. This flag\r
109 may not be used in combination with <constant>GL_MAP_READ_BIT</constant>.\r
110 </para>\r
111 </listitem>\r
112 <listitem>\r
113 <para>\r
114 <constant>GL_MAP_INVALIDATE_BUFFER_BIT</constant> indicates that the previous contents of the\r
115 entire buffer may be discarded. Data within the entire buffer are undefined\r
116 with the exception of subsequently written data. No GL error is generated if\r
117 subsequent GL operations access unwritten data, but the result is undefined\r
118 and system errors (possibly including program termination) may occur. This\r
119 flag may not be used in combination with <constant>GL_MAP_READ_BIT</constant>.\r
120 </para>\r
121 </listitem>\r
122 <listitem>\r
123 <para>\r
124 <constant>GL_MAP_FLUSH_EXPLICIT_BIT</constant> indicates that one or more discrete subranges\r
125 of the mapping may be modified. When this flag is set, modifications to\r
126 each subrange must be explicitly flushed by calling <citerefentry><refentrytitle>glFlushMappedBufferRange</refentrytitle></citerefentry>.\r
127 No GL error is set if a subrange of the mapping is modified and\r
128 not flushed, but data within the corresponding subrange of the buffer are undefined.\r
129 This flag may only be used in conjunction with <constant>GL_MAP_WRITE_BIT</constant>.\r
130 When this option is selected, flushing is strictly limited to regions that are\r
131 explicitly indicated with calls to <citerefentry><refentrytitle>glFlushMappedBufferRange</refentrytitle></citerefentry>\r
132 prior to unmap; if this option is not selected <citerefentry><refentrytitle>glUnmapBuffer</refentrytitle></citerefentry>\r
133 will automatically flush the entire mapped range when called.\r
134 </para>\r
135 </listitem>\r
136 <listitem>\r
137 <para>\r
138 <constant>GL_MAP_UNSYNCHRONIZED_BIT</constant> indicates that the GL should not attempt to\r
139 synchronize pending operations on the buffer prior to returning from <function>glMapBufferRange</function>.\r
140 No GL error is generated if pending operations which source or modify the buffer overlap the mapped region,\r
141 but the result of such previous and any subsequent operations is undefined.\r
142 </para>\r
143 </listitem>\r
144 </itemizedlist>\r
145 </para>\r
146 <para>\r
147 If an error occurs, <function>glMapBufferRange</function> returns a <code>NULL</code> pointer.\r
148 </para>\r
149 </refsect1>\r
150 <refsect1 id="errors"><title>Errors</title>\r
151 <para>\r
152 <constant>GL_INVALID_VALUE</constant> is generated if either of <parameter>offset</parameter> or <parameter>length</parameter> is negative,\r
153 or if <parameter>offset</parameter> + <parameter>length</parameter> is greater than the value of <constant>GL_BUFFER_SIZE</constant>.\r
154 </para>\r
155 <para>\r
156 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>access</parameter> has any bits set other than those defined above.\r
157 </para>\r
158 <para>\r
159 <constant>GL_INVALID_OPERATION</constant> is generated for any of the following conditions:\r
160 <itemizedlist>\r
161 <listitem>\r
162 <para>\r
163 The buffer is already in a mapped state.\r
164 </para>\r
165 </listitem>\r
166 <listitem>\r
167 <para>\r
168 Neither <constant>GL_MAP_READ_BIT</constant> or <constant>GL_MAP_WRITE_BIT</constant> is set.\r
169 </para>\r
170 </listitem>\r
171 <listitem>\r
172 <para>\r
173 <constant>GL_MAP_READ_BIT</constant> is set and any of <constant>GL_MAP_INVALIDATE_RANGE_BIT</constant>,\r
174 <constant>GL_MAP_INVALIDATE_BUFFER_BIT</constant>, or <constant>GL_MAP_UNSYNCHRONIZED_BIT</constant> is set.\r
175 </para>\r
176 </listitem>\r
177 <listitem>\r
178 <para>\r
179 <constant>GL_MAP_FLUSH_EXPLICIT_BIT</constant> is set and <constant>GL_MAP_WRITE_BIT</constant> is not set.\r
180 </para>\r
181 </listitem>\r
182 </itemizedlist>\r
183 </para>\r
184 <para>\r
185 <constant>GL_OUT_OF_MEMORY</constant> is generated if <function>glMapBufferRange</function> fails because memory for the\r
186 mapping could not be obtained.\r
187 </para>\r
188 </refsect1>\r
189 <refsect1 id="seealso"><title>See Also</title>\r
190 <para>\r
191 <citerefentry><refentrytitle>glMapBuffer</refentrytitle></citerefentry>,\r
192 <citerefentry><refentrytitle>glFlushMappedBufferRange</refentrytitle></citerefentry>,\r
193 <citerefentry><refentrytitle>glBindBuffer</refentrytitle></citerefentry>\r
194 </para>\r
195 </refsect1>\r
196 <refsect1 id="Copyright"><title>Copyright</title>\r
197 <para>\r
198 Copyright <trademark class="copyright"></trademark> 2010 Khronos Group. \r
199 This material may be distributed subject to the terms and conditions set forth in \r
200 the Open Publication License, v 1.0, 8 June 1999.\r
201 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.\r
202 </para>\r
203 </refsect1>\r
204</refentry>\r