OLD | NEW |
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/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "ppapi/c/dev/ppb_context_3d_dev.h" | 9 #include "ppapi/c/dev/ppb_context_3d_dev.h" |
10 #include "webkit/plugins/ppapi/plugin_delegate.h" | 10 #include "webkit/plugins/ppapi/plugin_delegate.h" |
11 #include "webkit/plugins/ppapi/resource.h" | 11 #include "webkit/plugins/ppapi/resource.h" |
12 | 12 |
| 13 struct PPB_Context3DTrusted_Dev; |
| 14 |
13 namespace gpu { | 15 namespace gpu { |
| 16 class CommandBuffer; |
14 namespace gles2 { | 17 namespace gles2 { |
15 class GLES2CmdHelper; | 18 class GLES2CmdHelper; |
16 class GLES2Implementation; | 19 class GLES2Implementation; |
17 } // namespace gles2 | 20 } // namespace gles2 |
18 } // namespace gpu | 21 } // namespace gpu |
19 | 22 |
20 namespace webkit { | 23 namespace webkit { |
21 namespace ppapi { | 24 namespace ppapi { |
22 | 25 |
23 class PPB_Surface3D_Impl; | 26 class PPB_Surface3D_Impl; |
24 | 27 |
25 class PPB_Context3D_Impl : public Resource { | 28 class PPB_Context3D_Impl : public Resource { |
26 public: | 29 public: |
27 explicit PPB_Context3D_Impl(PluginInstance* instance); | 30 explicit PPB_Context3D_Impl(PluginInstance* instance); |
28 virtual ~PPB_Context3D_Impl(); | 31 virtual ~PPB_Context3D_Impl(); |
29 | 32 |
30 static const PPB_Context3D_Dev* GetInterface(); | 33 static const PPB_Context3D_Dev* GetInterface(); |
| 34 static const PPB_Context3DTrusted_Dev* GetTrustedInterface(); |
31 | 35 |
32 // Resource override. | 36 // Resource override. |
33 virtual PPB_Context3D_Impl* AsPPB_Context3D_Impl(); | 37 virtual PPB_Context3D_Impl* AsPPB_Context3D_Impl(); |
34 | 38 |
35 bool Init(PP_Config3D_Dev config, | 39 bool Init(PP_Config3D_Dev config, |
36 PP_Resource share_context, | 40 PP_Resource share_context, |
37 const int32_t* attrib_list); | 41 const int32_t* attrib_list); |
| 42 bool InitRaw(PP_Config3D_Dev config, |
| 43 PP_Resource share_context, |
| 44 const int32_t* attrib_list); |
38 | 45 |
39 PluginInstance* instance() { | 46 PluginInstance* instance() { |
40 return instance_; | 47 return instance_; |
41 } | 48 } |
42 | 49 |
43 PluginDelegate::PlatformContext3D* platform_context() { | 50 PluginDelegate::PlatformContext3D* platform_context() { |
44 return platform_context_.get(); | 51 return platform_context_.get(); |
45 } | 52 } |
46 | 53 |
47 gpu::gles2::GLES2Implementation* gles2_impl() { | 54 gpu::gles2::GLES2Implementation* gles2_impl() { |
48 return gles2_impl_.get(); | 55 return gles2_impl_.get(); |
49 } | 56 } |
50 | 57 |
| 58 gpu::CommandBuffer* command_buffer(); |
| 59 |
51 int32_t BindSurfaces(PPB_Surface3D_Impl* draw, | 60 int32_t BindSurfaces(PPB_Surface3D_Impl* draw, |
52 PPB_Surface3D_Impl* read); | 61 PPB_Surface3D_Impl* read); |
53 | 62 |
54 private: | 63 private: |
55 void Destroy(); | 64 void Destroy(); |
| 65 bool CreateImplementation(); |
56 | 66 |
57 // Plugin instance this context is associated with. | 67 // Plugin instance this context is associated with. |
58 PluginInstance* instance_; | 68 PluginInstance* instance_; |
59 | 69 |
60 // PluginDelegate's 3D Context. Responsible for providing the command buffer. | 70 // PluginDelegate's 3D Context. Responsible for providing the command buffer. |
61 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; | 71 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; |
62 | 72 |
63 scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_; | 73 scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_; |
64 int32 transfer_buffer_id_; | 74 int32 transfer_buffer_id_; |
65 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; | 75 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; |
66 | 76 |
67 PPB_Surface3D_Impl* draw_surface_; | 77 PPB_Surface3D_Impl* draw_surface_; |
68 PPB_Surface3D_Impl* read_surface_; | 78 PPB_Surface3D_Impl* read_surface_; |
69 | 79 |
70 DISALLOW_COPY_AND_ASSIGN(PPB_Context3D_Impl); | 80 DISALLOW_COPY_AND_ASSIGN(PPB_Context3D_Impl); |
71 }; | 81 }; |
72 | 82 |
73 } // namespace ppapi | 83 } // namespace ppapi |
74 } // namespace webkit | 84 } // namespace webkit |
75 | 85 |
76 #endif // WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ | 86 #endif // WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ |
OLD | NEW |