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