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

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

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

Powered by Google App Engine
This is Rietveld 408576698