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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2623223002: Ensure memory mapped chunk size is aligned with the FencedAllocator. (Closed)
Patch Set: Perform alignment in gles2_implementation.cc Created 3 years, 11 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 | « no previous file | 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 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
11 #include <GLES2/gl2extchromium.h> 11 #include <GLES2/gl2extchromium.h>
12 #include <GLES3/gl3.h> 12 #include <GLES3/gl3.h>
13 #include <stddef.h> 13 #include <stddef.h>
14 #include <stdint.h> 14 #include <stdint.h>
15 #include <algorithm> 15 #include <algorithm>
16 #include <map> 16 #include <map>
17 #include <set> 17 #include <set>
18 #include <sstream> 18 #include <sstream>
19 #include <string> 19 #include <string>
20 #include "base/atomic_sequence_num.h" 20 #include "base/atomic_sequence_num.h"
21 #include "base/bits.h"
21 #include "base/compiler_specific.h" 22 #include "base/compiler_specific.h"
22 #include "base/numerics/safe_math.h" 23 #include "base/numerics/safe_math.h"
23 #include "base/strings/string_split.h" 24 #include "base/strings/string_split.h"
24 #include "base/strings/stringprintf.h" 25 #include "base/strings/stringprintf.h"
25 #include "base/sys_info.h" 26 #include "base/sys_info.h"
26 #include "base/threading/thread_task_runner_handle.h" 27 #include "base/threading/thread_task_runner_handle.h"
27 #include "base/trace_event/memory_allocator_dump.h" 28 #include "base/trace_event/memory_allocator_dump.h"
28 #include "base/trace_event/memory_dump_manager.h" 29 #include "base/trace_event/memory_dump_manager.h"
29 #include "base/trace_event/process_memory_dump.h" 30 #include "base/trace_event/process_memory_dump.h"
30 #include "base/trace_event/trace_event.h" 31 #include "base/trace_event/trace_event.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 kSizeToFlush)) { 213 kSizeToFlush)) {
213 return false; 214 return false;
214 } 215 }
215 216
216 mapped_memory_.reset(new MappedMemoryManager(helper_, mapped_memory_limit)); 217 mapped_memory_.reset(new MappedMemoryManager(helper_, mapped_memory_limit));
217 218
218 unsigned chunk_size = 2 * 1024 * 1024; 219 unsigned chunk_size = 2 * 1024 * 1024;
219 if (mapped_memory_limit != SharedMemoryLimits::kNoLimit) { 220 if (mapped_memory_limit != SharedMemoryLimits::kNoLimit) {
220 // Use smaller chunks if the client is very memory conscientious. 221 // Use smaller chunks if the client is very memory conscientious.
221 chunk_size = std::min(mapped_memory_limit / 4, chunk_size); 222 chunk_size = std::min(mapped_memory_limit / 4, chunk_size);
223 chunk_size = base::bits::Align(chunk_size,
224 FencedAllocator::kAllocAlignment);
222 } 225 }
223 mapped_memory_->set_chunk_size_multiple(chunk_size); 226 mapped_memory_->set_chunk_size_multiple(chunk_size);
224 227
225 GLStaticState::ShaderPrecisionMap* shader_precisions = 228 GLStaticState::ShaderPrecisionMap* shader_precisions =
226 &static_state_.shader_precisions; 229 &static_state_.shader_precisions;
227 capabilities_.VisitPrecisions([shader_precisions]( 230 capabilities_.VisitPrecisions([shader_precisions](
228 GLenum shader, GLenum type, Capabilities::ShaderPrecision* result) { 231 GLenum shader, GLenum type, Capabilities::ShaderPrecision* result) {
229 const GLStaticState::ShaderPrecisionKey key(shader, type); 232 const GLStaticState::ShaderPrecisionKey key(shader, type);
230 cmds::GetShaderPrecisionFormat::Result cached_result = { 233 cmds::GetShaderPrecisionFormat::Result cached_result = {
231 true, result->min_range, result->max_range, result->precision}; 234 true, result->min_range, result->max_range, result->precision};
(...skipping 6837 matching lines...) Expand 10 before | Expand all | Expand 10 after
7069 CheckGLError(); 7072 CheckGLError();
7070 } 7073 }
7071 7074
7072 // Include the auto-generated part of this file. We split this because it means 7075 // Include the auto-generated part of this file. We split this because it means
7073 // we can easily edit the non-auto generated parts right here in this file 7076 // we can easily edit the non-auto generated parts right here in this file
7074 // instead of having to edit some template or the code generator. 7077 // instead of having to edit some template or the code generator.
7075 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 7078 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
7076 7079
7077 } // namespace gles2 7080 } // namespace gles2
7078 } // namespace gpu 7081 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698