| 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_GRAPHICS_3D_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "gfx/size.h" | 11 #include "gfx/size.h" |
| 12 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 12 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
| 13 #include "gpu/command_buffer/client/gles2_implementation.h" | 13 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 14 #include "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
| 15 #include "webkit/plugins/ppapi/plugin_delegate.h" | 15 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 16 #include "webkit/plugins/ppapi/resource.h" | 16 #include "webkit/plugins/ppapi/resource.h" |
| 17 | 17 |
| 18 namespace gpu { | 18 namespace gpu { |
| 19 namespace gles2 { | 19 namespace gles2 { |
| 20 class GLES2Implementation; | 20 class GLES2Implementation; |
| 21 } // namespace gles2 | 21 } // namespace gles2 |
| 22 } // namespace gpu | 22 } // namespace gpu |
| 23 | 23 |
| 24 struct PPB_Graphics3D_Dev; | 24 struct PPB_Graphics3D_Dev; |
| 25 struct PPB_OpenGLES_Dev; | 25 struct PPB_OpenGLES2_Dev; |
| 26 | 26 |
| 27 namespace webkit { | 27 namespace webkit { |
| 28 namespace ppapi { | 28 namespace ppapi { |
| 29 | 29 |
| 30 class PPB_Graphics3D_Impl : public Resource { | 30 class PPB_Graphics3D_Impl : public Resource { |
| 31 public: | 31 public: |
| 32 explicit PPB_Graphics3D_Impl(PluginModule* module); | 32 explicit PPB_Graphics3D_Impl(PluginModule* module); |
| 33 | 33 |
| 34 virtual ~PPB_Graphics3D_Impl(); | 34 virtual ~PPB_Graphics3D_Impl(); |
| 35 | 35 |
| 36 static const PPB_Graphics3D_Dev* GetInterface(); | 36 static const PPB_Graphics3D_Dev* GetInterface(); |
| 37 static const PPB_OpenGLES_Dev* GetOpenGLESInterface(); | 37 static const PPB_OpenGLES2_Dev* GetOpenGLES2Interface(); |
| 38 | 38 |
| 39 static bool Shutdown(); | 39 static bool Shutdown(); |
| 40 | 40 |
| 41 static PPB_Graphics3D_Impl* GetCurrent(); | |
| 42 | |
| 43 static void ResetCurrent(); | |
| 44 | |
| 45 // Resource override. | 41 // Resource override. |
| 46 virtual PPB_Graphics3D_Impl* AsPPB_Graphics3D_Impl(); | 42 virtual PPB_Graphics3D_Impl* AsPPB_Graphics3D_Impl(); |
| 47 | 43 |
| 48 bool Init(PP_Instance instance_id, int32_t config, | 44 bool Init(PP_Instance instance_id, int32_t config, |
| 49 const int32_t* attrib_list); | 45 const int32_t* attrib_list); |
| 50 | 46 |
| 51 // Associates this PPB_Graphics3D_Impl with the given plugin instance. You can
pass | 47 // Associates this PPB_Graphics3D_Impl with the given plugin instance. You can
pass |
| 52 // NULL to clear the existing device. Returns true on success. In this case, | 48 // NULL to clear the existing device. Returns true on success. In this case, |
| 53 // the last rendered frame is displayed. | 49 // the last rendered frame is displayed. |
| 54 // TODO(apatrick): Figure out the best semantics here. | 50 // TODO(apatrick): Figure out the best semantics here. |
| 55 bool BindToInstance(PluginInstance* new_instance); | 51 bool BindToInstance(PluginInstance* new_instance); |
| 56 | 52 |
| 57 bool MakeCurrent(); | |
| 58 | |
| 59 bool SwapBuffers(); | 53 bool SwapBuffers(); |
| 60 | 54 |
| 61 unsigned GetError(); | 55 unsigned GetError(); |
| 62 | 56 |
| 63 void ResizeBackingTexture(const gfx::Size& size); | 57 void ResizeBackingTexture(const gfx::Size& size); |
| 64 | 58 |
| 65 void SetSwapBuffersCallback(Callback0::Type* callback); | 59 void SetSwapBuffersCallback(Callback0::Type* callback); |
| 66 | 60 |
| 67 unsigned GetBackingTextureId(); | 61 unsigned GetBackingTextureId(); |
| 68 | 62 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 84 gpu::gles2::GLES2Implementation* gles2_implementation_; | 78 gpu::gles2::GLES2Implementation* gles2_implementation_; |
| 85 | 79 |
| 86 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); | 80 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); |
| 87 }; | 81 }; |
| 88 | 82 |
| 89 } // namespace ppapi | 83 } // namespace ppapi |
| 90 } // namespace webkit | 84 } // namespace webkit |
| 91 | 85 |
| 92 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ | 86 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
| 93 | 87 |
| OLD | NEW |