| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 // Initialize the command buffer with the given size. | 55 // Initialize the command buffer with the given size. |
| 56 virtual bool Initialize(int32 size) = 0; | 56 virtual bool Initialize(int32 size) = 0; |
| 57 | 57 |
| 58 // Gets the ring buffer for the command buffer. | 58 // Gets the ring buffer for the command buffer. |
| 59 virtual Buffer GetRingBuffer() = 0; | 59 virtual Buffer GetRingBuffer() = 0; |
| 60 | 60 |
| 61 // Returns the current status. | 61 // Returns the current status. |
| 62 virtual State GetState() = 0; | 62 virtual State GetState() = 0; |
| 63 | 63 |
| 64 // The writer calls this to update its put offset. This ensures the reader |
| 65 // sees the latest added commands, and will eventually process them. |
| 66 virtual void Flush(int32 put_offset) = 0; |
| 67 |
| 64 // The writer calls this to update its put offset. This function returns the | 68 // The writer calls this to update its put offset. This function returns the |
| 65 // reader's most recent get offset. Does not return until after the put offset | 69 // reader's most recent get offset. Does not return until after the put offset |
| 66 // change callback has been invoked. Returns -1 if the put offset is invalid. | 70 // change callback has been invoked. Returns -1 if the put offset is invalid. |
| 67 virtual State Flush(int32 put_offset) = 0; | 71 // As opposed to Flush(), this function guarantees that the reader has |
| 72 // processed some commands before returning (assuming the command buffer isn't |
| 73 // empty and there is no error). |
| 74 virtual State FlushSync(int32 put_offset) = 0; |
| 68 | 75 |
| 69 // Sets the current get offset. This can be called from any thread. | 76 // Sets the current get offset. This can be called from any thread. |
| 70 virtual void SetGetOffset(int32 get_offset) = 0; | 77 virtual void SetGetOffset(int32 get_offset) = 0; |
| 71 | 78 |
| 72 // Create a transfer buffer and return a handle that uniquely | 79 // Create a transfer buffer and return a handle that uniquely |
| 73 // identifies it or -1 on error. | 80 // identifies it or -1 on error. |
| 74 virtual int32 CreateTransferBuffer(size_t size) = 0; | 81 virtual int32 CreateTransferBuffer(size_t size) = 0; |
| 75 | 82 |
| 76 // Destroy a transfer buffer and recycle the handle. | 83 // Destroy a transfer buffer and recycle the handle. |
| 77 virtual void DestroyTransferBuffer(int32 id) = 0; | 84 virtual void DestroyTransferBuffer(int32 id) = 0; |
| 78 | 85 |
| 79 // Get the transfer buffer associated with a handle. | 86 // Get the transfer buffer associated with a handle. |
| 80 virtual Buffer GetTransferBuffer(int32 handle) = 0; | 87 virtual Buffer GetTransferBuffer(int32 handle) = 0; |
| 81 | 88 |
| 82 // Allows the reader to update the current token value. | 89 // Allows the reader to update the current token value. |
| 83 virtual void SetToken(int32 token) = 0; | 90 virtual void SetToken(int32 token) = 0; |
| 84 | 91 |
| 85 // Allows the reader to set the current parse error. | 92 // Allows the reader to set the current parse error. |
| 86 virtual void SetParseError(error::Error) = 0; | 93 virtual void SetParseError(error::Error) = 0; |
| 87 | 94 |
| 88 private: | 95 private: |
| 89 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); | 96 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); |
| 90 }; | 97 }; |
| 91 | 98 |
| 92 } // namespace gpu | 99 } // namespace gpu |
| 93 | 100 |
| 94 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 101 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
| OLD | NEW |