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

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

Issue 5567004: Proposed changes to Pepper 3D API. (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
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 #ifndef PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_
6 #define PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_
7
8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_module.h"
10 #include "ppapi/c/pp_resource.h"
11
12 #define PPB_CONTEXT_3D_DEV_INTERFACE "PPB_Context3D(Dev);0.1"
13
14 // TODO(alokp): Should this rather be named Graphics3DContext
15 // to indicate that it is part of the Graphics3D package?
16 struct PPB_Context3D_Dev {
17 // Creates and initializes a rendering context and returns a handle to it.
18 // The context can be used to render to any compatible PPB_Surface3D_Dev.
19 //
20 // If share_context is not NULL, then all shareable data, as defined
21 // by the client API (note that for OpenGL and OpenGL ES, shareable data
22 // excludes texture objects named 0) will be shared by share_context, all
23 // other contexts share_context already shares with, and the newly created
24 // context. An arbitrary number of PPB_Context3D_Dev can share data in
25 // this fashion.
26 //
27 // attrib list specifies a list of attributes for the context. The list
28 // has the same structure as described for
29 // PPB_Graphics3D_Dev::GetConfigAttribs. The only attribute that can be
30 // specified in attrib list is PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION,
31 // and this attribute may only be specified when creating a OpenGL ES context.
32 // attrib list may be NULL or empty (first attribute is EGL_NONE), in which
33 // case attributes assume their default values as described below.
34 // PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION determines which version of an
35 // OpenGL ES context to create. An attribute value of 1 specifies creation
36 // of an OpenGL ES 1.x context. An attribute value of 2 specifies creation
37 // of an OpenGL ES 2.x context. The default value for
38 // PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION is 1.
39 //
40 // If config is not a valid PP_Graphics3DConfig_Dev, or does not support
41 // the requested client API, then an PP_GRAPHICS3DERROR_BAD_CONFIG error is
42 // generated (this includes requesting creation of an OpenGL ES 1.x context
43 // when the PP_GRAPHICS3DATTRIB_RENDERABLE_TYPE attribute of config does not
44 // contain PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES_BIT, or creation of an
45 // OpenGL ES 2.x context when the attribute does not contain
46 // PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES2_BIT).
47 //
48 // On failure Create returns NULL resource.
49 PP_Resource (*Create)(PP_Module module,
50 PP_Graphics3DConfig_Dev config,
51 PP_Resource share_context,
52 const int32_t* attrib_list);
53
54 // Returns PP_TRUE if the given resource is a valid PPB_Context3D_Dev,
55 // PP_FALSE if it is an invalid resource or is a resource of another type.
56 PP_Bool (*IsContext3D)(PP_Resource resource);
57
58 // Returns in value the value of attribute for context.
59 // Attributes that can be queried for include:
60 // - PP_GRAPHICS3DATTRIB_CONFIG_ID: returns the ID of the
61 // PP_Graphics3DConfig_Dev with respect to which the context was created.
62 // - PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_TYPE: returns the type of client API
brettw 2010/12/10 00:32:27 The documentation here is great. I think it would
alokp 2010/12/10 13:20:33 Done.
63 // this context supports.
64 // - PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION: returns the version of the
65 // client API this context supports, as specified at context creation time.
66 // The resulting value is only meaningful for an OpenGL ES context.
67 // - PP_GRAPHICS3DATTRIB_RENDER_BUFFER: returns the buffer which client API
68 // rendering via this context will use. The value returned depends on
69 // properties of both the context, and the surface to which the context
70 // is bound:
71 // - If the context is bound to a surface, then either
72 // PP_GRAPHICS3DATTRIBVALUE_BACK_BUFFER or
73 // PP_GRAPHICS3DATTRIBVALUE_SINGLE_BUFFER may be returned. The value
74 // returned depends on the buffer requested by the setting of the
75 // PP_GRAPHICS3DATTRIB_RENDER_BUFFER property of the surface.
76 // - If the context is not bound to a surface, then
77 // PP_GRAPHICS3DATTRIBVALUE_NONE will be returned.
78 //
79 // On failure the following error codes may be returned:
80 // - PP_GRAPHICS3DERROR_BAD_ATTRIBUTE if attribute is not a valid attribute
81 // - PP_GRAPHICS3DERROR_BAD_CONTEXT if context is invalid.
82 int32_t (*GetAttrib)(PP_Resource context,
83 int32_t attribute,
84 int32_t* value);
85
86 // Binds context to the draw and read surfaces.
87 // For an OpenGL or OpenGL ES context, draw is used for all operations except
88 // for any pixel data read back or copied, which is taken from the frame
89 // buffer values of read. Note that the same PPB_Surface3D_Dev may be
90 // specified for both draw and read.
91 //
92 // On failure the following error codes may be returned:
93 // - PP_GRAPHICS3DERROR_BAD_MATCH: if draw or read surfaces are not
94 // compatible with context.
95 // - PP_GRAPHICS3DERROR_BAD_ACCESS: if either draw or read is bound to any
96 // other context.
97 // - PP_GRAPHICS3DERROR_BAD_CONTEXT: if context is not a valid context.
98 // - PP_GRAPHICS3DERROR_BAD_SURFACE: if either draw or read are not valid
99 // surfaces.
100 // - PP_GRAPHICS3DERROR_BAD_MATCH:fIf draw and read cannot fit into
101 // graphics memory simultaneously.
102 // - PP_ERROR_NOMEMORY: if the ancillary buffers for draw and read cannot
103 // be allocated.
104 // - PP_GRAPHICS3DERROR_CONTEXT_LOST: if a power management event has
105 // occurred.
106 //
107 // If draw is destroyed after BindSurfaces is called, then subsequent
108 // rendering commands will be processed and the context state will be updated,
109 // but the surface contents become undefined. If read is destroyed after
110 // BindSurfaces then pixel values read from the framebuffer (e.g., as result
111 // of calling glReadPixels) are undefined.
112 //
113 // To unbind surfaces set draw and read to NULL.
114 int32_t (*BindSurfaces)(PP_Resource context,
115 PP_Resource draw,
116 PP_Resource read);
117
118 // Returns the surfaces bound to the context for drawing and reading in
119 // draw and read respectively.
120 //
121 // On failure, the following error codes can be returned:
122 // - PP_GRAPHICS3DERROR_BAD_CONTEXT: if context is not a valid context.
123 // - PP_ERROR_BADARGUMENT: if either draw or read is NULL.
124 int32_t (*GetBoundSurfaces)(PP_Resource context,
125 PP_Resource* draw,
126 PP_Resource* read);
127 };
128
129 #endif // PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698