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

Side by Side Diff: ppapi/c/dev/ppb_surface_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_SURFACE_3D_DEV_H_
6 #define PPAPI_C_DEV_PPB_SURFACE_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_SURFACE_3D_DEV_INTERFACE "PPB_Surface3D(Dev);0.1"
13
14 struct PPB_Surface3D_Dev {
15 // Creates a render surface and returns a handle to it.
16 // Any PPB_Context3D_Dev created with a compatible PP_Graphics3DConfig_Dev
17 // can be used to render into this surface. The returned surface is
18 // off-screen to start with. It must be attached to a plugin instance
19 // using PPB_Instance::BindGraphics to draw on the web page.
20 //
21 // attrib_list specifies a list of attributes for the surface. The list has
22 // the same structure as described for PPB_Graphics3D_Dev::GetConfigAttribs.
23 // Attributes that can be specified in attrib_list include:
24 // - PP_GRAPHICS3DATTRIB_WIDTH
25 // - PP_GRAPHICS3DATTRIB_HEIGHT
26 // - PP_GRAPHICS3DATTRIB_LARGEST_SURFACE: If true, creates the largest
27 // possible surface when the allocation of the surface would otherwise fail.
28 // The width and height of the allocated surface will never exceed the
29 // values of PP_GRAPHICS3DATTRIB_WIDTH and PP_GRAPHICS3DATTRIB_HEIGHT,
30 // respectively. If this option is used, PPB_Surface3D_Dev::GetAttrib
31 // can be used to retrieve surface dimensions.
32 // - PP_GRAPHICS3DATTRIB_RENDER_BUFFER
33 //
34 // TODO(alokp): Need a way to return specific error codes. Would a fourth
alokp 2010/12/10 13:20:34 Any suggestion on this?
brettw 2010/12/10 17:39:11 What types of error codes would you want to return
35 // int32_t* argument be fine. It will certainly be inconsistent with othe
36 // functions that return error code.
37 PP_Resource (*Create)(PP_Module module,
38 PP_Graphics3DConfig_Dev config,
39 const int32_t* attrib_list);
40
41 // Returns PP_TRUE if the given resource is a valid Surface3D, PP_FALSE if it
42 // is an invalid resource or is a resource of another type.
43 PP_Bool (*IsSurface3D)(PP_Resource resource);
44
45 // Sets an attribute for PPB_Surface3D_Dev. The specified attribute of
46 // surface is set to value. Attributes that can be specified are:
47 // - PP_GRAPHICS3DATTRIB_MULTISAMPLE_RESOLVE: If value
48 // is PP_GRAPHICS3DATTRIBVALUE_MULTISAMPLE_RESOLVE_BOX, and the
49 // PP_GRAPHICS3DATTRIB_SURFACE_TYPE attribute used to create surface does
50 // not contain PP_GRAPHICS3DATTRIBVALUE_MULTISAMPLE_RESOLVE_BOX_BIT, a
51 // PP_GRAPHICS3DERROR_BAD_MATCH error is returned.
52 // - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR: If value is
53 // PP_GRAPHICS3DATTRIBVALUE_BUFFER_PRESERVED, and the
54 // PP_GRAPHICS3DATTRIB_SURFACE_TYPE attribute used to create surface
55 // does not contain PP_GRAPHICS3DATTRIBVALUE_SWAP_BEHAVIOR_PRESERVED_BIT,
56 // a PP_GRAPHICS3DERROR_BAD_MATCH error is returned.
57 int32_t (*SetAttrib)(PP_Resource surface,
58 int32_t attribute,
59 int32_t value);
60
61 // Retrieves the value of attribute for surface. Attributes that can be
62 // queried for are:
63 // - PP_GRAPHICS3DATTRIB_CONFIG_ID: returns the ID of the
64 // PP_Graphics3DConfig_Dev with respect to which the surface was created.
65 // - PP_GRAPHICS3DATTRIB_LARGEST_SURFACE: returns the same attribute value
66 // specified when the surface was created with PPB_Surface3D_Dev::Create.
67 // - PP_GRAPHICS3DATTRIB_WIDTH and PP_GRAPHICS3DATTRIB_HEIGHT: The returned
68 // size may be less than the requested size if
69 // PP_GRAPHICS3DATTRIB_LARGEST_SURFACE is true.
70 // - PP_GRAPHICS3DATTRIB_RENDER_BUFFER
71 // - PP_GRAPHICS3DATTRIB_MULTISAMPLE_RESOLVE
72 // - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR
73 //
74 // If attribute is not a valid PPB_Surface3D_Dev surface attribute,
75 // then an PP_GRAPHICS3DERROR_BAD_ATTRIBUTE error is returned. If surface
76 // is not a valid PPB_Surface3D_Dev then an PP_GRAPHICS3DERROR_BAD_SURFACE
77 // error is returned.
78 int32_t (*GetAttrib)(PP_Resource surface,
79 int32_t attribute,
80 int32_t* value);
81
82 // Makes the contents of the color buffer available for compositing.
83 // This function has no effect on off-screen surfaces - ones not bound
84 // to any plugin instance. The contents of ancillary buffers are always
85 // undefined after calling SwapBuffers. The contents of the color buffer are
86 // undefined if the value of the PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR attribute
87 // of surface is not PP_GRAPHICS3DATTRIBVALUE_BUFFER_PRESERVED.
88 //
89 // If surface is bound as the draw surface of a context then SwapBuffers
90 // performs an implicit flush operation on the context.
91 //
92 // This functions can run in two modes:
93 // - In synchronous mode, you specify NULL for the callback and the callback
94 // data. This function will block the calling thread until the image has
95 // been painted to the screen. It is not legal to block the main thread of
96 // the plugin, you can use synchronous mode only from background threads.
97 // - In asynchronous mode, you specify a callback function and the argument
98 // for that callback function. The callback function will be executed on
99 // the calling thread when the image has been painted to the screen. While
100 // you are waiting for a Flush callback, additional calls to Flush will
101 // fail.
102 //
103 // Because the callback is executed (or thread unblocked) only when the
104 // plugin's current state is actually on the screen, this function provides a
105 // way to rate limit animations. By waiting until the image is on the screen
106 // before painting the next frame, you can ensure you're not generating
107 // updates faster than the screen can be updated.
108 //
109 int32_t (*SwapBuffers)(PP_Resource surface,
110 struct PP_CompletionCallback callback);
111 };
112
113 #endif // PPAPI_C_DEV_PPB_SURFACE_3D_DEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698