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