| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 uint32 generation; | 60 uint32 generation; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 CommandBuffer() { | 63 CommandBuffer() { |
| 64 } | 64 } |
| 65 | 65 |
| 66 virtual ~CommandBuffer() { | 66 virtual ~CommandBuffer() { |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Initialize the command buffer with the given size. | 69 // Initialize the command buffer with the given size. |
| 70 virtual bool Initialize(int32 size) = 0; | 70 virtual bool Initialize() = 0; |
| 71 | |
| 72 // Initialize the command buffer using the given preallocated buffer. | |
| 73 virtual bool Initialize(base::SharedMemory* buffer, int32 size) = 0; | |
| 74 | |
| 75 // Gets the ring buffer for the command buffer. | |
| 76 virtual Buffer GetRingBuffer() = 0; | |
| 77 | 71 |
| 78 // Returns the current status. | 72 // Returns the current status. |
| 79 virtual State GetState() = 0; | 73 virtual State GetState() = 0; |
| 80 | 74 |
| 81 // Returns the last state without synchronizing with the service. | 75 // Returns the last state without synchronizing with the service. |
| 82 virtual State GetLastState() = 0; | 76 virtual State GetLastState() = 0; |
| 83 | 77 |
| 84 // The writer calls this to update its put offset. This ensures the reader | 78 // The writer calls this to update its put offset. This ensures the reader |
| 85 // sees the latest added commands, and will eventually process them. On the | 79 // sees the latest added commands, and will eventually process them. On the |
| 86 // service side, commands are processed up to the given put_offset before | 80 // service side, commands are processed up to the given put_offset before |
| 87 // subsequent Flushes on the same GpuChannel. | 81 // subsequent Flushes on the same GpuChannel. |
| 88 virtual void Flush(int32 put_offset) = 0; | 82 virtual void Flush(int32 put_offset) = 0; |
| 89 | 83 |
| 90 // 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 |
| 91 // reader's most recent get offset. Does not return until all pending commands | 85 // reader's most recent get offset. Does not return until all pending commands |
| 92 // have been executed. | 86 // have been executed. |
| 93 virtual State FlushSync(int32 put_offset, int32 last_known_get) = 0; | 87 virtual State FlushSync(int32 put_offset, int32 last_known_get) = 0; |
| 94 | 88 |
| 89 // Sets the buffer commands are read from. |
| 90 // Also resets the get and put offsets to 0. |
| 91 virtual void SetGetBuffer(int32 transfer_buffer_id) = 0; |
| 92 |
| 95 // Sets the current get offset. This can be called from any thread. | 93 // Sets the current get offset. This can be called from any thread. |
| 96 virtual void SetGetOffset(int32 get_offset) = 0; | 94 virtual void SetGetOffset(int32 get_offset) = 0; |
| 97 | 95 |
| 98 // Create a transfer buffer and return a handle that uniquely | 96 // Create a transfer buffer and return a handle that uniquely |
| 99 // identifies it or -1 on error. id_request lets the caller request a | 97 // identifies it or -1 on error. id_request lets the caller request a |
| 100 // specific id for the transfer buffer, or -1 if the caller does not care. | 98 // specific id for the transfer buffer, or -1 if the caller does not care. |
| 101 // If the requested id can not be fulfilled, a different id will be returned. | 99 // If the requested id can not be fulfilled, a different id will be returned. |
| 102 // id_request must be either -1 or between 0 and 100. | 100 // id_request must be either -1 or between 0 and 100. |
| 103 virtual int32 CreateTransferBuffer(size_t size, int32 id_request) = 0; | 101 virtual int32 CreateTransferBuffer(size_t size, int32 id_request) = 0; |
| 104 | 102 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 129 // call this first. | 127 // call this first. |
| 130 virtual void SetContextLostReason(error::ContextLostReason) = 0; | 128 virtual void SetContextLostReason(error::ContextLostReason) = 0; |
| 131 | 129 |
| 132 private: | 130 private: |
| 133 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); | 131 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); |
| 134 }; | 132 }; |
| 135 | 133 |
| 136 } // namespace gpu | 134 } // namespace gpu |
| 137 | 135 |
| 138 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 136 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
| OLD | NEW |