Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2011 The Native Client Authors. All rights reserved. | |
| 3 * Use of this source code is governed by a BSD-style license that can | |
| 4 * be found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ | |
| 8 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ | |
| 9 | |
| 10 #include "base/scoped_ptr.h" | |
| 11 #include "native_client/src/include/nacl_macros.h" | |
| 12 #include "native_client/src/shared/ppapi_proxy/plugin_resource.h" | |
| 13 #include "native_client/src/third_party/ppapi/c/dev/pp_graphics_3d_dev.h" | |
| 14 #include "native_client/src/third_party/ppapi/c/dev/ppb_graphics_3d_dev.h" | |
| 15 #include "native_client/src/third_party/ppapi/c/dev/ppb_opengles_dev.h" | |
| 16 #include "native_client/src/third_party/ppapi/c/pp_instance.h" | |
| 17 | |
| 18 namespace gpu { | |
| 19 class CommandBuffer; | |
| 20 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.
| |
| 21 class GLES2CmdHelper; | |
| 22 class GLES2Implementation; | |
| 23 } // namespace gles2 | |
| 24 } // namespace gpu | |
| 25 | |
| 26 namespace ppapi_proxy { | |
| 27 | |
| 28 // Implements the plugin (i.e., .nexe) side of the PPB_Graphics3D interface. | |
| 29 class PluginGraphics3D : public PluginResource { | |
| 30 public: | |
| 31 PluginGraphics3D(); | |
| 32 ~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
| |
| 33 | |
| 34 static const PPB_Graphics3D_Dev* GetInterface(); | |
| 35 static const PPB_OpenGLES2_Dev* GetOpenGLESInterface(); | |
| 36 | |
| 37 virtual bool InitFromBrowserResource(PP_Resource graphics3d_id); | |
| 38 | |
| 39 gpu::gles2::GLES2Implementation* impl() { | |
| 40 return gles2_implementation_.get(); | |
| 41 } | |
| 42 | |
| 43 int32_t SwapBuffers(PP_Resource graphics3d_id, | |
| 44 struct PP_CompletionCallback callback); | |
|
sehr (please use chromium)
2011/08/17 20:44:36
alignment.
nfullagar
2011/08/18 00:23:57
Done.
| |
| 45 | |
| 46 PP_Instance instance_id() { return instance_id_; } | |
| 47 void set_instance_id(PP_Instance instance_id) { instance_id_ = instance_id; } | |
| 48 | |
| 49 static inline gpu::gles2::GLES2Implementation* implFromResource( | |
| 50 PP_Resource graphics3d_id) { | |
| 51 if (cached_graphics3d_id == graphics3d_id && cached_implementation != NULL) | |
| 52 return cached_implementation; | |
| 53 | |
| 54 return implFromResourceSlow(graphics3d_id); | |
| 55 } | |
| 56 | |
| 57 | |
| 58 private: | |
| 59 static __thread PP_Resource cached_graphics3d_id; | |
| 60 static __thread gpu::gles2::GLES2Implementation* cached_implementation; | |
| 61 | |
| 62 // GLES2 Implementation objects. | |
| 63 scoped_ptr<gpu::CommandBuffer> command_buffer_; | |
| 64 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_implementation_; | |
| 65 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | |
| 66 PP_Instance instance_id_; | |
| 67 | |
| 68 static gpu::gles2::GLES2Implementation* implFromResourceSlow( | |
| 69 PP_Resource context); | |
| 70 | |
| 71 IMPLEMENT_RESOURCE(PluginGraphics3D); | |
| 72 NACL_DISALLOW_COPY_AND_ASSIGN(PluginGraphics3D); | |
| 73 }; | |
| 74 | |
| 75 } // namespace ppapi_proxy | |
| 76 | |
| 77 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_ | |
| OLD | NEW |