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 // From ppb_graphics_3d.idl modified Fri Nov 1 16:12:12 2013.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_graphics_3d.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_graphics_3d_api.h"
20 int32_t GetAttribMaxValue(PP_Resource instance
,
23 VLOG(4) << "PPB_Graphics3D::GetAttribMaxValue()";
24 EnterResource
<PPB_Graphics3D_API
> enter(instance
, true);
26 return enter
.retval();
27 return enter
.object()->GetAttribMaxValue(attribute
, value
);
30 PP_Resource
Create(PP_Instance instance
,
31 PP_Resource share_context
,
32 const int32_t attrib_list
[]) {
33 VLOG(4) << "PPB_Graphics3D::Create()";
34 EnterResourceCreation
enter(instance
);
37 return enter
.functions()->CreateGraphics3D(instance
, share_context
,
41 PP_Bool
IsGraphics3D(PP_Resource resource
) {
42 VLOG(4) << "PPB_Graphics3D::IsGraphics3D()";
43 EnterResource
<PPB_Graphics3D_API
> enter(resource
, false);
44 return PP_FromBool(enter
.succeeded());
47 int32_t GetAttribs(PP_Resource context
, int32_t attrib_list
[]) {
48 VLOG(4) << "PPB_Graphics3D::GetAttribs()";
49 EnterResource
<PPB_Graphics3D_API
> enter(context
, true);
51 return enter
.retval();
52 return enter
.object()->GetAttribs(attrib_list
);
55 int32_t SetAttribs(PP_Resource context
, const int32_t attrib_list
[]) {
56 VLOG(4) << "PPB_Graphics3D::SetAttribs()";
57 EnterResource
<PPB_Graphics3D_API
> enter(context
, true);
59 return enter
.retval();
60 return enter
.object()->SetAttribs(attrib_list
);
63 int32_t GetError(PP_Resource context
) {
64 VLOG(4) << "PPB_Graphics3D::GetError()";
65 EnterResource
<PPB_Graphics3D_API
> enter(context
, true);
67 return enter
.retval();
68 return enter
.object()->GetError();
71 int32_t ResizeBuffers(PP_Resource context
, int32_t width
, int32_t height
) {
72 VLOG(4) << "PPB_Graphics3D::ResizeBuffers()";
73 EnterResource
<PPB_Graphics3D_API
> enter(context
, true);
75 return enter
.retval();
76 return enter
.object()->ResizeBuffers(width
, height
);
79 int32_t SwapBuffers(PP_Resource context
,
80 struct PP_CompletionCallback callback
) {
81 VLOG(4) << "PPB_Graphics3D::SwapBuffers()";
82 EnterResource
<PPB_Graphics3D_API
> enter(context
, callback
, true);
84 return enter
.retval();
85 return enter
.SetResult(enter
.object()->SwapBuffers(enter
.callback()));
88 const PPB_Graphics3D_1_0 g_ppb_graphics3d_thunk_1_0
= {&GetAttribMaxValue
,
99 PPAPI_THUNK_EXPORT
const PPB_Graphics3D_1_0
* GetPPB_Graphics3D_1_0_Thunk() {
100 return &g_ppb_graphics3d_thunk_1_0
;