| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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. | |
| 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/dev/ppb_context_3d_dev.h" | |
| 9 #include "ppapi/c/pp_bool.h" | |
| 10 #include "ppapi/c/pp_instance.h" | |
| 11 #include "ppapi/c/pp_resource.h" | |
| 12 #include "ppapi/c/pp_stdint.h" | |
| 13 | |
| 14 #define PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE_0_4 "PPB_Context3DTrusted(Dev);0.4" | |
| 15 #define PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE \ | |
| 16 PPB_CONTEXT_3D_TRUSTED_DEV_INTERFACE_0_4 | |
| 17 | |
| 18 // TODO(brettw) Remove these generic names from the global namespace! | |
| 19 typedef enum { | |
| 20 kNoError, | |
| 21 kInvalidSize, | |
| 22 kOutOfBounds, | |
| 23 kUnknownCommand, | |
| 24 kInvalidArguments, | |
| 25 kLostContext, | |
| 26 kGenericError | |
| 27 } PPB_Context3DTrustedError; | |
| 28 | |
| 29 struct PP_Context3DTrustedState { | |
| 30 // Size of the command buffer in command buffer entries. | |
| 31 int32_t num_entries; | |
| 32 | |
| 33 // The offset (in entries) from which the reader is reading. | |
| 34 int32_t get_offset; | |
| 35 | |
| 36 // The offset (in entries) at which the writer is writing. | |
| 37 int32_t put_offset; | |
| 38 | |
| 39 // The current token value. This is used by the writer to defer | |
| 40 // changes to shared memory objects until the reader has reached a certain | |
| 41 // point in the command buffer. The reader is responsible for updating the | |
| 42 // token value, for example in response to an asynchronous set token command | |
| 43 // embedded in the command buffer. The default token value is zero. | |
| 44 int32_t token; | |
| 45 | |
| 46 // Error status. | |
| 47 PPB_Context3DTrustedError error; | |
| 48 | |
| 49 // Generation index of this state. The generation index is incremented every | |
| 50 // time a new state is retrieved from the command processor, so that | |
| 51 // consistency can be kept even if IPC messages are processed out-of-order. | |
| 52 uint32_t generation; | |
| 53 }; | |
| 54 | |
| 55 struct PPB_Context3DTrusted_Dev { | |
| 56 // Creates a raw Context3D resource. A raw Context3D is intended to be used | |
| 57 // with the trusted interface, through the command buffer (for proxying). In | |
| 58 // particular, when a Surface3D is bound to a raw context, SwapBuffers has no | |
| 59 // effect. | |
| 60 PP_Resource (*CreateRaw)(PP_Instance instance_id, | |
| 61 PP_Config3D_Dev config, | |
| 62 PP_Resource share_context, | |
| 63 const int32_t* attrib_list); | |
| 64 | |
| 65 // Initializes the command buffer with the given size. | |
| 66 PP_Bool (*Initialize)(PP_Resource context_id, int32_t size); | |
| 67 | |
| 68 // Gets the ring buffer for the command buffer. | |
| 69 PP_Bool (*GetRingBuffer)(PP_Resource context_id, | |
| 70 int* shm_handle, | |
| 71 uint32_t* shm_size); | |
| 72 | |
| 73 // Returns the current state. | |
| 74 struct PP_Context3DTrustedState (*GetState)(PP_Resource context); | |
| 75 | |
| 76 // The writer calls this to update its put offset. | |
| 77 PP_Bool (*Flush)(PP_Resource context, int32_t put_offset); | |
| 78 | |
| 79 | |
| 80 // The writer calls this to update its put offset. This function returns the | |
| 81 // reader's most recent get offset. Does not return until after the put offset | |
| 82 // change callback has been invoked. | |
| 83 struct PP_Context3DTrustedState (*FlushSync)(PP_Resource context, | |
| 84 int32_t put_offset); | |
| 85 | |
| 86 // Create a transfer buffer and return a handle that uniquely | |
| 87 // identifies it or -1 on error. | |
| 88 int32_t (*CreateTransferBuffer)(PP_Resource context, uint32_t size); | |
| 89 | |
| 90 // Destroy a transfer buffer and recycle the handle. | |
| 91 PP_Bool (*DestroyTransferBuffer)(PP_Resource context, int32_t id); | |
| 92 | |
| 93 // Get the transfer buffer associated with a handle. | |
| 94 PP_Bool (*GetTransferBuffer)(PP_Resource context, | |
| 95 int32_t id, | |
| 96 int* shm_handle, | |
| 97 uint32_t* shm_size); | |
| 98 | |
| 99 // Like FlushSync, but returns before processing commands if the get offset is | |
| 100 // different than last_known_get. Allows synchronization with the command | |
| 101 // processor without forcing immediate command execution. | |
| 102 struct PP_Context3DTrustedState (*FlushSyncFast)(PP_Resource context, | |
| 103 int32_t put_offset, | |
| 104 int32_t last_known_get); | |
| 105 }; | |
| 106 | |
| 107 #endif // PPAPI_C_DEV_PPB_CONTEXT_3D_TRUSTED_DEV_H_ | |
| 108 | |
| OLD | NEW |