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

Side by Side Diff: ppapi/c/dev/ppb_graphics_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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ 5 #ifndef PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_
6 #define PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ 6 #define PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_
7 7
8 #include "ppapi/c/pp_bool.h" 8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_instance.h" 9 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/c/pp_module.h" 10 #include "ppapi/c/pp_module.h"
(...skipping 11 matching lines...) Expand all
22 // CHECK(device->MakeCurrent(NULL)); 22 // CHECK(device->MakeCurrent(NULL));
23 // CHECK(device->SwapBuffers(context)); 23 // CHECK(device->SwapBuffers(context));
24 // 24 //
25 // // Shutdown. 25 // // Shutdown.
26 // core->ReleaseResource(context); 26 // core->ReleaseResource(context);
27 27
28 #define PPB_GRAPHICS_3D_DEV_INTERFACE "PPB_Graphics3D(Dev);0.2" 28 #define PPB_GRAPHICS_3D_DEV_INTERFACE "PPB_Graphics3D(Dev);0.2"
29 29
30 // These are the same error codes as used by EGL. 30 // These are the same error codes as used by EGL.
31 enum { 31 enum {
32 PP_GRAPHICS_3D_ERROR_SUCCESS = 0x3000, 32 PP_GRAPHICS_3D_ERROR_SUCCESS = 0x3000,
brettw 2010/12/04 00:27:09 We should move these to pp_errors.h and do the EGL
33 PP_GRAPHICS_3D_ERROR_NOT_INITIALIZED = 0x3001, 33 PP_GRAPHICS_3D_ERROR_NOT_INITIALIZED = 0x3001,
34 PP_GRAOHICS_3D_ERROR_BAD_CONTEXT = 0x3006, 34 PP_GRAPHICS_3D_ERROR_BAD_CONTEXT = 0x3006,
35 PP_GRAPHICS_3D_ERROR_BAD_PARAMETER = 0x300C, 35 PP_GRAPHICS_3D_ERROR_BAD_PARAMETER = 0x300C,
36 PP_GRAPHICS_3D_ERROR_CONTEXT_LOST = 0x300E 36 PP_GRAPHICS_3D_ERROR_CONTEXT_LOST = 0x300E
37 }; 37 };
38 38
39 // QueryString targets, matching EGL ones. 39 // QueryString targets, matching EGL ones.
40 enum { 40 enum {
brettw 2010/12/04 00:27:09 This should be a named enum
41 EGL_VENDOR = 0x3053, 41 PP_GRAPHICS_3D_VENDOR = 0x3053,
42 EGL_VERSION = 0x3054, 42 PP_GRAPHICS_3D_VERSION = 0x3054,
43 EGL_EXTENSIONS = 0x3055, 43 PP_GRAPHICS_3D_EXTENSIONS = 0x3055,
44 EGL_CLIENT_APIS = 0x308D 44 PP_GRAPHICS_3D_CLIENT_APIS = 0x308D
45 }; 45 };
46 46
47 struct PPB_Graphics3D_Dev { 47 struct PPB_Graphics3D_Dev {
brettw 2010/12/04 00:27:09 We should have two different interfaces for Surfac
48 PP_Bool (*IsGraphics3D)(PP_Resource resource); 48 PP_Bool (*IsGraphics3D)(PP_Resource resource);
49 49
50 // EGL-like configuration ---------------------------------------------------- 50 // EGL-like configuration ----------------------------------------------------
51 PP_Bool (*GetConfigs)(int32_t* configs, 51 // Not that config functions do not take display argument.
52 int32_t config_size, 52 // Browser window can move from one display to another and straddle displays.
53 int32_t* num_config); 53 // So we are forced to virtualize multiple displays as a single display.
54 uint32_t (*GetConfigs)(int32_t* configs,
brettw 2010/12/04 00:27:09 When these return a "real" PP error, these should
55 int32_t config_size,
56 int32_t* num_config);
57 // This can potentially be implemented in EGL helper library.
58 // TODO(alokp): Should we remove it from here?
59 uint32_t (*ChooseConfig)(const int32_t* attrib_list,
brettw 2010/12/04 00:27:09 We're thinking there will be one function to get a
60 int32_t* configs,
61 int32_t config_size,
62 int32_t* num_config);
63 uint32_t (*GetConfigAttrib)(int32_t config,
64 int32_t attribute,
65 int32_t* value);
54 66
55 PP_Bool (*ChooseConfig)(const int32_t* attrib_list, 67 // TODO(alokp): GetString may be a better name
neb 2010/12/03 19:27:21 Isn't QueryString the EGL name?
alokp 2010/12/03 19:39:51 Yes and thats why I am using it here but I think i
56 int32_t* configs, 68 int32_t (*QueryString)(int32_t name, const char** str);
brettw 2010/12/04 00:27:09 As discussed, this will be: PP_Var (*QueryString
57 int32_t config_size,
58 int32_t* num_config);
59
60 // TODO(apatrick): What to do if the browser window is moved to
61 // another display? Do the configs potentially change?
62 PP_Bool (*GetConfigAttrib)(int32_t config, int32_t attribute, int32_t* value);
63
64 const char* (*QueryString)(int32_t name);
65 // --------------------------------------------------------------------------- 69 // ---------------------------------------------------------------------------
66 70
71 // Render surface
72 // Decouple context and buffer.
73 // Context is only a state machine. Surface contains buffers.
74 // TODO(alokp): What about BindGraphics()? Move to PPB_Graphics2D.
neb 2010/12/03 19:27:21 I don't understand this comment.
alokp 2010/12/03 19:39:51 This renders PPB_Instance::BindGraphics redundant.
75 // TODO(alokp): Do we need off-screen surface? No - use FBO.
76 uint32_t (*CreateSurface)(int32_t config,
77 PP_Instance instance,
78 const int32_t* attrib_list,
brettw 2010/12/04 00:27:09 I'd rather be explicit about the size and add a PP
79 PP_Resource* surface);
80 // TODO(alokp): SetSurfaceAttrib may be a better name
81 uint32_t (*SurfaceAttrib)(PP_Resource surface,
82 int32_t attribute,
83 int32_t value);
84 // TODO(alokp): GetSurfaceAttrib may be a better name
85 uint32_t (*QuerySurface)(PP_Resource surface,
86 int32_t attribute,
87 int32_t* value);
67 88
68 // Create a reference counted 3D context. Releasing a context while it is 89 // Create a reference counted 3D context. Releasing a context while it is
69 // current automatically sets the current context to NULL. This is only true 90 // current automatically sets the current context to NULL. This is only true
70 // for the releasing thread. Releasing a context while it is current on 91 // for the releasing thread. Releasing a context while it is current on
71 // another thread leads to undefined behavior. 92 // another thread leads to undefined behavior.
72 PP_Resource (*CreateContext)(PP_Instance instance, 93 uint32_t (*CreateContext)(int32_t config,
73 int32_t config, 94 PP_Resource share_context,
74 int32_t share_context, 95 const int32_t* attrib_list,
75 const int32_t* attrib_list); 96 PP_Resource* context);
76 97
77 // Get the address of any GL functions, whether core or part of an extension. 98 // This is only necessary if we need to draw into the web page.
78 // Any thread. 99 // Off-screen rendering can be done by creating and binding an FBO.
79 void* (*GetProcAddress)(const char* name); 100 // If neither is present all gl commands will vanish into a black hole.
80 101 uint32_t (*BindContext)(PP_Resource draw,
brettw 2010/12/04 00:27:09 This should probably be called SetSurfaces
81 // Make a particular context current of the calling thread. Returns PP_TRUE 102 PP_Resource read,
82 // on success, PP_FALSE on failure. 103 PP_Resource context);
83 PP_Bool (*MakeCurent)(PP_Resource context);
84
85 // Returns the calling thread's current context or NULL if no context is
86 // current.
87 PP_Resource (*GetCurrentContext)();
88 104
brettw 2010/12/04 00:27:09 There was talk about adding a fence callback.
89 // Snapshots the rendered frame and makes it available for composition with 105 // Snapshots the rendered frame and makes it available for composition with
90 // the rest of the page. The alpha channel is used for translucency effects. 106 // the rest of the page. The alpha channel is used for translucency effects.
91 // One means fully opaque. Zero means fully transparent. Any thread. 107 // One means fully opaque. Zero means fully transparent. Any thread.
92 // TODO(apatrick): premultiplied alpha or linear alpha? Premultiplied alpha is 108 // TODO(apatrick): premultiplied alpha or linear alpha? Premultiplied alpha is
93 // better for correct alpha blending effect. Most existing OpenGL code assumes 109 // better for correct alpha blending effect. Most existing OpenGL code assumes
94 // linear. I could convert from linear to premultiplied during the copy from 110 // linear. I could convert from linear to premultiplied during the copy from
95 // back-buffer to offscreen "front-buffer". 111 // back-buffer to offscreen "front-buffer".
96 PP_Bool (*SwapBuffers)(PP_Resource context); 112 uint32_t (*SwapBuffers)(PP_Resource surface);
brettw 2010/12/04 00:27:09 This should take a completion callback to optional
97
98 // Returns the current error for this thread. This is not associated with a
99 // particular context. It is distinct from the GL error returned by
100 // glGetError.
101 uint32_t (*GetError)();
102 }; 113 };
103 114
104 #endif // PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ 115 #endif // PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698