OLD | NEW |
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 #ifndef PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ |
6 #define PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ |
7 | 7 |
8 #include "ppapi/c/dev/pp_graphics_3d_dev.h" | 8 #include "ppapi/c/dev/pp_graphics_3d_dev.h" |
9 | 9 |
10 #include "ppapi/c/pp_bool.h" | 10 #include "ppapi/c/pp_bool.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // context = g3d->Create(instance, config, attribs, &context); | 24 // context = g3d->Create(instance, config, attribs, &context); |
25 // inst->BindGraphics(instance, context); | 25 // inst->BindGraphics(instance, context); |
26 // | 26 // |
27 // // Present one frame. | 27 // // Present one frame. |
28 // gles2->Clear(context, GL_COLOR_BUFFER); | 28 // gles2->Clear(context, GL_COLOR_BUFFER); |
29 // g3d->SwapBuffers(context); | 29 // g3d->SwapBuffers(context); |
30 // | 30 // |
31 // // Shutdown. | 31 // // Shutdown. |
32 // core->ReleaseResource(context); | 32 // core->ReleaseResource(context); |
33 | 33 |
34 #define PPB_GRAPHICS_3D_DEV_INTERFACE_0_5 "PPB_Graphics3D(Dev);0.5" | 34 #define PPB_GRAPHICS_3D_DEV_INTERFACE_0_6 "PPB_Graphics3D(Dev);0.6" |
35 #define PPB_GRAPHICS_3D_DEV_INTERFACE PPB_GRAPHICS_3D_DEV_INTERFACE_0_5 | 35 #define PPB_GRAPHICS_3D_DEV_INTERFACE PPB_GRAPHICS_3D_DEV_INTERFACE_0_6 |
36 | 36 |
37 struct PPB_Graphics3D_Dev { | 37 struct PPB_Graphics3D_Dev { |
38 // TODO(alokp): Do these functions need module argument? | 38 // TODO(alokp): Do these functions need module argument? |
39 | 39 |
40 // Retrieves the list of all available PP_Config3D_Devs. | 40 // Retrieves the list of all available PP_Config3D_Devs. |
41 // configs is a pointer to a buffer containing config_size elements. | 41 // configs is a pointer to a buffer containing config_size elements. |
42 // On success, PP_OK is returned. The number of configurations is returned | 42 // On success, PP_OK is returned. The number of configurations is returned |
43 // in num_config, and elements 0 through num_config - 1 of configs are filled | 43 // in num_config, and elements 0 through num_config - 1 of configs are filled |
44 // in with valid PP_Config3D_Devs. No more than config_size | 44 // in with valid PP_Config3D_Devs. No more than config_size |
45 // PP_Config3D_Devs will be returned even if more are available. | 45 // PP_Config3D_Devs will be returned even if more are available. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // not contain PP_GRAPHICS3DATTRIBVALUE_MULTISAMPLE_RESOLVE_BOX_BIT, a | 189 // not contain PP_GRAPHICS3DATTRIBVALUE_MULTISAMPLE_RESOLVE_BOX_BIT, a |
190 // PP_GRAPHICS3DERROR_BAD_MATCH error is returned. | 190 // PP_GRAPHICS3DERROR_BAD_MATCH error is returned. |
191 // - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR: If value is | 191 // - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR: If value is |
192 // PP_GRAPHICS3DATTRIBVALUE_BUFFER_PRESERVED, and the | 192 // PP_GRAPHICS3DATTRIBVALUE_BUFFER_PRESERVED, and the |
193 // PP_GRAPHICS3DATTRIB_SURFACE_TYPE attribute used to create surface | 193 // PP_GRAPHICS3DATTRIB_SURFACE_TYPE attribute used to create surface |
194 // does not contain PP_GRAPHICS3DATTRIBVALUE_SWAP_BEHAVIOR_PRESERVED_BIT, | 194 // does not contain PP_GRAPHICS3DATTRIBVALUE_SWAP_BEHAVIOR_PRESERVED_BIT, |
195 // a PP_GRAPHICS3DERROR_BAD_MATCH error is returned. | 195 // a PP_GRAPHICS3DERROR_BAD_MATCH error is returned. |
196 int32_t (*SetAttribs)(PP_Resource context, | 196 int32_t (*SetAttribs)(PP_Resource context, |
197 int32_t* attrib_list); | 197 int32_t* attrib_list); |
198 | 198 |
| 199 // Resizes the backing surface for context. |
| 200 // |
| 201 // On failure the following error codes may be returned: |
| 202 // - PP_ERROR_BADRESOURCE if context is invalid. |
| 203 // - PP_ERROR_BADARGUMENT if the value specified for width or height |
| 204 // is less than zero. |
| 205 // |
| 206 // If the surface could not be resized due to insufficient resources, |
| 207 // PP_ERROR_NOMEMORY error is returned on the next SwapBuffers callback. |
| 208 int32_t (*ResizeBuffers)(PP_Resource context, |
| 209 int32_t width, int32_t height); |
| 210 |
199 // Makes the contents of the color buffer available for compositing. | 211 // Makes the contents of the color buffer available for compositing. |
200 // This function has no effect on off-screen surfaces - ones not bound | 212 // This function has no effect on off-screen surfaces - ones not bound |
201 // to any plugin instance. The contents of ancillary buffers are always | 213 // to any plugin instance. The contents of ancillary buffers are always |
202 // undefined after calling SwapBuffers. The contents of the color buffer are | 214 // undefined after calling SwapBuffers. The contents of the color buffer are |
203 // undefined if the value of the PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR attribute | 215 // undefined if the value of the PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR attribute |
204 // of context is not PP_GRAPHICS3DATTRIBVALUE_BUFFER_PRESERVED. | 216 // of context is not PP_GRAPHICS3DATTRIBVALUE_BUFFER_PRESERVED. |
205 // | 217 // |
206 // SwapBuffers performs an implicit flush operation on context. | 218 // SwapBuffers performs an implicit flush operation on context. |
207 // | 219 // |
208 // This functions can run in two modes: | 220 // This functions can run in two modes: |
(...skipping 10 matching lines...) Expand all Loading... |
219 // Because the callback is executed (or thread unblocked) only when the | 231 // Because the callback is executed (or thread unblocked) only when the |
220 // plugin's current state is actually on the screen, this function provides a | 232 // plugin's current state is actually on the screen, this function provides a |
221 // way to rate limit animations. By waiting until the image is on the screen | 233 // way to rate limit animations. By waiting until the image is on the screen |
222 // before painting the next frame, you can ensure you're not generating | 234 // before painting the next frame, you can ensure you're not generating |
223 // updates faster than the screen can be updated. | 235 // updates faster than the screen can be updated. |
224 int32_t (*SwapBuffers)(PP_Resource context, | 236 int32_t (*SwapBuffers)(PP_Resource context, |
225 struct PP_CompletionCallback callback); | 237 struct PP_CompletionCallback callback); |
226 }; | 238 }; |
227 | 239 |
228 #endif /* PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ */ | 240 #endif /* PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ */ |
OLD | NEW |