Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h

Issue 7740013: Cloning a bunch of stuff from the native_client repository at r6528 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h
===================================================================
--- ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h (revision 0)
+++ ppapi/native_client/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 "ppapi/c/dev/pp_graphics_3d_dev.h"
+#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
+#include "ppapi/c/dev/ppb_opengles_dev.h"
+#include "ppapi/c/pp_instance.h"
+
+namespace gpu {
+class CommandBuffer;
+namespace gles2 {
+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();
+ virtual ~PluginGraphics3D();
+
+ 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);
+
+ 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_

Powered by Google App Engine
This is Rietveld 408576698