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

Side by Side Diff: gpu/command_buffer/service/command_buffer_service.cc

Issue 896723008: Add OrderingBarrierCHROMIUM API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits. Created 5 years, 10 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
OLDNEW
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 #include "gpu/command_buffer/service/command_buffer_service.h" 5 #include "gpu/command_buffer/service/command_buffer_service.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 error_ = gpu::error::kOutOfBounds; 72 error_ = gpu::error::kOutOfBounds;
73 return; 73 return;
74 } 74 }
75 75
76 put_offset_ = put_offset; 76 put_offset_ = put_offset;
77 77
78 if (!put_offset_change_callback_.is_null()) 78 if (!put_offset_change_callback_.is_null())
79 put_offset_change_callback_.Run(); 79 put_offset_change_callback_.Run();
80 } 80 }
81 81
82 void CommandBufferService::OrderingBarrier(int32 put_offset) {
83 Flush(put_offset);
84 }
85
82 void CommandBufferService::SetGetBuffer(int32 transfer_buffer_id) { 86 void CommandBufferService::SetGetBuffer(int32 transfer_buffer_id) {
83 DCHECK_EQ(-1, ring_buffer_id_); 87 DCHECK_EQ(-1, ring_buffer_id_);
84 DCHECK_EQ(put_offset_, get_offset_); // Only if it's empty. 88 DCHECK_EQ(put_offset_, get_offset_); // Only if it's empty.
85 // If the buffer is invalid we handle it gracefully. 89 // If the buffer is invalid we handle it gracefully.
86 // This means ring_buffer_ can be NULL. 90 // This means ring_buffer_ can be NULL.
87 ring_buffer_ = GetTransferBuffer(transfer_buffer_id); 91 ring_buffer_ = GetTransferBuffer(transfer_buffer_id);
88 ring_buffer_id_ = transfer_buffer_id; 92 ring_buffer_id_ = transfer_buffer_id;
89 int32 size = ring_buffer_.get() ? ring_buffer_->size() : 0; 93 int32 size = ring_buffer_.get() ? ring_buffer_->size() : 0;
90 num_entries_ = size / sizeof(CommandBufferEntry); 94 num_entries_ = size / sizeof(CommandBufferEntry);
91 put_offset_ = 0; 95 put_offset_ = 0;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 const GetBufferChangedCallback& callback) { 189 const GetBufferChangedCallback& callback) {
186 get_buffer_change_callback_ = callback; 190 get_buffer_change_callback_ = callback;
187 } 191 }
188 192
189 void CommandBufferService::SetParseErrorCallback( 193 void CommandBufferService::SetParseErrorCallback(
190 const base::Closure& callback) { 194 const base::Closure& callback) {
191 parse_error_callback_ = callback; 195 parse_error_callback_ = callback;
192 } 196 }
193 197
194 } // namespace gpu 198 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.h ('k') | gpu/command_buffer/service/in_process_command_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698