| OLD | NEW |
| 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 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 348 |
| 349 bool BufferManager::UseNonZeroSizeForClientSideArrayBuffer() { | 349 bool BufferManager::UseNonZeroSizeForClientSideArrayBuffer() { |
| 350 return feature_info_.get() && | 350 return feature_info_.get() && |
| 351 feature_info_->workarounds() | 351 feature_info_->workarounds() |
| 352 .use_non_zero_size_for_client_side_stream_buffers; | 352 .use_non_zero_size_for_client_side_stream_buffers; |
| 353 } | 353 } |
| 354 | 354 |
| 355 bool BufferManager::UseShadowBuffer(GLenum target, GLenum usage) { | 355 bool BufferManager::UseShadowBuffer(GLenum target, GLenum usage) { |
| 356 const bool is_client_side_array = IsUsageClientSideArray(usage); | 356 const bool is_client_side_array = IsUsageClientSideArray(usage); |
| 357 const bool support_fixed_attribs = | 357 const bool support_fixed_attribs = |
| 358 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2; | 358 gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2; |
| 359 | 359 |
| 360 // TODO(zmo): Don't shadow buffer data on ES3. crbug.com/491002. | 360 // TODO(zmo): Don't shadow buffer data on ES3. crbug.com/491002. |
| 361 return ( | 361 return ( |
| 362 target == GL_ELEMENT_ARRAY_BUFFER || allow_buffers_on_multiple_targets_ || | 362 target == GL_ELEMENT_ARRAY_BUFFER || allow_buffers_on_multiple_targets_ || |
| 363 (allow_fixed_attribs_ && !support_fixed_attribs) || is_client_side_array); | 363 (allow_fixed_attribs_ && !support_fixed_attribs) || is_client_side_array); |
| 364 } | 364 } |
| 365 | 365 |
| 366 void BufferManager::SetInfo(Buffer* buffer, | 366 void BufferManager::SetInfo(Buffer* buffer, |
| 367 GLenum target, | 367 GLenum target, |
| 368 GLsizeiptr size, | 368 GLsizeiptr size, |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 const auto& buffer = buffer_entry.second; | 644 const auto& buffer = buffer_entry.second; |
| 645 | 645 |
| 646 std::string dump_name = base::StringPrintf( | 646 std::string dump_name = base::StringPrintf( |
| 647 "gpu/gl/buffers/client_%d/buffer_%d", client_id, client_buffer_id); | 647 "gpu/gl/buffers/client_%d/buffer_%d", client_id, client_buffer_id); |
| 648 base::trace_event::MemoryAllocatorDump* dump = | 648 base::trace_event::MemoryAllocatorDump* dump = |
| 649 pmd->CreateAllocatorDump(dump_name); | 649 pmd->CreateAllocatorDump(dump_name); |
| 650 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 650 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 651 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 651 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 652 static_cast<uint64_t>(buffer->size())); | 652 static_cast<uint64_t>(buffer->size())); |
| 653 | 653 |
| 654 auto guid = gfx::GetGLBufferGUIDForTracing( | 654 auto guid = gl::GetGLBufferGUIDForTracing( |
| 655 memory_tracker_->ShareGroupTracingGUID(), client_buffer_id); | 655 memory_tracker_->ShareGroupTracingGUID(), client_buffer_id); |
| 656 pmd->CreateSharedGlobalAllocatorDump(guid); | 656 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 657 pmd->AddOwnershipEdge(dump->guid(), guid); | 657 pmd->AddOwnershipEdge(dump->guid(), guid); |
| 658 } | 658 } |
| 659 return true; | 659 return true; |
| 660 } | 660 } |
| 661 | 661 |
| 662 } // namespace gles2 | 662 } // namespace gles2 |
| 663 } // namespace gpu | 663 } // namespace gpu |
| OLD | NEW |