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

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
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | ppapi/c/dev/ppb_opengles_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 13 matching lines...) Expand all
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,
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 {
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 {
48 PP_Bool (*IsGraphics3D)(PP_Resource resource); 48 uint32_t (*IsGraphics3D)(PP_Resource resource, PP_Bool* value);
apatrick 2010/12/03 18:36:36 I think there is a convention that PPAPI interface
alokp 2010/12/03 19:06:37 Done.
49 49
50 // EGL-like configuration ---------------------------------------------------- 50 // EGL-like configuration ----------------------------------------------------
51 PP_Bool (*GetConfigs)(int32_t* configs, 51 uint32_t (*GetConfigs)(int32_t* configs,
52 int32_t config_size, 52 int32_t config_size,
53 int32_t* num_config); 53 int32_t* num_config);
54 54
55 PP_Bool (*ChooseConfig)(const int32_t* attrib_list, 55 uint32_t (*ChooseConfig)(const int32_t* attrib_list,
apatrick 2010/12/03 18:36:36 Can you add a comment indicating that this method
alokp 2010/12/03 19:06:37 Done.
56 int32_t* configs, 56 int32_t* configs,
57 int32_t config_size, 57 int32_t config_size,
58 int32_t* num_config); 58 int32_t* num_config);
59 59
60 // TODO(apatrick): What to do if the browser window is moved to 60 // TODO(apatrick): What to do if the browser window is moved to
apatrick 2010/12/03 18:36:36 Can you remove this comment? We decided last meeti
alokp 2010/12/03 19:06:37 Done.
61 // another display? Do the configs potentially change? 61 // another display? Do the configs potentially change?
62 PP_Bool (*GetConfigAttrib)(int32_t config, int32_t attribute, int32_t* value); 62 uint32_t (*GetConfigAttrib)(int32_t config,
63 int32_t attribute,
64 int32_t* value);
63 65
64 const char* (*QueryString)(int32_t name); 66 // TODO(alokp): GetString may be a better name
67 int32_t (*QueryString)(int32_t name, char* str, int32_t* str_size);
apatrick 2010/12/03 18:36:36 How about: uint32_t (*QueryString)(int32_t name, c
alokp 2010/12/03 19:06:37 Done.
65 // --------------------------------------------------------------------------- 68 // ---------------------------------------------------------------------------
66 69
70 // Render surface
71 // Decouple context and buffer.
72 // Context is only a state machine. Surface contains buffers.
73 // TODO(alokp): What about BindGraphics()? Move to PPB_Graphics3D.
74 // TODO(alokp): Do we need off-screen surface? No - use FBO.
75 uint32_t (*CreateSurface)(int32_t config,
apatrick 2010/12/03 18:36:36 These surface related functions could go in a sepa
alokp 2010/12/03 19:06:37 Yes they could go into PPB_Surface3D.
76 PP_Instance instance,
apatrick 2010/12/03 18:36:36 Do you want to delete the instance argument here a
alokp 2010/12/03 19:06:37 Actually instance argument is required here. We ar
77 const int32_t* attrib_list,
78 PP_Resource* surface);
79 // TODO(alokp): SetSurfaceAttrib may be a better name
80 uint32_t (*SurfaceAttrib)(PP_Resource surface,
81 int32_t attribute,
82 int32_t value);
83 // TODO(alokp): GetSurfaceAttrib may be a better name
84 uint32_t (*QuerySurface)(PP_Resource surface,
85 int32_t attribute,
86 int32_t* value);
67 87
68 // Create a reference counted 3D context. Releasing a context while it is 88 // 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 89 // 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 90 // for the releasing thread. Releasing a context while it is current on
71 // another thread leads to undefined behavior. 91 // another thread leads to undefined behavior.
72 PP_Resource (*CreateContext)(PP_Instance instance, 92 uint32_t (*CreateContext)(int32_t config,
73 int32_t config, 93 PP_Resource share_context,
74 int32_t share_context, 94 const int32_t* attrib_list,
75 const int32_t* attrib_list); 95 PP_Resource* context);
76 96
77 // Get the address of any GL functions, whether core or part of an extension. 97 // This is only necessary if we need to draw into the web page.
78 // Any thread. 98 // Off-screen rendering can be done by creating and binding an FBO.
79 void* (*GetProcAddress)(const char* name); 99 // If neither is present all gl commands will vanish into a black hole.
80 100 uint32_t (*BindContext)(PP_Resource draw,
apatrick 2010/12/03 18:36:36 I don't understand how this works but I'm about to
alokp 2010/12/03 19:06:37 I have a couple of options that we can discuss.
81 // Make a particular context current of the calling thread. Returns PP_TRUE 101 PP_Resource read,
82 // on success, PP_FALSE on failure. 102 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 103
89 // Snapshots the rendered frame and makes it available for composition with 104 // 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. 105 // the rest of the page. The alpha channel is used for translucency effects.
91 // One means fully opaque. Zero means fully transparent. Any thread. 106 // One means fully opaque. Zero means fully transparent. Any thread.
92 // TODO(apatrick): premultiplied alpha or linear alpha? Premultiplied alpha is 107 // TODO(apatrick): premultiplied alpha or linear alpha? Premultiplied alpha is
93 // better for correct alpha blending effect. Most existing OpenGL code assumes 108 // better for correct alpha blending effect. Most existing OpenGL code assumes
94 // linear. I could convert from linear to premultiplied during the copy from 109 // linear. I could convert from linear to premultiplied during the copy from
95 // back-buffer to offscreen "front-buffer". 110 // back-buffer to offscreen "front-buffer".
96 PP_Bool (*SwapBuffers)(PP_Resource context); 111 uint32_t (*SwapBuffers)(PP_Resource surface);
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 }; 112 };
103 113
104 #endif // PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ 114 #endif // PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | ppapi/c/dev/ppb_opengles_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698