OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 } | 572 } |
573 | 573 |
574 ResourceId ResourceProvider::CreateResource( | 574 ResourceId ResourceProvider::CreateResource( |
575 const gfx::Size& size, | 575 const gfx::Size& size, |
576 TextureHint hint, | 576 TextureHint hint, |
577 ResourceFormat format, | 577 ResourceFormat format, |
578 const gfx::ColorSpace& color_space) { | 578 const gfx::ColorSpace& color_space) { |
579 DCHECK(!size.IsEmpty()); | 579 DCHECK(!size.IsEmpty()); |
580 switch (settings_.default_resource_type) { | 580 switch (settings_.default_resource_type) { |
581 case RESOURCE_TYPE_GPU_MEMORY_BUFFER: | 581 case RESOURCE_TYPE_GPU_MEMORY_BUFFER: |
582 // GPU memory buffers don't support LUMINANCE_F16 or RGBA_F16 yet. | 582 // GPU memory buffers don't support LUMINANCE_F16 yet. |
583 if (format != LUMINANCE_F16 && format != RGBA_F16) { | 583 if (format != LUMINANCE_F16) { |
584 return CreateGLTexture( | 584 return CreateGLTexture( |
585 size, hint, RESOURCE_TYPE_GPU_MEMORY_BUFFER, format, | 585 size, hint, RESOURCE_TYPE_GPU_MEMORY_BUFFER, format, |
586 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, color_space); | 586 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, color_space); |
587 } | 587 } |
588 // Fall through and use a regular texture. | 588 // Fall through and use a regular texture. |
589 case RESOURCE_TYPE_GL_TEXTURE: | 589 case RESOURCE_TYPE_GL_TEXTURE: |
590 return CreateGLTexture(size, hint, RESOURCE_TYPE_GL_TEXTURE, format, | 590 return CreateGLTexture(size, hint, RESOURCE_TYPE_GL_TEXTURE, format, |
591 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, | 591 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, |
592 color_space); | 592 color_space); |
593 | 593 |
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2197 | 2197 |
2198 const int kImportance = 2; | 2198 const int kImportance = 2; |
2199 pmd->CreateSharedGlobalAllocatorDump(guid); | 2199 pmd->CreateSharedGlobalAllocatorDump(guid); |
2200 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); | 2200 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
2201 } | 2201 } |
2202 | 2202 |
2203 return true; | 2203 return true; |
2204 } | 2204 } |
2205 | 2205 |
2206 } // namespace cc | 2206 } // namespace cc |
OLD | NEW |