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

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

Issue 152263002: Changed pack alignment of GPU command buffer commands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: #pragma pack value must be literal. Created 6 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
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_format.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/transfer_buffer_manager.h" 5 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/process/process_handle.h" 12 #include "base/process/process_handle.h"
13 #include "gpu/command_buffer/common/cmd_buffer_common.h"
13 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 14 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
14 15
15 using ::base::SharedMemory; 16 using ::base::SharedMemory;
16 17
17 namespace gpu { 18 namespace gpu {
18 19
19 TransferBufferManagerInterface::~TransferBufferManagerInterface() { 20 TransferBufferManagerInterface::~TransferBufferManagerInterface() {
20 } 21 }
21 22
22 TransferBufferManager::TransferBufferManager() 23 TransferBufferManager::TransferBufferManager()
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 DVLOG(0) << "Failed to map shared memory."; 69 DVLOG(0) << "Failed to map shared memory.";
69 return false; 70 return false;
70 } 71 }
71 72
72 // If it could be mapped register the shared memory with the ID. 73 // If it could be mapped register the shared memory with the ID.
73 Buffer buffer; 74 Buffer buffer;
74 buffer.ptr = duped_shared_memory->memory(); 75 buffer.ptr = duped_shared_memory->memory();
75 buffer.size = size; 76 buffer.size = size;
76 buffer.shared_memory = duped_shared_memory.release(); 77 buffer.shared_memory = duped_shared_memory.release();
77 78
79 // Check buffer alignment is sane.
80 DCHECK(!(reinterpret_cast<uintptr_t>(buffer.ptr) &
81 (kCommandBufferEntrySize - 1)));
82
78 shared_memory_bytes_allocated_ += size; 83 shared_memory_bytes_allocated_ += size;
79 TRACE_COUNTER_ID1( 84 TRACE_COUNTER_ID1(
80 "gpu", "GpuTransferBufferMemory", this, shared_memory_bytes_allocated_); 85 "gpu", "GpuTransferBufferMemory", this, shared_memory_bytes_allocated_);
81 86
82 registered_buffers_[id] = buffer; 87 registered_buffers_[id] = buffer;
83 88
84 return true; 89 return true;
85 } 90 }
86 91
87 void TransferBufferManager::DestroyTransferBuffer(int32 id) { 92 void TransferBufferManager::DestroyTransferBuffer(int32 id) {
(...skipping 18 matching lines...) Expand all
106 111
107 BufferMap::iterator it = registered_buffers_.find(id); 112 BufferMap::iterator it = registered_buffers_.find(id);
108 if (it == registered_buffers_.end()) 113 if (it == registered_buffers_.end())
109 return Buffer(); 114 return Buffer();
110 115
111 return it->second; 116 return it->second;
112 } 117 }
113 118
114 } // namespace gpu 119 } // namespace gpu
115 120
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_format.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698