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

Side by Side Diff: webkit/plugins/ppapi/ppb_context_3d_impl.h

Issue 8676042: Remove Context3D/Surface3D (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style Created 9 years 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 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "ppapi/shared_impl/resource.h"
11 #include "ppapi/thunk/ppb_context_3d_api.h"
12 #include "webkit/plugins/ppapi/plugin_delegate.h"
13
14 namespace gpu {
15 namespace gles2 {
16 class GLES2CmdHelper;
17 class GLES2Implementation;
18 } // namespace gles2
19 } // namespace gpu
20
21 namespace webkit {
22 namespace ppapi {
23
24 class PPB_Surface3D_Impl;
25
26 class PPB_Context3D_Impl : public ::ppapi::Resource,
27 public ::ppapi::thunk::PPB_Context3D_API {
28 public:
29 virtual ~PPB_Context3D_Impl();
30
31 static PP_Resource Create(PP_Instance instance,
32 PP_Config3D_Dev config,
33 PP_Resource share_context,
34 const int32_t* attrib_list);
35 static PP_Resource CreateRaw(PP_Instance instance,
36 PP_Config3D_Dev config,
37 PP_Resource share_context,
38 const int32_t* attrib_list);
39
40 // Resource override.
41 virtual ::ppapi::thunk::PPB_Context3D_API* AsPPB_Context3D_API();
42
43 // PPB_Context3D_API implementation.
44 virtual int32_t GetAttrib(int32_t attribute, int32_t* value) OVERRIDE;
45 virtual int32_t BindSurfaces(PP_Resource draw, PP_Resource read) OVERRIDE;
46 virtual int32_t GetBoundSurfaces(PP_Resource* draw,
47 PP_Resource* read) OVERRIDE;
48 virtual PP_Bool InitializeTrusted(int32_t size) OVERRIDE;
49 virtual PP_Bool GetRingBuffer(int* shm_handle,
50 uint32_t* shm_size) OVERRIDE;
51 virtual PP_Context3DTrustedState GetState() OVERRIDE;
52 virtual PP_Bool Flush(int32_t put_offset) OVERRIDE;
53 virtual PP_Context3DTrustedState FlushSync(int32_t put_offset) OVERRIDE;
54 virtual int32_t CreateTransferBuffer(uint32_t size) OVERRIDE;
55 virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE;
56 virtual PP_Bool GetTransferBuffer(int32_t id,
57 int* shm_handle,
58 uint32_t* shm_size) OVERRIDE;
59 virtual PP_Context3DTrustedState FlushSyncFast(
60 int32_t put_offset,
61 int32_t last_known_get) OVERRIDE;
62 virtual void* MapTexSubImage2DCHROMIUM(GLenum target,
63 GLint level,
64 GLint xoffset,
65 GLint yoffset,
66 GLsizei width,
67 GLsizei height,
68 GLenum format,
69 GLenum type,
70 GLenum access) OVERRIDE;
71 virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE;
72 virtual gpu::gles2::GLES2Implementation* GetGLES2Impl() OVERRIDE;
73
74 int32_t BindSurfacesImpl(PPB_Surface3D_Impl* draw, PPB_Surface3D_Impl* read);
75
76 gpu::gles2::GLES2Implementation* gles2_impl() {
77 return gles2_impl_.get();
78 }
79
80 // Possibly NULL if initialization fails.
81 PluginDelegate::PlatformContext3D* platform_context() {
82 return platform_context_.get();
83 }
84
85 private:
86 explicit PPB_Context3D_Impl(PP_Instance instance);
87
88 bool Init(PP_Config3D_Dev config,
89 PP_Resource share_context,
90 const int32_t* attrib_list);
91 bool InitRaw(PP_Config3D_Dev config,
92 PP_Resource share_context,
93 const int32_t* attrib_list);
94
95 bool CreateImplementation();
96 void Destroy();
97 void OnContextLost();
98
99 // PluginDelegate's 3D Context. Responsible for providing the command buffer.
100 // Possibly NULL.
101 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_;
102
103 scoped_ptr<gpu::gles2::GLES2CmdHelper> helper_;
104 int32 transfer_buffer_id_;
105 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_;
106
107 PPB_Surface3D_Impl* draw_surface_;
108 PPB_Surface3D_Impl* read_surface_;
109
110 base::WeakPtrFactory<PPB_Context3D_Impl> weak_ptr_factory_;
111
112 DISALLOW_COPY_AND_ASSIGN(PPB_Context3D_Impl);
113 };
114
115 } // namespace ppapi
116 } // namespace webkit
117
118 #endif // WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/plugins/ppapi/ppb_context_3d_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698