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 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 | 1671 |
1672 DCHECK(resource->gl_id || resource->allocated); | 1672 DCHECK(resource->gl_id || resource->allocated); |
1673 if (resource->allocated || !resource->gl_id) | 1673 if (resource->allocated || !resource->gl_id) |
1674 return; | 1674 return; |
1675 resource->allocated = true; | 1675 resource->allocated = true; |
1676 WebGraphicsContext3D* context3d = Context3d(); | 1676 WebGraphicsContext3D* context3d = Context3d(); |
1677 gfx::Size& size = resource->size; | 1677 gfx::Size& size = resource->size; |
1678 DCHECK_EQ(resource->target, static_cast<GLenum>(GL_TEXTURE_2D)); | 1678 DCHECK_EQ(resource->target, static_cast<GLenum>(GL_TEXTURE_2D)); |
1679 ResourceFormat format = resource->format; | 1679 ResourceFormat format = resource->format; |
1680 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->gl_id)); | 1680 GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->gl_id)); |
1681 if (use_texture_storage_ext_ && IsFormatSupportedForStorage(format)) { | 1681 if (use_texture_storage_ext_ && IsFormatSupportedForStorage(format) && |
| 1682 resource->hint != TextureUsageFramebuffer) { |
1682 GLenum storage_format = TextureToStorageFormat(format); | 1683 GLenum storage_format = TextureToStorageFormat(format); |
1683 GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D, | 1684 GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D, |
1684 1, | 1685 1, |
1685 storage_format, | 1686 storage_format, |
1686 size.width(), | 1687 size.width(), |
1687 size.height())); | 1688 size.height())); |
1688 } else { | 1689 } else { |
1689 // ETC1 does not support preallocation. | 1690 // ETC1 does not support preallocation. |
1690 if (format != ETC1) { | 1691 if (format != ETC1) { |
1691 GLC(context3d, | 1692 GLC(context3d, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 1810 context->getIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
1810 return active_unit; | 1811 return active_unit; |
1811 } | 1812 } |
1812 | 1813 |
1813 WebKit::WebGraphicsContext3D* ResourceProvider::Context3d() const { | 1814 WebKit::WebGraphicsContext3D* ResourceProvider::Context3d() const { |
1814 ContextProvider* context_provider = output_surface_->context_provider(); | 1815 ContextProvider* context_provider = output_surface_->context_provider(); |
1815 return context_provider ? context_provider->Context3d() : NULL; | 1816 return context_provider ? context_provider->Context3d() : NULL; |
1816 } | 1817 } |
1817 | 1818 |
1818 } // namespace cc | 1819 } // namespace cc |
OLD | NEW |