Chromium Code Reviews| Index: src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h |
| =================================================================== |
| --- src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h (revision 0) |
| +++ src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h (revision 0) |
| @@ -0,0 +1,77 @@ |
| +/* |
| + * Copyright 2011 The Native Client Authors. All rights reserved. |
| + * Use of this source code is governed by a BSD-style license that can |
| + * be found in the LICENSE file. |
| + */ |
| + |
| +#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ |
| +#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ |
| + |
| +#include "base/scoped_ptr.h" |
| +#include "native_client/src/include/nacl_macros.h" |
| +#include "native_client/src/shared/ppapi_proxy/plugin_resource.h" |
| +#include "native_client/src/third_party/ppapi/c/dev/pp_graphics_3d_dev.h" |
| +#include "native_client/src/third_party/ppapi/c/dev/ppb_graphics_3d_dev.h" |
| +#include "native_client/src/third_party/ppapi/c/dev/ppb_opengles_dev.h" |
| +#include "native_client/src/third_party/ppapi/c/pp_instance.h" |
| + |
| +namespace gpu { |
| +class CommandBuffer; |
| +namespace gles2 { |
|
Nick Bray
2011/08/17 18:20:33
Is this stylistically correct for nestled namespac
nfullagar
2011/08/18 00:23:57
looks strange but I think that's what we do.
|
| +class GLES2CmdHelper; |
| +class GLES2Implementation; |
| +} // namespace gles2 |
| +} // namespace gpu |
| + |
| +namespace ppapi_proxy { |
| + |
| +// Implements the plugin (i.e., .nexe) side of the PPB_Graphics3D interface. |
| +class PluginGraphics3D : public PluginResource { |
| + public: |
| + PluginGraphics3D(); |
| + ~PluginGraphics3D(); |
|
sehr (please use chromium)
2011/08/17 20:44:36
Classes having virtual functions always have virtu
nfullagar
2011/08/18 00:23:57
good catch - kargo-kulted over from plugin_context
|
| + |
| + static const PPB_Graphics3D_Dev* GetInterface(); |
| + static const PPB_OpenGLES2_Dev* GetOpenGLESInterface(); |
| + |
| + virtual bool InitFromBrowserResource(PP_Resource graphics3d_id); |
| + |
| + gpu::gles2::GLES2Implementation* impl() { |
| + return gles2_implementation_.get(); |
| + } |
| + |
| + int32_t SwapBuffers(PP_Resource graphics3d_id, |
| + struct PP_CompletionCallback callback); |
|
sehr (please use chromium)
2011/08/17 20:44:36
alignment.
nfullagar
2011/08/18 00:23:57
Done.
|
| + |
| + PP_Instance instance_id() { return instance_id_; } |
| + void set_instance_id(PP_Instance instance_id) { instance_id_ = instance_id; } |
| + |
| + static inline gpu::gles2::GLES2Implementation* implFromResource( |
| + PP_Resource graphics3d_id) { |
| + if (cached_graphics3d_id == graphics3d_id && cached_implementation != NULL) |
| + return cached_implementation; |
| + |
| + return implFromResourceSlow(graphics3d_id); |
| + } |
| + |
| + |
| + private: |
| + static __thread PP_Resource cached_graphics3d_id; |
| + static __thread gpu::gles2::GLES2Implementation* cached_implementation; |
| + |
| + // GLES2 Implementation objects. |
| + scoped_ptr<gpu::CommandBuffer> command_buffer_; |
| + scoped_ptr<gpu::gles2::GLES2Implementation> gles2_implementation_; |
| + scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
| + PP_Instance instance_id_; |
| + |
| + static gpu::gles2::GLES2Implementation* implFromResourceSlow( |
| + PP_Resource context); |
| + |
| + IMPLEMENT_RESOURCE(PluginGraphics3D); |
| + NACL_DISALLOW_COPY_AND_ASSIGN(PluginGraphics3D); |
| +}; |
| + |
| +} // namespace ppapi_proxy |
| + |
| +#endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ |