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

Side by Side Diff: cc/resources/resource_provider.cc

Issue 79603002: ResourceProvider should be able to avoid allocating immutable textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698