summaryrefslogtreecommitdiff
path: root/man/waffle_context.3.xml
blob: 91fca9b32d7768bde748789426db2d2a437c59e8 (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
<?xml version='1.0'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<!--
  Copyright Intel 2012

  This manual page is licensed under the Creative Commons Attribution-ShareAlike 3.0 United States License (CC BY-SA 3.0
  US). To view a copy of this license, visit http://creativecommons.org.license/by-sa/3.0/us.
-->

<refentry
    id="waffle_context"
    xmlns:xi="http://www.w3.org/2001/XInclude">

  <!-- See http://www.docbook.org/tdg/en/html/refentry.html. -->

  <refmeta>
    <refentrytitle>waffle_context</refentrytitle>
    <manvolnum>3</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>waffle_context</refname>
    <refname>waffle_context_create</refname>
    <refname>waffle_context_destroy</refname>
    <refname>waffle_context_get_native</refname>
    <refpurpose>class <classname>waffle_context</classname></refpurpose>
  </refnamediv>

  <refentryinfo>
    <title>Waffle Manual</title>
    <productname>waffle</productname>
    <xi:include href="common/author-chad.versace.xml"/>
    <xi:include href="common/copyright.xml"/>
    <xi:include href="common/legalnotice.xml"/>
  </refentryinfo>

  <refsynopsisdiv>

    <funcsynopsis language="C">

      <funcsynopsisinfo>
#include &lt;waffle.h&gt;

struct waffle_context;
      </funcsynopsisinfo>

      <funcprototype>
        <funcdef>struct waffle_context* <function>waffle_context_create</function></funcdef>
        <paramdef>struct waffle_config *<parameter>config</parameter></paramdef>
        <paramdef>struct waffle_context *<parameter>shared_ctx</parameter></paramdef>
      </funcprototype>

      <funcprototype>
        <funcdef>bool <function>waffle_context_destroy</function></funcdef>
        <paramdef>struct waffle_context *<parameter>self</parameter></paramdef>
      </funcprototype>

      <funcprototype>
        <funcdef>union waffle_native_context* <function>waffle_context_get_native</function></funcdef>
        <paramdef>struct waffle_context *<parameter>self</parameter></paramdef>
      </funcprototype>

    </funcsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title>Description</title>

    <variablelist>

      <varlistentry>
        <term><type>struct waffle_context</type></term>
        <listitem>
          <para>
            An opaque type.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><function>waffle_context_create()</function></term>
        <listitem>
          <para>
            Create a context for OpenGL rendering with the properties specified by <parameter>config</parameter>.
          </para>

          <para>
            The returned context's actual properties may differ from,
            but are guaranteed to be compatible with,
            the properties specified by <parameter>config</parameter>.

            See <xref linkend="sect.version_promotion"/> below for details.
          </para>

          <para>
            If <parameter>share_ctx</parameter> is not null, then the newly created context is added to the share group
            of <parameter>share_ctx</parameter>. Some data, such as display lists, are shared among all contexts
            that belong to the same share group. For details on what data is shared, see the specification for the
            relevant native platform:
            the <ulink url="http://www.opengl.org/registry/doc/glx1.4.pdf">GLX 1.4 Specification</ulink>,
            the <ulink url="http://www.khronos.org/registry/egl/specs/eglspec.1.4.20110406.pdf">EGL 1.4 Specification</ulink>,
            or the <ulink url="https://developer.apple.com/library/mac/#documentation/graphicsimaging/reference/CGL_OpenGL/Reference/reference.html">CGL Reference</ulink>.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><function>waffle_context_destroy()</function></term>
        <listitem>
          <para>
            Destroy the context and release its memory.
          </para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term><function>waffle_context_get_native()</function></term>
        <listitem>
          <para>
            Get the context's underlying native objects. Use
            <citerefentry><refentrytitle><function>free</function></refentrytitle><manvolnum>3</manvolnum></citerefentry> to deallocate the
            returned pointer.
            See <citerefentry><refentrytitle><function>waffle_native</function></refentrytitle><manvolnum>3</manvolnum></citerefentry>
            for the definition of <type>union waffle_native_context</type>.
          </para>
        </listitem>
      </varlistentry>

    </variablelist>
  </refsect1>

  <refsect1
      id="sect.version_promotion">

    <title>Version Promotion</title>

    <para>
      The context's requested version and profile is given by the config attributes

      <constant>WAFFLE_CONTEXT_MAJOR_VERSION</constant>,
      <constant>WAFFLE_CONTEXT_MINOR_VERSION</constant>,
      <constant>WAFFLE_CONTEXT_PROFILE</constant>.

      The context returned by <function>waffle_context_create</function>
      may implement any version and profile
      that is backwards compatible with that requested,
      as described below.

      <itemizedlist>

        <listitem>
          <para>
            If the chosen API is
            <constant>WAFFLE_OPENGL_ES1</constant>,
            <constant>WAFFLE_OPENGL_ES2</constant>, or
            <constant>WAFFLE_OPENGL_ES3</constant>,

            then the returned context may implement any of:

            <simplelist type="vert">
              <member>* The requested version.</member>
              <member>* Any later version, so long as no features have been from that later version.</member>
            </simplelist>
          </para>
        </listitem>

        <listitem>
          <para>
            If the chosen API is <constant>WAFFLE_CONTEXT_OPENGL</constant>

            and version 3.0 or less is requested,

            then the returned context may implement any of:

            <simplelist type="vert">
              <member>* Any version no less than that requested and no greater than 3.0.</member>
              <member>* Version 3.1, if the GL_ARB_compatibility extension is also implemented.</member>
              <member>* The compatibility profile of version 3.2 or greater.</member>
            </simplelist>
          </para>
        </listitem>

        <listitem>
          <para>
            If the chosen API is <constant>WAFFLE_CONTEXT_OPENGL</constant>

            and version 3.1 is requested,

            then the returned context may implement any of:

            <simplelist type="vert">
              <member>* Version 3.1, with or without the GL_ARB_compatibility extension.</member>
              <member>* The core profile of version 3.2 or greater.</member>
            </simplelist>
          </para>
        </listitem>

        <listitem>
          <para>
            If the chosen API is <constant>WAFFLE_CONTEXT_OPENGL</constant>

            and version 3.2 or greater is requested,

            then the returned context may implement any of:

            <simplelist type="vert">
              <member>* The requested profile and version.</member>
              <member><para>
                  * The requested profile of any later version, so long as no features have been from that later
                  version and profile.
              </para></member>
            </simplelist>
          </para>
        </listitem>

      </itemizedlist>
    </para>

  </refsect1>

  <refsect1>
    <title>Return Value</title>
    <xi:include href="common/return-value.xml"/>
  </refsect1>

  <refsect1>
    <title>Errors</title>

    <xi:include href="common/error-codes.xml"/>

    <para>
      No errors are specific to the <type>waffle_context</type> functions.
    </para>
  </refsect1>

  <xi:include href="common/issues.xml"/>

  <refsect1>
    <title>See Also</title>
    <para>
      <citerefentry><refentrytitle>waffle</refentrytitle><manvolnum>7</manvolnum></citerefentry>
      <citerefentry><refentrytitle>waffle_config_choose</refentrytitle><manvolnum>3</manvolnum></citerefentry>
    </para>
  </refsect1>

</refentry>

<!--
vim:tw=120 et ts=2 sw=2:
-->