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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 "ppapi/c/dev/pp_graphics_3d_dev.h"
14 #include "ppapi/c/dev/ppb_graphics_3d_dev.h"
15 #include "ppapi/c/dev/ppb_opengles_dev.h"
16 #include "ppapi/c/pp_instance.h"
17
18 namespace gpu {
19 class CommandBuffer;
20 namespace gles2 {
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 virtual ~PluginGraphics3D();
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);
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698