1 // Copyright (c) 2012 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 #include "ppapi/c/pp_completion_callback.h"
6 #include "ppapi/c/pp_errors.h"
7 #include "ppapi/shared_impl/tracked_callback.h"
8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/thunk.h"
10 #include "ppapi/thunk/ppb_graphics_3d_api.h"
11 #include "ppapi/thunk/resource_creation_api.h"
18 typedef EnterResource
<PPB_Graphics3D_API
> EnterGraphics3D
;
20 int32_t GetAttribMaxValue(PP_Instance instance
,
23 // TODO(alokp): Implement me.
24 return PP_ERROR_FAILED
;
27 PP_Resource
Create(PP_Instance instance
,
28 PP_Resource share_context
,
29 const int32_t attrib_list
[]) {
30 EnterResourceCreation
enter(instance
);
33 return enter
.functions()->CreateGraphics3D(
34 instance
, share_context
, attrib_list
);
37 PP_Bool
IsGraphics3D(PP_Resource resource
) {
38 EnterGraphics3D
enter(resource
, false);
39 return PP_FromBool(enter
.succeeded());
42 int32_t GetAttribs(PP_Resource graphics_3d
, int32_t attrib_list
[]) {
43 EnterGraphics3D
enter(graphics_3d
, true);
45 return enter
.retval();
46 return enter
.object()->GetAttribs(attrib_list
);
49 int32_t SetAttribs(PP_Resource graphics_3d
, const int32_t attrib_list
[]) {
50 EnterGraphics3D
enter(graphics_3d
, true);
52 return enter
.retval();
53 return enter
.object()->SetAttribs(attrib_list
);
56 int32_t GetError(PP_Resource graphics_3d
) {
57 EnterGraphics3D
enter(graphics_3d
, true);
59 return enter
.retval();
60 return enter
.object()->GetError();
63 int32_t ResizeBuffers(PP_Resource graphics_3d
, int32_t width
, int32_t height
) {
64 EnterGraphics3D
enter(graphics_3d
, true);
66 return enter
.retval();
67 return enter
.object()->ResizeBuffers(width
, height
);
70 int32_t SwapBuffers(PP_Resource graphics_3d
, PP_CompletionCallback callback
) {
71 EnterGraphics3D
enter(graphics_3d
, callback
, true);
73 return enter
.retval();
74 return enter
.SetResult(enter
.object()->SwapBuffers(enter
.callback()));
77 const PPB_Graphics3D g_ppb_graphics_3d_thunk
= {
90 const PPB_Graphics3D_1_0
* GetPPB_Graphics3D_1_0_Thunk() {
91 return &g_ppb_graphics_3d_thunk
;