OLD | NEW |
---|---|
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | |
6 /* From ppb_graphics_3d.idl modified Tue Feb 07 11:38:46 2012. */ | |
7 | |
5 #ifndef PPAPI_C_PPB_GRAPHICS_3D_H_ | 8 #ifndef PPAPI_C_PPB_GRAPHICS_3D_H_ |
6 #define PPAPI_C_PPB_GRAPHICS_3D_H_ | 9 #define PPAPI_C_PPB_GRAPHICS_3D_H_ |
7 | 10 |
11 #include "ppapi/c/pp_bool.h" | |
12 #include "ppapi/c/pp_completion_callback.h" | |
13 #include "ppapi/c/pp_instance.h" | |
14 #include "ppapi/c/pp_macros.h" | |
15 #include "ppapi/c/pp_resource.h" | |
16 #include "ppapi/c/pp_stdint.h" | |
17 | |
18 #define PPB_GRAPHICS_3D_INTERFACE_1_0 "PPB_Graphics3D;1.0" | |
19 #define PPB_GRAPHICS_3D_INTERFACE PPB_GRAPHICS_3D_INTERFACE_1_0 | |
20 | |
21 /** | |
22 * @file | |
23 * Defines the <code>PPB_Graphics3D</code> struct representing a 3D graphics | |
24 * context within the browser. | |
25 */ | |
26 | |
27 | |
28 /* Add 3D graphics enums */ | |
8 #include "ppapi/c/pp_graphics_3d.h" | 29 #include "ppapi/c/pp_graphics_3d.h" |
9 | 30 |
10 #include "ppapi/c/pp_bool.h" | 31 /** |
11 #include "ppapi/c/pp_instance.h" | 32 * @addtogroup Interfaces |
12 #include "ppapi/c/pp_resource.h" | 33 * @{ |
13 | 34 */ |
14 /* Example usage from plugin code: | 35 /** |
36 * <code>PPB_Graphics3D</code> defines the interface for a 3D graphics context. | |
37 * <strong>Example usage from plugin code:</strong> | |
15 * | 38 * |
16 * // Setup. | 39 * <strong>Setup:</strong> |
40 * <code> | |
17 * PP_Resource context; | 41 * PP_Resource context; |
18 * int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800, | 42 * int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800, |
19 * PP_GRAPHICS3DATTRIB_HEIGHT, 800, | 43 * PP_GRAPHICS3DATTRIB_HEIGHT, 800, |
20 * PP_GRAPHICS3DATTRIB_NONE}; | 44 * PP_GRAPHICS3DATTRIB_NONE}; |
21 * context = g3d->Create(instance, attribs, &context); | 45 * context = g3d->Create(instance, attribs, &context); |
22 * inst->BindGraphics(instance, context); | 46 * inst->BindGraphics(instance, context); |
47 * </code> | |
23 * | 48 * |
24 * // Present one frame. | 49 * <strong>Present one frame:</strong> |
50 * <code> | |
25 * gles2->Clear(context, GL_COLOR_BUFFER); | 51 * gles2->Clear(context, GL_COLOR_BUFFER); |
26 * g3d->SwapBuffers(context); | 52 * g3d->SwapBuffers(context); |
53 * </code> | |
27 * | 54 * |
28 * // Shutdown. | 55 * <strong>Shutdown:</strong> |
56 * <code> | |
29 * core->ReleaseResource(context); | 57 * core->ReleaseResource(context); |
58 * </code> | |
30 */ | 59 */ |
31 | |
32 #define PPB_GRAPHICS_3D_INTERFACE_1_0 "PPB_Graphics3D;1.0" | |
33 #define PPB_GRAPHICS_3D_INTERFACE PPB_GRAPHICS_3D_INTERFACE_1_0 | |
34 | |
35 struct PPB_Graphics3D_1_0 { | 60 struct PPB_Graphics3D_1_0 { |
36 /** | 61 /** |
37 * Retrieves the maximum supported value for the given attribute. | 62 * GetAttribMaxValue() retrieves the maximum supported value for the |
63 * given attribute. This function may be used to check if a particular | |
64 * attribute value is supported before attempting to create a context. | |
38 * | 65 * |
39 * This function may be used to check if a particular attribute value is | 66 * @param[in] instance The module instance. |
40 * supported before attempting to create a context. | 67 * @param[in] attribute The attribute for which maximum value is queried. |
41 * Attributes that can be queried for include: | 68 * Attributes that can be queried for include: |
42 * - PP_GRAPHICS3DATTRIB_ALPHA_SIZE | 69 * - <code>PP_GRAPHICS3DATTRIB_ALPHA_SIZE</code> |
43 * - PP_GRAPHICS3DATTRIB_BLUE_SIZE | 70 * - <code>PP_GRAPHICS3DATTRIB_BLUE_SIZE</code> |
44 * - PP_GRAPHICS3DATTRIB_GREEN_SIZE | 71 * - <code>PP_GRAPHICS3DATTRIB_GREEN_SIZE</code> |
45 * - PP_GRAPHICS3DATTRIB_RED_SIZE | 72 * - <code>PP_GRAPHICS3DATTRIB_RED_SIZE</code> |
46 * - PP_GRAPHICS3DATTRIB_DEPTH_SIZE | 73 * - <code>PP_GRAPHICS3DATTRIB_DEPTH_SIZE</code> |
47 * - PP_GRAPHICS3DATTRIB_STENCIL_SIZE | 74 * - <code>PP_GRAPHICS3DATTRIB_STENCIL_SIZE</code> |
48 * - PP_GRAPHICS3DATTRIB_SAMPLES | 75 * - <code>PP_GRAPHICS3DATTRIB_SAMPLES</code> |
49 * - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS | 76 * - <code>PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS</code> |
50 * - PP_GRAPHICS3DATTRIB_WIDTH | 77 * - <code>PP_GRAPHICS3DATTRIB_WIDTH</code> |
51 * - PP_GRAPHICS3DATTRIB_HEIGHT | 78 * - <code>PP_GRAPHICS3DATTRIB_HEIGHT</code> |
79 * @param[out] value The maximum supported value for <code>attribute</code> | |
52 * | 80 * |
53 * On failure the following error codes may be returned: | 81 * @return Returns <code>PP_TRUE</code> on success or the following on error: |
54 * - PP_ERROR_BADRESOURCE if instance is invalid. | 82 * - <code>PP_ERROR_BADRESOURCE</code> if <code>instance</code> is invalid |
55 * - PP_ERROR_BADARGUMENT if attribute is invalid or value is NULL | 83 * - <code>PP_ERROR_BADARGUMENT</code> if <code>attribute</code> is invalid |
84 * or <code>value</code> is 0 | |
56 */ | 85 */ |
57 int32_t (*GetAttribMaxValue)(PP_Resource instance, | 86 int32_t (*GetAttribMaxValue)(PP_Resource instance, |
58 int32_t attribute, int32_t* value); | 87 int32_t attribute, |
59 | 88 int32_t* value); |
60 /** | 89 /** |
61 * Creates and initializes a rendering context and returns a handle to it. | 90 * Create() creates and initializes a 3D rendering context. |
62 * The returned context is off-screen to start with. It must be attached to | 91 * The returned context is off-screen to start with. It must be attached to |
63 * a plugin instance using PPB_Instance::BindGraphics to draw on the web page. | 92 * a plugin instance using <code>PPB_Instance::BindGraphics</code> to draw |
93 * on the web page. | |
64 * | 94 * |
65 * If share_context is not NULL, then all shareable data, as defined | 95 * @param[in] instance The module instance. |
66 * by the client API (note that for OpenGL and OpenGL ES, shareable data | |
67 * excludes texture objects named 0) will be shared by share_context, all | |
68 * other contexts share_context already shares with, and the newly created | |
69 * context. An arbitrary number of PPB_Graphics3D can share data in | |
70 * this fashion. | |
71 * | 96 * |
72 * attrib_list specifies a list of attributes for the context. It is a list | 97 * @param[in] share_context The 3D context with which the created context |
73 * of attribute name-value pairs in which each attribute is immediately | 98 * would share resources. If <code>share_context</code> is not 0, then all |
74 * followed by the corresponding desired value. The list is terminated with | 99 * shareable data, as defined by the client API (note that for OpenGL and |
75 * PP_GRAPHICS3DATTRIB_NONE. The attrib_list may be NULL or empty | 100 * OpenGL ES, shareable data excludes texture objects named 0) will be shared |
76 * (first attribute is PP_GRAPHICS3DATTRIB_NONE). If an attribute is not | 101 * by <code>share_context<code>, all other contexts <code>share_context</code> |
77 * specified in attrib_list, then the default value is used (it is said to | 102 * already shares with, and the newly created context. An arbitrary number of |
78 * be specified implicitly). | 103 * <code>PPB_Graphics3D</code> can share data in this fashion. |
79 * | 104 * |
105 * @param[out] attrib_list specifies a list of attributes for the context. | |
106 * It is a list of attribute name-value pairs in which each attribute is | |
107 * immediately followed by the corresponding desired value. The list is | |
108 * terminated with <code>PP_GRAPHICS3DATTRIB_NONE</code>. | |
109 * The <code>attrib_list<code> may be 0 or empty (first attribute is | |
110 * <code>PP_GRAPHICS3DATTRIB_NONE</code>). If an attribute is not | |
111 * specified in <code>attrib_list</code>, then the default value is used | |
112 * (it is said to be specified implicitly). | |
80 * Attributes for the context are chosen according to an attribute-specific | 113 * Attributes for the context are chosen according to an attribute-specific |
81 * criteria. Attributes can be classified into two categories: | 114 * criteria. Attributes can be classified into two categories: |
82 * - AtLeast: The attribute value in the returned context meets or exceeds | 115 * - AtLeast: The attribute value in the returned context meets or exceeds |
83 * the value specified in attrib_list. | 116 * the value specified in <code>attrib_list</code>. |
84 * - Exact: The attribute value in the returned context is equal to | 117 * - Exact: The attribute value in the returned context is equal to |
85 * the value specified in attrib_list. | 118 * the value specified in <code>attrib_list</code>. |
86 * | 119 * |
87 * Attributes that can be specified in attrib_list include: | 120 * Attributes that can be specified in <code>attrib_list</code> include: |
88 * - PP_GRAPHICS3DATTRIB_ALPHA_SIZE: Category: AtLeast Default: 0. | 121 * - <code>PP_GRAPHICS3DATTRIB_ALPHA_SIZE</code>: |
89 * - PP_GRAPHICS3DATTRIB_BLUE_SIZE: Category: AtLeast Default: 0. | 122 * Category: AtLeast Default: 0. |
90 * - PP_GRAPHICS3DATTRIB_GREEN_SIZE: Category: AtLeast Default: 0. | 123 * - <code>PP_GRAPHICS3DATTRIB_BLUE_SIZE</code>: |
91 * - PP_GRAPHICS3DATTRIB_RED_SIZE: Category: AtLeast Default: 0. | 124 * Category: AtLeast Default: 0. |
92 * - PP_GRAPHICS3DATTRIB_DEPTH_SIZE: Category: AtLeast Default: 0. | 125 * - <code>PP_GRAPHICS3DATTRIB_GREEN_SIZE</code>: |
93 * - PP_GRAPHICS3DATTRIB_STENCIL_SIZE: Category: AtLeast Default: 0. | 126 * Category: AtLeast Default: 0. |
94 * - PP_GRAPHICS3DATTRIB_SAMPLES: Category: AtLeast Default: 0. | 127 * - <code>PP_GRAPHICS3DATTRIB_RED_SIZE</code>: |
95 * - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS: Category: AtLeast Default: 0. | 128 * Category: AtLeast Default: 0. |
96 * - PP_GRAPHICS3DATTRIB_WIDTH: Category: Exact Default: 0. | 129 * - <code>PP_GRAPHICS3DATTRIB_DEPTH_SIZE</code>: |
97 * - PP_GRAPHICS3DATTRIB_HEIGHT: Category: Exact Default: 0. | 130 * Category: AtLeast Default: 0. |
98 * - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR: | 131 * - <code>PP_GRAPHICS3DATTRIB_STENCIL_SIZE</code>: |
132 * Category: AtLeast Default: 0. | |
133 * - <code>PP_GRAPHICS3DATTRIB_SAMPLES</code>: | |
134 * Category: AtLeast Default: 0. | |
135 * - <code>PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS</code>: | |
136 * Category: AtLeast Default: 0. | |
137 * - <code>PP_GRAPHICS3DATTRIB_WIDTH</code>: | |
138 * Category: Exact Default: 0. | |
139 * - <code>PP_GRAPHICS3DATTRIB_HEIGHT</code>: | |
140 * Category: Exact Default: 0. | |
141 * - <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code>: | |
99 * Category: Exact Default: Implementation defined. | 142 * Category: Exact Default: Implementation defined. |
100 * | 143 * |
101 * On failure NULL resource is returned. | 144 * @return A <code>PP_Resource</code> containing the 3D graphics context if |
145 * successful or 0 if unsuccessful. | |
102 */ | 146 */ |
103 PP_Resource (*Create)(PP_Instance instance, | 147 PP_Resource (*Create)(PP_Instance instance, |
104 PP_Resource share_context, | 148 PP_Resource share_context, |
105 const int32_t* attrib_list); | 149 const int32_t attrib_list[]); |
106 | |
107 /** | 150 /** |
108 * Returns PP_TRUE if the given resource is a valid PPB_Graphics3D, | 151 * IsGraphics3D() determines if the given resource is a valid |
109 * PP_FALSE if it is an invalid resource or is a resource of another type. | 152 * <code>Graphics3D</code> context. |
153 * | |
154 * @param[in] resource A <code>Graphics3D</code> context resource. | |
155 * | |
156 * @return PP_TRUE if the given resource is a valid <code>Graphics3D</code>, | |
157 * <code>PP_FALSE</code> if it is an invalid resource or is a resource of | |
158 * another type. | |
110 */ | 159 */ |
111 PP_Bool (*IsGraphics3D)(PP_Resource resource); | 160 PP_Bool (*IsGraphics3D)(PP_Resource resource); |
112 | |
113 /** | 161 /** |
114 * Retrieves the value for each attribute in attrib_list. The list | 162 * GetAttribs() retrieves the value for each attribute in |
115 * has the same structure as described for PPB_Graphics3D::Create. | 163 * <code>attrib_list</code>. |
116 * It is both input and output structure for this function. | |
117 * | 164 * |
118 * All attributes specified in PPB_Graphics3D.Create can be queried for. | 165 * @param[in] context The 3D graphics context. |
119 * On failure the following error codes may be returned: | 166 * @param[in,out] attrib_list The list of attributes that are queried. |
120 * - PP_ERROR_BADRESOURCE if context is invalid. | 167 * <code>attrib_list</code> has the same structure as described for |
121 * - PP_ERROR_BADARGUMENT if attrib_list is NULL or any attribute in the | 168 * <code>PPB_Graphics3D::Create</code>. It is both input and output |
122 * attrib_list is not a valid attribute. | 169 * structure for this function. All attributes specified in |
170 * <code>PPB_Graphics3D::Create</code> can be queried for. | |
123 * | 171 * |
124 * Example usage: To get the values for rgb bits in the color buffer, | 172 * @return Returns <code>PP_OK</code> on success or: |
125 * this function must be called as following: | 173 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid |
174 * - <code>PP_ERROR_BADARGUMENT</code> if attrib_list is 0 or any attribute | |
175 * in the <code>attrib_list</code> is not a valid attribute. | |
176 * | |
177 * <strong>Example usage:</strong> To get the values for rgb bits in the | |
178 * color buffer, this function must be called as following: | |
179 * <code> | |
126 * int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0, | 180 * int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0, |
127 * PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0, | 181 * PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0, |
128 * PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0, | 182 * PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0, |
129 * PP_GRAPHICS3DATTRIB_NONE}; | 183 * PP_GRAPHICS3DATTRIB_NONE}; |
130 * GetAttribs(context, attrib_list); | 184 * GetAttribs(context, attrib_list); |
131 * int red_bits = attrib_list[1]; | 185 * int red_bits = attrib_list[1]; |
132 * int green_bits = attrib_list[3]; | 186 * int green_bits = attrib_list[3]; |
133 * int blue_bits = attrib_list[5]; | 187 * int blue_bits = attrib_list[5]; |
188 * </code> | |
134 */ | 189 */ |
135 int32_t (*GetAttribs)(PP_Resource context, int32_t* attrib_list); | 190 int32_t (*GetAttribs)(PP_Resource context, int32_t attrib_list[]); |
136 | |
137 /** | 191 /** |
138 * Sets the values for each attribute in attrib_list. The list | 192 * SetAttribs() sets the values for each attribute in |
139 * has the same structure as described for PPB_Graphics3D.Create. | 193 * <code>attrib_list</code>. |
140 * | 194 * |
195 * @param[in] context The 3D graphics context. | |
196 * @param[in] attrib_list The list of attributes whose values need to be set. | |
197 * <code>attrib_list</code> has the same structure as described for | |
198 * <code>PPB_Graphics3D::Create</code>. | |
141 * Attributes that can be specified are: | 199 * Attributes that can be specified are: |
142 * - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR | 200 * - <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code> |
143 * | 201 * |
144 * On failure the following error codes may be returned: | 202 * @return Returns <code>PP_OK</code> on success or: |
145 * - PP_ERROR_BADRESOURCE if context is invalid. | 203 * - <code>PP_ERROR_BADRESOURCE</code> if <code>context</code> is invalid. |
146 * - PP_ERROR_BADARGUMENT if attrib_list is NULL or any attribute in the | 204 * - <code>PP_ERROR_BADARGUMENT</code> if <code>attrib_list</code> is 0 or |
147 * attrib_list is not a valid attribute. | 205 * any attribute in the <code>attrib_list</code> is not a valid attribute. |
148 */ | 206 */ |
149 int32_t (*SetAttribs)(PP_Resource context, int32_t* attrib_list); | 207 int32_t (*SetAttribs)(PP_Resource context, const int32_t attrib_list[]); |
alokp
2012/02/09 17:56:43
We are changing the function signature in this cas
brettw
2012/02/09 18:15:29
I'd say don't bother revving the interface if bina
| |
150 | |
151 /** | 208 /** |
209 * GetError() returns the current state of the given 3D context. | |
210 * | |
152 * The recoverable error conditions that have no side effect are | 211 * The recoverable error conditions that have no side effect are |
153 * detected and returned immediately by all functions in this interface. | 212 * detected and returned immediately by all functions in this interface. |
154 * In addition the implementation may get into a fatal state while | 213 * In addition the implementation may get into a fatal state while |
155 * processing a command. In this case the application must detroy the | 214 * processing a command. In this case the application must detroy the |
156 * context and reinitialize client API state and objects to continue | 215 * context and reinitialize client API state and objects to continue |
157 * rendering. | 216 * rendering. |
158 * | 217 * |
159 * Note that the same error code is also returned in the SwapBuffers callback. | 218 * Note that the same error code is also returned in the SwapBuffers callback. |
160 * It is recommended to handle error in the SwapBuffers callback because | 219 * It is recommended to handle error in the SwapBuffers callback because |
161 * GetError is synchronous. This function may be useful in rare cases where | 220 * GetError is synchronous. This function may be useful in rare cases where |
162 * drawing a frame is expensive and you want to verify the result of | 221 * drawing a frame is expensive and you want to verify the result of |
163 * ResizeBuffers before attemptimg to draw a frame. | 222 * ResizeBuffers before attemptimg to draw a frame. |
164 * | 223 * |
165 * The following error codes may be returned: | 224 * @param[in] The 3D graphics context. |
166 * - PP_ERROR_NOMEMORY | 225 * @return Returns: |
167 * - PP_ERROR_CONTEXT_LOST | 226 * - <code>PP_OK</code> if no error |
227 * - <code>PP_ERROR_NOMEMORY</code> | |
228 * - <code>PP_ERROR_CONTEXT_LOST</code> | |
168 */ | 229 */ |
169 int32_t (*GetError)(PP_Resource context); | 230 int32_t (*GetError)(PP_Resource context); |
170 | |
171 /** | 231 /** |
172 * Resizes the backing surface for context. | 232 * ResizeBuffers() resizes the backing surface for context. |
173 * | |
174 * On failure the following error codes may be returned: | |
175 * - PP_ERROR_BADRESOURCE if context is invalid. | |
176 * - PP_ERROR_BADARGUMENT if the value specified for width or height | |
177 * is less than zero. | |
178 * | 233 * |
179 * If the surface could not be resized due to insufficient resources, | 234 * If the surface could not be resized due to insufficient resources, |
180 * PP_ERROR_NOMEMORY error is returned on the next SwapBuffers callback. | 235 * <code>PP_ERROR_NOMEMORY</code> error is returned on the next |
236 * <code>SwapBuffers</code> callback. | |
237 * | |
238 * @param[in] context The 3D graphics context. | |
239 * @param[in] width The width of the backing surface. | |
240 * @param[in] height The height of the backing surface. | |
241 * @return Returns <code>PP_OK</code> on success or: | |
242 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid. | |
243 * - <code>PP_ERROR_BADARGUMENT</code> if the value specified for | |
244 * <code>width</code> or <code>height</code> is less than zero. | |
181 */ | 245 */ |
182 int32_t (*ResizeBuffers)(PP_Resource context, | 246 int32_t (*ResizeBuffers)(PP_Resource context, int32_t width, int32_t height); |
183 int32_t width, int32_t height); | |
184 | |
185 /** | 247 /** |
186 * Makes the contents of the color buffer available for compositing. | 248 * SwapBuffers() makes the contents of the color buffer available for |
187 * This function has no effect on off-screen surfaces - ones not bound | 249 * compositing. This function has no effect on off-screen surfaces - ones not |
188 * to any plugin instance. The contents of ancillary buffers are always | 250 * bound to any plugin instance. The contents of ancillary buffers are always |
189 * undefined after calling SwapBuffers. The contents of the color buffer are | 251 * undefined after calling <code>SwapBuffers</code>. The contents of the color |
190 * undefined if the value of the PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR attribute | 252 * buffer are undefined if the value of the |
191 * of context is not PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED. | 253 * <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code> attribute of context is not |
254 * <code>PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED</code>. | |
192 * | 255 * |
193 * SwapBuffers runs in asynchronous mode. Specify a callback function and the | 256 * <code>SwapBuffers</code> runs in asynchronous mode. Specify a callback |
194 * argument for that callback function. The callback function will be executed | 257 * function and the argument for that callback function. The callback function |
195 * on the calling thread after the color buffer has been composited with | 258 * will be executed on the calling thread after the color buffer has been |
196 * rest of the html page. While you are waiting for a SwapBuffers callback, | 259 * composited with rest of the html page. While you are waiting for a |
197 * additional calls to SwapBuffers will fail. | 260 * SwapBuffers callback, additional calls to SwapBuffers will fail. |
198 * | 261 * |
199 * Because the callback is executed (or thread unblocked) only when the | 262 * Because the callback is executed (or thread unblocked) only when the |
200 * plugin's current state is actually on the screen, this function provides a | 263 * plugin's current state is actually on the screen, this function provides a |
201 * way to rate limit animations. By waiting until the image is on the screen | 264 * way to rate limit animations. By waiting until the image is on the screen |
202 * before painting the next frame, you can ensure you're not generating | 265 * before painting the next frame, you can ensure you're not generating |
203 * updates faster than the screen can be updated. | 266 * updates faster than the screen can be updated. |
204 * | 267 * |
205 * SwapBuffers performs an implicit flush operation on context. | 268 * SwapBuffers performs an implicit flush operation on context. |
206 * If the context gets into an unrecoverable error condition while | 269 * If the context gets into an unrecoverable error condition while |
207 * processing a command, the error code will be returned as the argument | 270 * processing a command, the error code will be returned as the argument |
208 * for the callback. The callback may return the following error codes: | 271 * for the callback. The callback may return the following error codes: |
209 * - PP_ERROR_NOMEMORY | 272 * - <code>PP_ERROR_NOMEMORY</code> |
210 * - PP_ERROR_CONTEXT_LOST | 273 * - <code>PP_ERROR_CONTEXT_LOST</code> |
211 * Note that the same error code may also be obtained by calling GetError. | 274 * Note that the same error code may also be obtained by calling GetError. |
212 * | 275 * |
213 * On failure SwapBuffers may return the following error codes: | 276 * @param[in] context The 3D graphics context. |
214 * - PP_ERROR_BADRESOURCE if context is invalid. | 277 * @param[in] callback The callback that will executed when |
215 * - PP_ERROR_BADARGUMENT if callback is invalid. | 278 * <code>SwapBuffers</code> completes. |
279 * | |
280 * @return Returns PP_OK on success or: | |
281 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid. | |
282 * - <code>PP_ERROR_BADARGUMENT</code> if callback is invalid. | |
283 * | |
216 */ | 284 */ |
217 int32_t (*SwapBuffers)(PP_Resource context, | 285 int32_t (*SwapBuffers)(PP_Resource context, |
218 struct PP_CompletionCallback callback); | 286 struct PP_CompletionCallback callback); |
219 }; | 287 }; |
220 | 288 |
221 typedef struct PPB_Graphics3D_1_0 PPB_Graphics3D; | 289 typedef struct PPB_Graphics3D_1_0 PPB_Graphics3D; |
290 /** | |
291 * @} | |
292 */ | |
222 | 293 |
223 #endif /* PPAPI_C_PPB_GRAPHICS_3D_H_ */ | 294 #endif /* PPAPI_C_PPB_GRAPHICS_3D_H_ */ |
295 | |
OLD | NEW |