summaryrefslogtreecommitdiff
path: root/glew/auto/EGL-Registry/sdk/docs/man/eglCreatePbufferFromClientBuffer.xml
blob: 5c600170b26514f661d3b91411e178d76ede3d17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:base="" xml:id="eglCreatePbufferFromClientBuffer">
    <info>
         <copyright>
             <year>2003-2014</year>
             <holder>The Khronos Group Inc.</holder>
         </copyright>
    </info>
    <refmeta>
        <refentrytitle>eglCreatePbufferFromClientBuffer</refentrytitle>
        <manvolnum>3G</manvolnum>
    </refmeta>
    <refnamediv>
        <refname>eglCreatePbufferFromClientBuffer</refname>
        <refpurpose>
            create a new <acronym>EGL</acronym> pixel buffer surface
            bound to an OpenVG image
        </refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>C Specification</title>
        <funcsynopsis>
            <funcprototype>
                <funcdef>EGLSurface <function>eglCreatePbufferFromClientBuffer</function></funcdef>
                <paramdef>EGLDisplay <parameter>display</parameter></paramdef>
                <paramdef>EGLenum <parameter>buftype</parameter></paramdef>
                <paramdef>EGLClientBuffer <parameter>buffer</parameter></paramdef>
                <paramdef>EGLConfig <parameter>config</parameter></paramdef>
                <paramdef>EGLint const * <parameter>attrib_list</parameter></paramdef>
            </funcprototype>
        </funcsynopsis>
    </refsynopsisdiv>
    <refsect1 xml:id="parameters"><title>Parameters</title>
        <variablelist>
            <varlistentry>
                <term><parameter>display</parameter></term>
                <listitem><para>Specifies the EGL display connection.</para></listitem>
            </varlistentry>
            <varlistentry>
                <term><parameter>buftype</parameter></term>
                <listitem>
                <para>
                    Specifies the type of client API buffer to be bound.
                    Must be <constant>EGL_OPENVG_IMAGE</constant>,
                    corresponding to an OpenVG <type>VGImage</type>
                    buffer.
                </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><parameter>buffer</parameter></term>
                <listitem>
                <para>
                    Specifies the OpenVG <type>VGImage</type> handle of
                    the buffer to be bound.
                </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><parameter>config</parameter></term>
                <listitem><para>
                    Specifies the EGL frame buffer configuration that defines the
                    frame buffer resource available to the surface.
                </para></listitem>
            </varlistentry>
            <varlistentry>
                <term><parameter>attrib_list</parameter></term>
                <listitem><para>
                    Specifies pixel buffer surface attributes.
                    May be <constant>NULL</constant> or empty
                    (first attribute is <constant>EGL_NONE</constant>).
                </para></listitem>
            </varlistentry>
        </variablelist>
    </refsect1>
    <refsect1 xml:id="description"><title>Description</title>
        <para>
            <function>eglCreatePbufferFromClientBuffer</function> creates an
            off-screen pixel buffer surface and returns its handle. If
            <function>eglCreatePbufferFromClientBuffer</function> fails to create
            a pixel buffer surface, <constant>EGL_NO_SURFACE</constant>
            is returned.
        </para>
        <para>
            The new pixel buffer surface is similar to a pixel buffer
            created with
            <citerefentry><refentrytitle>eglCreatePbufferSurface</refentrytitle></citerefentry>,
            but storage for the color buffer is provided by a client API
            buffer. Other buffer required by
            <parameter>config</parameter>, such as depth, stencil, and
            alpha mask, are allocated by EGL.
        </para>
        <para>
            <parameter>buftype</parameter> must be
            <constant>EGL_OPENVG_IMAGE</constant>, corresponding to an
            OpenVG <type>VGImage</type> buffer.
            <parameter>buffer</parameter> must be a valid
            <type>VGImage</type> handle in the current OpenVG context,
            cast into the type <type>EGLClientBuffer</type>.
        </para>
        <para>
            The height, width,, OpenVG alpha format, and OpenVG
            colorspace (surface attributes
            <constant>EGL_HEIGHT</constant>,
            <constant>EGL_WIDTH</constant>,
            <constant>EGL_VG_ALPHA_FORMAT</constant>, and
            <constant>EGL_VG_COLORSPACE</constant>, respectively) of the
            resulting surface are determined by the size and format of
            <parameter>buffer</parameter>.
        </para>
        <para>
            Surface attributes are specified as a list of
            attribute-value pairs, terminated with
            <constant>EGL_NONE</constant>. Accepted attributes are:
        </para>
        <variablelist>
            <varlistentry>
                <term><constant>EGL_MIPMAP_TEXTURE</constant></term>
                <listitem>
                <para>
                    Specifies whether storage for mipmaps should be
                    allocated. Space for mipmaps will be set aside if
                    the attribute value is <constant>EGL_TRUE</constant>
                    and <constant>EGL_TEXTURE_FORMAT</constant> is not
                    <constant>EGL_NO_TEXTURE</constant>. The default
                    value is <constant>EGL_FALSE</constant>.
                </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>EGL_TEXTURE_FORMAT</constant></term>
                <listitem>
                <para>
                    Specifies the format of the texture that will be
                    created when a pbuffer is bound to a texture map.
                    Possible values are
                    <constant>EGL_NO_TEXTURE</constant>,
                    <constant>EGL_TEXTURE_RGB</constant>, and
                    <constant>EGL_TEXTURE_RGBA</constant>. The default
                    value is <constant>EGL_NO_TEXTURE</constant>.
                </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><constant>EGL_TEXTURE_TARGET</constant></term>
                <listitem>
                <para>
                    Specifies the target for the texture that will be
                    created when the pbuffer is created with a texture
                    format of <constant>EGL_TEXTURE_RGB</constant> or
                    <constant>EGL_TEXTURE_RGBA</constant>. Possible
                    values are <constant>EGL_NO_TEXTURE</constant>, or
                    <constant>EGL_TEXTURE_2D</constant>. The default
                    value is <constant>EGL_NO_TEXTURE</constant>.
                </para>
                </listitem>
            </varlistentry>
        </variablelist>
        <para>
            Any EGL rendering context that was created with respect to
            <parameter>config</parameter> can be used to render into the
            surface. Use
            <citerefentry><refentrytitle>eglMakeCurrent</refentrytitle></citerefentry>
            to attach an EGL rendering context to the surface.
        </para>
        <para>
            Use
            <citerefentry><refentrytitle>eglQuerySurface</refentrytitle></citerefentry>
            to retrieve the dimensions of the allocated pixel buffer
            surface or the ID of <parameter>config</parameter>.
        </para>
        <para>
            Use <citerefentry><refentrytitle>eglDestroySurface</refentrytitle></citerefentry>
            to destroy the surface.
        </para>
    </refsect1>
    <refsect1 xml:id="notes"><title>Notes</title>
        <para>
            <function>eglCreatePbufferFromClientBuffer</function> is
            supported only if the EGL version is 1.2 or greater, and if
            the EGL implementation supports the OpenVG client API.
        </para>
        <para>
            Currently
            <function>eglCreatePbufferFromClientBuffer</function> only
            supports binding OpenVG <type>VGImage</type> buffers to
            pixel buffers. While other client API resources could be
            supported in the future, mechanisms such as OpenGL ES
            framebuffer objects, and the family of EGL and client API
            extensions for defining and using <type>EGLImageKHR</type>
            images, are a more flexible and general framework to satisfy
            most of the same needs.
        </para>
        <para>
            If the value of <parameter>config</parameter> attribute
            <constant>EGL_TEXTURE_FORMAT</constant> is not
            <constant>EGL_NO_TEXTURE</constant>, then the pbuffer width
            and height specify the size of the level zero texture image
        </para>
        <para>
            If <constant>EGL_LARGEST_PBUFFER</constant> is specified and
            if the pbuffer will be used as a texture (i.e. the value of
            <constant>EGL_TEXTURE_TARGET</constant> is
            <constant>EGL_TEXTURE_2D</constant>, and the value of
            <constant>EGL_TEXTURE FORMAT</constant> is
            <constant>EGL_TEXTURE_RGB</constant> or
            <constant>EGL_TEXTURE_RGBA</constant>), then the aspect
            ratio will be preserved and the new width and height will be
            valid sizes for the texture target (e.g. if the underlying
            OpenGL ES implementation does not support non-power-of-two
            textures, both the width and height will be a power of 2).
        </para>
        <para>
            The contents of the depth and stencil buffers may not be
            preserved when rendering a texture to the pbuffer and
            switching which image of the texture is rendered to (e.g.,
            switching from rendering one mipmap level to rendering
            another).
        </para>
        <para>
            Binding client API buffers to EGL pbuffers create the
            possibility of race conditions, and of buffers being deleted
            through one API while still in use in another API. To avoid
            these problems, a number of constraints apply to bound
            client API buffers:
            <orderedlist>
                <listitem>
                <para>
                    Bound buffers may be used exclusively by either EGL,
                    or the client API that originally created them. For
                    example, if a <type>VGImage</type> is bound to a
                    pbuffer, and that pbuffer is bound to any client API
                    rendering context, then the <type>VGImage</type> may
                    not be used as the explicit source or destination of
                    any OpenVG operation. Errors resulting from such use
                    are described in client API specifications.
                    Similarly, while a <type>VGImage</type> is in use by
                    OpenVG, the pbuffer it is bound to may not be made
                    current to any client API context using
                    <citerefentry><refentrytitle>eglMakeCurrent</refentrytitle></citerefentry>.
                </para>
                </listitem>
                <listitem>
                <para>
                    Binding a buffer creates an additional reference to
                    it, and implementations must respect outstanding
                    references when destroying objects. For example, if
                    a <type>VGImage</type> is bound to a pbuffer,
                    destroying the image with
                    <function>vgDestroyImage</function> will not free
                    the underlying buffer, because it is still in use by
                    EGL. However, following
                    <function>vgDestroyImage</function> the buffer may
                    only be referred to via the EGL pbuffer handle,
                    since the OpenVG handle to that buffer no longer
                    exists. Similarly, destroying the pbuffer with
                    <function>eglDestroySurface</function> will not free
                    the underlying buffer, because it is still in use by
                    OpenVG . However, following
                    <function>eglDestroySurface</function> the buffer
                    may only be referred to via the OpenVG
                    <type>VGImage</type> handle, since the EGL pbuffer
                    handle no longer exists.
                </para>
                </listitem>
            </orderedlist>
        </para>
    </refsect1>
    <refsect1 xml:id="errors"><title>Errors</title>
        <para>
            <constant>EGL_NO_SURFACE</constant> is returned if creation of
            the context fails.
        </para>
        <para>
            <constant>EGL_BAD_DISPLAY</constant> is generated if
            <parameter>display</parameter> is not an EGL display connection.
        </para>
        <para>
            <constant>EGL_NOT_INITIALIZED</constant> is generated if
            <parameter>display</parameter> has not been initialized.
        </para>
        <para>
            <constant>EGL_BAD_CONFIG</constant> is generated if
            <parameter>config</parameter> is not an EGL frame buffer configuration.
        </para>
        <para>
            <constant>EGL_BAD_PARAMETER</constant> is generated if
            <parameter>buftype</parameter> is not
            <constant>EGL_OPENVG_IMAGE</constant>, or if
            <parameter>buffer</parameter> is not a valid handle to a
            <type>VGImage</type> object in the currently bound OpenVG
            context.
        </para>
        <para>
            <constant>EGL_BAD_ACCESS</constant> is generated if there is
            no current OpenVG context, or if
            <parameter>buffer</parameter> is already bound to another
            pixel buffer or in use by OpenVG as discussed in the Notes
            section above.
        </para>
        <para>
            <constant>EGL_BAD_ACCESS</constant> is generated if the buffers
            contained in <parameter>buffer</parameter> consist of any
            <type>EGLImage</type> siblings.
        </para>
        <para>
            <constant>EGL_BAD_ALLOC</constant> is generated if there are not
            enough resources to allocate the new surface.
        </para>
        <para>
            <constant>EGL_BAD_ATTRIBUTE</constant> is generated if
            <parameter>attrib_list</parameter> contains an invalid pixel
            buffer attribute or if an attribute value is not recognized
            or out of range.
        </para>
        <para>
            <constant>EGL_BAD_ATTRIBUTE</constant> is generated if
            <parameter>attrib_list</parameter> contains any of the
            attributes <constant>EGL_MIPMAP_TEXTURE</constant>,
            <constant>EGL_TEXTURE_FORMAT</constant>, or
            <constant>EGL_TEXTURE_TARGET</constant>, and
            <parameter>config</parameter> does not support OpenGL ES
            rendering (e.g. the EGL version is 1.2 or later, and the
            <constant>EGL_RENDERABLE_TYPE</constant> attribute of
            <parameter>config</parameter> does not include at least one
            of <constant>EGL_OPENGL_ES_BIT</constant> or
            <constant>EGL_OPENGL_ES2_BIT</constant>).
        </para>
        <para>
            <constant>EGL_BAD_MATCH</constant> is generated if
            <parameter>config</parameter> does not support rendering to
            pixel buffers (the <constant>EGL_SURFACE_TYPE</constant>
            attribute does not contain
            <constant>EGL_PBUFFER_BIT</constant>).
        </para>
        <para>
            <constant>EGL_BAD_MATCH</constant> is generated if the
            buffers contained in <parameter>buffer</parameter> do not
            match the bit depths for those buffers specified by
            <parameter>config</parameter>.
        </para>
        <para>
            <constant>EGL_BAD_MATCH</constant> is generated if the
            <constant>EGL_TEXTURE_FORMAT</constant> attribute is not
            <constant>EGL_NO_TEXTURE</constant>, and
            <constant>EGL_WIDTH</constant> and/or
            <constant>EGL_HEIGHT</constant> specify an invalid size
            (e.g., the texture size is not a power of 2, and the
            underlying OpenGL ES implementation does not support
            non-power-of-two textures).
        </para>
        <para>
            <constant>EGL_BAD_MATCH</constant> is generated if
            the <constant>EGL_TEXTURE_FORMAT</constant> attribute is
            <constant>EGL_NO_TEXTURE</constant>, and
            <constant>EGL_TEXTURE_TARGET</constant> is something other
            than <constant>EGL_NO_TEXTURE</constant>; or,
            <constant>EGL_TEXTURE_FORMAT</constant> is something other
            than <constant>EGL_NO_TEXTURE</constant>, and
            <constant>EGL_TEXTURE_TARGET</constant> is
            <constant>EGL_NO_TEXTURE</constant>.
        </para>
        <para>
            <constant>EGL_BAD_MATCH</constant> is generated if the
            implementation has additional constraints on which types of
            client API buffers may be bound to pixel buffer surfaces.
            For example, it is possible that the OpenVG implementation
            might not support a <type>VGImage</type> being bound to a
            pixel buffer which will be used as a mipmapped OpenGL ES
            texture (e.g. whose <constant>EGL_MIPMAP_TEXTURE</constant>
            attribute is <constant>TRUE</constant>). Any such
            constraints should be documented by the implementation
            release notes.
        </para>
    </refsect1>
    <refsect1 xml:id="seealso"><title>See Also</title>
        <para>
            <citerefentry><refentrytitle>eglDestroySurface</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>eglChooseConfig</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>eglCreatePbufferSurface</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>eglGetConfigs</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>eglMakeCurrent</refentrytitle></citerefentry>,
            <citerefentry><refentrytitle>eglQuerySurface</refentrytitle></citerefentry>
        </para>
    </refsect1>
    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="copyright.xml"/>
</refentry>