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

Side by Side Diff: ppapi/api/ppb_graphics_3d.idl

Issue 9340003: Added idl file for Pepper 3D. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 months 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 | « no previous file | ppapi/c/ppb_graphics_3d.h » ('j') | ppapi/c/ppb_graphics_3d.h » ('J')
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) 2012 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 /**
7 * Defines the <code>PPB_Graphics3D</code> struct representing a 3D graphics
8 * context within the browser.
9 */
10
11 label Chrome {
12 M15 = 1.0
13 };
14
15 /**
16 * <code>PPB_Graphics3D</code> defines the interface for a 3D graphics context.
17 * <strong>Example usage from plugin code:</strong>
18 *
19 * <strong>Setup:</strong>
20 * <code>
21 * PP_Resource context;
22 * int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800,
23 * PP_GRAPHICS3DATTRIB_HEIGHT, 800,
24 * PP_GRAPHICS3DATTRIB_NONE};
25 * context = g3d->Create(instance, attribs, &context);
26 * inst->BindGraphics(instance, context);
27 * </code>
28 *
29 * <strong>Present one frame:</strong>
30 * <code>
31 * gles2->Clear(context, GL_COLOR_BUFFER);
32 * g3d->SwapBuffers(context);
33 * </code>
34 *
35 * <strong>Shutdown:</strong>
36 * <code>
37 * core->ReleaseResource(context);
38 * </code>
39 */
40 [macro="PPB_GRAPHICS_3D_INTERFACE"]
41 interface PPB_Graphics3D {
42 /**
43 * GetAttribMaxValue() retrieves the maximum supported value for the
44 * given attribute. This function may be used to check if a particular
45 * attribute value is supported before attempting to create a context.
46 *
47 * @param[in] instance The module instance.
48 * @param[in] attribute The attribute for which maximum value is queried.
49 * Attributes that can be queried for include:
50 * - <code>PP_GRAPHICS3DATTRIB_ALPHA_SIZE</code>
51 * - <code>PP_GRAPHICS3DATTRIB_BLUE_SIZE</code>
52 * - <code>PP_GRAPHICS3DATTRIB_GREEN_SIZE</code>
53 * - <code>PP_GRAPHICS3DATTRIB_RED_SIZE</code>
54 * - <code>PP_GRAPHICS3DATTRIB_DEPTH_SIZE</code>
55 * - <code>PP_GRAPHICS3DATTRIB_STENCIL_SIZE</code>
56 * - <code>PP_GRAPHICS3DATTRIB_SAMPLES</code>
57 * - <code>PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS</code>
58 * - <code>PP_GRAPHICS3DATTRIB_WIDTH</code>
59 * - <code>PP_GRAPHICS3DATTRIB_HEIGHT</code>
60 * @param[out] value The maximum supported value for <code>attribute</code>
61 *
62 * @return Returns <code>PP_TRUE</code> on success or the following on error:
63 * - <code>PP_ERROR_BADRESOURCE</code> if <code>instance</code> is invalid
64 * - <code>PP_ERROR_BADARGUMENT</code> if <code>attribute</code> is invalid
65 * or <code>value</code> is 0
66 */
67 int32_t GetAttribMaxValue(
68 [in] PP_Resource instance,
69 [in] int32_t attribute,
70 [out] int32_t value);
71
72 /**
73 * Create() creates and initializes a 3D rendering context.
74 * The returned context is off-screen to start with. It must be attached to
75 * a plugin instance using <code>PPB_Instance::BindGraphics</code> to draw
76 * on the web page.
77 *
78 * @param[in] instance The module instance.
79 *
80 * @param[in] share_context The 3D context with which the created context
81 * would share resources. If <code>share_context</code> is not 0, then all
82 * shareable data, as defined by the client API (note that for OpenGL and
83 * OpenGL ES, shareable data excludes texture objects named 0) will be shared
84 * by <code>share_context<code>, all other contexts <code>share_context</code>
85 * already shares with, and the newly created context. An arbitrary number of
86 * <code>PPB_Graphics3D</code> can share data in this fashion.
87 *
88 * @param[out] attrib_list specifies a list of attributes for the context.
89 * It is a list of attribute name-value pairs in which each attribute is
90 * immediately followed by the corresponding desired value. The list is
91 * terminated with <code>PP_GRAPHICS3DATTRIB_NONE</code>.
92 * The <code>attrib_list<code> may be 0 or empty (first attribute is
93 * <code>PP_GRAPHICS3DATTRIB_NONE</code>). If an attribute is not
94 * specified in <code>attrib_list</code>, then the default value is used
95 * (it is said to be specified implicitly).
96 * Attributes for the context are chosen according to an attribute-specific
97 * criteria. Attributes can be classified into two categories:
98 * - AtLeast: The attribute value in the returned context meets or exceeds
99 * the value specified in <code>attrib_list</code>.
100 * - Exact: The attribute value in the returned context is equal to
101 * the value specified in <code>attrib_list</code>.
102 *
103 * Attributes that can be specified in <code>attrib_list</code> include:
104 * - <code>PP_GRAPHICS3DATTRIB_ALPHA_SIZE</code>:
105 * Category: AtLeast Default: 0.
106 * - <code>PP_GRAPHICS3DATTRIB_BLUE_SIZE</code>:
107 * Category: AtLeast Default: 0.
108 * - <code>PP_GRAPHICS3DATTRIB_GREEN_SIZE</code>:
109 * Category: AtLeast Default: 0.
110 * - <code>PP_GRAPHICS3DATTRIB_RED_SIZE</code>:
111 * Category: AtLeast Default: 0.
112 * - <code>PP_GRAPHICS3DATTRIB_DEPTH_SIZE</code>:
113 * Category: AtLeast Default: 0.
114 * - <code>PP_GRAPHICS3DATTRIB_STENCIL_SIZE</code>:
115 * Category: AtLeast Default: 0.
116 * - <code>PP_GRAPHICS3DATTRIB_SAMPLES</code>:
117 * Category: AtLeast Default: 0.
118 * - <code>PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS</code>:
119 * Category: AtLeast Default: 0.
120 * - <code>PP_GRAPHICS3DATTRIB_WIDTH</code>:
121 * Category: Exact Default: 0.
122 * - <code>PP_GRAPHICS3DATTRIB_HEIGHT</code>:
123 * Category: Exact Default: 0.
124 * - <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code>:
125 * Category: Exact Default: Implementation defined.
126 *
127 * @return A <code>PP_Resource</code> containing the 3D graphics context if
128 * successful or 0 if unsuccessful.
129 */
130 PP_Resource Create(
131 [in] PP_Instance instance,
132 [in] PP_Resource share_context,
133 [in] int32_t[] attrib_list);
134
135 /**
136 * IsGraphics3D() determines if the given resource is a valid
137 * <code>Graphics3D</code> context.
138 *
139 * @param[in] resource A <code>Graphics3D</code> context resource.
140 *
141 * @return PP_TRUE if the given resource is a valid <code>Graphics3D</code>,
142 * <code>PP_FALSE</code> if it is an invalid resource or is a resource of
143 * another type.
144 */
145 PP_Bool IsGraphics3D(
146 [in] PP_Resource resource);
147
148 /**
149 * GetAttribs() retrieves the value for each attribute in
150 * <code>attrib_list</code>.
151 *
152 * @param[in] context The 3D graphics context.
153 * @param[in,out] attrib_list The list of attributes that are queried.
154 * <code>attrib_list</code> has the same structure as described for
155 * <code>PPB_Graphics3D::Create</code>. It is both input and output
156 * structure for this function. All attributes specified in
157 * <code>PPB_Graphics3D::Create</code> can be queried for.
158 *
159 * @return Returns <code>PP_OK</code> on success or:
160 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid
161 * - <code>PP_ERROR_BADARGUMENT</code> if attrib_list is 0 or any attribute
162 * in the <code>attrib_list</code> is not a valid attribute.
163 *
164 * <strong>Example usage:</strong> To get the values for rgb bits in the
165 * color buffer, this function must be called as following:
166 * <code>
167 * int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0,
168 * PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0,
169 * PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0,
170 * PP_GRAPHICS3DATTRIB_NONE};
171 * GetAttribs(context, attrib_list);
172 * int red_bits = attrib_list[1];
173 * int green_bits = attrib_list[3];
174 * int blue_bits = attrib_list[5];
175 * </code>
176 */
177 int32_t GetAttribs(
178 [in] PP_Resource context,
179 [inout] int32_t[] attrib_list);
180
181 /**
182 * SetAttribs() sets the values for each attribute in
183 * <code>attrib_list</code>.
184 *
185 * @param[in] context The 3D graphics context.
186 * @param[in] attrib_list The list of attributes whose values need to be set.
187 * <code>attrib_list</code> has the same structure as described for
188 * <code>PPB_Graphics3D::Create</code>.
189 * Attributes that can be specified are:
190 * - <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code>
191 *
192 * @return Returns <code>PP_OK</code> on success or:
193 * - <code>PP_ERROR_BADRESOURCE</code> if <code>context</code> is invalid.
194 * - <code>PP_ERROR_BADARGUMENT</code> if <code>attrib_list</code> is 0 or
195 * any attribute in the <code>attrib_list</code> is not a valid attribute.
196 */
197 int32_t SetAttribs(
198 [in] PP_Resource context,
199 [in] int32_t[] attrib_list);
200
201 /**
202 * GetError() returns the current state of the given 3D context.
203 *
204 * The recoverable error conditions that have no side effect are
205 * detected and returned immediately by all functions in this interface.
206 * In addition the implementation may get into a fatal state while
207 * processing a command. In this case the application must detroy the
208 * context and reinitialize client API state and objects to continue
209 * rendering.
210 *
211 * Note that the same error code is also returned in the SwapBuffers callback.
212 * It is recommended to handle error in the SwapBuffers callback because
213 * GetError is synchronous. This function may be useful in rare cases where
214 * drawing a frame is expensive and you want to verify the result of
215 * ResizeBuffers before attemptimg to draw a frame.
216 *
217 * @param[in] The 3D graphics context.
218 * @return Returns:
219 * - <code>PP_OK</code> if no error
220 * - <code>PP_ERROR_NOMEMORY</code>
221 * - <code>PP_ERROR_CONTEXT_LOST</code>
222 */
223 int32_t GetError(
224 [in] PP_Resource context);
225
226 /**
227 * ResizeBuffers() resizes the backing surface for context.
228 *
229 * If the surface could not be resized due to insufficient resources,
230 * <code>PP_ERROR_NOMEMORY</code> error is returned on the next
231 * <code>SwapBuffers</code> callback.
232 *
233 * @param[in] context The 3D graphics context.
234 * @param[in] width The width of the backing surface.
235 * @param[in] height The height of the backing surface.
236 * @return Returns <code>PP_OK</code> on success or:
237 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid.
238 * - <code>PP_ERROR_BADARGUMENT</code> if the value specified for
239 * <code>width</code> or <code>height</code> is less than zero.
240 */
241 int32_t ResizeBuffers(
242 [in] PP_Resource context,
243 [in] int32_t width,
244 [in] int32_t height);
245
246 /**
247 * SwapBuffers() makes the contents of the color buffer available for
248 * compositing. This function has no effect on off-screen surfaces - ones not
249 * bound to any plugin instance. The contents of ancillary buffers are always
250 * undefined after calling <code>SwapBuffers</code>. The contents of the color
251 * buffer are undefined if the value of the
252 * <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code> attribute of context is not
253 * <code>PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED</code>.
254 *
255 * <code>SwapBuffers</code> runs in asynchronous mode. Specify a callback
256 * function and the argument for that callback function. The callback function
257 * will be executed on the calling thread after the color buffer has been
258 * composited with rest of the html page. While you are waiting for a
259 * SwapBuffers callback, additional calls to SwapBuffers will fail.
260 *
261 * Because the callback is executed (or thread unblocked) only when the
262 * plugin's current state is actually on the screen, this function provides a
263 * way to rate limit animations. By waiting until the image is on the screen
264 * before painting the next frame, you can ensure you're not generating
265 * updates faster than the screen can be updated.
266 *
267 * SwapBuffers performs an implicit flush operation on context.
268 * If the context gets into an unrecoverable error condition while
269 * processing a command, the error code will be returned as the argument
270 * for the callback. The callback may return the following error codes:
271 * - <code>PP_ERROR_NOMEMORY</code>
272 * - <code>PP_ERROR_CONTEXT_LOST</code>
273 * Note that the same error code may also be obtained by calling GetError.
274 *
275 * @param[in] context The 3D graphics context.
276 * @param[in] callback The callback that will executed when
277 * <code>SwapBuffers</code> completes.
278 *
279 * @return Returns PP_OK on success or:
280 * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid.
281 * - <code>PP_ERROR_BADARGUMENT</code> if callback is invalid.
282 *
283 */
284 int32_t SwapBuffers(
285 [in] PP_Resource context,
286 [in] PP_CompletionCallback callback);
287 };
288
OLDNEW
« no previous file with comments | « no previous file | ppapi/c/ppb_graphics_3d.h » ('j') | ppapi/c/ppb_graphics_3d.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698