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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 | 1685 |
1686 DCHECK(resource->gl_id || resource->allocated); | 1686 DCHECK(resource->gl_id || resource->allocated); |
1687 if (resource->allocated || !resource->gl_id) | 1687 if (resource->allocated || !resource->gl_id) |
1688 return; | 1688 return; |
1689 resource->allocated = true; | 1689 resource->allocated = true; |
1690 WebGraphicsContext3D* context3d = Context3d(); | 1690 WebGraphicsContext3D* context3d = Context3d(); |
1691 gfx::Size& size = resource->size; | 1691 gfx::Size& size = resource->size; |
1692 DCHECK_EQ(resource->target, static_cast<GLenum>(GL_TEXTURE_2D)); | 1692 DCHECK_EQ(resource->target, static_cast<GLenum>(GL_TEXTURE_2D)); |
1693 ResourceFormat format = resource->format; | 1693 ResourceFormat format = resource->format; |
1694 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->gl_id)); | 1694 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->gl_id)); |
1695 if (use_texture_storage_ext_ && IsFormatSupportedForStorage(format)) { | 1695 if (use_texture_storage_ext_ && IsFormatSupportedForStorage(format) && |
| 1696 resource->hint != TextureUsageFramebuffer) { |
1696 GLenum storage_format = TextureToStorageFormat(format); | 1697 GLenum storage_format = TextureToStorageFormat(format); |
1697 GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D, | 1698 GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D, |
1698 1, | 1699 1, |
1699 storage_format, | 1700 storage_format, |
1700 size.width(), | 1701 size.width(), |
1701 size.height())); | 1702 size.height())); |
1702 } else { | 1703 } else { |
1703 // ETC1 does not support preallocation. | 1704 // ETC1 does not support preallocation. |
1704 if (format != ETC1) { | 1705 if (format != ETC1) { |
1705 GLC(context3d, | 1706 GLC(context3d, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 1829 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
1829 return active_unit; | 1830 return active_unit; |
1830 } | 1831 } |
1831 | 1832 |
1832 blink::WebGraphicsContext3D* ResourceProvider::Context3d() const { | 1833 blink::WebGraphicsContext3D* ResourceProvider::Context3d() const { |
1833 ContextProvider* context_provider = output_surface_->context_provider(); | 1834 ContextProvider* context_provider = output_surface_->context_provider(); |
1834 return context_provider ? context_provider->Context3d() : NULL; | 1835 return context_provider ? context_provider->Context3d() : NULL; |
1835 } | 1836 } |
1836 | 1837 |
1837 } // namespace cc | 1838 } // namespace cc |
OLD | NEW |