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.
5 #ifndef MOJO_EXAMPLES_PEPPER_CONTAINER_APP_GRAPHICS_3D_RESOURCE_H_
6 #define MOJO_EXAMPLES_PEPPER_CONTAINER_APP_GRAPHICS_3D_RESOURCE_H_
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "mojo/public/c/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"
18 class Graphics3DResource
: public ppapi::Resource
,
19 public ppapi::thunk::PPB_Graphics3D_API
{
21 explicit Graphics3DResource(PP_Instance instance
);
23 bool IsBoundGraphics() const;
26 // ppapi::Resource overrides.
27 virtual ppapi::thunk::PPB_Graphics3D_API
* AsPPB_Graphics3D_API() OVERRIDE
;
29 // ppapi::thunk::PPB_Graphics3D_API implementation.
30 virtual int32_t GetAttribs(int32_t attrib_list
[]) OVERRIDE
;
31 virtual int32_t SetAttribs(const int32_t attrib_list
[]) OVERRIDE
;
32 virtual int32_t GetError() OVERRIDE
;
33 virtual int32_t ResizeBuffers(int32_t width
, int32_t height
) OVERRIDE
;
34 virtual int32_t SwapBuffers(
35 scoped_refptr
<ppapi::TrackedCallback
> callback
) OVERRIDE
;
36 virtual int32_t GetAttribMaxValue(int32_t attribute
, int32_t* value
) OVERRIDE
;
37 virtual PP_Bool
SetGetBuffer(int32_t shm_id
) OVERRIDE
;
38 virtual scoped_refptr
<gpu::Buffer
> CreateTransferBuffer(uint32_t size
,
40 virtual PP_Bool
DestroyTransferBuffer(int32_t id
) OVERRIDE
;
41 virtual PP_Bool
Flush(int32_t put_offset
) OVERRIDE
;
42 virtual gpu::CommandBuffer::State
WaitForTokenInRange(int32_t start
,
43 int32_t end
) OVERRIDE
;
44 virtual gpu::CommandBuffer::State
WaitForGetOffsetInRange(
45 int32_t start
, int32_t end
) OVERRIDE
;
46 virtual void* MapTexSubImage2DCHROMIUM(GLenum target
,
54 GLenum access
) OVERRIDE
;
55 virtual void UnmapTexSubImage2DCHROMIUM(const void* mem
) OVERRIDE
;
56 virtual uint32_t InsertSyncPoint() OVERRIDE
;
57 virtual uint32_t InsertFutureSyncPoint() OVERRIDE
;
58 virtual void RetireSyncPoint(uint32_t sync_point
) OVERRIDE
;
61 virtual ~Graphics3DResource();
63 static void ContextLostThunk(void* closure
);
66 MojoGLES2Context context_
;
67 DISALLOW_COPY_AND_ASSIGN(Graphics3DResource
);
70 } // namespace examples
73 #endif // MOJO_EXAMPLES_PEPPER_CONTAINER_APP_GRAPHICS_3D_RESOURCE_H_