OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/command_buffer/common/buffer.h" | 8 #include "gpu/command_buffer/common/buffer.h" |
9 #include "gpu/command_buffer/common/constants.h" | 9 #include "gpu/command_buffer/common/constants.h" |
10 #include "gpu/gpu_export.h" | 10 #include "gpu/gpu_export.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 virtual void WaitForTokenInRange(int32 start, int32 end) = 0; | 106 virtual void WaitForTokenInRange(int32 start, int32 end) = 0; |
107 | 107 |
108 // The writer calls this to wait until the current get offset is within a | 108 // The writer calls this to wait until the current get offset is within a |
109 // specific range, inclusive. Can return early if an error is generated. | 109 // specific range, inclusive. Can return early if an error is generated. |
110 virtual void WaitForGetOffsetInRange(int32 start, int32 end) = 0; | 110 virtual void WaitForGetOffsetInRange(int32 start, int32 end) = 0; |
111 | 111 |
112 // Sets the buffer commands are read from. | 112 // Sets the buffer commands are read from. |
113 // Also resets the get and put offsets to 0. | 113 // Also resets the get and put offsets to 0. |
114 virtual void SetGetBuffer(int32 transfer_buffer_id) = 0; | 114 virtual void SetGetBuffer(int32 transfer_buffer_id) = 0; |
115 | 115 |
116 // Sets the current get offset. This can be called from any thread. | |
117 virtual void SetGetOffset(int32 get_offset) = 0; | |
118 | |
119 // Create a transfer buffer of the given size. Returns its ID or -1 on | 116 // Create a transfer buffer of the given size. Returns its ID or -1 on |
120 // error. | 117 // error. |
121 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, | 118 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, |
122 int32* id) = 0; | 119 int32* id) = 0; |
123 | 120 |
124 // Destroy a transfer buffer. The ID must be positive. | 121 // Destroy a transfer buffer. The ID must be positive. |
125 virtual void DestroyTransferBuffer(int32 id) = 0; | 122 virtual void DestroyTransferBuffer(int32 id) = 0; |
126 | 123 |
127 // Get the transfer buffer associated with an ID. Returns a null buffer for | |
128 // ID 0. | |
129 virtual scoped_refptr<gpu::Buffer> GetTransferBuffer(int32 id) = 0; | |
130 | |
131 // Allows the reader to update the current token value. | |
132 virtual void SetToken(int32 token) = 0; | |
133 | |
134 // Allows the reader to set the current parse error. | |
135 virtual void SetParseError(error::Error) = 0; | |
136 | |
137 // Allows the reader to set the current context lost reason. | |
138 // NOTE: if calling this in conjunction with SetParseError, | |
139 // call this first. | |
140 virtual void SetContextLostReason(error::ContextLostReason) = 0; | |
141 | |
142 // The NaCl Win64 build only really needs the struct definitions above; having | 124 // The NaCl Win64 build only really needs the struct definitions above; having |
143 // GetLastError declared would mean we'd have to also define it, and pull more | 125 // GetLastError declared would mean we'd have to also define it, and pull more |
144 // of gpu in to the NaCl Win64 build. | 126 // of gpu in to the NaCl Win64 build. |
145 #if !defined(NACL_WIN64) | 127 #if !defined(NACL_WIN64) |
146 // TODO(apatrick): this is a temporary optimization while skia is calling | 128 // TODO(apatrick): this is a temporary optimization while skia is calling |
147 // RendererGLContext::MakeCurrent prior to every GL call. It saves returning 6 | 129 // RendererGLContext::MakeCurrent prior to every GL call. It saves returning 6 |
148 // ints redundantly when only the error is needed for the CommandBufferProxy | 130 // ints redundantly when only the error is needed for the CommandBufferProxy |
149 // implementation. | 131 // implementation. |
150 virtual error::Error GetLastError(); | 132 virtual error::Error GetLastError(); |
151 #endif | 133 #endif |
152 | 134 |
153 private: | 135 private: |
154 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); | 136 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); |
155 }; | 137 }; |
156 | 138 |
157 } // namespace gpu | 139 } // namespace gpu |
158 | 140 |
159 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 141 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
OLD | NEW |