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

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.
34 //
35 // If config is not a valid PP_Graphics3DConfig_Dev, or does not support
36 // the requested client API, then an PP_GRAPHICS3DERROR_BAD_CONFIG error is
37 // generated (this includes requesting creation of an OpenGL ES 1.x context
38 // when the PP_GRAPHICS3DATTRIB_RENDERABLE_TYPE attribute of config does not
39 // contain PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES_BIT, or creation of an
40 // OpenGL ES 2.x context when the attribute does not contain
41 // PP_GRAPHICS3DATTRIBVALUE_OPENGL_ES2_BIT).
42 //
43 // On failure Create returns NULL resource.
44 PP_Resource (*Create)(PP_Module module,
45 PP_Graphics3DConfig_Dev config,
46 PP_Resource share_context,
47 const int32_t* attrib_list);
48
49 // Returns PP_TRUE if the given resource is a valid PPB_Context3D_Dev,
50 // PP_FALSE if it is an invalid resource or is a resource of another type.
51 PP_Bool (*IsContext3D)(PP_Resource resource);
52
53 // Returns in value the value of attribute for context.
54 // Attributes that can be queried for include:
55 // - PP_GRAPHICS3DATTRIB_CONFIG_ID: returns the ID of the
56 // PP_Graphics3DConfig_Dev with respect to which the context was created.
57 // - PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_TYPE: returns the type of client API
58 // this context supports.
59 // - PP_GRAPHICS3DATTRIB_CONTEXT_CLIENT_VERSION: returns the version of the
60 // client API this context supports, as specified at context creation time.
61 // - PP_GRAPHICS3DATTRIB_RENDER_BUFFER: returns the buffer which client API
62 // rendering via this context will use. The value returned depends on
63 // properties of both the context, and the surface to which the context
64 // is bound:
65 // - If the context is bound to a surface, then either
66 // PP_GRAPHICS3DATTRIBVALUE_BACK_BUFFER or
67 // PP_GRAPHICS3DATTRIBVALUE_SINGLE_BUFFER may be returned. The value
68 // returned depends on the buffer requested by the setting of the
69 // PP_GRAPHICS3DATTRIB_RENDER_BUFFER property of the surface.
70 // - If the context is not bound to a surface, then
71 // PP_GRAPHICS3DATTRIBVALUE_NONE will be returned.
72 //
73 // On failure the following error codes may be returned:
74 // - PP_GRAPHICS3DERROR_BAD_ATTRIBUTE if attribute is not a valid attribute
75 // - PP_GRAPHICS3DERROR_BAD_CONTEXT if context is invalid.
76 int32_t (*GetAttrib)(PP_Resource context,
77 int32_t attribute,
78 int32_t* value);
79
80 // Binds context to the draw and read surfaces.
81 // For an OpenGL or OpenGL ES context, draw is used for all operations except
82 // for any pixel data read back or copied, which is taken from the frame
83 // buffer values of read. Note that the same PPB_Surface3D_Dev may be
84 // specified for both draw and read.
85 //
86 // On failure the following error codes may be returned:
87 // - PP_GRAPHICS3DERROR_BAD_MATCH: if draw or read surfaces are not
88 // compatible with context.
89 // - PP_GRAPHICS3DERROR_BAD_ACCESS: if either draw or read is bound to any
90 // other context.
91 // - PP_GRAPHICS3DERROR_BAD_CONTEXT: if context is not a valid context.
92 // - PP_GRAPHICS3DERROR_BAD_SURFACE: if either draw or read are not valid
93 // surfaces.
94 // - PP_GRAPHICS3DERROR_BAD_MATCH:fIf draw and read cannot fit into
95 // graphics memory simultaneously.
96 // - PP_ERROR_NOMEMORY: if the ancillary buffers for draw and read cannot
97 // be allocated.
98 // - PP_GRAPHICS3DERROR_CONTEXT_LOST: if a power management event has
99 // occurred.
100 //
101 // If draw is destroyed after BindSurfaces is called, then subsequent
102 // rendering commands will be processed and the context state will be updated,
103 // but the surface contents become undefined. If read is destroyed after
104 // BindSurfaces then pixel values read from the framebuffer (e.g., as result
105 // of calling glReadPixels) are undefined.
106 //
107 // To unbind surfaces set draw and read to NULL.
108 int32_t (*BindSurfaces)(PP_Resource context,
109 PP_Resource draw,
110 PP_Resource read);
111
112 // Returns the surfaces bound to the context for drawing and reading in
113 // draw and read respectively.
114 //
115 // On failure, the following error codes can be returned:
116 // - PP_GRAPHICS3DERROR_BAD_CONTEXT: if context is not a valid context.
117 // - PP_ERROR_BADARGUMENT: if either draw or read is NULL.
118 int32_t (*GetBoundSurfaces)(PP_Resource context,
119 PP_Resource* draw,
120 PP_Resource* read);
121 };
122
123 #endif // PPAPI_C_DEV_PPB_CONTEXT_3D_DEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698