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

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

Issue 2170293002: Use GLVersionInfo instead of gl::GetGLImplementation() to decide GL paths (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc » ('j') | 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/buffer_manager.h" 5 #include "gpu/command_buffer/service/buffer_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
11 #include "base/format_macros.h" 11 #include "base/format_macros.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
15 #include "base/trace_event/memory_dump_manager.h" 15 #include "base/trace_event/memory_dump_manager.h"
16 #include "base/trace_event/trace_event.h" 16 #include "base/trace_event/trace_event.h"
17 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 17 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
18 #include "gpu/command_buffer/service/context_state.h" 18 #include "gpu/command_buffer/service/context_state.h"
19 #include "gpu/command_buffer/service/error_state.h" 19 #include "gpu/command_buffer/service/error_state.h"
20 #include "gpu/command_buffer/service/feature_info.h" 20 #include "gpu/command_buffer/service/feature_info.h"
21 #include "gpu/command_buffer/service/memory_tracking.h" 21 #include "gpu/command_buffer/service/memory_tracking.h"
22 #include "gpu/command_buffer/service/transform_feedback_manager.h" 22 #include "gpu/command_buffer/service/transform_feedback_manager.h"
23 #include "ui/gl/gl_bindings.h" 23 #include "ui/gl/gl_bindings.h"
24 #include "ui/gl/gl_implementation.h"
25 #include "ui/gl/gl_version_info.h" 24 #include "ui/gl/gl_version_info.h"
26 #include "ui/gl/trace_util.h" 25 #include "ui/gl/trace_util.h"
27 26
28 namespace gpu { 27 namespace gpu {
29 namespace gles2 { 28 namespace gles2 {
30 namespace { 29 namespace {
31 static const GLsizeiptr kDefaultMaxBufferSize = 1u << 30; // 1GB 30 static const GLsizeiptr kDefaultMaxBufferSize = 1u << 30; // 1GB
32 } 31 }
33 32
34 BufferManager::BufferManager(MemoryTracker* memory_tracker, 33 BufferManager::BufferManager(MemoryTracker* memory_tracker,
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 352
354 bool BufferManager::UseNonZeroSizeForClientSideArrayBuffer() { 353 bool BufferManager::UseNonZeroSizeForClientSideArrayBuffer() {
355 return feature_info_.get() && 354 return feature_info_.get() &&
356 feature_info_->workarounds() 355 feature_info_->workarounds()
357 .use_non_zero_size_for_client_side_stream_buffers; 356 .use_non_zero_size_for_client_side_stream_buffers;
358 } 357 }
359 358
360 bool BufferManager::UseShadowBuffer(GLenum target, GLenum usage) { 359 bool BufferManager::UseShadowBuffer(GLenum target, GLenum usage) {
361 const bool is_client_side_array = IsUsageClientSideArray(usage); 360 const bool is_client_side_array = IsUsageClientSideArray(usage);
362 const bool support_fixed_attribs = 361 const bool support_fixed_attribs =
363 gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2; 362 !feature_info_ || feature_info_->gl_version_info().is_es;
no sievers 2016/07/22 17:26:17 |!feature_info_| is for some unit tests? maybe wor
piman 2016/07/22 17:30:02 It is (that's not ideal, but same as UseNonZeroSiz
piman 2016/07/22 19:25:37 Done.
364 363
365 // TODO(zmo): Don't shadow buffer data on ES3. crbug.com/491002. 364 // TODO(zmo): Don't shadow buffer data on ES3. crbug.com/491002.
366 return ( 365 return (
367 target == GL_ELEMENT_ARRAY_BUFFER || allow_buffers_on_multiple_targets_ || 366 target == GL_ELEMENT_ARRAY_BUFFER || allow_buffers_on_multiple_targets_ ||
368 (allow_fixed_attribs_ && !support_fixed_attribs) || is_client_side_array); 367 (allow_fixed_attribs_ && !support_fixed_attribs) || is_client_side_array);
369 } 368 }
370 369
371 void BufferManager::SetInfo(Buffer* buffer, 370 void BufferManager::SetInfo(Buffer* buffer,
372 GLenum target, 371 GLenum target,
373 GLsizeiptr size, 372 GLsizeiptr size,
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 auto guid = gl::GetGLBufferGUIDForTracing(share_group_tracing_guid, 660 auto guid = gl::GetGLBufferGUIDForTracing(share_group_tracing_guid,
662 client_buffer_id); 661 client_buffer_id);
663 pmd->CreateSharedGlobalAllocatorDump(guid); 662 pmd->CreateSharedGlobalAllocatorDump(guid);
664 pmd->AddOwnershipEdge(dump->guid(), guid); 663 pmd->AddOwnershipEdge(dump->guid(), guid);
665 } 664 }
666 return true; 665 return true;
667 } 666 }
668 667
669 } // namespace gles2 668 } // namespace gles2
670 } // namespace gpu 669 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698