Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
| 6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
| 7 | 7 |
| 8 #include "../common/buffer.h" | 8 #include "../common/buffer.h" |
| 9 #include "../common/constants.h" | 9 #include "../common/constants.h" |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 | 67 |
| 68 // Initialize the command buffer using the given preallocated buffer. | 68 // Initialize the command buffer using the given preallocated buffer. |
| 69 virtual bool Initialize(base::SharedMemory* buffer, int32 size) = 0; | 69 virtual bool Initialize(base::SharedMemory* buffer, int32 size) = 0; |
| 70 | 70 |
| 71 // Gets the ring buffer for the command buffer. | 71 // Gets the ring buffer for the command buffer. |
| 72 virtual Buffer GetRingBuffer() = 0; | 72 virtual Buffer GetRingBuffer() = 0; |
| 73 | 73 |
| 74 // Returns the current status. | 74 // Returns the current status. |
| 75 virtual State GetState() = 0; | 75 virtual State GetState() = 0; |
| 76 | 76 |
| 77 // Returns the last state without synchronizing with the service. | |
| 78 virtual State GetLastState() = 0; | |
| 79 | |
| 77 // The writer calls this to update its put offset. This ensures the reader | 80 // The writer calls this to update its put offset. This ensures the reader |
| 78 // sees the latest added commands, and will eventually process them. | 81 // sees the latest added commands, and will eventually process them. |
|
jbates
2011/07/11 18:39:50
Could use an updated comment here right? Like "on
apatrick_chromium
2011/07/11 21:25:45
Done.
| |
| 79 virtual void Flush(int32 put_offset) = 0; | 82 virtual void Flush(int32 put_offset) = 0; |
| 80 | 83 |
| 81 // The writer calls this to update its put offset. This function returns the | 84 // The writer calls this to update its put offset. This function returns the |
| 82 // reader's most recent get offset. Does not return until after the put offset | 85 // reader's most recent get offset. Does not return until all pending commands |
| 83 // change callback has been invoked. Returns -1 if the put offset is invalid. | 86 // have been executed. |
| 84 // If last_known_get is different from the reader's current get pointer, this | |
| 85 // function will return immediately, otherwise it guarantees that the reader | |
| 86 // has processed some commands before returning (assuming the command buffer | |
| 87 // isn't empty and there is no error). | |
| 88 virtual State FlushSync(int32 put_offset, int32 last_known_get) = 0; | 87 virtual State FlushSync(int32 put_offset, int32 last_known_get) = 0; |
| 89 | 88 |
| 90 // Sets the current get offset. This can be called from any thread. | 89 // Sets the current get offset. This can be called from any thread. |
| 91 virtual void SetGetOffset(int32 get_offset) = 0; | 90 virtual void SetGetOffset(int32 get_offset) = 0; |
| 92 | 91 |
| 93 // Create a transfer buffer and return a handle that uniquely | 92 // Create a transfer buffer and return a handle that uniquely |
| 94 // identifies it or -1 on error. id_request lets the caller request a | 93 // identifies it or -1 on error. id_request lets the caller request a |
| 95 // specific id for the transfer buffer, or -1 if the caller does not care. | 94 // specific id for the transfer buffer, or -1 if the caller does not care. |
| 96 // If the requested id can not be fulfilled, a different id will be returned. | 95 // If the requested id can not be fulfilled, a different id will be returned. |
| 97 // id_request must be either -1 or between 0 and 100. | 96 // id_request must be either -1 or between 0 and 100. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 | 139 |
| 141 // These want to be private (and const) but can't in order to support | 140 // These want to be private (and const) but can't in order to support |
| 142 // pickling. | 141 // pickling. |
| 143 int32 last_token_read; | 142 int32 last_token_read; |
| 144 int32 last_token_written; | 143 int32 last_token_written; |
| 145 }; | 144 }; |
| 146 | 145 |
| 147 } // namespace gpu | 146 } // namespace gpu |
| 148 | 147 |
| 149 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 148 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
| OLD | NEW |