| Index: cc/resources/resource_provider.cc
|
| diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
|
| index 3105feb6af7a7991ae426339715c3f03c01d6f85..4efad2e64fd1271c6860fb8dc3f283881751c0d4 100644
|
| --- a/cc/resources/resource_provider.cc
|
| +++ b/cc/resources/resource_provider.cc
|
| @@ -425,6 +425,32 @@ ResourceProvider::~ResourceProvider() {
|
| gl->Finish();
|
| }
|
|
|
| +bool ResourceProvider::IsResourceFormatSupported(ResourceFormat format) const {
|
| + ContextProvider::Capabilities caps;
|
| + if (output_surface_->context_provider())
|
| + caps = output_surface_->context_provider()->ContextCapabilities();
|
| +
|
| + switch (format) {
|
| + case ALPHA_8:
|
| + case RGBA_4444:
|
| + case RGBA_8888:
|
| + case RGB_565:
|
| + case LUMINANCE_8:
|
| + return true;
|
| + case BGRA_8888:
|
| + return caps.gpu.texture_format_bgra8888;
|
| + case ETC1:
|
| + return caps.gpu.texture_format_etc1;
|
| + case RED_8:
|
| + return caps.gpu.texture_rg;
|
| + case LUMINANCE_F16:
|
| + return caps.gpu.texture_half_float_linear;
|
| + }
|
| +
|
| + NOTREACHED();
|
| + return false;
|
| +}
|
| +
|
| bool ResourceProvider::InUseByConsumer(ResourceId id) {
|
| Resource* resource = GetResource(id);
|
| return resource->lock_for_read_count > 0 || resource->exported_count > 0 ||
|
| @@ -1182,10 +1208,10 @@ void ResourceProvider::Initialize() {
|
| max_texture_size_ = 0; // Context expects cleared value.
|
| gl->GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size_);
|
| best_texture_format_ =
|
| - PlatformColor::BestTextureFormat(use_texture_format_bgra_);
|
| + PlatformColor::BestSupportedTextureFormat(use_texture_format_bgra_);
|
|
|
| - best_render_buffer_format_ =
|
| - PlatformColor::BestTextureFormat(caps.gpu.render_buffer_format_bgra8888);
|
| + best_render_buffer_format_ = PlatformColor::BestSupportedTextureFormat(
|
| + caps.gpu.render_buffer_format_bgra8888);
|
|
|
| texture_id_allocator_.reset(
|
| new TextureIdAllocator(gl, id_allocation_chunk_size_));
|
|
|