Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: gpu/command_buffer/client/cmd_buffer_helper.h

Issue 2956005: Adds MapBufferSubData and MapTexSubImage2D.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // This file contains the command buffer helper class. 5 // This file contains the command buffer helper class.
6 6
7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ 8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
9 9
10 #include <string.h> 10 #include <string.h>
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 // Typed version of GetSpace for immediate commands. 103 // Typed version of GetSpace for immediate commands.
104 template <typename T> 104 template <typename T>
105 T& GetImmediateCmdSpaceTotalSize(size_t total_space) { 105 T& GetImmediateCmdSpaceTotalSize(size_t total_space) {
106 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN); 106 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN);
107 uint32 space_needed = ComputeNumEntries(total_space); 107 uint32 space_needed = ComputeNumEntries(total_space);
108 void* data = GetSpace(space_needed); 108 void* data = GetSpace(space_needed);
109 return *reinterpret_cast<T*>(data); 109 return *reinterpret_cast<T*>(data);
110 } 110 }
111 111
112 int32 last_token_read() const {
113 return last_token_read_;
114 }
115
112 error::Error GetError(); 116 error::Error GetError();
113 117
114 // Common Commands 118 // Common Commands
115 void Noop(uint32 skip_count) { 119 void Noop(uint32 skip_count) {
116 cmd::Noop& cmd = GetImmediateCmdSpace<cmd::Noop>( 120 cmd::Noop& cmd = GetImmediateCmdSpace<cmd::Noop>(
117 skip_count * sizeof(CommandBufferEntry)); 121 skip_count * sizeof(CommandBufferEntry));
118 cmd.Init(skip_count); 122 cmd.Init(skip_count);
119 } 123 }
120 124
121 void SetToken(uint32 token) { 125 void SetToken(uint32 token) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 uint32 shared_memory_id, 193 uint32 shared_memory_id,
190 uint32 shared_memory_offset) { 194 uint32 shared_memory_offset) {
191 cmd::GetBucketData& cmd = GetCmdSpace<cmd::GetBucketData>(); 195 cmd::GetBucketData& cmd = GetCmdSpace<cmd::GetBucketData>();
192 cmd.Init(bucket_id, 196 cmd.Init(bucket_id,
193 offset, 197 offset,
194 size, 198 size,
195 shared_memory_id, 199 shared_memory_id,
196 shared_memory_offset); 200 shared_memory_offset);
197 } 201 }
198 202
203 CommandBuffer* command_buffer() const {
204 return command_buffer_;
205 }
206
199 private: 207 private:
200 // Waits until get changes, updating the value of get_. 208 // Waits until get changes, updating the value of get_.
201 void WaitForGetChange(); 209 void WaitForGetChange();
202 210
203 // Returns the number of available entries (they may not be contiguous). 211 // Returns the number of available entries (they may not be contiguous).
204 int32 AvailableEntries() { 212 int32 AvailableEntries() {
205 return (get_ - put_ - 1 + usable_entry_count_) % usable_entry_count_; 213 return (get_ - put_ - 1 + usable_entry_count_) % usable_entry_count_;
206 } 214 }
207 215
208 // Synchronize with current service state. 216 // Synchronize with current service state.
209 void SynchronizeState(CommandBuffer::State state); 217 void SynchronizeState(CommandBuffer::State state);
210 218
211 CommandBuffer* command_buffer_; 219 CommandBuffer* command_buffer_;
212 Buffer ring_buffer_; 220 Buffer ring_buffer_;
213 CommandBufferEntry *entries_; 221 CommandBufferEntry *entries_;
214 int32 total_entry_count_; // the total number of entries 222 int32 total_entry_count_; // the total number of entries
215 int32 usable_entry_count_; // the usable number (ie, minus space for jump) 223 int32 usable_entry_count_; // the usable number (ie, minus space for jump)
216 int32 token_; 224 int32 token_;
217 int32 last_token_read_; 225 int32 last_token_read_;
218 int32 get_; 226 int32 get_;
219 int32 put_; 227 int32 put_;
220 228
221 friend class CommandBufferHelperTest; 229 friend class CommandBufferHelperTest;
222 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); 230 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper);
223 }; 231 };
224 232
225 } // namespace gpu 233 } // namespace gpu
226 234
227 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ 235 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | gpu/command_buffer/client/fenced_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698