Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
|
apatrick_chromium
2011/01/26 00:15:33
2011!
neb
2011/01/26 00:38:14
Nice one. Done.
| |
| 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 PPAPI_C_DEV_PPB_CONTEXT_3D_TRUSTED_DEV_H_ | |
| 6 #define PPAPI_C_DEV_PPB_CONTEXT_3D_TRUSTED_DEV_H_ | |
| 7 | |
| 8 #include "ppapi/c/pp_bool.h" | |
| 9 #include "ppapi/c/pp_resource.h" | |
| 10 #include "ppapi/c/pp_stdint.h" | |
| 11 | |
| 12 #define PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE "PPB_Context3DTrusted(Dev);0.1" | |
| 13 | |
| 14 enum PPB_Context3DTrustedError { | |
| 15 kNoError, | |
| 16 kInvalidSize, | |
| 17 kOutOfBounds, | |
| 18 kUnknownCommand, | |
| 19 kInvalidArguments, | |
| 20 kLostContext, | |
| 21 kGenericError | |
| 22 }; | |
| 23 | |
| 24 struct PP_Context3DTrustedState { | |
| 25 // Size of the command buffer in command buffer entries. | |
| 26 int32_t num_entries; | |
| 27 | |
| 28 // The offset (in entries) from which the reader is reading. | |
| 29 int32_t get_offset; | |
| 30 | |
| 31 // The offset (in entries) at which the writer is writing. | |
| 32 int32_t put_offset; | |
| 33 | |
| 34 // The current token value. This is used by the writer to defer | |
| 35 // changes to shared memory objects until the reader has reached a certain | |
| 36 // point in the command buffer. The reader is responsible for updating the | |
| 37 // token value, for example in response to an asynchronous set token command | |
| 38 // embedded in the command buffer. The default token value is zero. | |
| 39 int32_t token; | |
| 40 | |
| 41 // Error status. | |
| 42 PPB_Context3DTrustedError error; | |
| 43 }; | |
| 44 | |
| 45 struct PPB_Context3DTrusted_Dev { | |
| 46 PP_Bool (*GetRingBuffer)(PP_Resource context_id, | |
| 47 int* shm_handle, | |
| 48 uint32_t* shm_size); | |
| 49 | |
| 50 // Returns the current state. | |
| 51 PP_Context3DTrustedState (*GetState)(PP_Resource context); | |
| 52 | |
| 53 // The writer calls this to update its put offset. | |
| 54 PP_Bool (*Flush)(PP_Resource context, int32_t put_offset); | |
| 55 | |
| 56 | |
| 57 // The writer calls this to update its put offset. This function returns the | |
| 58 // reader's most recent get offset. Does not return until after the put offset | |
| 59 // change callback has been invoked. | |
| 60 PP_Context3DTrustedState (*FlushSync)(PP_Resource context, | |
| 61 int32_t put_offset); | |
| 62 | |
| 63 // Create a transfer buffer and return a handle that uniquely | |
| 64 // identifies it or -1 on error. | |
| 65 int32_t (*CreateTransferBuffer)(PP_Resource context, size_t size); | |
| 66 | |
| 67 // Destroy a transfer buffer and recycle the handle. | |
| 68 PP_Bool (*DestroyTransferBuffer)(PP_Resource context, int32_t id); | |
| 69 | |
| 70 // Get the transfer buffer associated with a handle. | |
| 71 PP_Bool (*GetTransferBuffer)(PP_Resource context, | |
| 72 int32_t id, | |
| 73 int* shm_handle, | |
| 74 uint32_t* shm_size); | |
| 75 }; | |
| 76 | |
| 77 #endif // PPAPI_C_DEV_PPB_CONTEXT_3D_TRUSTED_DEV_H_ | |
| 78 | |
| OLD | NEW |