OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_completion_callback.h" | |
10 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
11 #include "ppapi/c/pp_module.h" | 10 #include "ppapi/c/pp_module.h" |
12 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
13 #include "ppapi/c/pp_stdint.h" | 12 #include "ppapi/c/pp_stdint.h" |
14 | 13 |
15 // Example usage from plugin code: | 14 // Example usage from plugin code: |
16 // | 15 // |
17 // PP_Resource context = device->Create(module, config, contextAttribList); | 16 // PP_Resource context = device->Create(module, config, contextAttribList); |
18 // CHECK(context); | 17 // CHECK(context); |
19 // | 18 // |
20 // // Present one frame. | 19 // // Present one frame. |
21 // CHECK(device->MakeCurrent(context)); | 20 // CHECK(device->MakeCurrent(context)); |
22 // glClear(GL_COLOR_BUFFER); | 21 // glClear(GL_COLOR_BUFFER); |
23 // CHECK(device->MakeCurrent(NULL)); | 22 // CHECK(device->MakeCurrent(NULL)); |
24 // CHECK(device->SwapBuffers(context, callback)); | 23 // CHECK(device->SwapBuffers(context)); |
25 // | 24 // |
26 // // Shutdown. | 25 // // Shutdown. |
27 // core->ReleaseResource(context); | 26 // core->ReleaseResource(context); |
28 | 27 |
29 #define PPB_GRAPHICS_3D_DEV_INTERFACE "PPB_Graphics3D(Dev);0.4" | 28 #define PPB_GRAPHICS_3D_DEV_INTERFACE "PPB_Graphics3D(Dev);0.3" |
30 | 29 |
31 // These are the same error codes as used by EGL. | 30 // These are the same error codes as used by EGL. |
32 enum { | 31 enum { |
33 PP_GRAPHICS_3D_ERROR_SUCCESS = 0x3000, | 32 PP_GRAPHICS_3D_ERROR_SUCCESS = 0x3000, |
34 PP_GRAPHICS_3D_ERROR_NOT_INITIALIZED = 0x3001, | 33 PP_GRAPHICS_3D_ERROR_NOT_INITIALIZED = 0x3001, |
35 PP_GRAOHICS_3D_ERROR_BAD_CONTEXT = 0x3006, | 34 PP_GRAOHICS_3D_ERROR_BAD_CONTEXT = 0x3006, |
36 PP_GRAPHICS_3D_ERROR_BAD_PARAMETER = 0x300C, | 35 PP_GRAPHICS_3D_ERROR_BAD_PARAMETER = 0x300C, |
37 PP_GRAPHICS_3D_ERROR_CONTEXT_LOST = 0x300E | 36 PP_GRAPHICS_3D_ERROR_CONTEXT_LOST = 0x300E |
38 }; | 37 }; |
39 | 38 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // on success, PP_FALSE on failure. | 82 // on success, PP_FALSE on failure. |
84 PP_Bool (*MakeCurent)(PP_Resource context); | 83 PP_Bool (*MakeCurent)(PP_Resource context); |
85 | 84 |
86 // Returns the calling thread's current context or NULL if no context is | 85 // Returns the calling thread's current context or NULL if no context is |
87 // current. | 86 // current. |
88 PP_Resource (*GetCurrentContext)(); | 87 PP_Resource (*GetCurrentContext)(); |
89 | 88 |
90 // Snapshots the rendered frame and makes it available for composition with | 89 // Snapshots the rendered frame and makes it available for composition with |
91 // the rest of the page. The alpha channel is used for translucency effects. | 90 // the rest of the page. The alpha channel is used for translucency effects. |
92 // One means fully opaque. Zero means fully transparent. Any thread. | 91 // One means fully opaque. Zero means fully transparent. Any thread. |
93 // The callback will be called when SwapBuffers completes. While a SwapBuffers | |
94 // call is pending, all subsequent SwapBuffers calls will fail. Specifying a | |
95 // NULL callback means blocking but this is not legal on the main thread. | |
96 // TODO(apatrick): premultiplied alpha or linear alpha? Premultiplied alpha is | 92 // TODO(apatrick): premultiplied alpha or linear alpha? Premultiplied alpha is |
97 // better for correct alpha blending effect. Most existing OpenGL code assumes | 93 // better for correct alpha blending effect. Most existing OpenGL code assumes |
98 // linear. I could convert from linear to premultiplied during the copy from | 94 // linear. I could convert from linear to premultiplied during the copy from |
99 // back-buffer to offscreen "front-buffer". | 95 // back-buffer to offscreen "front-buffer". |
100 PP_Bool (*SwapBuffers)(PP_Resource context, | 96 PP_Bool (*SwapBuffers)(PP_Resource context); |
101 struct PP_CompletionCallback callback); | |
102 | 97 |
103 // Returns the current error for this thread. This is not associated with a | 98 // Returns the current error for this thread. This is not associated with a |
104 // particular context. It is distinct from the GL error returned by | 99 // particular context. It is distinct from the GL error returned by |
105 // glGetError. | 100 // glGetError. |
106 uint32_t (*GetError)(); | 101 uint32_t (*GetError)(); |
107 }; | 102 }; |
108 | 103 |
109 #endif // PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ | 104 #endif // PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ |
OLD | NEW |