Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc

Issue 7824040: Pepper 3D API changes: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/c/pp_errors.h ('k') | ppapi/shared_impl/graphics_3d_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h" 7 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h"
8 8
9 #include "gpu/command_buffer/client/gles2_implementation.h" 9 #include "gpu/command_buffer/client/gles2_implementation.h"
10 #include "native_client/src/shared/ppapi_proxy/command_buffer_nacl.h" 10 #include "native_client/src/shared/ppapi_proxy/command_buffer_nacl.h"
(...skipping 23 matching lines...) Expand all
34 if (attrib_list) { 34 if (attrib_list) {
35 // skip over attrib pairs 35 // skip over attrib pairs
36 while (attrib_list[num] != PP_GRAPHICS3DATTRIB_NONE) 36 while (attrib_list[num] != PP_GRAPHICS3DATTRIB_NONE)
37 num += 2; 37 num += 2;
38 // Add one more for PP_GRAPHICS3DATTRIB_NONE. 38 // Add one more for PP_GRAPHICS3DATTRIB_NONE.
39 num += 1; 39 num += 1;
40 } 40 }
41 return num; 41 return num;
42 } 42 }
43 43
44 int32_t GetAttribMaxValue(PP_Resource instance,
45 int32_t attribute,
46 int32_t* value) {
47 // TODO(nfullagar): Implement me.
48 return PP_ERROR_FAILED;
49 }
50
44 PP_Resource Create(PP_Instance instance, 51 PP_Resource Create(PP_Instance instance,
45 PP_Resource share_context, 52 PP_Resource share_context,
46 const int32_t* attrib_list) { 53 const int32_t* attrib_list) {
47 DebugPrintf("PPB_Graphics3D::Create: instance=%"NACL_PRIu32"\n", instance); 54 DebugPrintf("PPB_Graphics3D::Create: instance=%"NACL_PRIu32"\n", instance);
48 PP_Resource graphics3d_id = kInvalidResourceId; 55 PP_Resource graphics3d_id = kInvalidResourceId;
49 nacl_abi_size_t num_attribs = GetNumAttribs(attrib_list); 56 nacl_abi_size_t num_attribs = GetNumAttribs(attrib_list);
50 NaClSrpcError retval = 57 NaClSrpcError retval =
51 PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_CreateRaw( 58 PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_CreateRaw(
52 GetMainSrpcChannel(), 59 GetMainSrpcChannel(),
53 instance, 60 instance,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 GetMainSrpcChannel(), 105 GetMainSrpcChannel(),
99 graphics3d_id, 106 graphics3d_id,
100 num_attribs, attrib_list, 107 num_attribs, attrib_list,
101 &pp_error); 108 &pp_error);
102 if (retval != NACL_SRPC_RESULT_OK) { 109 if (retval != NACL_SRPC_RESULT_OK) {
103 return PP_ERROR_BADARGUMENT; 110 return PP_ERROR_BADARGUMENT;
104 } 111 }
105 return pp_error; 112 return pp_error;
106 } 113 }
107 114
115 int32_t GetError(PP_Resource graphics_3d) {
116 // TODO(nfullagar): Implement me.
117 return PP_ERROR_FAILED;
118 }
119
108 int32_t ResizeBuffers(PP_Resource graphics3d_id, 120 int32_t ResizeBuffers(PP_Resource graphics3d_id,
109 int32_t width, 121 int32_t width,
110 int32_t height) { 122 int32_t height) {
111 if ((width < 0) || (height < 0)) 123 if ((width < 0) || (height < 0))
112 return PP_ERROR_BADARGUMENT; 124 return PP_ERROR_BADARGUMENT;
113 gpu::gles2::GLES2Implementation* impl = 125 gpu::gles2::GLES2Implementation* impl =
114 PluginGraphics3D::implFromResource(graphics3d_id); 126 PluginGraphics3D::implFromResource(graphics3d_id);
115 if (impl == NULL) 127 if (impl == NULL)
116 return PP_ERROR_BADRESOURCE; 128 return PP_ERROR_BADRESOURCE;
117 impl->ResizeCHROMIUM(width, height); 129 impl->ResizeCHROMIUM(width, height);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return pp_error; 230 return pp_error;
219 231
220 impl()->SwapBuffers(); 232 impl()->SwapBuffers();
221 return PP_OK_COMPLETIONPENDING; 233 return PP_OK_COMPLETIONPENDING;
222 } 234 }
223 235
224 236
225 // static 237 // static
226 const PPB_Graphics3D_Dev* PluginGraphics3D::GetInterface() { 238 const PPB_Graphics3D_Dev* PluginGraphics3D::GetInterface() {
227 static const PPB_Graphics3D_Dev intf = { 239 static const PPB_Graphics3D_Dev intf = {
240 &GetAttribMaxValue,
228 &Create, 241 &Create,
229 &IsGraphics3D, 242 &IsGraphics3D,
230 &GetAttribs, 243 &GetAttribs,
231 &SetAttribs, 244 &SetAttribs,
245 &GetError,
232 &ResizeBuffers, 246 &ResizeBuffers,
233 &SwapBuffs, 247 &SwapBuffs,
234 }; 248 };
235 return &intf; 249 return &intf;
236 } 250 }
237 251
238 } // namespace ppapi_proxy 252 } // namespace ppapi_proxy
239 253
OLDNEW
« no previous file with comments | « ppapi/c/pp_errors.h ('k') | ppapi/shared_impl/graphics_3d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698