Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: ppapi/c/dev/ppb_context_3d_dev.h

Issue 6062003: Added ppapi::Context3D interface. The API has already been reviewed. I am add... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/c/dev/pp_graphics_3d_dev.h ('k') | ppapi/c/dev/ppb_graphics_3d_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 * found in the LICENSE file.
4 */
5
6 #ifndef PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_
7 #define PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_
8
9 #include "ppapi/c/dev/pp_graphics_3d_dev.h"
10
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_resource.h"
14
15 #define PPB_CONTEXT_3D_DEV_INTERFACE "PPB_Context3D(Dev);0.1"
16
17 struct PPB_Context3D_Dev {
18 // Creates and initializes a rendering context and returns a handle to it.
19 // The context can be used to render to any compatible PPB_Surface3D_Dev.
20 //
21 // If share_context is not NULL, then all shareable data, as defined
22 // by the client API (note that for OpenGL and OpenGL ES, shareable data
23 // excludes texture objects named 0) will be shared by share_context, all
24 // other contexts share_context already shares with, and the newly created
25 // context. An arbitrary number of PPB_Context3D_Dev can share data in
26 // this fashion.
27 //
28 // attrib_list specifies a list of attributes for the context. The list
29 // has the same structure as described for
30 // PPB_Graphics3D_Dev::GetConfigAttribs. The only attribute that can be
31 // specified in attrib_list is PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION,
32 // and this attribute may only be specified when creating a OpenGL ES context.
33 // attrib_list may be NULL or empty (first attribute is EGL_NONE), in which
34 // case attributes assume their default values.
35 //
36 // If config is not a valid PP_Config3D_Dev, or does not support
37 // the requested client API, then an PP_GRAPHICS3DERROR_BAD_CONFIG error is
38 // generated (this includes requesting creation of an OpenGL ES 1.x context
39 // when the PP_GRAPHICS3DATTRIB_RENDERABLE_TYPE attribute of config does not
40 // contain PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES_BIT, or creation of an
41 // OpenGL ES 2.x context when the attribute does not contain
42 // PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES2_BIT).
43 //
44 // On failure Create returns NULL resource.
45 PP_Resource (*Create)(PP_Instance instance,
46 PP_Config3D_Dev config,
47 PP_Resource share_context,
48 const int32_t* attrib_list);
49
50 // Returns PP_TRUE if the given resource is a valid PPB_Context3D_Dev,
51 // PP_FALSE if it is an invalid resource or is a resource of another type.
52 PP_Bool (*IsContext3D)(PP_Resource resource);
53
54 // Returns in value the value of attribute for context.
55 // Attributes that can be queried for include:
56 // - PP_GRAPHICS3DATTRIB_CONFIG_ID: returns the ID of the
57 // PP_Config3D_Dev with respect to which the context was created.
58 // - PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_TYPE: returns the type of client API
59 // this context supports.
60 // - PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION: returns the version of the
61 // client API this context supports, as specified at context creation time.
62 // - PP_GRAPHICS3DATTRIB_RENDER_BUFFER: returns the buffer which client API
63 // rendering via this context will use. The value returned depends on
64 // properties of both the context, and the surface to which the context
65 // is bound:
66 // - If the context is bound to a surface, then either
67 // PP_GRAPHICS3DATTRIBVALUE_BACK_BUFFER or
68 // PP_GRAPHICS3DATTRIBVALUE_SINGLE_BUFFER may be returned. The value
69 // returned depends on the buffer requested by the setting of the
70 // PP_GRAPHICS3DATTRIB_RENDER_BUFFER property of the surface.
71 // - If the context is not bound to a surface, then
72 // PP_GRAPHICS3DATTRIBVALUE_NONE will be returned.
73 //
74 // On failure the following error codes may be returned:
75 // - PP_GRAPHICS3DERROR_BAD_ATTRIBUTE if attribute is not a valid attribute
76 // - PP_GRAPHICS3DERROR_BAD_CONTEXT if context is invalid.
77 int32_t (*GetAttrib)(PP_Resource context,
78 int32_t attribute,
79 int32_t* value);
80
81 // Binds context to the draw and read surfaces.
82 // For an OpenGL or OpenGL ES context, draw is used for all operations except
83 // for any pixel data read back or copied, which is taken from the frame
84 // buffer values of read. Note that the same PPB_Surface3D_Dev may be
85 // specified for both draw and read.
86 //
87 // On failure the following error codes may be returned:
88 // - PP_GRAPHICS3DERROR_BAD_MATCH: if draw or read surfaces are not
89 // compatible with context.
90 // - PP_GRAPHICS3DERROR_BAD_ACCESS: if either draw or read is bound to any
91 // other context.
92 // - PP_GRAPHICS3DERROR_BAD_CONTEXT: if context is not a valid context.
93 // - PP_GRAPHICS3DERROR_BAD_SURFACE: if either draw or read are not valid
94 // surfaces.
95 // - PP_GRAPHICS3DERROR_BAD_MATCH:fIf draw and read cannot fit into
96 // graphics memory simultaneously.
97 // - PP_ERROR_NOMEMORY: if the ancillary buffers for draw and read cannot
98 // be allocated.
99 // - PP_GRAPHICS3DERROR_CONTEXT_LOST: if a power management event has
100 // occurred.
101 //
102 // If draw is destroyed after BindSurfaces is called, then subsequent
103 // rendering commands will be processed and the context state will be updated,
104 // but the surface contents become undefined. If read is destroyed after
105 // BindSurfaces then pixel values read from the framebuffer (e.g., as result
106 // of calling glReadPixels) are undefined.
107 //
108 // To unbind surfaces set draw and read to NULL.
109 int32_t (*BindSurfaces)(PP_Resource context,
110 PP_Resource draw,
111 PP_Resource read);
112
113 // Returns the surfaces bound to the context for drawing and reading in
114 // draw and read respectively.
115 //
116 // On failure, the following error codes can be returned:
117 // - PP_GRAPHICS3DERROR_BAD_CONTEXT: if context is not a valid context.
118 // - PP_ERROR_BADARGUMENT: if either draw or read is NULL.
119 int32_t (*GetBoundSurfaces)(PP_Resource context,
120 PP_Resource* draw,
121 PP_Resource* read);
122
123 // TODO(alokp): Move to PPB_Surface3D_Dev
124 int32_t (*SwapBuffers)(PP_Resource context,
125 struct PP_CompletionCallback callback);
126 };
127
128 #endif // PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_
OLDNEW
« no previous file with comments | « ppapi/c/dev/pp_graphics_3d_dev.h ('k') | ppapi/c/dev/ppb_graphics_3d_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698