OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 MOJO_EXAMPLES_PEPPER_CONTAINER_APP_GRAPHICS_3D_RESOURCE_H_ | |
6 #define MOJO_EXAMPLES_PEPPER_CONTAINER_APP_GRAPHICS_3D_RESOURCE_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "mojo/public/c/gles2/gles2_types.h" | |
10 #include "ppapi/shared_impl/resource.h" | |
11 #include "ppapi/shared_impl/tracked_callback.h" | |
12 #include "ppapi/thunk/ppb_graphics_3d_api.h" | |
13 | |
14 namespace mojo { | |
15 namespace examples { | |
16 | |
17 class Graphics3DResource : public ppapi::Resource, | |
18 public ppapi::thunk::PPB_Graphics3D_API { | |
19 public: | |
20 explicit Graphics3DResource(PP_Instance instance); | |
21 | |
22 bool IsBoundGraphics() const; | |
23 void BindGraphics(); | |
24 | |
25 // ppapi::Resource overrides. | |
26 virtual ppapi::thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() override; | |
27 | |
28 // ppapi::thunk::PPB_Graphics3D_API implementation. | |
29 virtual int32_t GetAttribs(int32_t attrib_list[]) override; | |
30 virtual int32_t SetAttribs(const int32_t attrib_list[]) override; | |
31 virtual int32_t GetError() override; | |
32 virtual int32_t ResizeBuffers(int32_t width, int32_t height) override; | |
33 virtual int32_t SwapBuffers( | |
34 scoped_refptr<ppapi::TrackedCallback> callback) override; | |
35 virtual int32_t GetAttribMaxValue(int32_t attribute, int32_t* value) override; | |
36 virtual PP_Bool SetGetBuffer(int32_t shm_id) override; | |
37 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, | |
38 int32* id) override; | |
39 virtual PP_Bool DestroyTransferBuffer(int32_t id) override; | |
40 virtual PP_Bool Flush(int32_t put_offset) override; | |
41 virtual gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, | |
42 int32_t end) override; | |
43 virtual gpu::CommandBuffer::State WaitForGetOffsetInRange( | |
44 int32_t start, int32_t end) override; | |
45 virtual void* MapTexSubImage2DCHROMIUM(GLenum target, | |
46 GLint level, | |
47 GLint xoffset, | |
48 GLint yoffset, | |
49 GLsizei width, | |
50 GLsizei height, | |
51 GLenum format, | |
52 GLenum type, | |
53 GLenum access) override; | |
54 virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) override; | |
55 virtual uint32_t InsertSyncPoint() override; | |
56 virtual uint32_t InsertFutureSyncPoint() override; | |
57 virtual void RetireSyncPoint(uint32_t sync_point) override; | |
58 | |
59 private: | |
60 virtual ~Graphics3DResource(); | |
61 | |
62 static void ContextLostThunk(void* closure); | |
63 void ContextLost(); | |
64 | |
65 MojoGLES2Context context_; | |
66 DISALLOW_COPY_AND_ASSIGN(Graphics3DResource); | |
67 }; | |
68 | |
69 } // namespace examples | |
70 } // namespace mojo | |
71 | |
72 #endif // MOJO_EXAMPLES_PEPPER_CONTAINER_APP_GRAPHICS_3D_RESOURCE_H_ | |
OLD | NEW |