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