OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ | 5 #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ |
6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ | 6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "native_client/src/include/nacl_macros.h" | 9 #include "native_client/src/include/nacl_macros.h" |
10 #include "native_client/src/shared/ppapi_proxy/plugin_resource.h" | 10 #include "native_client/src/shared/ppapi_proxy/plugin_resource.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class GLES2Implementation; | 22 class GLES2Implementation; |
23 } // namespace gles2 | 23 } // namespace gles2 |
24 } // namespace gpu | 24 } // namespace gpu |
25 | 25 |
26 namespace ppapi_proxy { | 26 namespace ppapi_proxy { |
27 | 27 |
28 // Implements the plugin (i.e., .nexe) side of the PPB_Graphics3D interface. | 28 // Implements the plugin (i.e., .nexe) side of the PPB_Graphics3D interface. |
29 class PluginGraphics3D : public PluginResource { | 29 class PluginGraphics3D : public PluginResource { |
30 public: | 30 public: |
31 PluginGraphics3D(); | 31 PluginGraphics3D(); |
32 virtual ~PluginGraphics3D(); | |
33 | 32 |
34 static const PPB_Graphics3D* GetInterface(); | 33 static const PPB_Graphics3D* GetInterface(); |
35 static const PPB_OpenGLES2* GetOpenGLESInterface(); | 34 static const PPB_OpenGLES2* GetOpenGLESInterface(); |
36 static const PPB_OpenGLES2InstancedArrays* | 35 static const PPB_OpenGLES2InstancedArrays* |
37 GetOpenGLESInstancedArraysInterface(); | 36 GetOpenGLESInstancedArraysInterface(); |
38 static const PPB_OpenGLES2FramebufferBlit* | 37 static const PPB_OpenGLES2FramebufferBlit* |
39 GetOpenGLESFramebufferBlitInterface(); | 38 GetOpenGLESFramebufferBlitInterface(); |
40 static const PPB_OpenGLES2FramebufferMultisample* | 39 static const PPB_OpenGLES2FramebufferMultisample* |
41 GetOpenGLESFramebufferMultisampleInterface(); | 40 GetOpenGLESFramebufferMultisampleInterface(); |
42 static const PPB_OpenGLES2ChromiumEnableFeature* | 41 static const PPB_OpenGLES2ChromiumEnableFeature* |
(...skipping 16 matching lines...) Expand all Loading... |
59 void set_instance_id(PP_Instance instance_id) { instance_id_ = instance_id; } | 58 void set_instance_id(PP_Instance instance_id) { instance_id_ = instance_id; } |
60 | 59 |
61 static inline gpu::gles2::GLES2Implementation* implFromResource( | 60 static inline gpu::gles2::GLES2Implementation* implFromResource( |
62 PP_Resource graphics3d_id) { | 61 PP_Resource graphics3d_id) { |
63 if (cached_graphics3d_id == graphics3d_id && cached_implementation != NULL) | 62 if (cached_graphics3d_id == graphics3d_id && cached_implementation != NULL) |
64 return cached_implementation; | 63 return cached_implementation; |
65 | 64 |
66 return implFromResourceSlow(graphics3d_id); | 65 return implFromResourceSlow(graphics3d_id); |
67 } | 66 } |
68 | 67 |
| 68 protected: |
| 69 virtual ~PluginGraphics3D(); |
69 | 70 |
70 private: | 71 private: |
| 72 static gpu::gles2::GLES2Implementation* implFromResourceSlow( |
| 73 PP_Resource context); |
| 74 |
71 // TODO(nfullagar): make cached_* variables TLS once 64bit NaCl is faster, | 75 // TODO(nfullagar): make cached_* variables TLS once 64bit NaCl is faster, |
72 // and the proxy has support for being called off the main thread. | 76 // and the proxy has support for being called off the main thread. |
73 // see: http://code.google.com/p/chromium/issues/detail?id=99217 | 77 // see: http://code.google.com/p/chromium/issues/detail?id=99217 |
74 static PP_Resource cached_graphics3d_id; | 78 static PP_Resource cached_graphics3d_id; |
75 static gpu::gles2::GLES2Implementation* cached_implementation; | 79 static gpu::gles2::GLES2Implementation* cached_implementation; |
76 | 80 |
77 // GLES2 Implementation objects. | 81 // GLES2 Implementation objects. |
78 scoped_ptr<gpu::CommandBuffer> command_buffer_; | 82 scoped_ptr<gpu::CommandBuffer> command_buffer_; |
79 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_implementation_; | 83 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_implementation_; |
80 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; | 84 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; |
81 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 85 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
82 PP_Instance instance_id_; | 86 PP_Instance instance_id_; |
83 | 87 |
84 static gpu::gles2::GLES2Implementation* implFromResourceSlow( | |
85 PP_Resource context); | |
86 | |
87 IMPLEMENT_RESOURCE(PluginGraphics3D); | 88 IMPLEMENT_RESOURCE(PluginGraphics3D); |
88 NACL_DISALLOW_COPY_AND_ASSIGN(PluginGraphics3D); | 89 NACL_DISALLOW_COPY_AND_ASSIGN(PluginGraphics3D); |
89 }; | 90 }; |
90 | 91 |
91 } // namespace ppapi_proxy | 92 } // namespace ppapi_proxy |
92 | 93 |
93 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ | 94 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ |
OLD | NEW |