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

Side by Side Diff: webkit/plugins/ppapi/ppb_context_3d_impl.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
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 WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_
7 7
8 #include "base/callback.h"
9 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
10 #include "ppapi/c/dev/ppb_context_3d_dev.h" 9 #include "ppapi/c/dev/ppb_context_3d_dev.h"
11 #include "webkit/plugins/ppapi/plugin_delegate.h" 10 #include "webkit/plugins/ppapi/plugin_delegate.h"
12 #include "webkit/plugins/ppapi/resource.h" 11 #include "webkit/plugins/ppapi/resource.h"
13 12
14 namespace gfx {
15 class Size;
16 }
17
18 namespace gpu { 13 namespace gpu {
19 namespace gles2 { 14 namespace gles2 {
20 class GLES2Implementation; 15 class GLES2Implementation;
21 } // namespace gles2 16 } // namespace gles2
22 } // namespace gpu 17 } // namespace gpu
23 18
24 namespace webkit { 19 namespace webkit {
25 namespace ppapi { 20 namespace ppapi {
26 21
22 class PPB_Surface3D_Impl;
23
27 class PPB_Context3D_Impl : public Resource { 24 class PPB_Context3D_Impl : public Resource {
28 public: 25 public:
29 explicit PPB_Context3D_Impl(PluginModule* module); 26 explicit PPB_Context3D_Impl(PluginInstance* instance);
30 virtual ~PPB_Context3D_Impl(); 27 virtual ~PPB_Context3D_Impl();
31 28
32 static const PPB_Context3D_Dev* GetInterface(); 29 static const PPB_Context3D_Dev* GetInterface();
33 30
34 // Resource override. 31 // Resource override.
35 virtual PPB_Context3D_Impl* AsPPB_Context3D_Impl(); 32 virtual PPB_Context3D_Impl* AsPPB_Context3D_Impl();
36 33
37 bool Init(PluginInstance* instance, 34 bool Init(PP_Config3D_Dev config,
38 PP_Config3D_Dev config,
39 PP_Resource share_context, 35 PP_Resource share_context,
40 const int32_t* attrib_list); 36 const int32_t* attrib_list);
41 37
42 // Associates this PPB_Context3D_Impl with the given plugin instance. 38 PluginInstance* instance() {
43 // You can pass NULL to clear the existing device. Returns true on success. 39 return instance_;
44 // In this case, the last rendered frame is displayed. 40 }
45 //
46 // TODO(alokp): This is confusing. This context is already associated with
47 // an instance. This function should rather be called BindToInstanceGraphics
48 // or something similar which means from this point on, anything drawn with
49 // this context appears on instance window. This function should also not
50 // take any argument. But this means modifying PPB_Instance::BindGraphics.
51 bool BindToInstance(PluginInstance* new_instance);
52
53 bool SwapBuffers();
54 void SetSwapBuffersCallback(Callback0::Type* callback);
55
56 unsigned int GetBackingTextureId();
57 void ResizeBackingTexture(const gfx::Size& size);
58 41
59 gpu::gles2::GLES2Implementation* gles2_impl() { 42 gpu::gles2::GLES2Implementation* gles2_impl() {
60 return gles2_impl_; 43 return gles2_impl_;
61 } 44 }
62 45
46 int32_t BindSurfaces(PPB_Surface3D_Impl* draw,
47 PPB_Surface3D_Impl* read);
48
63 private: 49 private:
64 void Destroy(); 50 void Destroy();
65 51
66 // Non-owning pointer to the plugin instance this context is currently bound 52 // Plugin instance this context is associated with.
67 // to, if any. If the context is currently unbound, this will be NULL. 53 PluginInstance* instance_;
68 PluginInstance* bound_instance_;
69 54
70 // PluginDelegate's 3D Context. Responsible for providing the command buffer. 55 // PluginDelegate's 3D Context. Responsible for providing the command buffer.
71 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; 56 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_;
72 57
73 // GLES2 Implementation instance. Owned by the platform context's GGL context. 58 // GLES2 Implementation instance. Owned by the platform context's GGL context.
74 gpu::gles2::GLES2Implementation* gles2_impl_; 59 gpu::gles2::GLES2Implementation* gles2_impl_;
75 60
61 PPB_Surface3D_Impl* draw_surface_;
62 PPB_Surface3D_Impl* read_surface_;
63
76 DISALLOW_COPY_AND_ASSIGN(PPB_Context3D_Impl); 64 DISALLOW_COPY_AND_ASSIGN(PPB_Context3D_Impl);
77 }; 65 };
78 66
79 } // namespace ppapi 67 } // namespace ppapi
80 } // namespace webkit 68 } // namespace webkit
81 69
82 #endif // WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ 70 #endif // WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698