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