summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortomhudson@google.com <tomhudson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 15:01:50 +0000
committertomhudson@google.com <tomhudson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 15:01:50 +0000
commitb992782c3d48258799d34fdd48f931078e39f979 (patch)
tree45718bf908d2230d15b59f2c77d506b2f14ee0df
parent9976c1d42b52e4228cf998afb03267f2d3b3ce40 (diff)
downloadchromium_src-b992782c3d48258799d34fdd48f931078e39f979.zip
chromium_src-b992782c3d48258799d34fdd48f931078e39f979.tar.gz
chromium_src-b992782c3d48258799d34fdd48f931078e39f979.tar.bz2
Revert "Adding support for RGBA_4444 tile textures"
This reverts commit 8e6d15826280b9f11a28060b5b2d2bbef17d15bc (r223830; http://crrev.com/21159007). Although the 4444 textures work on S4, they break on N7v2 and N10. (We've got inconsistent reports about N4.) Passing --disable-4444-textures isn't sufficient to fix the problems. ilevy@ points out that the commit bot is using GN, so could easily have missed this breakage. We're hoping to switch to N4, but in this case there's no guarantee that that would have caught it either. Perhaps the main patch can be landed in pieces next time? From N7: E/chromium(32513): [ERROR:gles2_cmd_decoder.cc(5770)] [.RenderCompositor-0x783c9880]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete' From N10: I/chromium( 2104): [INFO:CONSOLE(0)] "[.WebGLRenderingContext]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'", source: file:///sdcard/clanktemp/index.html (0) R=skyostil@chromium.org TBR=kaanb@chromium.org BUG=245774,272539 Review URL: https://codereview.chromium.org/24219002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223871 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/base/switches.cc3
-rw-r--r--cc/base/switches.h1
-rw-r--r--cc/cc.gyp2
-rw-r--r--cc/layers/content_layer.cc5
-rw-r--r--cc/layers/heads_up_display_layer_impl.cc5
-rw-r--r--cc/layers/image_layer.cc5
-rw-r--r--cc/layers/nine_patch_layer.cc5
-rw-r--r--cc/layers/nine_patch_layer_unittest.cc3
-rw-r--r--cc/layers/picture_layer_impl.cc12
-rw-r--r--cc/layers/texture_layer_impl.cc4
-rw-r--r--cc/layers/tiled_layer.cc2
-rw-r--r--cc/layers/tiled_layer.h5
-rw-r--r--cc/layers/tiled_layer_unittest.cc3
-rw-r--r--cc/output/direct_renderer.cc12
-rw-r--r--cc/output/direct_renderer.h2
-rw-r--r--cc/output/gl_renderer.cc56
-rw-r--r--cc/output/gl_renderer.h2
-rw-r--r--cc/output/gl_renderer_unittest.cc33
-rw-r--r--cc/output/renderer_pixeltest.cc45
-rw-r--r--cc/output/software_renderer_unittest.cc24
-rw-r--r--cc/quads/draw_quad_unittest.cc14
-rw-r--r--cc/quads/picture_draw_quad.cc31
-rw-r--r--cc/quads/picture_draw_quad.h5
-rw-r--r--cc/resources/image_raster_worker_pool.cc17
-rw-r--r--cc/resources/image_raster_worker_pool.h2
-rw-r--r--cc/resources/picture_layer_tiling_set_unittest.cc2
-rw-r--r--cc/resources/pixel_buffer_raster_worker_pool.cc15
-rw-r--r--cc/resources/pixel_buffer_raster_worker_pool.h3
-rw-r--r--cc/resources/platform_color.h17
-rw-r--r--cc/resources/prioritized_resource.cc13
-rw-r--r--cc/resources/prioritized_resource.h20
-rw-r--r--cc/resources/prioritized_resource_manager.cc7
-rw-r--r--cc/resources/prioritized_resource_manager.h6
-rw-r--r--cc/resources/prioritized_resource_unittest.cc7
-rw-r--r--cc/resources/prioritized_tile_set_unittest.cc4
-rw-r--r--cc/resources/raster_worker_pool.cc71
-rw-r--r--cc/resources/raster_worker_pool.h17
-rw-r--r--cc/resources/raster_worker_pool_perftest.cc4
-rw-r--r--cc/resources/raster_worker_pool_unittest.cc19
-rw-r--r--cc/resources/resource.cc23
-rw-r--r--cc/resources/resource.h12
-rw-r--r--cc/resources/resource_format.cc24
-rw-r--r--cc/resources/resource_format.h25
-rw-r--r--cc/resources/resource_pool.cc8
-rw-r--r--cc/resources/resource_pool.h8
-rw-r--r--cc/resources/resource_provider.cc247
-rw-r--r--cc/resources/resource_provider.h41
-rw-r--r--cc/resources/resource_provider_unittest.cc147
-rw-r--r--cc/resources/resource_update_controller_unittest.cc6
-rw-r--r--cc/resources/scoped_resource.cc6
-rw-r--r--cc/resources/scoped_resource.h4
-rw-r--r--cc/resources/scoped_resource_unittest.cc31
-rw-r--r--cc/resources/tile_manager_perftest.cc3
-rw-r--r--cc/resources/tile_manager_unittest.cc3
-rw-r--r--cc/resources/transferable_resource.cc2
-rw-r--r--cc/resources/transferable_resource.h3
-rw-r--r--cc/resources/video_resource_updater.cc19
-rw-r--r--cc/resources/video_resource_updater.h7
-rw-r--r--cc/resources/video_resource_updater_unittest.cc2
-rw-r--r--cc/scheduler/texture_uploader.cc24
-rw-r--r--cc/scheduler/texture_uploader.h8
-rw-r--r--cc/scheduler/texture_uploader_unittest.cc26
-rw-r--r--cc/test/fake_tile_manager.cc4
-rw-r--r--cc/test/pixel_test.cc6
-rw-r--r--cc/test/render_pass_test_common.cc32
-rw-r--r--cc/test/tiled_layer_test_common.cc2
-rw-r--r--cc/trees/layer_tree_host.cc8
-rw-r--r--cc/trees/layer_tree_host.h3
-rw-r--r--cc/trees/layer_tree_host_impl.cc8
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc10
-rw-r--r--cc/trees/layer_tree_host_unittest.cc2
-rw-r--r--cc/trees/layer_tree_host_unittest_context.cc4
-rw-r--r--cc/trees/layer_tree_settings.cc3
-rw-r--r--cc/trees/layer_tree_settings.h1
-rw-r--r--content/common/cc_messages.h2
-rw-r--r--content/common/cc_messages_unittest.cc4
-rw-r--r--content/renderer/gpu/render_widget_compositor.cc10
-rw-r--r--gpu/command_buffer/service/async_pixel_transfer_manager_android.cc6
-rw-r--r--gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc11
79 files changed, 496 insertions, 802 deletions
diff --git a/cc/base/switches.cc b/cc/base/switches.cc
index 87e10ce..e604145 100644
--- a/cc/base/switches.cc
+++ b/cc/base/switches.cc
@@ -141,9 +141,6 @@ const char kDisableMapImage[] = "disable-map-image";
// Prevents the layer tree unit tests from timing out.
const char kCCLayerTreeTestNoTimeout[] = "cc-layer-tree-test-no-timeout";
-// Disable textures using RGBA_4444 layout.
-const char kDisable4444Textures[] = "disable-4444-textures";
-
bool IsLCDTextEnabled() {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(cc::switches::kDisableLCDText))
diff --git a/cc/base/switches.h b/cc/base/switches.h
index 97fe833..b8585e2 100644
--- a/cc/base/switches.h
+++ b/cc/base/switches.h
@@ -41,7 +41,6 @@ CC_EXPORT extern const char kEnablePartialSwap[];
CC_EXPORT extern const char kStrictLayerPropertyChangeChecking[];
CC_EXPORT extern const char kEnableMapImage[];
CC_EXPORT extern const char kDisableMapImage[];
-CC_EXPORT extern const char kDisable4444Textures[];
// Switches for both the renderer and ui compositors.
CC_EXPORT extern const char kUIDisablePartialSwap[];
diff --git a/cc/cc.gyp b/cc/cc.gyp
index ffc8615..00a0b8b 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -317,8 +317,6 @@
'resources/release_callback.h',
'resources/resource.cc',
'resources/resource.h',
- 'resources/resource_format.h',
- 'resources/resource_format.cc',
'resources/resource_pool.cc',
'resources/resource_pool.h',
'resources/resource_provider.cc',
diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc
index 3d611ee..01a8922 100644
--- a/cc/layers/content_layer.cc
+++ b/cc/layers/content_layer.cc
@@ -127,8 +127,9 @@ void ContentLayer::CreateUpdaterIfNeeded() {
}
updater_->SetOpaque(contents_opaque());
- SetTextureFormat(
- layer_tree_host()->GetRendererCapabilities().best_texture_format);
+ unsigned texture_format =
+ layer_tree_host()->GetRendererCapabilities().best_texture_format;
+ SetTextureFormat(texture_format);
}
void ContentLayer::SetContentsOpaque(bool opaque) {
diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc
index c1fa9f3..8728d70 100644
--- a/cc/layers/heads_up_display_layer_impl.cc
+++ b/cc/layers/heads_up_display_layer_impl.cc
@@ -94,9 +94,8 @@ bool HeadsUpDisplayLayerImpl::WillDraw(DrawMode draw_mode,
hud_resource_->Free();
if (!hud_resource_->id()) {
- hud_resource_->Allocate(content_bounds(),
- ResourceProvider::TextureUsageAny,
- RGBA_8888);
+ hud_resource_->Allocate(
+ content_bounds(), GL_RGBA, ResourceProvider::TextureUsageAny);
}
return LayerImpl::WillDraw(draw_mode, resource_provider);
diff --git a/cc/layers/image_layer.cc b/cc/layers/image_layer.cc
index bbf1aa8..8ba1908 100644
--- a/cc/layers/image_layer.cc
+++ b/cc/layers/image_layer.cc
@@ -56,8 +56,9 @@ void ImageLayer::CreateUpdaterIfNeeded() {
return;
updater_ = ImageLayerUpdater::Create();
- SetTextureFormat(
- layer_tree_host()->GetRendererCapabilities().best_texture_format);
+ GLenum texture_format =
+ layer_tree_host()->GetRendererCapabilities().best_texture_format;
+ SetTextureFormat(texture_format);
}
LayerUpdater* ImageLayer::Updater() const {
diff --git a/cc/layers/nine_patch_layer.cc b/cc/layers/nine_patch_layer.cc
index b500798..517b49b 100644
--- a/cc/layers/nine_patch_layer.cc
+++ b/cc/layers/nine_patch_layer.cc
@@ -40,9 +40,10 @@ void NinePatchLayer::SetTexturePriorities(
if (resource_) {
resource_->texture()->set_request_priority(
PriorityCalculator::UIPriority(true));
+ GLenum texture_format =
+ layer_tree_host()->GetRendererCapabilities().best_texture_format;
resource_->texture()->SetDimensions(
- gfx::Size(bitmap_.width(), bitmap_.height()),
- layer_tree_host()->GetRendererCapabilities().best_texture_format);
+ gfx::Size(bitmap_.width(), bitmap_.height()), texture_format);
}
}
diff --git a/cc/layers/nine_patch_layer_unittest.cc b/cc/layers/nine_patch_layer_unittest.cc
index 2e18808..f918efb 100644
--- a/cc/layers/nine_patch_layer_unittest.cc
+++ b/cc/layers/nine_patch_layer_unittest.cc
@@ -104,8 +104,7 @@ TEST_F(NinePatchLayerTest, TriggerFullUploadOnceWhenChangingBitmap) {
DebugScopedSetMainThreadBlocked main_thread_blocked(Proxy());
output_surface = FakeOutputSurface::Create3d();
CHECK(output_surface->BindToClient(&output_surface_client));
- resource_provider =
- ResourceProvider::Create(output_surface.get(), 0, false);
+ resource_provider = ResourceProvider::Create(output_surface.get(), 0);
params.texture->AcquireBackingTexture(resource_provider.get());
ASSERT_TRUE(params.texture->have_backing_texture());
}
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 46a0c0e..9c7f355 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -136,7 +136,7 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink,
opaque_rect,
texture_rect,
texture_size,
- RGBA_8888,
+ false,
quad_content_rect,
contents_scale,
draw_direct_to_backbuffer,
@@ -248,17 +248,17 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink,
gfx::Rect opaque_rect = iter->opaque_rect();
opaque_rect.Intersect(content_rect);
- ResourceProvider* resource_provider =
- layer_tree_impl()->resource_provider();
- ResourceFormat format =
- resource_provider->memory_efficient_texture_format();
scoped_ptr<PictureDrawQuad> quad = PictureDrawQuad::Create();
quad->SetNew(shared_quad_state,
geometry_rect,
opaque_rect,
texture_rect,
iter.texture_size(),
- format,
+ // TODO(reveman): This assumes the renderer will use
+ // GL_RGBA as format of temporary resource. The need
+ // to swizzle should instead be determined by the
+ // renderer.
+ !PlatformColor::SameComponentOrder(GL_RGBA),
iter->content_rect(),
iter->contents_scale(),
draw_direct_to_backbuffer,
diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc
index e16fd3c..413708d 100644
--- a/cc/layers/texture_layer_impl.cc
+++ b/cc/layers/texture_layer_impl.cc
@@ -111,8 +111,8 @@ bool TextureLayerImpl::WillDraw(DrawMode draw_mode,
if (!texture_copy_->id()) {
texture_copy_->Allocate(texture_mailbox_.shared_memory_size(),
- ResourceProvider::TextureUsageAny,
- resource_provider->best_texture_format());
+ resource_provider->best_texture_format(),
+ ResourceProvider::TextureUsageAny);
}
if (texture_copy_->id()) {
diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc
index 8bbf227..2d812e8 100644
--- a/cc/layers/tiled_layer.cc
+++ b/cc/layers/tiled_layer.cc
@@ -86,7 +86,7 @@ class UpdatableTile : public LayerTilingData::Tile {
TiledLayer::TiledLayer()
: ContentsScalingLayer(),
- texture_format_(RGBA_8888),
+ texture_format_(GL_INVALID_ENUM),
skips_draw_(false),
failed_update_(false),
tiling_option_(AUTO_TILE) {
diff --git a/cc/layers/tiled_layer.h b/cc/layers/tiled_layer.h
index 3870d69..51afed2 100644
--- a/cc/layers/tiled_layer.h
+++ b/cc/layers/tiled_layer.h
@@ -8,7 +8,6 @@
#include "cc/base/cc_export.h"
#include "cc/layers/contents_scaling_layer.h"
#include "cc/resources/layer_tiling_data.h"
-#include "cc/resources/resource_format.h"
namespace cc {
class LayerUpdater;
@@ -46,7 +45,7 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer {
// Exposed to subclasses for testing.
void SetTileSize(gfx::Size size);
- void SetTextureFormat(ResourceFormat texture_format) {
+ void SetTextureFormat(unsigned texture_format) {
texture_format_ = texture_format;
}
void SetBorderTexelOption(LayerTilingData::BorderTexelOption option);
@@ -121,7 +120,7 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer {
bool IsSmallAnimatedLayer() const;
- ResourceFormat texture_format_;
+ unsigned texture_format_;
bool skips_draw_;
bool failed_update_;
diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc
index 50d1865..daae39b 100644
--- a/cc/layers/tiled_layer_unittest.cc
+++ b/cc/layers/tiled_layer_unittest.cc
@@ -69,8 +69,7 @@ class TiledLayerTest : public testing::Test {
DebugScopedSetImplThreadAndMainThreadBlocked
impl_thread_and_main_thread_blocked(proxy_);
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), 0, false);
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0);
host_impl_ = make_scoped_ptr(new FakeLayerTreeHostImpl(proxy_));
}
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index 51ac56a..c3a4d39 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -168,8 +168,7 @@ void DirectRenderer::DecideRenderPassAllocationsForFrame(
const RenderPass* render_pass_in_frame = it->second;
gfx::Size required_size = RenderPassTextureSize(render_pass_in_frame);
- ResourceFormat required_format =
- RenderPassTextureFormat(render_pass_in_frame);
+ GLenum required_format = RenderPassTextureFormat(render_pass_in_frame);
CachedResource* texture = pass_iter->second;
DCHECK(texture);
@@ -399,8 +398,8 @@ bool DirectRenderer::UseRenderPass(DrawingFrame* frame,
enlarge_pass_texture_amount_.y());
if (!texture->id() &&
!texture->Allocate(size,
- ResourceProvider::TextureUsageFramebuffer,
- RenderPassTextureFormat(render_pass)))
+ RenderPassTextureFormat(render_pass),
+ ResourceProvider::TextureUsageFramebuffer))
return false;
return BindFramebufferToTexture(frame, texture, render_pass->output_rect);
@@ -421,9 +420,8 @@ gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
}
// static
-ResourceFormat DirectRenderer::RenderPassTextureFormat(
- const RenderPass* render_pass) {
- return RGBA_8888;
+GLenum DirectRenderer::RenderPassTextureFormat(const RenderPass* render_pass) {
+ return GL_RGBA;
}
} // namespace cc
diff --git a/cc/output/direct_renderer.h b/cc/output/direct_renderer.h
index efa34cf..94ec9cc 100644
--- a/cc/output/direct_renderer.h
+++ b/cc/output/direct_renderer.h
@@ -105,7 +105,7 @@ class CC_EXPORT DirectRenderer : public Renderer {
gfx::RectF draw_space_rect);
static gfx::Size RenderPassTextureSize(const RenderPass* render_pass);
- static ResourceFormat RenderPassTextureFormat(const RenderPass* render_pass);
+ static GLenum RenderPassTextureFormat(const RenderPass* render_pass);
void DrawRenderPass(DrawingFrame* frame,
const RenderPass* render_pass,
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index f365e36..89fe9de 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -653,8 +653,8 @@ scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters(
scoped_ptr<ScopedResource> device_background_texture =
ScopedResource::create(resource_provider_);
if (!device_background_texture->Allocate(window_rect.size(),
- ResourceProvider::TextureUsageAny,
- RGBA_8888)) {
+ GL_RGB,
+ ResourceProvider::TextureUsageAny)) {
return scoped_ptr<ScopedResource>();
} else {
ResourceProvider::ScopedWriteLockGL lock(resource_provider_,
@@ -679,8 +679,8 @@ scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters(
scoped_ptr<ScopedResource> background_texture =
ScopedResource::create(resource_provider_);
if (!background_texture->Allocate(quad->rect.size(),
- ResourceProvider::TextureUsageFramebuffer,
- RGBA_8888))
+ GL_RGBA,
+ ResourceProvider::TextureUsageFramebuffer))
return scoped_ptr<ScopedResource>();
const RenderPass* target_render_pass = frame->current_render_pass;
@@ -1702,10 +1702,10 @@ void GLRenderer::DrawPictureQuad(const DrawingFrame* frame,
on_demand_tile_raster_resource_id_ = resource_provider_->CreateGLTexture(
quad->texture_size,
+ GL_RGBA,
GL_TEXTURE_POOL_UNMANAGED_CHROMIUM,
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- quad->texture_format);
+ ResourceProvider::TextureUsageAny);
}
SkBitmapDevice device(on_demand_tile_raster_bitmap_);
@@ -1714,25 +1714,9 @@ void GLRenderer::DrawPictureQuad(const DrawingFrame* frame,
quad->picture_pile->RasterToBitmap(&canvas, quad->content_rect,
quad->contents_scale, NULL);
- uint8_t* bitmap_pixels = NULL;
- SkBitmap on_demand_tile_raster_bitmap_dest;
- SkBitmap::Config config = SkBitmapConfigFromFormat(quad->texture_format);
- if (on_demand_tile_raster_bitmap_.getConfig() != config) {
- on_demand_tile_raster_bitmap_.copyTo(&on_demand_tile_raster_bitmap_dest,
- config);
- // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the
- // bitmap data. This check will be removed once crbug.com/293728 is fixed.
- CHECK_EQ(0u, on_demand_tile_raster_bitmap_dest.rowBytes() % 4);
- bitmap_pixels = reinterpret_cast<uint8_t*>(
- on_demand_tile_raster_bitmap_dest.getPixels());
- } else {
- bitmap_pixels = reinterpret_cast<uint8_t*>(
- on_demand_tile_raster_bitmap_.getPixels());
- }
-
resource_provider_->SetPixels(
on_demand_tile_raster_resource_id_,
- bitmap_pixels,
+ reinterpret_cast<uint8_t*>(on_demand_tile_raster_bitmap_.getPixels()),
gfx::Rect(quad->texture_size),
gfx::Rect(quad->texture_size),
gfx::Vector2d());
@@ -2214,7 +2198,7 @@ void GLRenderer::GetFramebufferPixelsAsync(
GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
GLC(context_, context_->texParameteri(
GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
- GetFramebufferTexture(texture_id, RGBA_8888, window_rect);
+ GetFramebufferTexture(texture_id, GL_RGBA, window_rect);
gpu::Mailbox mailbox;
unsigned sync_point = 0;
@@ -2306,7 +2290,7 @@ void GLRenderer::DoGetFramebufferPixels(
// Copy the contents of the current (IOSurface-backed) framebuffer into a
// temporary texture.
GetFramebufferTexture(temporary_texture,
- RGBA_8888,
+ GL_RGBA,
gfx::Rect(current_surface_size_));
temporary_fbo = context_->createFramebuffer();
// Attach this texture to an FBO, and perform the readback from that FBO.
@@ -2456,8 +2440,9 @@ void GLRenderer::PassOnSkBitmap(
request->SendBitmapResult(bitmap.Pass());
}
-void GLRenderer::GetFramebufferTexture(
- unsigned texture_id, ResourceFormat texture_format, gfx::Rect window_rect) {
+void GLRenderer::GetFramebufferTexture(unsigned texture_id,
+ unsigned texture_format,
+ gfx::Rect window_rect) {
DCHECK(texture_id);
DCHECK_GE(window_rect.x(), 0);
DCHECK_GE(window_rect.y(), 0);
@@ -2466,15 +2451,14 @@ void GLRenderer::GetFramebufferTexture(
GLC(context_, context_->bindTexture(GL_TEXTURE_2D, texture_id));
GLC(context_,
- context_->copyTexImage2D(
- GL_TEXTURE_2D,
- 0,
- ResourceProvider::GetGLDataFormat(texture_format),
- window_rect.x(),
- window_rect.y(),
- window_rect.width(),
- window_rect.height(),
- 0));
+ context_->copyTexImage2D(GL_TEXTURE_2D,
+ 0,
+ texture_format,
+ window_rect.x(),
+ window_rect.y(),
+ window_rect.width(),
+ window_rect.height(),
+ 0));
GLC(context_, context_->bindTexture(GL_TEXTURE_2D, 0));
}
diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h
index 13f65f2..61262a66 100644
--- a/cc/output/gl_renderer.h
+++ b/cc/output/gl_renderer.h
@@ -102,7 +102,7 @@ class CC_EXPORT GLRenderer : public DirectRenderer {
void GetFramebufferPixelsAsync(gfx::Rect rect,
scoped_ptr<CopyOutputRequest> request);
void GetFramebufferTexture(unsigned texture_id,
- ResourceFormat texture_format,
+ unsigned texture_format,
gfx::Rect device_rect);
void ReleaseRenderPassTextures();
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc
index 18d77e4445..dfb8e99 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -221,7 +221,7 @@ class GLRendererTest : public testing::Test {
CHECK(output_surface_->BindToClient(&output_surface_client_));
resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), 0, false).Pass();
+ ResourceProvider::Create(output_surface_.get(), 0).Pass();
renderer_ = make_scoped_ptr(new FakeRendererGL(&renderer_client_,
&settings_,
output_surface_.get(),
@@ -312,8 +312,8 @@ class GLRendererShaderTest : public testing::Test {
new ShaderCreatorMockGraphicsContext())).Pass();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ = ResourceProvider::Create(
- output_surface_.get(), 0, false).Pass();
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(),
+ 0).Pass();
renderer_.reset(new FakeRendererGL(&renderer_client_,
&settings_,
output_surface_.get(),
@@ -634,7 +634,7 @@ TEST(GLRendererTest2, InitializationDoesNotMakeSynchronousCalls) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -679,7 +679,7 @@ TEST(GLRendererTest2, InitializationWithQuicklyLostContextDoesNotAssert) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -714,7 +714,7 @@ TEST(GLRendererTest2, OpaqueBackground) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -752,7 +752,7 @@ TEST(GLRendererTest2, TransparentBackground) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -784,7 +784,7 @@ TEST(GLRendererTest2, OffscreenOutputSurface) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -860,7 +860,7 @@ TEST(GLRendererTest2, VisibilityChangeIsLastCall) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -920,7 +920,7 @@ TEST(GLRendererTest2, ActiveTextureState) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -1007,7 +1007,7 @@ TEST(GLRendererTest2, ShouldClearRootRenderPass) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
LayerTreeSettings settings;
settings.should_clear_root_render_pass = false;
@@ -1095,7 +1095,7 @@ TEST(GLRendererTest2, ScissorTestWhenClearing) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
LayerTreeSettings settings;
FakeRendererClient renderer_client;
@@ -1198,7 +1198,7 @@ TEST(GLRendererTest2, ScissorAndViewportWithinNonreshapableSurface) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
LayerTreeSettings settings;
OffsetViewportRendererClient renderer_client;
@@ -1240,9 +1240,9 @@ TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) {
cc::ResourceProvider::ResourceId mask =
resource_provider_->CreateResource(gfx::Size(20, 12),
+ resource_provider_->best_texture_format(),
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- resource_provider_->best_texture_format());
+ ResourceProvider::TextureUsageAny);
resource_provider_->AllocateForTesting(mask);
SkScalar matrix[20];
@@ -1547,8 +1547,7 @@ class MockOutputSurfaceTest : public testing::Test, public FakeRendererClient {
FakeOutputSurfaceClient output_surface_client_;
CHECK(output_surface_.BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(&output_surface_, 0, false).Pass();
+ resource_provider_ = ResourceProvider::Create(&output_surface_, 0).Pass();
renderer_.reset(new FakeRendererGL(
this, &settings_, &output_surface_, resource_provider_.get()));
diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc
index f0187aa..daa5039 100644
--- a/cc/output/renderer_pixeltest.cc
+++ b/cc/output/renderer_pixeltest.cc
@@ -8,6 +8,7 @@
#include "cc/quads/draw_quad.h"
#include "cc/quads/picture_draw_quad.h"
#include "cc/quads/texture_draw_quad.h"
+#include "cc/resources/platform_color.h"
#include "cc/resources/sync_point_helper.h"
#include "cc/test/fake_picture_pile_impl.h"
#include "cc/test/pixel_test.h"
@@ -110,11 +111,9 @@ scoped_ptr<TextureDrawQuad> CreateTestTextureDrawQuad(
SkColorGetB(texel_color));
std::vector<uint32_t> pixels(rect.size().GetArea(), pixel_color);
- ResourceProvider::ResourceId resource =
- resource_provider->CreateResource(rect.size(),
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- RGBA_8888);
+ ResourceProvider::ResourceId resource = resource_provider->CreateResource(
+ rect.size(), GL_RGBA, GL_CLAMP_TO_EDGE,
+ ResourceProvider::TextureUsageAny);
resource_provider->SetPixels(
resource,
reinterpret_cast<uint8_t*>(&pixels.front()),
@@ -410,28 +409,28 @@ class VideoGLRendererPixelTest : public GLRendererPixelTest {
ResourceProvider::ResourceId y_resource =
resource_provider_->CreateResource(
this->device_viewport_size_,
+ GL_LUMINANCE,
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- LUMINANCE_8);
+ ResourceProvider::TextureUsageAny);
ResourceProvider::ResourceId u_resource =
resource_provider_->CreateResource(
this->device_viewport_size_,
+ GL_LUMINANCE,
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- LUMINANCE_8);
+ ResourceProvider::TextureUsageAny);
ResourceProvider::ResourceId v_resource =
resource_provider_->CreateResource(
this->device_viewport_size_,
+ GL_LUMINANCE,
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- LUMINANCE_8);
+ ResourceProvider::TextureUsageAny);
ResourceProvider::ResourceId a_resource = 0;
if (with_alpha) {
a_resource = resource_provider_->CreateResource(
this->device_viewport_size_,
+ GL_LUMINANCE,
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- LUMINANCE_8);
+ ResourceProvider::TextureUsageAny);
}
int w = this->device_viewport_size_.width();
@@ -1367,7 +1366,7 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, PictureDrawQuadIdentityScale) {
gfx::Rect viewport(this->device_viewport_size_);
bool use_skia_gpu_backend = this->UseSkiaGPUBackend();
// TODO(enne): the renderer should figure this out on its own.
- ResourceFormat texture_format = RGBA_8888;
+ bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA);
RenderPass::Id id(1, 1);
gfx::Transform transform_to_root;
@@ -1405,7 +1404,7 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, PictureDrawQuadIdentityScale) {
gfx::Rect(),
viewport,
viewport.size(),
- texture_format,
+ contents_swizzled,
viewport,
1.f,
use_skia_gpu_backend,
@@ -1430,7 +1429,7 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, PictureDrawQuadIdentityScale) {
gfx::Rect(),
gfx::RectF(0.f, 0.f, 1.f, 1.f),
viewport.size(),
- texture_format,
+ contents_swizzled,
viewport,
1.f,
use_skia_gpu_backend,
@@ -1452,7 +1451,7 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadOpacity) {
gfx::Size pile_tile_size(1000, 1000);
gfx::Rect viewport(this->device_viewport_size_);
bool use_skia_gpu_backend = this->UseSkiaGPUBackend();
- ResourceFormat texture_format = RGBA_8888;
+ bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA);
RenderPass::Id id(1, 1);
gfx::Transform transform_to_root;
@@ -1478,7 +1477,7 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadOpacity) {
gfx::Rect(),
gfx::RectF(0, 0, 1, 1),
viewport.size(),
- texture_format,
+ contents_swizzled,
viewport,
1.f,
use_skia_gpu_backend,
@@ -1503,7 +1502,7 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadOpacity) {
gfx::Rect(),
gfx::RectF(0, 0, 1, 1),
viewport.size(),
- texture_format,
+ contents_swizzled,
viewport,
1.f,
use_skia_gpu_backend,
@@ -1526,7 +1525,7 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend,
gfx::Rect viewport(this->device_viewport_size_);
bool use_skia_gpu_backend = this->UseSkiaGPUBackend();
// TODO(enne): the renderer should figure this out on its own.
- ResourceFormat texture_format = RGBA_8888;
+ bool contents_swizzled = !PlatformColor::SameComponentOrder(GL_RGBA);
RenderPass::Id id(1, 1);
gfx::Transform transform_to_root;
@@ -1560,7 +1559,7 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend,
gfx::Rect(),
gfx::RectF(green_rect1.size()),
green_rect1.size(),
- texture_format,
+ contents_swizzled,
green_rect1,
1.f,
use_skia_gpu_backend,
@@ -1573,7 +1572,7 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend,
gfx::Rect(),
gfx::RectF(green_rect2.size()),
green_rect2.size(),
- texture_format,
+ contents_swizzled,
green_rect2,
1.f,
use_skia_gpu_backend,
@@ -1645,7 +1644,7 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend,
gfx::Rect(),
quad_content_rect,
content_union_rect.size(),
- texture_format,
+ contents_swizzled,
content_union_rect,
contents_scale,
use_skia_gpu_backend,
diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc
index 03f1635..6f61525 100644
--- a/cc/output/software_renderer_unittest.cc
+++ b/cc/output/software_renderer_unittest.cc
@@ -33,8 +33,7 @@ class SoftwareRendererTest : public testing::Test, public RendererClient {
software_output_device.Pass());
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), 0, false);
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0);
renderer_ = SoftwareRenderer::Create(
this, &settings_, output_surface_.get(), resource_provider());
}
@@ -125,15 +124,13 @@ TEST_F(SoftwareRendererTest, TileQuad) {
InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice));
ResourceProvider::ResourceId resource_yellow =
- resource_provider()->CreateResource(outer_size,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- RGBA_8888);
+ resource_provider()->CreateResource(
+ outer_size, GL_RGBA, GL_CLAMP_TO_EDGE,
+ ResourceProvider::TextureUsageAny);
ResourceProvider::ResourceId resource_cyan =
- resource_provider()->CreateResource(inner_size,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- RGBA_8888);
+ resource_provider()->CreateResource(
+ inner_size, GL_RGBA, GL_CLAMP_TO_EDGE,
+ ResourceProvider::TextureUsageAny);
SkBitmap yellow_tile;
yellow_tile.setConfig(
@@ -217,10 +214,9 @@ TEST_F(SoftwareRendererTest, TileQuadVisibleRect) {
InitializeRenderer(make_scoped_ptr(new SoftwareOutputDevice));
ResourceProvider::ResourceId resource_cyan =
- resource_provider()->CreateResource(tile_size,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- RGBA_8888);
+ resource_provider()->CreateResource(
+ tile_size, GL_RGBA, GL_CLAMP_TO_EDGE,
+ ResourceProvider::TextureUsageAny);
SkBitmap cyan_tile; // The lowest five rows are yellow.
cyan_tile.setConfig(
diff --git a/cc/quads/draw_quad_unittest.cc b/cc/quads/draw_quad_unittest.cc
index 5705ce7..0ab0513 100644
--- a/cc/quads/draw_quad_unittest.cc
+++ b/cc/quads/draw_quad_unittest.cc
@@ -665,7 +665,7 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
gfx::Rect opaque_rect(33, 44, 22, 33);
gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
gfx::Size texture_size(85, 32);
- ResourceFormat texture_format = RGBA_8888;
+ bool swizzle_contents = true;
gfx::Rect content_rect(30, 40, 20, 30);
float contents_scale = 3.141592f;
bool can_draw_direct_to_backbuffer = true;
@@ -676,7 +676,7 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
opaque_rect,
tex_coord_rect,
texture_size,
- texture_format,
+ swizzle_contents,
content_rect,
contents_scale,
can_draw_direct_to_backbuffer,
@@ -685,7 +685,7 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect);
EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
EXPECT_EQ(texture_size, copy_quad->texture_size);
- EXPECT_EQ(texture_format, copy_quad->texture_format);
+ EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents);
EXPECT_RECT_EQ(content_rect, copy_quad->content_rect);
EXPECT_EQ(contents_scale, copy_quad->contents_scale);
EXPECT_EQ(can_draw_direct_to_backbuffer,
@@ -695,7 +695,7 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
CREATE_QUAD_7_ALL(PictureDrawQuad,
tex_coord_rect,
texture_size,
- texture_format,
+ swizzle_contents,
content_rect,
contents_scale,
can_draw_direct_to_backbuffer,
@@ -703,7 +703,7 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material);
EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
EXPECT_EQ(texture_size, copy_quad->texture_size);
- EXPECT_EQ(texture_format, copy_quad->texture_format);
+ EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents);
EXPECT_RECT_EQ(content_rect, copy_quad->content_rect);
EXPECT_EQ(contents_scale, copy_quad->contents_scale);
EXPECT_EQ(can_draw_direct_to_backbuffer,
@@ -893,7 +893,7 @@ TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) {
gfx::Rect opaque_rect(33, 44, 22, 33);
gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
gfx::Size texture_size(85, 32);
- ResourceFormat texture_format = RGBA_8888;
+ bool swizzle_contents = true;
gfx::Rect content_rect(30, 40, 20, 30);
float contents_scale = 3.141592f;
bool can_draw_direct_to_backbuffer = true;
@@ -904,7 +904,7 @@ TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) {
opaque_rect,
tex_coord_rect,
texture_size,
- texture_format,
+ swizzle_contents,
content_rect,
contents_scale,
can_draw_direct_to_backbuffer,
diff --git a/cc/quads/picture_draw_quad.cc b/cc/quads/picture_draw_quad.cc
index e566b24..0494764 100644
--- a/cc/quads/picture_draw_quad.cc
+++ b/cc/quads/picture_draw_quad.cc
@@ -6,7 +6,6 @@
#include "base/values.h"
#include "cc/base/math_util.h"
-#include "cc/resources/platform_color.h"
namespace cc {
@@ -25,24 +24,18 @@ void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
gfx::Rect opaque_rect,
const gfx::RectF& tex_coord_rect,
gfx::Size texture_size,
- ResourceFormat texture_format,
+ bool swizzle_contents,
gfx::Rect content_rect,
float contents_scale,
bool can_draw_direct_to_backbuffer,
scoped_refptr<PicturePileImpl> picture_pile) {
- ContentDrawQuadBase::SetNew(shared_quad_state,
- DrawQuad::PICTURE_CONTENT,
- rect,
- opaque_rect,
- tex_coord_rect,
- texture_size,
- !PlatformColor::SameComponentOrder(
- texture_format));
+ ContentDrawQuadBase::SetNew(shared_quad_state, DrawQuad::PICTURE_CONTENT,
+ rect, opaque_rect, tex_coord_rect, texture_size,
+ swizzle_contents);
this->content_rect = content_rect;
this->contents_scale = contents_scale;
this->can_draw_direct_to_backbuffer = can_draw_direct_to_backbuffer;
this->picture_pile = picture_pile;
- this->texture_format = texture_format;
}
void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
@@ -52,26 +45,19 @@ void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
bool needs_blending,
const gfx::RectF& tex_coord_rect,
gfx::Size texture_size,
- ResourceFormat texture_format,
+ bool swizzle_contents,
gfx::Rect content_rect,
float contents_scale,
bool can_draw_direct_to_backbuffer,
scoped_refptr<PicturePileImpl> picture_pile) {
ContentDrawQuadBase::SetAll(shared_quad_state,
- DrawQuad::PICTURE_CONTENT,
- rect,
- opaque_rect,
- visible_rect,
- needs_blending,
- tex_coord_rect,
- texture_size,
- !PlatformColor::SameComponentOrder(
- texture_format));
+ DrawQuad::PICTURE_CONTENT, rect, opaque_rect,
+ visible_rect, needs_blending, tex_coord_rect,
+ texture_size, swizzle_contents);
this->content_rect = content_rect;
this->contents_scale = contents_scale;
this->can_draw_direct_to_backbuffer = can_draw_direct_to_backbuffer;
this->picture_pile = picture_pile;
- this->texture_format = texture_format;
}
void PictureDrawQuad::IterateResources(
@@ -91,7 +77,6 @@ void PictureDrawQuad::ExtendValue(base::DictionaryValue* value) const {
value->SetDouble("contents_scale", contents_scale);
value->SetBoolean("can_draw_direct_to_backbuffer",
can_draw_direct_to_backbuffer);
- value->SetInteger("texture_format", texture_format);
// TODO(piman): picture_pile?
}
diff --git a/cc/quads/picture_draw_quad.h b/cc/quads/picture_draw_quad.h
index 756482a..beec88c 100644
--- a/cc/quads/picture_draw_quad.h
+++ b/cc/quads/picture_draw_quad.h
@@ -27,7 +27,7 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase {
gfx::Rect opaque_rect,
const gfx::RectF& tex_coord_rect,
gfx::Size texture_size,
- ResourceFormat texture_format,
+ bool swizzle_contents,
gfx::Rect content_rect,
float contents_scale,
bool can_draw_direct_to_backbuffer,
@@ -40,7 +40,7 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase {
bool needs_blending,
const gfx::RectF& tex_coord_rect,
gfx::Size texture_size,
- ResourceFormat texture_format,
+ bool swizzle_contents,
gfx::Rect content_rect,
float contents_scale,
bool can_draw_direct_to_backbuffer,
@@ -50,7 +50,6 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase {
float contents_scale;
bool can_draw_direct_to_backbuffer;
scoped_refptr<PicturePileImpl> picture_pile;
- ResourceFormat texture_format;
virtual void IterateResources(const ResourceIteratorCallback& callback)
OVERRIDE;
diff --git a/cc/resources/image_raster_worker_pool.cc b/cc/resources/image_raster_worker_pool.cc
index 2dfc090..9862484 100644
--- a/cc/resources/image_raster_worker_pool.cc
+++ b/cc/resources/image_raster_worker_pool.cc
@@ -34,10 +34,14 @@ class ImageWorkerPoolTaskImpl : public internal::WorkerPoolTask {
if (!buffer_)
return;
- task_->RunOnWorkerThread(thread_index,
- buffer_,
- task_->resource()->size(),
- stride_);
+ SkBitmap bitmap;
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config,
+ task_->resource()->size().width(),
+ task_->resource()->size().height(),
+ stride_);
+ bitmap.setPixels(buffer_);
+ SkBitmapDevice device(bitmap);
+ task_->RunOnWorkerThread(&device, thread_index);
}
virtual void CompleteOnOriginThread() OVERRIDE {
reply_.Run(!HasFinishedRunning());
@@ -152,9 +156,8 @@ void ImageRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) {
"state", TracedValue::FromValue(StateAsValue().release()));
}
-ResourceFormat ImageRasterWorkerPool::GetResourceFormat() const {
- // Only format supported by CHROMIUM_map_image
- return RGBA_8888;
+GLenum ImageRasterWorkerPool::GetResourceFormat() const {
+ return GL_RGBA; // Only format supported by CHROMIUM_map_image
}
void ImageRasterWorkerPool::OnRasterTasksFinished() {
diff --git a/cc/resources/image_raster_worker_pool.h b/cc/resources/image_raster_worker_pool.h
index 63526493..1816b27 100644
--- a/cc/resources/image_raster_worker_pool.h
+++ b/cc/resources/image_raster_worker_pool.h
@@ -21,7 +21,7 @@ class CC_EXPORT ImageRasterWorkerPool : public RasterWorkerPool {
// Overridden from RasterWorkerPool:
virtual void ScheduleTasks(RasterTask::Queue* queue) OVERRIDE;
- virtual ResourceFormat GetResourceFormat() const OVERRIDE;
+ virtual GLenum GetResourceFormat() const OVERRIDE;
virtual void OnRasterTasksFinished() OVERRIDE;
virtual void OnRasterTasksRequiredForActivationFinished() OVERRIDE;
diff --git a/cc/resources/picture_layer_tiling_set_unittest.cc b/cc/resources/picture_layer_tiling_set_unittest.cc
index 231e378..db72ade 100644
--- a/cc/resources/picture_layer_tiling_set_unittest.cc
+++ b/cc/resources/picture_layer_tiling_set_unittest.cc
@@ -66,7 +66,7 @@ class PictureLayerTilingSetTestWithResources : public testing::Test {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider =
- ResourceProvider::Create(output_surface.get(), 0, false);
+ ResourceProvider::Create(output_surface.get(), 0);
FakePictureLayerTilingClient client;
client.SetTileSize(gfx::Size(256, 256));
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.cc b/cc/resources/pixel_buffer_raster_worker_pool.cc
index e831b3a..a7d9b31 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.cc
+++ b/cc/resources/pixel_buffer_raster_worker_pool.cc
@@ -41,10 +41,13 @@ class PixelBufferWorkerPoolTaskImpl : public internal::WorkerPoolTask {
needs_upload_ = true;
return;
}
- needs_upload_ = task_->RunOnWorkerThread(thread_index,
- buffer_,
- task_->resource()->size(),
- 0);
+ SkBitmap bitmap;
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config,
+ task_->resource()->size().width(),
+ task_->resource()->size().height());
+ bitmap.setPixels(buffer_);
+ SkBitmapDevice device(bitmap);
+ needs_upload_ = task_->RunOnWorkerThread(&device, thread_index);
}
virtual void CompleteOnOriginThread() OVERRIDE {
// |needs_upload_| must be be false if task didn't run.
@@ -216,8 +219,8 @@ void PixelBufferRasterWorkerPool::ScheduleTasks(RasterTask::Queue* queue) {
"state", TracedValue::FromValue(StateAsValue().release()));
}
-ResourceFormat PixelBufferRasterWorkerPool::GetResourceFormat() const {
- return resource_provider()->memory_efficient_texture_format();
+GLenum PixelBufferRasterWorkerPool::GetResourceFormat() const {
+ return resource_provider()->best_texture_format();
}
void PixelBufferRasterWorkerPool::CheckForCompletedTasks() {
diff --git a/cc/resources/pixel_buffer_raster_worker_pool.h b/cc/resources/pixel_buffer_raster_worker_pool.h
index a856d8a..980fe54 100644
--- a/cc/resources/pixel_buffer_raster_worker_pool.h
+++ b/cc/resources/pixel_buffer_raster_worker_pool.h
@@ -34,7 +34,7 @@ class CC_EXPORT PixelBufferRasterWorkerPool : public RasterWorkerPool {
// Overridden from RasterWorkerPool:
virtual void ScheduleTasks(RasterTask::Queue* queue) OVERRIDE;
- virtual ResourceFormat GetResourceFormat() const OVERRIDE;
+ virtual GLenum GetResourceFormat() const OVERRIDE;
virtual void OnRasterTasksFinished() OVERRIDE;
virtual void OnRasterTasksRequiredForActivationFinished() OVERRIDE;
@@ -81,7 +81,6 @@ class CC_EXPORT PixelBufferRasterWorkerPool : public RasterWorkerPool {
bool should_notify_client_if_no_tasks_are_pending_;
bool should_notify_client_if_no_tasks_required_for_activation_are_pending_;
- ResourceFormat format_;
DISALLOW_COPY_AND_ASSIGN(PixelBufferRasterWorkerPool);
};
diff --git a/cc/resources/platform_color.h b/cc/resources/platform_color.h
index ecdf7c1..bd27d82 100644
--- a/cc/resources/platform_color.h
+++ b/cc/resources/platform_color.h
@@ -7,7 +7,6 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "cc/resources/resource_format.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
#include "third_party/skia/include/core/SkTypes.h"
@@ -26,25 +25,27 @@ class PlatformColor {
}
// Returns the most efficient texture format for this platform.
- static ResourceFormat BestTextureFormat(bool supports_bgra8888) {
+ static GLenum BestTextureFormat(bool supports_bgra8888) {
switch (Format()) {
case SOURCE_FORMAT_BGRA8:
- return (supports_bgra8888) ? BGRA_8888 : RGBA_8888;
+ if (supports_bgra8888)
+ return GL_BGRA_EXT;
+ return GL_RGBA;
case SOURCE_FORMAT_RGBA8:
- return RGBA_8888;
+ return GL_RGBA;
}
NOTREACHED();
- return RGBA_8888;
+ return GL_RGBA;
}
// Return true if the given texture format has the same component order
// as the color on this platform.
- static bool SameComponentOrder(ResourceFormat format) {
+ static bool SameComponentOrder(GLenum texture_format) {
switch (Format()) {
case SOURCE_FORMAT_RGBA8:
- return format == RGBA_8888 || format == RGBA_4444;
+ return texture_format == GL_RGBA;
case SOURCE_FORMAT_BGRA8:
- return format == BGRA_8888;
+ return texture_format == GL_BGRA_EXT;
}
NOTREACHED();
return false;
diff --git a/cc/resources/prioritized_resource.cc b/cc/resources/prioritized_resource.cc
index 313b275..78fd900 100644
--- a/cc/resources/prioritized_resource.cc
+++ b/cc/resources/prioritized_resource.cc
@@ -15,7 +15,7 @@ namespace cc {
PrioritizedResource::PrioritizedResource(PrioritizedResourceManager* manager,
gfx::Size size,
- ResourceFormat format)
+ GLenum format)
: size_(size),
format_(format),
bytes_(0),
@@ -25,7 +25,10 @@ PrioritizedResource::PrioritizedResource(PrioritizedResourceManager* manager,
is_self_managed_(false),
backing_(NULL),
manager_(NULL) {
- bytes_ = Resource::MemorySizeBytes(size, format);
+ // manager_ is set in RegisterTexture() so validity can be checked.
+ DCHECK(format || size.IsEmpty());
+ if (format)
+ bytes_ = Resource::MemorySizeBytes(size, format);
if (manager)
manager->RegisterTexture(this);
}
@@ -45,7 +48,7 @@ void PrioritizedResource::SetTextureManager(
manager->RegisterTexture(this);
}
-void PrioritizedResource::SetDimensions(gfx::Size size, ResourceFormat format) {
+void PrioritizedResource::SetDimensions(gfx::Size size, GLenum format) {
if (format_ != format || size_ != size) {
is_above_priority_cutoff_ = false;
format_ = format;
@@ -110,7 +113,7 @@ void PrioritizedResource::Unlink() {
}
void PrioritizedResource::SetToSelfManagedMemoryPlaceholder(size_t bytes) {
- SetDimensions(gfx::Size(), RGBA_8888);
+ SetDimensions(gfx::Size(), GL_RGBA);
set_is_self_managed(true);
bytes_ = bytes;
}
@@ -118,7 +121,7 @@ void PrioritizedResource::SetToSelfManagedMemoryPlaceholder(size_t bytes) {
PrioritizedResource::Backing::Backing(unsigned id,
ResourceProvider* resource_provider,
gfx::Size size,
- ResourceFormat format)
+ GLenum format)
: Resource(id, size, format),
owner_(NULL),
priority_at_last_priority_update_(PriorityCalculator::LowestPriority()),
diff --git a/cc/resources/prioritized_resource.h b/cc/resources/prioritized_resource.h
index a3d5d89..07e0787 100644
--- a/cc/resources/prioritized_resource.h
+++ b/cc/resources/prioritized_resource.h
@@ -12,6 +12,7 @@
#include "cc/resources/priority_calculator.h"
#include "cc/resources/resource.h"
#include "cc/resources/resource_provider.h"
+#include "third_party/khronos/GLES2/gl2.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
#include "ui/gfx/vector2d.h"
@@ -23,16 +24,13 @@ class Proxy;
class CC_EXPORT PrioritizedResource {
public:
- static scoped_ptr<PrioritizedResource> Create(
- PrioritizedResourceManager* manager,
- gfx::Size size,
- ResourceFormat format) {
+ static scoped_ptr<PrioritizedResource>
+ Create(PrioritizedResourceManager* manager, gfx::Size size, GLenum format) {
return make_scoped_ptr(new PrioritizedResource(manager, size, format));
}
static scoped_ptr<PrioritizedResource> Create(
PrioritizedResourceManager* manager) {
- return make_scoped_ptr(
- new PrioritizedResource(manager, gfx::Size(), RGBA_8888));
+ return make_scoped_ptr(new PrioritizedResource(manager, gfx::Size(), 0));
}
~PrioritizedResource();
@@ -40,8 +38,8 @@ class CC_EXPORT PrioritizedResource {
// Setting these to the same value is a no-op.
void SetTextureManager(PrioritizedResourceManager* manager);
PrioritizedResourceManager* resource_manager() { return manager_; }
- void SetDimensions(gfx::Size size, ResourceFormat format);
- ResourceFormat format() const { return format_; }
+ void SetDimensions(gfx::Size size, GLenum format);
+ GLenum format() const { return format_; }
gfx::Size size() const { return size_; }
size_t bytes() const { return bytes_; }
bool contents_swizzled() const { return contents_swizzled_; }
@@ -108,7 +106,7 @@ class CC_EXPORT PrioritizedResource {
Backing(unsigned id,
ResourceProvider* resource_provider,
gfx::Size size,
- ResourceFormat format);
+ GLenum format);
~Backing();
void UpdatePriority();
void UpdateInDrawingImplTree();
@@ -148,7 +146,7 @@ class CC_EXPORT PrioritizedResource {
PrioritizedResource(PrioritizedResourceManager* resource_manager,
gfx::Size size,
- ResourceFormat format);
+ GLenum format);
bool is_above_priority_cutoff() { return is_above_priority_cutoff_; }
void set_above_priority_cutoff(bool is_above_priority_cutoff) {
@@ -163,7 +161,7 @@ class CC_EXPORT PrioritizedResource {
void Unlink();
gfx::Size size_;
- ResourceFormat format_;
+ GLenum format_;
size_t bytes_;
bool contents_swizzled_;
diff --git a/cc/resources/prioritized_resource_manager.cc b/cc/resources/prioritized_resource_manager.cc
index 1a6e545..e0b5dca 100644
--- a/cc/resources/prioritized_resource_manager.cc
+++ b/cc/resources/prioritized_resource_manager.cc
@@ -449,16 +449,13 @@ void PrioritizedResourceManager::ReturnBackingTexture(
PrioritizedResource::Backing* PrioritizedResourceManager::CreateBacking(
gfx::Size size,
- ResourceFormat format,
+ GLenum format,
ResourceProvider* resource_provider) {
DCHECK(proxy_->IsImplThread() && proxy_->IsMainThreadBlocked());
DCHECK(resource_provider);
ResourceProvider::ResourceId resource_id =
resource_provider->CreateManagedResource(
- size,
- GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
PrioritizedResource::Backing* backing = new PrioritizedResource::Backing(
resource_id, resource_provider, size, format);
memory_use_bytes_ += backing->bytes();
diff --git a/cc/resources/prioritized_resource_manager.h b/cc/resources/prioritized_resource_manager.h
index 2374a1e..7396772 100644
--- a/cc/resources/prioritized_resource_manager.h
+++ b/cc/resources/prioritized_resource_manager.h
@@ -17,6 +17,7 @@
#include "cc/resources/priority_calculator.h"
#include "cc/resources/resource.h"
#include "cc/trees/proxy.h"
+#include "third_party/khronos/GLES2/gl2.h"
#include "ui/gfx/size.h"
#if defined(COMPILER_GCC)
@@ -39,8 +40,7 @@ class CC_EXPORT PrioritizedResourceManager {
static scoped_ptr<PrioritizedResourceManager> Create(const Proxy* proxy) {
return make_scoped_ptr(new PrioritizedResourceManager(proxy));
}
- scoped_ptr<PrioritizedResource> CreateTexture(
- gfx::Size size, ResourceFormat format) {
+ scoped_ptr<PrioritizedResource> CreateTexture(gfx::Size size, GLenum format) {
return make_scoped_ptr(new PrioritizedResource(this, size, format));
}
~PrioritizedResourceManager();
@@ -184,7 +184,7 @@ class CC_EXPORT PrioritizedResourceManager {
ResourceProvider* resource_provider);
PrioritizedResource::Backing* CreateBacking(
gfx::Size size,
- ResourceFormat format,
+ GLenum format,
ResourceProvider* resource_provider);
void EvictFirstBackingResource(ResourceProvider* resource_provider);
void SortBackings();
diff --git a/cc/resources/prioritized_resource_unittest.cc b/cc/resources/prioritized_resource_unittest.cc
index 181498c..91b1c2e 100644
--- a/cc/resources/prioritized_resource_unittest.cc
+++ b/cc/resources/prioritized_resource_unittest.cc
@@ -19,12 +19,11 @@ class PrioritizedResourceTest : public testing::Test {
public:
PrioritizedResourceTest()
: texture_size_(256, 256),
- texture_format_(RGBA_8888),
+ texture_format_(GL_RGBA),
output_surface_(FakeOutputSurface::Create3d()) {
DebugScopedSetImplThread impl_thread(&proxy_);
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- cc::ResourceProvider::Create(output_surface_.get(), 0, false);
+ resource_provider_ = cc::ResourceProvider::Create(output_surface_.get(), 0);
}
virtual ~PrioritizedResourceTest() {
@@ -94,7 +93,7 @@ class PrioritizedResourceTest : public testing::Test {
protected:
FakeProxy proxy_;
const gfx::Size texture_size_;
- const ResourceFormat texture_format_;
+ const GLenum texture_format_;
FakeOutputSurfaceClient output_surface_client_;
scoped_ptr<OutputSurface> output_surface_;
scoped_ptr<cc::ResourceProvider> resource_provider_;
diff --git a/cc/resources/prioritized_tile_set_unittest.cc b/cc/resources/prioritized_tile_set_unittest.cc
index 7de1032..45c714f 100644
--- a/cc/resources/prioritized_tile_set_unittest.cc
+++ b/cc/resources/prioritized_tile_set_unittest.cc
@@ -56,8 +56,8 @@ class PrioritizedTileSetTest : public testing::Test {
output_surface_ = FakeOutputSurface::Create3d().Pass();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), 0, false).Pass();
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(),
+ 0).Pass();
tile_manager_.reset(new FakeTileManager(&tile_manager_client_,
resource_provider_.get()));
picture_pile_ = FakePicturePileImpl::CreatePile();
diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc
index 6f80cc3..15b8aa4 100644
--- a/cc/resources/raster_worker_pool.cc
+++ b/cc/resources/raster_worker_pool.cc
@@ -13,25 +13,11 @@
#include "cc/resources/picture_pile_impl.h"
#include "skia/ext/lazy_pixel_ref.h"
#include "skia/ext/paint_simplifier.h"
-#include "third_party/skia/include/core/SkBitmap.h"
namespace cc {
namespace {
-// Subclass of Allocator that takes a suitably allocated pointer and uses
-// it as the pixel memory for the bitmap.
-class IdentityAllocator : public SkBitmap::Allocator {
- public:
- explicit IdentityAllocator(void* buffer) : buffer_(buffer) {}
- virtual bool allocPixelRef(SkBitmap* dst, SkColorTable*) OVERRIDE {
- dst->setPixels(buffer_);
- return true;
- }
- private:
- void* buffer_;
-};
-
// Flag to indicate whether we should try and detect that
// a tile is of solid color.
const bool kUseColorEstimator = true;
@@ -103,10 +89,7 @@ class RasterWorkerPoolTaskImpl : public internal::RasterWorkerPoolTask {
analysis_.is_solid_color &= kUseColorEstimator;
}
- bool RunRasterOnThread(unsigned thread_index,
- void* buffer,
- gfx::Size size,
- int stride) {
+ bool RunRasterOnThread(SkBaseDevice* device, unsigned thread_index) {
TRACE_EVENT2(
benchmark_instrumentation::kCategory,
benchmark_instrumentation::kRunRasterOnThread,
@@ -119,7 +102,7 @@ class RasterWorkerPoolTaskImpl : public internal::RasterWorkerPoolTask {
devtools_instrumentation::kRasterTask, layer_id_);
DCHECK(picture_pile_.get());
- DCHECK(buffer);
+ DCHECK(device);
if (analysis_.is_solid_color)
return false;
@@ -127,31 +110,8 @@ class RasterWorkerPoolTaskImpl : public internal::RasterWorkerPoolTask {
PicturePileImpl* picture_clone =
picture_pile_->GetCloneForDrawingOnThread(thread_index);
- SkBitmap bitmap;
- switch (resource()->format()) {
- case RGBA_4444:
- // Use the default stride if we will eventually convert this
- // bitmap to 4444.
- bitmap.setConfig(SkBitmap::kARGB_8888_Config,
- size.width(),
- size.height());
- bitmap.allocPixels();
- break;
- case RGBA_8888:
- case BGRA_8888:
- bitmap.setConfig(SkBitmap::kARGB_8888_Config,
- size.width(),
- size.height(),
- stride);
- bitmap.setPixels(buffer);
- break;
- case LUMINANCE_8:
- NOTREACHED();
- break;
- }
+ SkCanvas canvas(device);
- SkBitmapDevice device(bitmap);
- SkCanvas canvas(&device);
skia::RefPtr<SkDrawFilter> draw_filter;
switch (raster_mode_) {
case LOW_QUALITY_RASTER_MODE:
@@ -189,20 +149,14 @@ class RasterWorkerPoolTaskImpl : public internal::RasterWorkerPoolTask {
picture_clone->RasterToBitmap(
&canvas, content_rect_, contents_scale_, NULL);
}
-
- ChangeBitmapConfigIfNeeded(bitmap, buffer);
-
return true;
}
// Overridden from internal::RasterWorkerPoolTask:
- virtual bool RunOnWorkerThread(unsigned thread_index,
- void* buffer,
- gfx::Size size,
- int stride)
+ virtual bool RunOnWorkerThread(SkBaseDevice* device, unsigned thread_index)
OVERRIDE {
RunAnalysisOnThread(thread_index);
- return RunRasterOnThread(thread_index, buffer, size, stride);
+ return RunRasterOnThread(device, thread_index);
}
virtual void CompleteOnOriginThread() OVERRIDE {
reply_.Run(analysis_, !HasFinishedRunning() || WasCanceled());
@@ -223,21 +177,6 @@ class RasterWorkerPoolTaskImpl : public internal::RasterWorkerPoolTask {
return res.PassAs<base::Value>();
}
- void ChangeBitmapConfigIfNeeded(const SkBitmap& bitmap,
- void* buffer) {
- TRACE_EVENT0("cc", "RasterWorkerPoolTaskImpl::ChangeBitmapConfigIfNeeded");
- SkBitmap::Config config = SkBitmapConfigFromFormat(
- resource()->format());
- if (bitmap.getConfig() != config) {
- SkBitmap bitmap_dest;
- IdentityAllocator allocator(buffer);
- bitmap.copyTo(&bitmap_dest, config, &allocator);
- // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the
- // bitmap data. This check will be removed once crbug.com/293728 is fixed.
- CHECK_EQ(0u, bitmap_dest.rowBytes() % 4);
- }
- }
-
PicturePileImpl::Analysis analysis_;
scoped_refptr<PicturePileImpl> picture_pile_;
gfx::Rect content_rect_;
diff --git a/cc/resources/raster_worker_pool.h b/cc/resources/raster_worker_pool.h
index b12a1b4..a53e52f 100644
--- a/cc/resources/raster_worker_pool.h
+++ b/cc/resources/raster_worker_pool.h
@@ -11,11 +11,11 @@
#include "cc/debug/rendering_stats_instrumentation.h"
#include "cc/resources/picture_pile_impl.h"
#include "cc/resources/raster_mode.h"
-#include "cc/resources/resource.h"
-#include "cc/resources/resource_provider.h"
#include "cc/resources/tile_priority.h"
#include "cc/resources/worker_pool.h"
#include "third_party/khronos/GLES2/gl2.h"
+// TODO(robertphillips): change this to "class SkBaseDevice;"
+#include "third_party/skia/include/core/SkDevice.h"
namespace skia {
class LazyPixelRef;
@@ -24,6 +24,7 @@ class LazyPixelRef;
namespace cc {
class PicturePileImpl;
class PixelBufferRasterWorkerPool;
+class Resource;
class ResourceProvider;
namespace internal {
@@ -33,13 +34,11 @@ class CC_EXPORT RasterWorkerPoolTask
public:
typedef std::vector<scoped_refptr<WorkerPoolTask> > TaskVector;
- // Returns true if |buffer| was written to. False indicate that
- // the content of |buffer| is undefined and the resource doesn't
+ // Returns true if |device| was written to. False indicate that
+ // the content of |device| is undefined and the resource doesn't
// need to be initialized.
- virtual bool RunOnWorkerThread(unsigned thread_index,
- void* buffer,
- gfx::Size size,
- int stride) = 0;
+ virtual bool RunOnWorkerThread(SkBaseDevice* device,
+ unsigned thread_index) = 0;
virtual void CompleteOnOriginThread() = 0;
void DidRun(bool was_canceled);
@@ -187,7 +186,7 @@ class CC_EXPORT RasterWorkerPool : public WorkerPool {
virtual void ScheduleTasks(RasterTask::Queue* queue) = 0;
// Returns the format that needs to be used for raster task resources.
- virtual ResourceFormat GetResourceFormat() const = 0;
+ virtual GLenum GetResourceFormat() const = 0;
// TODO(vmpstr): Figure out an elegant way to not pass this many parameters.
static RasterTask CreateRasterTask(
diff --git a/cc/resources/raster_worker_pool_perftest.cc b/cc/resources/raster_worker_pool_perftest.cc
index cec9c48..fbcdb24 100644
--- a/cc/resources/raster_worker_pool_perftest.cc
+++ b/cc/resources/raster_worker_pool_perftest.cc
@@ -40,9 +40,9 @@ class PerfRasterWorkerPool : public RasterWorkerPool {
virtual void ScheduleTasks(RasterTask::Queue* queue) OVERRIDE {
NOTREACHED();
}
- virtual ResourceFormat GetResourceFormat() const OVERRIDE {
+ virtual GLenum GetResourceFormat() const OVERRIDE {
NOTREACHED();
- return RGBA_8888;
+ return GL_RGBA;
}
virtual void OnRasterTasksFinished() OVERRIDE {
NOTREACHED();
diff --git a/cc/resources/raster_worker_pool_unittest.cc b/cc/resources/raster_worker_pool_unittest.cc
index 61cb324..ab55bf3 100644
--- a/cc/resources/raster_worker_pool_unittest.cc
+++ b/cc/resources/raster_worker_pool_unittest.cc
@@ -35,10 +35,8 @@ class TestRasterWorkerPoolTaskImpl : public internal::RasterWorkerPoolTask {
did_raster_(false) {}
// Overridden from internal::WorkerPoolTask:
- virtual bool RunOnWorkerThread(unsigned thread_index,
- void* buffer,
- gfx::Size size,
- int stride) OVERRIDE {
+ virtual bool RunOnWorkerThread(SkBaseDevice* device, unsigned thread_index)
+ OVERRIDE {
did_raster_ = true;
return true;
}
@@ -67,8 +65,8 @@ class RasterWorkerPoolTest : public testing::Test,
output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), 0, false).Pass();
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(),
+ 0).Pass();
}
virtual ~RasterWorkerPoolTest() {
resource_provider_.reset();
@@ -106,11 +104,8 @@ class RasterWorkerPoolTest : public testing::Test,
raster_worker_pool_ = ImageRasterWorkerPool::Create(
resource_provider(), 1);
} else {
- raster_worker_pool_ =
- PixelBufferRasterWorkerPool::Create(
- resource_provider(),
- 1,
- std::numeric_limits<size_t>::max());
+ raster_worker_pool_ = PixelBufferRasterWorkerPool::Create(
+ resource_provider(), 1, std::numeric_limits<size_t>::max());
}
raster_worker_pool_->SetClient(this);
@@ -160,7 +155,7 @@ class RasterWorkerPoolTest : public testing::Test,
scoped_ptr<ScopedResource> resource(
ScopedResource::create(resource_provider()));
- resource->Allocate(size, ResourceProvider::TextureUsageAny, RGBA_8888);
+ resource->Allocate(size, GL_RGBA, ResourceProvider::TextureUsageAny);
const Resource* const_resource = resource.get();
RasterWorkerPool::Task::Set empty;
diff --git a/cc/resources/resource.cc b/cc/resources/resource.cc
index c97db7f..192eaeb 100644
--- a/cc/resources/resource.cc
+++ b/cc/resources/resource.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "cc/resources/resource.h"
+#include "third_party/khronos/GLES2/gl2ext.h"
namespace cc {
@@ -13,8 +14,26 @@ size_t Resource::bytes() const {
return MemorySizeBytes(size_, format_);
}
-size_t Resource::MemorySizeBytes(gfx::Size size, ResourceFormat format) {
- return ResourceProvider::BytesPerPixel(format) * size.width() * size.height();
+size_t Resource::BytesPerPixel(GLenum format) {
+ size_t components_per_pixel = 0;
+ size_t bytes_per_component = 1;
+ switch (format) {
+ case GL_RGBA:
+ case GL_BGRA_EXT:
+ components_per_pixel = 4;
+ break;
+ case GL_LUMINANCE:
+ components_per_pixel = 1;
+ break;
+ default:
+ NOTREACHED();
+ }
+ return components_per_pixel * bytes_per_component;
}
+size_t Resource::MemorySizeBytes(gfx::Size size, GLenum format) {
+ return BytesPerPixel(format) * size.width() * size.height();
+}
+
+
} // namespace cc
diff --git a/cc/resources/resource.h b/cc/resources/resource.h
index d2d104c..1c65822 100644
--- a/cc/resources/resource.h
+++ b/cc/resources/resource.h
@@ -15,21 +15,23 @@ namespace cc {
class CC_EXPORT Resource {
public:
Resource() : id_(0) {}
- Resource(unsigned id, gfx::Size size, ResourceFormat format)
+ Resource(unsigned id, gfx::Size size, GLenum format)
: id_(id),
size_(size),
format_(format) {}
ResourceProvider::ResourceId id() const { return id_; }
gfx::Size size() const { return size_; }
- ResourceFormat format() const { return format_; }
+ GLenum format() const { return format_; }
+
size_t bytes() const;
- static size_t MemorySizeBytes(gfx::Size size, ResourceFormat format);
+ static size_t BytesPerPixel(GLenum format);
+ static size_t MemorySizeBytes(gfx::Size size, GLenum format);
protected:
void set_id(ResourceProvider::ResourceId id) { id_ = id; }
- void set_dimensions(gfx::Size size, ResourceFormat format) {
+ void set_dimensions(gfx::Size size, GLenum format) {
size_ = size;
format_ = format;
}
@@ -37,7 +39,7 @@ class CC_EXPORT Resource {
private:
ResourceProvider::ResourceId id_;
gfx::Size size_;
- ResourceFormat format_;
+ GLenum format_;
DISALLOW_COPY_AND_ASSIGN(Resource);
};
diff --git a/cc/resources/resource_format.cc b/cc/resources/resource_format.cc
deleted file mode 100644
index 28bb1e4..0000000
--- a/cc/resources/resource_format.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/resources/resource_format.h"
-
-namespace cc {
-
-SkBitmap::Config SkBitmapConfigFromFormat(ResourceFormat format) {
- switch (format) {
- case RGBA_4444:
- return SkBitmap::kARGB_4444_Config;
- case RGBA_8888:
- case BGRA_8888:
- return SkBitmap::kARGB_8888_Config;
- case LUMINANCE_8:
- NOTREACHED();
- break;
- }
- NOTREACHED();
- return SkBitmap::kARGB_8888_Config;
-}
-
-} // namespace cc
diff --git a/cc/resources/resource_format.h b/cc/resources/resource_format.h
deleted file mode 100644
index 4b12d92..0000000
--- a/cc/resources/resource_format.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_RESOURCES_RESOURCE_FORMAT_H_
-#define CC_RESOURCES_RESOURCE_FORMAT_H_
-
-#include "base/logging.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-
-namespace cc {
-
-enum ResourceFormat {
- RGBA_8888,
- RGBA_4444,
- BGRA_8888,
- LUMINANCE_8,
- RESOURCE_FORMAT_MAX = LUMINANCE_8,
-};
-
-SkBitmap::Config SkBitmapConfigFromFormat(ResourceFormat format);
-
-} // namespace cc
-
-#endif // CC_RESOURCES_RESOURCE_FORMAT_H_
diff --git a/cc/resources/resource_pool.cc b/cc/resources/resource_pool.cc
index cef86de..75f7d1e 100644
--- a/cc/resources/resource_pool.cc
+++ b/cc/resources/resource_pool.cc
@@ -10,12 +10,12 @@ namespace cc {
ResourcePool::Resource::Resource(cc::ResourceProvider* resource_provider,
gfx::Size size,
- ResourceFormat format)
+ GLenum format)
: cc::Resource(resource_provider->CreateManagedResource(
size,
+ format,
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- format),
+ ResourceProvider::TextureUsageAny),
size,
format),
resource_provider_(resource_provider) {
@@ -43,7 +43,7 @@ ResourcePool::~ResourcePool() {
}
scoped_ptr<ResourcePool::Resource> ResourcePool::AcquireResource(
- gfx::Size size, ResourceFormat format) {
+ gfx::Size size, GLenum format) {
for (ResourceList::iterator it = unused_resources_.begin();
it != unused_resources_.end(); ++it) {
Resource* resource = *it;
diff --git a/cc/resources/resource_pool.h b/cc/resources/resource_pool.h
index 21bbb0a..771650e 100644
--- a/cc/resources/resource_pool.h
+++ b/cc/resources/resource_pool.h
@@ -11,9 +11,9 @@
#include "cc/base/cc_export.h"
#include "cc/output/renderer.h"
#include "cc/resources/resource.h"
-#include "cc/resources/resource_format.h"
namespace cc {
+class ResourceProvider;
class CC_EXPORT ResourcePool {
public:
@@ -21,7 +21,7 @@ class CC_EXPORT ResourcePool {
public:
Resource(ResourceProvider* resource_provider,
gfx::Size size,
- ResourceFormat format);
+ GLenum format);
~Resource();
private:
@@ -36,8 +36,8 @@ class CC_EXPORT ResourcePool {
virtual ~ResourcePool();
- scoped_ptr<ResourcePool::Resource> AcquireResource(
- gfx::Size size, ResourceFormat format);
+ scoped_ptr<ResourcePool::Resource> AcquireResource(gfx::Size size,
+ GLenum format);
void ReleaseResource(scoped_ptr<ResourcePool::Resource>);
void SetResourceUsageLimits(size_t max_memory_usage_bytes,
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index e1cbba5..017c2e9 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -12,7 +12,6 @@
#include "base/stl_util.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
-#include "cc/base/util.h"
#include "cc/output/gl_renderer.h" // For the GLC() macro.
#include "cc/resources/platform_color.h"
#include "cc/resources/returned_resource.h"
@@ -35,31 +34,24 @@ namespace {
const double kSoftwareUploadTickRate = 0.000250;
const double kTextureUploadTickRate = 0.004;
-GLenum TextureToStorageFormat(ResourceFormat format) {
+GLenum TextureToStorageFormat(GLenum texture_format) {
GLenum storage_format = GL_RGBA8_OES;
- switch (format) {
- case RGBA_8888:
- case RGBA_4444:
- case LUMINANCE_8:
+ switch (texture_format) {
+ case GL_RGBA:
break;
- case BGRA_8888:
+ case GL_BGRA_EXT:
storage_format = GL_BGRA8_EXT;
break;
+ default:
+ NOTREACHED();
+ break;
}
return storage_format;
}
-bool IsFormatSupportedForStorage(ResourceFormat format) {
- switch (format) {
- case RGBA_8888:
- case BGRA_8888:
- return true;
- case RGBA_4444:
- case LUMINANCE_8:
- return false;
- }
- return false;
+bool IsTextureFormatSupportedForStorage(GLenum format) {
+ return (format == GL_RGBA || format == GL_BGRA_EXT);
}
class ScopedSetActiveTexture {
@@ -103,6 +95,7 @@ ResourceProvider::Resource::Resource()
enable_read_lock_fences(false),
read_lock_fence(NULL),
size(),
+ format(0),
original_filter(0),
filter(0),
target(0),
@@ -110,19 +103,18 @@ ResourceProvider::Resource::Resource()
texture_pool(0),
wrap_mode(0),
hint(TextureUsageAny),
- type(static_cast<ResourceType>(0)),
- format(RGBA_8888) {}
+ type(static_cast<ResourceType>(0)) {}
ResourceProvider::Resource::~Resource() {}
ResourceProvider::Resource::Resource(
unsigned texture_id,
gfx::Size size,
+ GLenum format,
GLenum filter,
GLenum texture_pool,
GLint wrap_mode,
- TextureUsageHint hint,
- ResourceFormat format)
+ TextureUsageHint hint)
: gl_id(texture_id),
gl_pixel_buffer_id(0),
gl_upload_query_id(0),
@@ -140,6 +132,7 @@ ResourceProvider::Resource::Resource(
enable_read_lock_fences(false),
read_lock_fence(NULL),
size(size),
+ format(format),
original_filter(filter),
filter(filter),
target(0),
@@ -147,14 +140,14 @@ ResourceProvider::Resource::Resource(
texture_pool(texture_pool),
wrap_mode(wrap_mode),
hint(hint),
- type(GLTexture),
- format(format) {
+ type(GLTexture) {
DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
}
ResourceProvider::Resource::Resource(
uint8_t* pixels,
gfx::Size size,
+ GLenum format,
GLenum filter,
GLint wrap_mode)
: gl_id(0),
@@ -174,6 +167,7 @@ ResourceProvider::Resource::Resource(
enable_read_lock_fences(false),
read_lock_fence(NULL),
size(size),
+ format(format),
original_filter(filter),
filter(filter),
target(0),
@@ -181,8 +175,7 @@ ResourceProvider::Resource::Resource(
texture_pool(0),
wrap_mode(wrap_mode),
hint(TextureUsageAny),
- type(Bitmap),
- format(RGBA_8888) {
+ type(Bitmap) {
DCHECK(wrap_mode == GL_CLAMP_TO_EDGE || wrap_mode == GL_REPEAT);
}
@@ -192,12 +185,9 @@ ResourceProvider::Child::~Child() {}
scoped_ptr<ResourceProvider> ResourceProvider::Create(
OutputSurface* output_surface,
- int highp_threshold_min,
- bool use_rgba_4444_texture_format) {
+ int highp_threshold_min) {
scoped_ptr<ResourceProvider> resource_provider(
- new ResourceProvider(output_surface,
- highp_threshold_min,
- use_rgba_4444_texture_format));
+ new ResourceProvider(output_surface, highp_threshold_min));
bool success = false;
if (resource_provider->Context3d()) {
@@ -227,20 +217,17 @@ bool ResourceProvider::InUseByConsumer(ResourceId id) {
}
ResourceProvider::ResourceId ResourceProvider::CreateResource(
- gfx::Size size,
- GLint wrap_mode,
- TextureUsageHint hint,
- ResourceFormat format) {
+ gfx::Size size, GLenum format, GLint wrap_mode, TextureUsageHint hint) {
DCHECK(!size.IsEmpty());
switch (default_resource_type_) {
case GLTexture:
- return CreateGLTexture(size,
- GL_TEXTURE_POOL_UNMANAGED_CHROMIUM,
- wrap_mode,
- hint,
- format);
+ return CreateGLTexture(size, format, GL_TEXTURE_POOL_UNMANAGED_CHROMIUM,
+ wrap_mode, hint);
case Bitmap:
- DCHECK_EQ(RGBA_8888, format);
+ // The only wrap_mode currently implemented in software mode is
+ // GL_CLAMP_TO_EDGE.
+ // http://crbug.com/284796
+ DCHECK(format == GL_RGBA);
return CreateBitmap(size);
case InvalidType:
break;
@@ -251,20 +238,14 @@ ResourceProvider::ResourceId ResourceProvider::CreateResource(
}
ResourceProvider::ResourceId ResourceProvider::CreateManagedResource(
- gfx::Size size,
- GLint wrap_mode,
- TextureUsageHint hint,
- ResourceFormat format) {
+ gfx::Size size, GLenum format, GLint wrap_mode, TextureUsageHint hint) {
DCHECK(!size.IsEmpty());
switch (default_resource_type_) {
case GLTexture:
- return CreateGLTexture(size,
- GL_TEXTURE_POOL_MANAGED_CHROMIUM,
- wrap_mode,
- hint,
- format);
+ return CreateGLTexture(size, format, GL_TEXTURE_POOL_MANAGED_CHROMIUM,
+ wrap_mode, hint);
case Bitmap:
- DCHECK_EQ(RGBA_8888, format);
+ DCHECK(format == GL_RGBA);
return CreateBitmap(size);
case InvalidType:
break;
@@ -276,16 +257,16 @@ ResourceProvider::ResourceId ResourceProvider::CreateManagedResource(
ResourceProvider::ResourceId ResourceProvider::CreateGLTexture(
gfx::Size size,
+ GLenum format,
GLenum texture_pool,
GLint wrap_mode,
- TextureUsageHint hint,
- ResourceFormat format) {
+ TextureUsageHint hint) {
DCHECK_LE(size.width(), max_texture_size_);
DCHECK_LE(size.height(), max_texture_size_);
DCHECK(thread_checker_.CalledOnValidThread());
ResourceId id = next_id_++;
- Resource resource(0, size, GL_LINEAR, texture_pool, wrap_mode, hint, format);
+ Resource resource(0, size, format, GL_LINEAR, texture_pool, wrap_mode, hint);
resource.allocated = false;
resources_[id] = resource;
return id;
@@ -297,7 +278,7 @@ ResourceProvider::ResourceId ResourceProvider::CreateBitmap(gfx::Size size) {
uint8_t* pixels = new uint8_t[4 * size.GetArea()];
ResourceId id = next_id_++;
- Resource resource(pixels, size, GL_LINEAR, GL_CLAMP_TO_EDGE);
+ Resource resource(pixels, size, GL_RGBA, GL_LINEAR, GL_CLAMP_TO_EDGE);
resource.allocated = true;
resources_[id] = resource;
return id;
@@ -322,13 +303,8 @@ ResourceProvider::CreateResourceFromExternalTexture(
texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
ResourceId id = next_id_++;
- Resource resource(texture_id,
- gfx::Size(),
- GL_LINEAR,
- 0,
- GL_CLAMP_TO_EDGE,
- TextureUsageAny,
- RGBA_8888);
+ Resource resource(texture_id, gfx::Size(), 0, GL_LINEAR, 0, GL_CLAMP_TO_EDGE,
+ TextureUsageAny);
resource.external = true;
resource.allocated = true;
resources_[id] = resource;
@@ -344,20 +320,15 @@ ResourceProvider::ResourceId ResourceProvider::CreateResourceFromTextureMailbox(
DCHECK(mailbox.IsValid());
Resource& resource = resources_[id];
if (mailbox.IsTexture()) {
- resource = Resource(0,
- gfx::Size(),
- GL_LINEAR,
- 0,
- GL_CLAMP_TO_EDGE,
- TextureUsageAny,
- RGBA_8888);
+ resource = Resource(0, gfx::Size(), 0, GL_LINEAR, 0, GL_CLAMP_TO_EDGE,
+ TextureUsageAny);
} else {
DCHECK(mailbox.IsSharedMemory());
base::SharedMemory* shared_memory = mailbox.shared_memory();
DCHECK(shared_memory->memory());
uint8_t* pixels = reinterpret_cast<uint8_t*>(shared_memory->memory());
- resource = Resource(
- pixels, mailbox.shared_memory_size(), GL_LINEAR, GL_CLAMP_TO_EDGE);
+ resource = Resource(pixels, mailbox.shared_memory_size(),
+ GL_RGBA, GL_LINEAR, GL_CLAMP_TO_EDGE);
}
resource.external = true;
resource.allocated = true;
@@ -477,7 +448,7 @@ void ResourceProvider::SetPixels(ResourceId id,
if (resource->pixels) {
DCHECK(resource->allocated);
- DCHECK_EQ(RGBA_8888, resource->format);
+ DCHECK(resource->format == GL_RGBA);
SkBitmap src_full;
src_full.setConfig(
SkBitmap::kARGB_8888_Config, image_rect.width(), image_rect.height());
@@ -701,7 +672,7 @@ ResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL() {
void ResourceProvider::PopulateSkBitmapWithResource(
SkBitmap* sk_bitmap, const Resource* resource) {
DCHECK(resource->pixels);
- DCHECK_EQ(RGBA_8888, resource->format);
+ DCHECK(resource->format == GL_RGBA);
sk_bitmap->setConfig(SkBitmap::kARGB_8888_Config,
resource->size.width(),
resource->size.height());
@@ -736,8 +707,7 @@ ResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware() {
}
ResourceProvider::ResourceProvider(OutputSurface* output_surface,
- int highp_threshold_min,
- bool use_rgba_4444_texture_format)
+ int highp_threshold_min)
: output_surface_(output_surface),
lost_output_surface_(false),
highp_threshold_min_(highp_threshold_min),
@@ -748,8 +718,7 @@ ResourceProvider::ResourceProvider(OutputSurface* output_surface,
use_texture_usage_hint_(false),
use_shallow_flush_(false),
max_texture_size_(0),
- best_texture_format_(RGBA_8888),
- use_rgba_4444_texture_format_(use_rgba_4444_texture_format) {
+ best_texture_format_(0) {
DCHECK(output_surface_->HasClient());
}
@@ -761,7 +730,7 @@ void ResourceProvider::InitializeSoftware() {
default_resource_type_ = Bitmap;
max_texture_size_ = INT_MAX / 2;
- best_texture_format_ = RGBA_8888;
+ best_texture_format_ = GL_RGBA;
}
bool ResourceProvider::InitializeGL() {
@@ -962,16 +931,10 @@ void ResourceProvider::ReceiveFromChild(
GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, texture_id));
GLC(context3d, context3d->consumeTextureCHROMIUM(GL_TEXTURE_2D,
it->mailbox.name));
-
ResourceId id = next_id_++;
Resource resource(
- texture_id,
- it->size,
- it->filter,
- 0,
- GL_CLAMP_TO_EDGE,
- TextureUsageAny,
- it->format);
+ texture_id, it->size, it->format, it->filter, 0, GL_CLAMP_TO_EDGE,
+ TextureUsageAny);
resource.mailbox.SetName(it->mailbox);
// Don't allocate a texture for a child.
resource.allocated = true;
@@ -1060,11 +1023,9 @@ void ResourceProvider::AcquirePixelBuffer(ResourceId id) {
context3d->bindBuffer(
GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
resource->gl_pixel_buffer_id);
- unsigned bytes_per_pixel = BytesPerPixel(resource->format);
context3d->bufferData(
GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM,
- resource->size.height() * RoundUp(bytes_per_pixel
- * resource->size.width(), 4u),
+ 4 * resource->size.GetArea(),
NULL,
GL_DYNAMIC_DRAW);
context3d->bindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0);
@@ -1240,27 +1201,25 @@ void ResourceProvider::BeginSetPixels(ResourceId id) {
GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM,
resource->gl_upload_query_id);
if (allocate) {
- context3d->asyncTexImage2DCHROMIUM(
- GL_TEXTURE_2D,
- 0, /* level */
- GetGLInternalFormat(resource->format),
- resource->size.width(),
- resource->size.height(),
- 0, /* border */
- GetGLDataFormat(resource->format),
- GetGLDataType(resource->format),
- NULL);
+ context3d->asyncTexImage2DCHROMIUM(GL_TEXTURE_2D,
+ 0, /* level */
+ resource->format,
+ resource->size.width(),
+ resource->size.height(),
+ 0, /* border */
+ resource->format,
+ GL_UNSIGNED_BYTE,
+ NULL);
} else {
- context3d->asyncTexSubImage2DCHROMIUM(
- GL_TEXTURE_2D,
- 0, /* level */
- 0, /* x */
- 0, /* y */
- resource->size.width(),
- resource->size.height(),
- GetGLDataFormat(resource->format),
- GetGLDataType(resource->format),
- NULL);
+ context3d->asyncTexSubImage2DCHROMIUM(GL_TEXTURE_2D,
+ 0, /* level */
+ 0, /* x */
+ 0, /* y */
+ resource->size.width(),
+ resource->size.height(),
+ resource->format,
+ GL_UNSIGNED_BYTE,
+ NULL);
}
context3d->endQueryEXT(GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM);
context3d->bindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0);
@@ -1269,7 +1228,7 @@ void ResourceProvider::BeginSetPixels(ResourceId id) {
if (resource->pixels) {
DCHECK(!resource->mailbox.IsValid());
DCHECK(resource->pixel_buffer);
- DCHECK_EQ(RGBA_8888, resource->format);
+ DCHECK(resource->format == GL_RGBA);
std::swap(resource->pixels, resource->pixel_buffer);
delete[] resource->pixel_buffer;
@@ -1375,9 +1334,9 @@ void ResourceProvider::LazyAllocate(Resource* resource) {
resource->allocated = true;
WebGraphicsContext3D* context3d = Context3d();
gfx::Size& size = resource->size;
- ResourceFormat format = resource->format;
+ GLenum format = resource->format;
GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->gl_id));
- if (use_texture_storage_ext_ && IsFormatSupportedForStorage(format)) {
+ if (use_texture_storage_ext_ && IsTextureFormatSupportedForStorage(format)) {
GLenum storage_format = TextureToStorageFormat(format);
GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D,
1,
@@ -1387,12 +1346,12 @@ void ResourceProvider::LazyAllocate(Resource* resource) {
} else {
GLC(context3d, context3d->texImage2D(GL_TEXTURE_2D,
0,
- GetGLInternalFormat(format),
+ format,
size.width(),
size.height(),
0,
- GetGLDataFormat(format),
- GetGLDataType(format),
+ format,
+ GL_UNSIGNED_BYTE,
NULL));
}
}
@@ -1417,7 +1376,7 @@ void ResourceProvider::AcquireImage(ResourceId id) {
resource->allocated = true;
WebGraphicsContext3D* context3d = Context3d();
DCHECK(context3d);
- DCHECK_EQ(RGBA_8888, resource->format);
+ DCHECK_EQ(static_cast<GLenum>(GL_RGBA), resource->format);
resource->image_id = context3d->createImageCHROMIUM(
resource->size.width(), resource->size.height(), GL_RGBA8_OES);
DCHECK(resource->image_id);
@@ -1497,62 +1456,4 @@ WebKit::WebGraphicsContext3D* ResourceProvider::Context3d() const {
return context_provider ? context_provider->Context3d() : NULL;
}
-size_t ResourceProvider::BytesPerPixel(ResourceFormat format) {
- size_t components_per_pixel = 0;
- switch (format) {
- case RGBA_8888:
- case RGBA_4444:
- case BGRA_8888:
- components_per_pixel = 4;
- break;
- case LUMINANCE_8:
- components_per_pixel = 1;
- break;
- }
- size_t bits_per_component = 0;
- switch (format) {
- case RGBA_8888:
- case BGRA_8888:
- case LUMINANCE_8:
- bits_per_component = 8;
- break;
- case RGBA_4444:
- bits_per_component = 4;
- break;
- }
- const size_t kBitsPerByte = 8;
- return (components_per_pixel * bits_per_component) / kBitsPerByte;
-}
-
-GLenum ResourceProvider::GetGLDataType(ResourceFormat format) {
- switch (format) {
- case RGBA_4444:
- return GL_UNSIGNED_SHORT_4_4_4_4;
- case RGBA_8888:
- case BGRA_8888:
- case LUMINANCE_8:
- return GL_UNSIGNED_BYTE;
- }
- NOTREACHED();
- return GL_UNSIGNED_BYTE;
-}
-
-GLenum ResourceProvider::GetGLDataFormat(ResourceFormat format) {
- switch (format) {
- case RGBA_8888:
- case RGBA_4444:
- return GL_RGBA;
- case BGRA_8888:
- return GL_BGRA_EXT;
- case LUMINANCE_8:
- return GL_LUMINANCE;
- }
- NOTREACHED();
- return GL_RGBA;
-}
-
-GLenum ResourceProvider::GetGLInternalFormat(ResourceFormat format) {
- return GetGLDataFormat(format);
-}
-
} // namespace cc
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h
index e73ea15..88ff274 100644
--- a/cc/resources/resource_provider.h
+++ b/cc/resources/resource_provider.h
@@ -19,7 +19,6 @@
#include "cc/output/context_provider.h"
#include "cc/output/output_surface.h"
#include "cc/resources/release_callback.h"
-#include "cc/resources/resource_format.h"
#include "cc/resources/single_release_callback.h"
#include "cc/resources/texture_mailbox.h"
#include "cc/resources/transferable_resource.h"
@@ -57,8 +56,8 @@ class CC_EXPORT ResourceProvider {
};
static scoped_ptr<ResourceProvider> Create(OutputSurface* output_surface,
- int highp_threshold_min,
- bool use_rgba_4444_texture_format);
+ int highp_threshold_min);
+
virtual ~ResourceProvider();
void InitializeSoftware();
@@ -67,10 +66,7 @@ class CC_EXPORT ResourceProvider {
void DidLoseOutputSurface() { lost_output_surface_ = true; }
int max_texture_size() const { return max_texture_size_; }
- ResourceFormat memory_efficient_texture_format() const {
- return use_rgba_4444_texture_format_ ? RGBA_4444 : best_texture_format_;
- }
- ResourceFormat best_texture_format() const { return best_texture_format_; }
+ GLenum best_texture_format() const { return best_texture_format_; }
size_t num_resources() const { return resources_.size(); }
// Checks whether a resource is in use by a consumer.
@@ -84,23 +80,23 @@ class CC_EXPORT ResourceProvider {
// Creates a resource of the default resource type.
ResourceId CreateResource(gfx::Size size,
+ GLenum format,
GLint wrap_mode,
- TextureUsageHint hint,
- ResourceFormat format);
+ TextureUsageHint hint);
// Creates a resource which is tagged as being managed for GPU memory
// accounting purposes.
ResourceId CreateManagedResource(gfx::Size size,
+ GLenum format,
GLint wrap_mode,
- TextureUsageHint hint,
- ResourceFormat format);
+ TextureUsageHint hint);
// You can also explicitly create a specific resource type.
ResourceId CreateGLTexture(gfx::Size size,
+ GLenum format,
GLenum texture_pool,
GLint wrap_mode,
- TextureUsageHint hint,
- ResourceFormat format);
+ TextureUsageHint hint);
ResourceId CreateBitmap(gfx::Size size);
// Wraps an external texture into a GL resource.
@@ -338,10 +334,6 @@ class CC_EXPORT ResourceProvider {
bool CanLockForWrite(ResourceId id);
static GLint GetActiveTextureUnit(WebKit::WebGraphicsContext3D* context);
- static size_t BytesPerPixel(ResourceFormat format);
- static GLenum GetGLDataType(ResourceFormat format);
- static GLenum GetGLDataFormat(ResourceFormat format);
- static GLenum GetGLInternalFormat(ResourceFormat format);
private:
struct Resource {
@@ -349,13 +341,14 @@ class CC_EXPORT ResourceProvider {
~Resource();
Resource(unsigned texture_id,
gfx::Size size,
+ GLenum format,
GLenum filter,
GLenum texture_pool,
GLint wrap_mode,
- TextureUsageHint hint,
- ResourceFormat format);
+ TextureUsageHint hint);
Resource(uint8_t* pixels,
gfx::Size size,
+ GLenum format,
GLenum filter,
GLint wrap_mode);
@@ -380,6 +373,7 @@ class CC_EXPORT ResourceProvider {
bool enable_read_lock_fences;
scoped_refptr<Fence> read_lock_fence;
gfx::Size size;
+ GLenum format;
// TODO(skyostil): Use a separate sampler object for filter state.
GLenum original_filter;
GLenum filter;
@@ -389,7 +383,6 @@ class CC_EXPORT ResourceProvider {
GLint wrap_mode;
TextureUsageHint hint;
ResourceType type;
- ResourceFormat format;
};
typedef base::hash_map<ResourceId, Resource> ResourceMap;
struct Child {
@@ -406,9 +399,8 @@ class CC_EXPORT ResourceProvider {
resource->read_lock_fence->HasPassed();
}
- ResourceProvider(OutputSurface* output_surface,
- int highp_threshold_min,
- bool use_rgba_4444_texture_format);
+ explicit ResourceProvider(OutputSurface* output_surface,
+ int highp_threshold_min);
void CleanUpGLIfNeeded();
@@ -459,12 +451,11 @@ class CC_EXPORT ResourceProvider {
bool use_shallow_flush_;
scoped_ptr<TextureUploader> texture_uploader_;
int max_texture_size_;
- ResourceFormat best_texture_format_;
+ GLenum best_texture_format_;
base::ThreadChecker thread_checker_;
scoped_refptr<Fence> current_read_lock_fence_;
- bool use_rgba_4444_texture_format_;
DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
};
diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc
index 7df9412..abdd78e 100644
--- a/cc/resources/resource_provider_unittest.cc
+++ b/cc/resources/resource_provider_unittest.cc
@@ -41,7 +41,7 @@ using WebKit::WebGLId;
namespace cc {
namespace {
-size_t TextureSize(gfx::Size size, ResourceFormat format) {
+size_t TextureSize(gfx::Size size, WGC3Denum format) {
unsigned int components_per_pixel = 4;
unsigned int bytes_per_component = 1;
return size.width() * size.height() * components_per_pixel *
@@ -65,17 +65,16 @@ class TextureStateTrackingContext : public TestWebGraphicsContext3D {
};
struct Texture : public base::RefCounted<Texture> {
- Texture() : format(RGBA_8888),
- filter(GL_NEAREST_MIPMAP_LINEAR) {}
+ Texture() : format(0), filter(GL_NEAREST_MIPMAP_LINEAR) {}
- void Reallocate(gfx::Size size, ResourceFormat format) {
+ void Reallocate(gfx::Size size, WGC3Denum format) {
this->size = size;
this->format = format;
this->data.reset(new uint8_t[TextureSize(size, format)]);
}
gfx::Size size;
- ResourceFormat format;
+ WGC3Denum format;
WGC3Denum filter;
scoped_ptr<uint8_t[]> data;
@@ -238,9 +237,7 @@ class ResourceProviderContext : public TestWebGraphicsContext3D {
ASSERT_EQ(static_cast<unsigned>(GL_TEXTURE_2D), target);
ASSERT_FALSE(level);
ASSERT_TRUE(textures_[current_texture_].get());
- ASSERT_EQ(
- ResourceProvider::GetGLDataFormat(textures_[current_texture_]->format),
- format);
+ ASSERT_EQ(textures_[current_texture_]->format, format);
ASSERT_EQ(static_cast<unsigned>(GL_UNSIGNED_BYTE), type);
ASSERT_TRUE(pixels);
SetPixels(xoffset, yoffset, width, height, pixels);
@@ -283,7 +280,7 @@ class ResourceProviderContext : public TestWebGraphicsContext3D {
mailbox, last_waited_sync_point_);
}
- void GetPixels(gfx::Size size, ResourceFormat format, uint8_t* pixels) {
+ void GetPixels(gfx::Size size, WGC3Denum format, uint8_t* pixels) {
ASSERT_TRUE(current_texture_);
scoped_refptr<Texture> texture = textures_[current_texture_];
ASSERT_TRUE(texture.get());
@@ -314,16 +311,7 @@ class ResourceProviderContext : public TestWebGraphicsContext3D {
ASSERT_TRUE(current_texture_);
scoped_refptr<Texture> texture = textures_[current_texture_];
ASSERT_TRUE(texture.get());
- ResourceFormat texture_format = RGBA_8888;
- switch (format) {
- case GL_RGBA:
- texture_format = RGBA_8888;
- break;
- case GL_BGRA_EXT:
- texture_format = BGRA_8888;
- break;
- }
- texture->Reallocate(size, texture_format);
+ texture->Reallocate(size, format);
}
void SetPixels(int xoffset,
@@ -368,7 +356,7 @@ void GetResourcePixels(ResourceProvider* resource_provider,
ResourceProviderContext* context,
ResourceProvider::ResourceId id,
gfx::Size size,
- ResourceFormat format,
+ WGC3Denum format,
uint8_t* pixels) {
switch (resource_provider->default_resource_type()) {
case ResourceProvider::GLTexture: {
@@ -420,8 +408,7 @@ class ResourceProviderTest
break;
}
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ = ResourceProvider::Create(
- output_surface_.get(), 0, false);
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0);
}
static void SetResourceFilter(ResourceProvider* resource_provider,
@@ -447,12 +434,12 @@ void CheckCreateResource(ResourceProvider::ResourceType expected_default_type,
DCHECK_EQ(expected_default_type, resource_provider->default_resource_type());
gfx::Size size(1, 1);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
size_t pixel_size = TextureSize(size, format);
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
EXPECT_EQ(1, static_cast<int>(resource_provider->num_resources()));
if (expected_default_type == ResourceProvider::GLTexture)
EXPECT_EQ(0, context->texture_count());
@@ -479,12 +466,12 @@ TEST_P(ResourceProviderTest, Basic) {
TEST_P(ResourceProviderTest, Upload) {
gfx::Size size(2, 2);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
size_t pixel_size = TextureSize(size, format);
ASSERT_EQ(16U, pixel_size);
ResourceProvider::ResourceId id = resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
uint8_t image[16] = { 0 };
gfx::Rect image_rect(size);
@@ -560,21 +547,21 @@ TEST_P(ResourceProviderTest, TransferResources) {
CHECK(child_output_surface->BindToClient(&child_output_surface_client));
scoped_ptr<ResourceProvider> child_resource_provider(
- ResourceProvider::Create(child_output_surface.get(), 0, false));
+ ResourceProvider::Create(child_output_surface.get(), 0));
gfx::Size size(1, 1);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
size_t pixel_size = TextureSize(size, format);
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
uint8_t data1[4] = { 1, 2, 3, 4 };
gfx::Rect rect(size);
child_resource_provider->SetPixels(id1, data1, rect, rect, gfx::Vector2d());
ResourceProvider::ResourceId id2 = child_resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
uint8_t data2[4] = { 5, 5, 5, 5 };
child_resource_provider->SetPixels(id2, data2, rect, rect, gfx::Vector2d());
@@ -696,15 +683,15 @@ TEST_P(ResourceProviderTest, DeleteTransferredResources) {
CHECK(child_output_surface->BindToClient(&child_output_surface_client));
scoped_ptr<ResourceProvider> child_resource_provider(
- ResourceProvider::Create(child_output_surface.get(), 0, false));
+ ResourceProvider::Create(child_output_surface.get(), 0));
gfx::Size size(1, 1);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
size_t pixel_size = TextureSize(size, format);
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id = child_resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
uint8_t data[4] = { 1, 2, 3, 4 };
gfx::Rect rect(size);
child_resource_provider->SetPixels(id, data, rect, rect, gfx::Vector2d());
@@ -757,7 +744,7 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest {
CHECK(child_output_surface->BindToClient(&child_output_surface_client));
scoped_ptr<ResourceProvider> child_resource_provider(
- ResourceProvider::Create(child_output_surface.get(), 0, false));
+ ResourceProvider::Create(child_output_surface.get(), 0));
scoped_ptr<TextureStateTrackingContext> parent_context_owned(
new TextureStateTrackingContext);
@@ -769,17 +756,17 @@ class ResourceProviderTestTextureFilters : public ResourceProviderTest {
CHECK(parent_output_surface->BindToClient(&parent_output_surface_client));
scoped_ptr<ResourceProvider> parent_resource_provider(
- ResourceProvider::Create(parent_output_surface.get(), 0, false));
+ ResourceProvider::Create(parent_output_surface.get(), 0));
gfx::Size size(1, 1);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
int texture_id = 1;
size_t pixel_size = TextureSize(size, format);
ASSERT_EQ(4U, pixel_size);
ResourceProvider::ResourceId id = child_resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
// The new texture is created with GL_LINEAR.
EXPECT_CALL(*child_context, bindTexture(GL_TEXTURE_2D, texture_id))
@@ -957,8 +944,7 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) {
context()->bindTexture(GL_TEXTURE_2D, other_texture);
context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
uint8_t test_data[4] = { 0 };
- context()->GetPixels(
- gfx::Size(1, 1), RGBA_8888, test_data);
+ context()->GetPixels(gfx::Size(1, 1), GL_RGBA, test_data);
EXPECT_EQ(0, memcmp(data, test_data, sizeof(data)));
context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
context()->deleteTexture(other_texture);
@@ -1005,8 +991,7 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) {
context()->bindTexture(GL_TEXTURE_2D, other_texture);
context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
uint8_t test_data[4] = { 0 };
- context()->GetPixels(
- gfx::Size(1, 1), RGBA_8888, test_data);
+ context()->GetPixels(gfx::Size(1, 1), GL_RGBA, test_data);
EXPECT_EQ(0, memcmp(data, test_data, sizeof(data)));
context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
context()->deleteTexture(other_texture);
@@ -1183,14 +1168,14 @@ TEST_P(ResourceProviderTest, ScopedSampler) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
gfx::Size size(1, 1);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
int texture_id = 1;
ResourceProvider::ResourceId id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
// Check that the texture gets created with the right sampler settings.
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id))
@@ -1209,7 +1194,6 @@ TEST_P(ResourceProviderTest, ScopedSampler) {
texParameteri(GL_TEXTURE_2D,
GL_TEXTURE_POOL_CHROMIUM,
GL_TEXTURE_POOL_UNMANAGED_CHROMIUM));
-
resource_provider->AllocateForTesting(id);
Mock::VerifyAndClearExpectations(context);
@@ -1264,15 +1248,15 @@ TEST_P(ResourceProviderTest, ManagedResource) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
gfx::Size size(1, 1);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
int texture_id = 1;
// Check that the texture gets created with the right sampler settings.
ResourceProvider::ResourceId id = resource_provider->CreateManagedResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id));
EXPECT_CALL(*context,
texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
@@ -1309,22 +1293,19 @@ TEST_P(ResourceProviderTest, TextureWrapMode) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
gfx::Size size(1, 1);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
int texture_id = 1;
GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM;
for (int i = 0; i < 2; ++i) {
GLint wrap_mode = i ? GL_CLAMP_TO_EDGE : GL_REPEAT;
// Check that the texture gets created with the right sampler settings.
- ResourceProvider::ResourceId id =
- resource_provider->CreateGLTexture(size,
- texture_pool,
- wrap_mode,
- ResourceProvider::TextureUsageAny,
- format);
+ ResourceProvider::ResourceId id = resource_provider->CreateGLTexture(
+ size, format, texture_pool, wrap_mode,
+ ResourceProvider::TextureUsageAny);
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id));
EXPECT_CALL(*context,
texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
@@ -1365,7 +1346,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_SharedMemory) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create(
base::Bind(&EmptyReleaseCallback));
@@ -1400,7 +1381,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
unsigned texture_id = 1;
unsigned sync_point = 30;
@@ -1464,7 +1445,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
unsigned texture_id = 1;
unsigned sync_point = 30;
@@ -1584,19 +1565,19 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
gfx::Size size(2, 2);
gfx::Vector2d offset(0, 0);
gfx::Rect rect(0, 0, 2, 2);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
ResourceProvider::ResourceId id = 0;
uint8_t pixels[16] = { 0 };
int texture_id = 123;
// Lazy allocation. Don't allocate when creating the resource.
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
EXPECT_CALL(*context, createTexture()).WillOnce(Return(texture_id));
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(1);
@@ -1609,7 +1590,7 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
// Do allocate when we set the pixels.
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
EXPECT_CALL(*context, createTexture()).WillOnce(Return(texture_id));
EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3);
@@ -1624,7 +1605,7 @@ TEST_P(ResourceProviderTest, TextureAllocation) {
// Same for async version.
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
resource_provider->AcquirePixelBuffer(id);
EXPECT_CALL(*context, createTexture()).WillOnce(Return(texture_id));
@@ -1655,15 +1636,15 @@ TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) {
CHECK(output_surface->BindToClient(&output_surface_client));
gfx::Size size(2, 2);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
ResourceProvider::ResourceId id = 0;
int texture_id = 123;
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
resource_provider->AcquirePixelBuffer(id);
EXPECT_CALL(*context, createTexture()).WillOnce(Return(texture_id));
@@ -1692,15 +1673,15 @@ TEST_P(ResourceProviderTest, PixelBuffer_Bitmap) {
CHECK(output_surface->BindToClient(&output_surface_client));
gfx::Size size(1, 1);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
ResourceProvider::ResourceId id = 0;
const uint32_t kBadBeef = 0xbadbeef;
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
resource_provider->AcquirePixelBuffer(id);
void* data = resource_provider->MapPixelBuffer(id);
@@ -1738,15 +1719,15 @@ TEST_P(ResourceProviderTest, ForcingAsyncUploadToComplete) {
CHECK(output_surface->BindToClient(&output_surface_client));
gfx::Size size(2, 2);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
ResourceProvider::ResourceId id = 0;
int texture_id = 123;
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
resource_provider->AcquirePixelBuffer(id);
EXPECT_CALL(*context, createTexture()).WillOnce(Return(texture_id));
@@ -1779,17 +1760,17 @@ TEST_P(ResourceProviderTest, PixelBufferLostContext) {
CHECK(output_surface->BindToClient(&output_surface_client));
gfx::Size size(2, 2);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
ResourceProvider::ResourceId id = 0;
int texture_id = 123;
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
EXPECT_CALL(*context, createTexture()).WillRepeatedly(Return(texture_id));
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
GL_INNOCENT_CONTEXT_RESET_ARB);
resource_provider->AcquirePixelBuffer(id);
@@ -1816,16 +1797,16 @@ TEST_P(ResourceProviderTest, Image_GLTexture) {
const int kWidth = 2;
const int kHeight = 2;
gfx::Size size(kWidth, kHeight);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
ResourceProvider::ResourceId id = 0;
const unsigned kTextureId = 123u;
const unsigned kImageId = 234u;
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
EXPECT_CALL(*context, createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES))
.WillOnce(Return(kImageId))
.RetiresOnSaturation();
@@ -1888,15 +1869,15 @@ TEST_P(ResourceProviderTest, Image_Bitmap) {
CHECK(output_surface->BindToClient(&output_surface_client));
gfx::Size size(1, 1);
- ResourceFormat format = RGBA_8888;
+ WGC3Denum format = GL_RGBA;
ResourceProvider::ResourceId id = 0;
const uint32_t kBadBeef = 0xbadbeef;
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
id = resource_provider->CreateResource(
- size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny, format);
+ size, format, GL_CLAMP_TO_EDGE, ResourceProvider::TextureUsageAny);
resource_provider->AcquireImage(id);
const int kStride = 0;
@@ -1944,7 +1925,7 @@ TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice)));
EXPECT_TRUE(output_surface->BindToClient(&client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL);
diff --git a/cc/resources/resource_update_controller_unittest.cc b/cc/resources/resource_update_controller_unittest.cc
index 31b5d71..ccbfadd 100644
--- a/cc/resources/resource_update_controller_unittest.cc
+++ b/cc/resources/resource_update_controller_unittest.cc
@@ -124,8 +124,7 @@ class ResourceUpdateControllerTest : public Test {
for (int i = 0; i < 4; i++) {
textures_[i] = PrioritizedResource::Create(resource_manager_.get(),
- gfx::Size(300, 150),
- RGBA_8888);
+ gfx::Size(300, 150), GL_RGBA);
textures_[i]->
set_request_priority(PriorityCalculator::VisiblePriority(true));
}
@@ -136,8 +135,7 @@ class ResourceUpdateControllerTest : public Test {
new WebGraphicsContext3DForUploadTest(this)));
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), 0, false);
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0);
}
void AppendFullUploadsOfIndexedTextureToUpdateQueue(int count,
diff --git a/cc/resources/scoped_resource.cc b/cc/resources/scoped_resource.cc
index 5fcaaca..525fb73 100644
--- a/cc/resources/scoped_resource.cc
+++ b/cc/resources/scoped_resource.cc
@@ -16,14 +16,14 @@ ScopedResource::~ScopedResource() {
}
bool ScopedResource::Allocate(gfx::Size size,
- ResourceProvider::TextureUsageHint hint,
- ResourceFormat format) {
+ GLenum format,
+ ResourceProvider::TextureUsageHint hint) {
DCHECK(!id());
DCHECK(!size.IsEmpty());
set_dimensions(size, format);
set_id(resource_provider_->CreateResource(
- size, GL_CLAMP_TO_EDGE, hint, format));
+ size, format, GL_CLAMP_TO_EDGE, hint));
#ifndef NDEBUG
allocate_thread_id_ = base::PlatformThread::CurrentId();
diff --git a/cc/resources/scoped_resource.h b/cc/resources/scoped_resource.h
index 8e316eb..6a2c8f1 100644
--- a/cc/resources/scoped_resource.h
+++ b/cc/resources/scoped_resource.h
@@ -26,8 +26,8 @@ class CC_EXPORT ScopedResource : public Resource {
virtual ~ScopedResource();
bool Allocate(gfx::Size size,
- ResourceProvider::TextureUsageHint hint,
- ResourceFormat texture_format);
+ GLenum format,
+ ResourceProvider::TextureUsageHint hint);
void Free();
void Leak();
diff --git a/cc/resources/scoped_resource_unittest.cc b/cc/resources/scoped_resource_unittest.cc
index 8b59995..9c66180 100644
--- a/cc/resources/scoped_resource_unittest.cc
+++ b/cc/resources/scoped_resource_unittest.cc
@@ -9,6 +9,7 @@
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/tiled_layer_test_common.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/khronos/GLES2/gl2.h"
namespace cc {
namespace {
@@ -19,7 +20,7 @@ TEST(ScopedResourceTest, NewScopedResource) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
scoped_ptr<ScopedResource> texture =
ScopedResource::create(resource_provider.get());
@@ -37,19 +38,18 @@ TEST(ScopedResourceTest, CreateScopedResource) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
scoped_ptr<ScopedResource> texture =
ScopedResource::create(resource_provider.get());
- texture->Allocate(gfx::Size(30, 30),
- ResourceProvider::TextureUsageAny,
- RGBA_8888);
+ texture->Allocate(
+ gfx::Size(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny);
// The texture has an allocated byte-size now.
size_t expected_bytes = 30 * 30 * 4;
EXPECT_EQ(expected_bytes, texture->bytes());
EXPECT_LT(0u, texture->id());
- EXPECT_EQ(static_cast<unsigned>(RGBA_8888), texture->format());
+ EXPECT_EQ(static_cast<unsigned>(GL_RGBA), texture->format());
EXPECT_EQ(gfx::Size(30, 30), texture->size());
}
@@ -59,15 +59,14 @@ TEST(ScopedResourceTest, ScopedResourceIsDeleted) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
{
scoped_ptr<ScopedResource> texture =
ScopedResource::create(resource_provider.get());
EXPECT_EQ(0u, resource_provider->num_resources());
- texture->Allocate(gfx::Size(30, 30),
- ResourceProvider::TextureUsageAny,
- RGBA_8888);
+ texture->Allocate(
+ gfx::Size(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny);
EXPECT_LT(0u, texture->id());
EXPECT_EQ(1u, resource_provider->num_resources());
}
@@ -77,9 +76,8 @@ TEST(ScopedResourceTest, ScopedResourceIsDeleted) {
scoped_ptr<ScopedResource> texture =
ScopedResource::create(resource_provider.get());
EXPECT_EQ(0u, resource_provider->num_resources());
- texture->Allocate(gfx::Size(30, 30),
- ResourceProvider::TextureUsageAny,
- RGBA_8888);
+ texture->Allocate(
+ gfx::Size(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny);
EXPECT_LT(0u, texture->id());
EXPECT_EQ(1u, resource_provider->num_resources());
texture->Free();
@@ -93,15 +91,14 @@ TEST(ScopedResourceTest, LeakScopedResource) {
CHECK(output_surface->BindToClient(&output_surface_client));
scoped_ptr<ResourceProvider> resource_provider(
- ResourceProvider::Create(output_surface.get(), 0, false));
+ ResourceProvider::Create(output_surface.get(), 0));
{
scoped_ptr<ScopedResource> texture =
ScopedResource::create(resource_provider.get());
EXPECT_EQ(0u, resource_provider->num_resources());
- texture->Allocate(gfx::Size(30, 30),
- ResourceProvider::TextureUsageAny,
- RGBA_8888);
+ texture->Allocate(
+ gfx::Size(30, 30), GL_RGBA, ResourceProvider::TextureUsageAny);
EXPECT_LT(0u, texture->id());
EXPECT_EQ(1u, resource_provider->num_resources());
diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc
index 99d16a1..e0d130b 100644
--- a/cc/resources/tile_manager_perftest.cc
+++ b/cc/resources/tile_manager_perftest.cc
@@ -39,8 +39,7 @@ class TileManagerPerfTest : public testing::Test {
output_surface_ = FakeOutputSurface::Create3d();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), 0, false);
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0);
tile_manager_ = make_scoped_ptr(
new FakeTileManager(&tile_manager_client_, resource_provider_.get()));
diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc
index 0274914..d3b9fac 100644
--- a/cc/resources/tile_manager_unittest.cc
+++ b/cc/resources/tile_manager_unittest.cc
@@ -25,8 +25,7 @@ class TileManagerTest : public testing::TestWithParam<bool> {
output_surface_ = FakeOutputSurface::Create3d();
CHECK(output_surface_->BindToClient(&output_surface_client_));
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), 0, false);
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0);
tile_manager_ = make_scoped_ptr(
new FakeTileManager(&tile_manager_client_, resource_provider_.get()));
diff --git a/cc/resources/transferable_resource.cc b/cc/resources/transferable_resource.cc
index 1b8930f..8a200c3 100644
--- a/cc/resources/transferable_resource.cc
+++ b/cc/resources/transferable_resource.cc
@@ -11,7 +11,7 @@ namespace cc {
TransferableResource::TransferableResource()
: id(0),
sync_point(0),
- format(RGBA_8888),
+ format(0),
filter(0) {
}
diff --git a/cc/resources/transferable_resource.h b/cc/resources/transferable_resource.h
index 0ea6243..be6902c 100644
--- a/cc/resources/transferable_resource.h
+++ b/cc/resources/transferable_resource.h
@@ -9,7 +9,6 @@
#include "base/basictypes.h"
#include "cc/base/cc_export.h"
-#include "cc/resources/resource_format.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "ui/gfx/size.h"
@@ -30,7 +29,7 @@ struct CC_EXPORT TransferableResource {
unsigned id;
unsigned sync_point;
- ResourceFormat format;
+ uint32 format;
uint32 filter;
gfx::Size size;
gpu::Mailbox mailbox;
diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc
index 34c7ab6..d07ff35 100644
--- a/cc/resources/video_resource_updater.cc
+++ b/cc/resources/video_resource_updater.cc
@@ -15,10 +15,10 @@
#include "third_party/khronos/GLES2/gl2ext.h"
#include "ui/gfx/size_conversions.h"
-namespace cc {
+const unsigned kYUVResourceFormat = GL_LUMINANCE;
+const unsigned kRGBResourceFormat = GL_RGBA;
-const ResourceFormat kYUVResourceFormat = LUMINANCE_8;
-const ResourceFormat kRGBResourceFormat = RGBA_8888;
+namespace cc {
VideoFrameExternalResources::VideoFrameExternalResources() : type(NONE) {}
@@ -90,7 +90,7 @@ bool VideoResourceUpdater::VerifyFrame(
static gfx::Size SoftwarePlaneDimension(
media::VideoFrame::Format input_frame_format,
gfx::Size coded_size,
- ResourceFormat output_resource_format,
+ GLenum output_resource_format,
int plane_index) {
if (output_resource_format == kYUVResourceFormat) {
if (plane_index == media::VideoFrame::kYPlane ||
@@ -116,7 +116,7 @@ static gfx::Size SoftwarePlaneDimension(
}
}
- DCHECK_EQ(output_resource_format, kRGBResourceFormat);
+ DCHECK_EQ(output_resource_format, static_cast<unsigned>(kRGBResourceFormat));
return coded_size;
}
@@ -143,7 +143,7 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
bool software_compositor = context_provider_ == NULL;
- ResourceFormat output_resource_format = kYUVResourceFormat;
+ GLenum output_resource_format = kYUVResourceFormat;
size_t output_plane_count =
(input_frame_format == media::VideoFrame::YV12A) ? 4 : 3;
@@ -194,9 +194,9 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
// ResourceProvider and stop using ResourceProvider in this class.
resource_id =
resource_provider_->CreateResource(output_plane_resource_size,
+ output_resource_format,
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- output_resource_format);
+ ResourceProvider::TextureUsageAny);
DCHECK(mailbox.IsZero());
@@ -284,7 +284,8 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
for (size_t i = 0; i < plane_resources.size(); ++i) {
// Update each plane's resource id with its content.
- DCHECK_EQ(plane_resources[i].resource_format, kYUVResourceFormat);
+ DCHECK_EQ(plane_resources[i].resource_format,
+ static_cast<unsigned>(kYUVResourceFormat));
const uint8_t* input_plane_pixels = video_frame->data(i);
diff --git a/cc/resources/video_resource_updater.h b/cc/resources/video_resource_updater.h
index e3476d4..d0e9f9c 100644
--- a/cc/resources/video_resource_updater.h
+++ b/cc/resources/video_resource_updater.h
@@ -13,7 +13,6 @@
#include "base/memory/weak_ptr.h"
#include "cc/base/cc_export.h"
#include "cc/resources/release_callback.h"
-#include "cc/resources/resource_format.h"
#include "cc/resources/texture_mailbox.h"
#include "ui/gfx/size.h"
@@ -76,12 +75,12 @@ class CC_EXPORT VideoResourceUpdater
struct PlaneResource {
unsigned resource_id;
gfx::Size resource_size;
- ResourceFormat resource_format;
+ unsigned resource_format;
gpu::Mailbox mailbox;
PlaneResource(unsigned resource_id,
gfx::Size resource_size,
- ResourceFormat resource_format,
+ unsigned resource_format,
gpu::Mailbox mailbox)
: resource_id(resource_id),
resource_size(resource_size),
@@ -99,7 +98,7 @@ class CC_EXPORT VideoResourceUpdater
struct RecycleResourceData {
unsigned resource_id;
gfx::Size resource_size;
- ResourceFormat resource_format;
+ unsigned resource_format;
gpu::Mailbox mailbox;
};
static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater,
diff --git a/cc/resources/video_resource_updater_unittest.cc b/cc/resources/video_resource_updater_unittest.cc
index c36689e..60673ed 100644
--- a/cc/resources/video_resource_updater_unittest.cc
+++ b/cc/resources/video_resource_updater_unittest.cc
@@ -26,7 +26,7 @@ class VideoResourceUpdaterTest : public testing::Test {
FakeOutputSurface::Create3d(context3d.Pass());
CHECK(output_surface3d_->BindToClient(&client_));
resource_provider3d_ =
- ResourceProvider::Create(output_surface3d_.get(), 0, false);
+ ResourceProvider::Create(output_surface3d_.get(), 0);
}
scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame() {
diff --git a/cc/scheduler/texture_uploader.cc b/cc/scheduler/texture_uploader.cc
index 207bae2..920c38e 100644
--- a/cc/scheduler/texture_uploader.cc
+++ b/cc/scheduler/texture_uploader.cc
@@ -135,7 +135,7 @@ void TextureUploader::Upload(const uint8* image,
gfx::Rect image_rect,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- ResourceFormat format,
+ GLenum format,
gfx::Size size) {
CHECK(image_rect.Contains(source_rect));
@@ -178,7 +178,7 @@ void TextureUploader::UploadWithTexSubImage(const uint8* image,
gfx::Rect image_rect,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- ResourceFormat format) {
+ GLenum format) {
// Instrumentation to debug issue 156107
int source_rect_x = source_rect.x();
int source_rect_y = source_rect.y();
@@ -207,10 +207,10 @@ void TextureUploader::UploadWithTexSubImage(const uint8* image,
gfx::Vector2d offset(source_rect.origin() - image_rect.origin());
const uint8* pixel_source;
- unsigned bytes_per_pixel = ResourceProvider::BytesPerPixel(format);
+ unsigned int bytes_per_pixel = Resource::BytesPerPixel(format);
// Use 4-byte row alignment (OpenGL default) for upload performance.
// Assuming that GL_UNPACK_ALIGNMENT has not changed from default.
- unsigned upload_image_stride =
+ unsigned int upload_image_stride =
RoundUp(bytes_per_pixel * source_rect.width(), 4u);
if (upload_image_stride == image_rect.width() * bytes_per_pixel &&
@@ -239,8 +239,8 @@ void TextureUploader::UploadWithTexSubImage(const uint8* image,
dest_offset.y(),
source_rect.width(),
source_rect.height(),
- ResourceProvider::GetGLDataFormat(format),
- ResourceProvider::GetGLDataType(format),
+ format,
+ GL_UNSIGNED_BYTE,
pixel_source);
}
@@ -248,7 +248,7 @@ void TextureUploader::UploadWithMapTexSubImage(const uint8* image,
gfx::Rect image_rect,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- ResourceFormat format) {
+ GLenum format) {
// Instrumentation to debug issue 156107
int source_rect_x = source_rect.x();
int source_rect_y = source_rect.y();
@@ -277,10 +277,10 @@ void TextureUploader::UploadWithMapTexSubImage(const uint8* image,
// Offset from image-rect to source-rect.
gfx::Vector2d offset(source_rect.origin() - image_rect.origin());
- unsigned bytes_per_pixel = ResourceProvider::BytesPerPixel(format);
+ unsigned int bytes_per_pixel = Resource::BytesPerPixel(format);
// Use 4-byte row alignment (OpenGL default) for upload performance.
// Assuming that GL_UNPACK_ALIGNMENT has not changed from default.
- unsigned upload_image_stride =
+ unsigned int upload_image_stride =
RoundUp(bytes_per_pixel * source_rect.width(), 4u);
// Upload tile data via a mapped transfer buffer
@@ -291,10 +291,8 @@ void TextureUploader::UploadWithMapTexSubImage(const uint8* image,
dest_offset.y(),
source_rect.width(),
source_rect.height(),
- ResourceProvider::GetGLDataFormat(
- format),
- ResourceProvider::GetGLDataType(
- format),
+ format,
+ GL_UNSIGNED_BYTE,
GL_WRITE_ONLY));
if (!pixel_dest) {
diff --git a/cc/scheduler/texture_uploader.h b/cc/scheduler/texture_uploader.h
index a131ba0..1457bed 100644
--- a/cc/scheduler/texture_uploader.h
+++ b/cc/scheduler/texture_uploader.h
@@ -11,7 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
#include "cc/base/scoped_ptr_deque.h"
-#include "cc/resources/resource_provider.h"
+#include "third_party/khronos/GLES2/gl2.h"
namespace WebKit { class WebGraphicsContext3D; }
@@ -46,7 +46,7 @@ class CC_EXPORT TextureUploader {
gfx::Rect content_rect,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- ResourceFormat format,
+ GLenum format,
gfx::Size size);
void Flush();
@@ -97,12 +97,12 @@ class CC_EXPORT TextureUploader {
gfx::Rect image_rect,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- ResourceFormat format);
+ GLenum format);
void UploadWithMapTexSubImage(const uint8* image,
gfx::Rect image_rect,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- ResourceFormat format);
+ GLenum format);
WebKit::WebGraphicsContext3D* context_;
ScopedPtrDeque<Query> pending_queries_;
diff --git a/cc/scheduler/texture_uploader_unittest.cc b/cc/scheduler/texture_uploader_unittest.cc
index 68413df..0595917 100644
--- a/cc/scheduler/texture_uploader_unittest.cc
+++ b/cc/scheduler/texture_uploader_unittest.cc
@@ -151,7 +151,7 @@ class TestWebGraphicsContext3DTextureUpload : public TestWebGraphicsContext3D {
};
void UploadTexture(TextureUploader* uploader,
- ResourceFormat format,
+ WGC3Denum format,
gfx::Size size,
const uint8* data) {
uploader->Upload(data,
@@ -170,17 +170,17 @@ TEST(TextureUploaderTest, NumBlockingUploads) {
fake_context->SetResultAvailable(0);
EXPECT_EQ(0u, uploader->NumBlockingUploads());
- UploadTexture(uploader.get(), RGBA_8888, gfx::Size(), NULL);
+ UploadTexture(uploader.get(), GL_RGBA, gfx::Size(), NULL);
EXPECT_EQ(1u, uploader->NumBlockingUploads());
- UploadTexture(uploader.get(), RGBA_8888, gfx::Size(), NULL);
+ UploadTexture(uploader.get(), GL_RGBA, gfx::Size(), NULL);
EXPECT_EQ(2u, uploader->NumBlockingUploads());
fake_context->SetResultAvailable(1);
EXPECT_EQ(0u, uploader->NumBlockingUploads());
- UploadTexture(uploader.get(), RGBA_8888, gfx::Size(), NULL);
+ UploadTexture(uploader.get(), GL_RGBA, gfx::Size(), NULL);
EXPECT_EQ(0u, uploader->NumBlockingUploads());
- UploadTexture(uploader.get(), RGBA_8888, gfx::Size(), NULL);
- UploadTexture(uploader.get(), RGBA_8888, gfx::Size(), NULL);
+ UploadTexture(uploader.get(), GL_RGBA, gfx::Size(), NULL);
+ UploadTexture(uploader.get(), GL_RGBA, gfx::Size(), NULL);
EXPECT_EQ(0u, uploader->NumBlockingUploads());
}
@@ -192,18 +192,18 @@ TEST(TextureUploaderTest, MarkPendingUploadsAsNonBlocking) {
fake_context->SetResultAvailable(0);
EXPECT_EQ(0u, uploader->NumBlockingUploads());
- UploadTexture(uploader.get(), RGBA_8888, gfx::Size(), NULL);
- UploadTexture(uploader.get(), RGBA_8888, gfx::Size(), NULL);
+ UploadTexture(uploader.get(), GL_RGBA, gfx::Size(), NULL);
+ UploadTexture(uploader.get(), GL_RGBA, gfx::Size(), NULL);
EXPECT_EQ(2u, uploader->NumBlockingUploads());
uploader->MarkPendingUploadsAsNonBlocking();
EXPECT_EQ(0u, uploader->NumBlockingUploads());
- UploadTexture(uploader.get(), RGBA_8888, gfx::Size(), NULL);
+ UploadTexture(uploader.get(), GL_RGBA, gfx::Size(), NULL);
EXPECT_EQ(1u, uploader->NumBlockingUploads());
fake_context->SetResultAvailable(1);
EXPECT_EQ(0u, uploader->NumBlockingUploads());
- UploadTexture(uploader.get(), RGBA_8888, gfx::Size(), NULL);
+ UploadTexture(uploader.get(), GL_RGBA, gfx::Size(), NULL);
uploader->MarkPendingUploadsAsNonBlocking();
EXPECT_EQ(0u, uploader->NumBlockingUploads());
}
@@ -222,7 +222,7 @@ TEST(TextureUploaderTest, UploadContentsTest) {
buffer[i * 4 * 256] = 0x1;
buffer[(i + 1) * 4 * 256 - 1] = 0x2;
}
- UploadTexture(uploader.get(), RGBA_8888, gfx::Size(256, 256), buffer);
+ UploadTexture(uploader.get(), GL_RGBA, gfx::Size(256, 256), buffer);
// Upload a tightly packed 41x43 RGBA texture.
memset(buffer, 0, sizeof(buffer));
@@ -231,7 +231,7 @@ TEST(TextureUploaderTest, UploadContentsTest) {
buffer[i * 4 * 41] = 0x1;
buffer[(i + 1) * 4 * 41 - 1] = 0x2;
}
- UploadTexture(uploader.get(), RGBA_8888, gfx::Size(41, 43), buffer);
+ UploadTexture(uploader.get(), GL_RGBA, gfx::Size(41, 43), buffer);
// Upload a tightly packed 82x86 LUMINANCE texture.
memset(buffer, 0, sizeof(buffer));
@@ -240,7 +240,7 @@ TEST(TextureUploaderTest, UploadContentsTest) {
buffer[i * 1 * 82] = 0x1;
buffer[(i + 1) * 82 - 1] = 0x2;
}
- UploadTexture(uploader.get(), LUMINANCE_8, gfx::Size(82, 86), buffer);
+ UploadTexture(uploader.get(), GL_LUMINANCE, gfx::Size(82, 86), buffer);
}
} // namespace
diff --git a/cc/test/fake_tile_manager.cc b/cc/test/fake_tile_manager.cc
index d8b53aa..8b13c63 100644
--- a/cc/test/fake_tile_manager.cc
+++ b/cc/test/fake_tile_manager.cc
@@ -32,9 +32,7 @@ class FakeRasterWorkerPool : public RasterWorkerPool {
completed_tasks_.pop_front();
}
}
- virtual ResourceFormat GetResourceFormat() const OVERRIDE {
- return RGBA_8888;
- }
+ virtual GLenum GetResourceFormat() const OVERRIDE { return GL_RGBA; }
virtual void OnRasterTasksFinished() OVERRIDE {}
virtual void OnRasterTasksRequiredForActivationFinished() OVERRIDE {}
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index 864af4e..556a194 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -162,8 +162,7 @@ void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend) {
ContextProviderInProcess::CreateOffscreen()));
output_surface_->BindToClient(fake_client_.get());
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), 0, false);
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0);
texture_mailbox_deleter_ = make_scoped_ptr(new TextureMailboxDeleter);
@@ -205,8 +204,7 @@ void PixelTest::SetUpSoftwareRenderer() {
scoped_ptr<SoftwareOutputDevice> device(new PixelTestSoftwareOutputDevice());
output_surface_.reset(new PixelTestOutputSurface(device.Pass()));
output_surface_->BindToClient(fake_client_.get());
- resource_provider_ =
- ResourceProvider::Create(output_surface_.get(), 0, false);
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0);
renderer_ = SoftwareRenderer::Create(fake_client_.get(),
&settings_,
output_surface_.get(),
diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc
index b50d923..13e5c54 100644
--- a/cc/test/render_pass_test_common.cc
+++ b/cc/test/render_pass_test_common.cc
@@ -36,51 +36,51 @@ void TestRenderPass::AppendOneOfEveryQuadType(
cc::ResourceProvider::ResourceId resource1 =
resource_provider->CreateResource(
gfx::Size(45, 5),
+ resource_provider->best_texture_format(),
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- resource_provider->best_texture_format());
+ ResourceProvider::TextureUsageAny);
resource_provider->AllocateForTesting(resource1);
cc::ResourceProvider::ResourceId resource2 =
resource_provider->CreateResource(
gfx::Size(346, 61),
+ resource_provider->best_texture_format(),
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- resource_provider->best_texture_format());
+ ResourceProvider::TextureUsageAny);
resource_provider->AllocateForTesting(resource2);
cc::ResourceProvider::ResourceId resource3 =
resource_provider->CreateResource(
gfx::Size(12, 134),
+ resource_provider->best_texture_format(),
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- resource_provider->best_texture_format());
+ ResourceProvider::TextureUsageAny);
resource_provider->AllocateForTesting(resource3);
cc::ResourceProvider::ResourceId resource4 =
resource_provider->CreateResource(
gfx::Size(56, 12),
+ resource_provider->best_texture_format(),
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- resource_provider->best_texture_format());
+ ResourceProvider::TextureUsageAny);
resource_provider->AllocateForTesting(resource4);
cc::ResourceProvider::ResourceId resource5 =
resource_provider->CreateResource(
gfx::Size(73, 26),
+ resource_provider->best_texture_format(),
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- resource_provider->best_texture_format());
+ ResourceProvider::TextureUsageAny);
resource_provider->AllocateForTesting(resource5);
cc::ResourceProvider::ResourceId resource6 =
resource_provider->CreateResource(
gfx::Size(64, 92),
+ resource_provider->best_texture_format(),
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- resource_provider->best_texture_format());
+ ResourceProvider::TextureUsageAny);
resource_provider->AllocateForTesting(resource6);
cc::ResourceProvider::ResourceId resource7 =
resource_provider->CreateResource(
gfx::Size(9, 14),
+ resource_provider->best_texture_format(),
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- resource_provider->best_texture_format());
+ ResourceProvider::TextureUsageAny);
resource_provider->AllocateForTesting(resource7);
scoped_ptr<cc::SharedQuadState> shared_state = cc::SharedQuadState::Create();
@@ -220,9 +220,9 @@ void TestRenderPass::AppendOneOfEveryQuadType(
plane_resources[i] =
resource_provider->CreateResource(
gfx::Size(20, 12),
+ resource_provider->best_texture_format(),
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- resource_provider->best_texture_format());
+ ResourceProvider::TextureUsageAny);
resource_provider->AllocateForTesting(plane_resources[i]);
}
scoped_ptr<cc::YUVVideoDrawQuad> yuv_quad =
diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc
index 4db79e8..79d658d 100644
--- a/cc/test/tiled_layer_test_common.cc
+++ b/cc/test/tiled_layer_test_common.cc
@@ -71,7 +71,7 @@ FakeTiledLayer::FakeTiledLayer(PrioritizedResourceManager* resource_manager)
fake_updater_(make_scoped_refptr(new FakeLayerUpdater)),
resource_manager_(resource_manager) {
SetTileSize(tile_size());
- SetTextureFormat(RGBA_8888);
+ SetTextureFormat(GL_RGBA);
SetBorderTexelOption(LayerTilingData::NO_BORDER_TEXELS);
// So that we don't get false positives if any of these
// tests expect to return false from DrawsContent() for other reasons.
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 8afb592..dea5757 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -47,7 +47,7 @@ static int s_num_layer_tree_instances;
namespace cc {
RendererCapabilities::RendererCapabilities()
- : best_texture_format(RGBA_8888),
+ : best_texture_format(0),
using_partial_swap(false),
using_set_visibility(false),
using_egl_image(false),
@@ -197,7 +197,7 @@ LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) {
contents_texture_manager_ =
PrioritizedResourceManager::Create(proxy_.get());
surface_memory_placeholder_ =
- contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888);
+ contents_texture_manager_->CreateTexture(gfx::Size(), GL_RGBA);
}
client_->DidInitializeOutputSurface(true);
@@ -930,7 +930,7 @@ size_t LayerTreeHost::CalculateMemoryForRenderSurfaces(
size_t bytes =
Resource::MemorySizeBytes(render_surface->content_rect().size(),
- RGBA_8888);
+ GL_RGBA);
contents_texture_bytes += bytes;
if (render_surface_layer->background_filters().IsEmpty())
@@ -940,7 +940,7 @@ size_t LayerTreeHost::CalculateMemoryForRenderSurfaces(
max_background_texture_bytes = bytes;
if (!readback_bytes) {
readback_bytes = Resource::MemorySizeBytes(device_viewport_size_,
- RGBA_8888);
+ GL_RGBA);
}
}
return readback_bytes + max_background_texture_bytes + contents_texture_bytes;
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index fff226a..ba91e11 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -24,7 +24,6 @@
#include "cc/input/top_controls_state.h"
#include "cc/layers/layer_lists.h"
#include "cc/output/output_surface.h"
-#include "cc/resources/resource_format.h"
#include "cc/resources/scoped_ui_resource.h"
#include "cc/resources/ui_resource_bitmap.h"
#include "cc/resources/ui_resource_client.h"
@@ -74,7 +73,7 @@ struct CC_EXPORT RendererCapabilities {
RendererCapabilities();
~RendererCapabilities();
- ResourceFormat best_texture_format;
+ unsigned best_texture_format;
bool using_partial_swap;
bool using_set_visibility;
bool using_egl_image;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 3a95b5b..2f657e1 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1699,9 +1699,7 @@ bool LayerTreeHostImpl::InitializeRenderer(
return false;
scoped_ptr<ResourceProvider> resource_provider = ResourceProvider::Create(
- output_surface.get(),
- settings_.highp_threshold_min,
- settings_.use_rgba_4444_textures);
+ output_surface.get(), settings_.highp_threshold_min);
if (!resource_provider)
return false;
@@ -2652,9 +2650,9 @@ void LayerTreeHostImpl::CreateUIResource(
DeleteUIResource(uid);
id = resource_provider_->CreateResource(
bitmap->GetSize(),
+ resource_provider_->best_texture_format(),
wrap_mode,
- ResourceProvider::TextureUsageAny,
- resource_provider_->best_texture_format());
+ ResourceProvider::TextureUsageAny);
ui_resource_map_[uid] = id;
resource_provider_->SetPixels(id,
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index d386795..3676745 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -1529,9 +1529,9 @@ class MissingTextureAnimatingLayer : public DidDrawCheckLayer {
if (!tile_missing) {
ResourceProvider::ResourceId resource =
resource_provider->CreateResource(gfx::Size(1, 1),
+ GL_RGBA,
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- RGBA_8888);
+ ResourceProvider::TextureUsageAny);
resource_provider->AllocateForTesting(resource);
PushTileProperties(0, 0, resource, gfx::Rect(), false);
}
@@ -2621,9 +2621,9 @@ class BlendStateCheckLayer : public LayerImpl {
quad_visible_rect_(5, 5, 5, 5),
resource_id_(resource_provider->CreateResource(
gfx::Size(1, 1),
+ GL_RGBA,
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- RGBA_8888)) {
+ ResourceProvider::TextureUsageAny)) {
resource_provider->AllocateForTesting(resource_id_);
SetAnchorPoint(gfx::PointF());
SetBounds(gfx::Size(10, 10));
@@ -5371,7 +5371,7 @@ TEST_F(LayerTreeHostImplTest, TestRemoveRenderPasses) {
ASSERT_TRUE(output_surface->context_provider());
scoped_ptr<ResourceProvider> resource_provider =
- ResourceProvider::Create(output_surface.get(), 0, false);
+ ResourceProvider::Create(output_surface.get(), 0);
scoped_ptr<TestRenderer> renderer = TestRenderer::Create(
&settings, resource_provider.get(), output_surface.get(), &proxy_);
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 173df3e..fc1d582 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -1741,7 +1741,7 @@ class EvictionTestLayer : public Layer {
return;
texture_ = PrioritizedResource::Create(
layer_tree_host()->contents_texture_manager());
- texture_->SetDimensions(gfx::Size(10, 10), RGBA_8888);
+ texture_->SetDimensions(gfx::Size(10, 10), GL_RGBA);
bitmap_.setConfig(SkBitmap::kARGB_8888_Config, 10, 10);
}
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 18683e8..6615cfc 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -1264,9 +1264,9 @@ class LayerTreeHostContextTestDontUseLostResources
ResourceProvider::ResourceId texture = resource_provider->CreateResource(
gfx::Size(4, 4),
+ resource_provider->default_resource_type(),
GL_CLAMP_TO_EDGE,
- ResourceProvider::TextureUsageAny,
- RGBA_8888);
+ ResourceProvider::TextureUsageAny);
ResourceProvider::ScopedWriteLockGL lock(resource_provider, texture);
gpu::Mailbox mailbox;
diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc
index 3e9cb21..1743532 100644
--- a/cc/trees/layer_tree_settings.cc
+++ b/cc/trees/layer_tree_settings.cc
@@ -56,8 +56,7 @@ LayerTreeSettings::LayerTreeSettings()
force_direct_layer_drawing(false),
strict_layer_property_change_checking(false),
use_map_image(false),
- ignore_root_layer_flings(false),
- use_rgba_4444_textures(false) {
+ ignore_root_layer_flings(false) {
// TODO(danakj): Renable surface caching when we can do it more realiably.
// crbug.com/170713
cache_render_pass_contents = false;
diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h
index 53b97dc..e66f229 100644
--- a/cc/trees/layer_tree_settings.h
+++ b/cc/trees/layer_tree_settings.h
@@ -67,7 +67,6 @@ class CC_EXPORT LayerTreeSettings {
bool strict_layer_property_change_checking;
bool use_map_image;
bool ignore_root_layer_flings;
- bool use_rgba_4444_textures;
LayerTreeDebugState initial_debug_state;
};
diff --git a/content/common/cc_messages.h b/content/common/cc_messages.h
index a3e06db..e63253a 100644
--- a/content/common/cc_messages.h
+++ b/content/common/cc_messages.h
@@ -21,7 +21,6 @@
#include "cc/quads/texture_draw_quad.h"
#include "cc/quads/tile_draw_quad.h"
#include "cc/quads/yuv_video_draw_quad.h"
-#include "cc/resources/resource_format.h"
#include "cc/resources/returned_resource.h"
#include "cc/resources/transferable_resource.h"
#include "content/common/content_export.h"
@@ -118,7 +117,6 @@ struct CONTENT_EXPORT ParamTraits<cc::DelegatedFrameData> {
IPC_ENUM_TRAITS(cc::DrawQuad::Material)
IPC_ENUM_TRAITS(cc::IOSurfaceDrawQuad::Orientation)
IPC_ENUM_TRAITS(cc::FilterOperation::FilterType)
-IPC_ENUM_TRAITS_MAX_VALUE(cc::ResourceFormat, cc::RESOURCE_FORMAT_MAX)
IPC_STRUCT_TRAITS_BEGIN(cc::RenderPass::Id)
IPC_STRUCT_TRAITS_MEMBER(layer_id)
diff --git a/content/common/cc_messages_unittest.cc b/content/common/cc_messages_unittest.cc
index 6be248d..bd089308 100644
--- a/content/common/cc_messages_unittest.cc
+++ b/content/common/cc_messages_unittest.cc
@@ -510,7 +510,7 @@ TEST_F(CCMessagesTest, Resources) {
TransferableResource arbitrary_resource1;
arbitrary_resource1.id = 2178312;
arbitrary_resource1.sync_point = arbitrary_uint1;
- arbitrary_resource1.format = cc::RGBA_8888;
+ arbitrary_resource1.format = 7;
arbitrary_resource1.filter = 53;
arbitrary_resource1.size = gfx::Size(37189, 123123);
arbitrary_resource1.mailbox.SetName(arbitrary_mailbox1);
@@ -518,7 +518,7 @@ TEST_F(CCMessagesTest, Resources) {
TransferableResource arbitrary_resource2;
arbitrary_resource2.id = 789132;
arbitrary_resource1.sync_point = arbitrary_uint2;
- arbitrary_resource2.format = cc::RGBA_4444;
+ arbitrary_resource2.format = 30;
arbitrary_resource1.filter = 47;
arbitrary_resource2.size = gfx::Size(89123, 23789);
arbitrary_resource2.mailbox.SetName(arbitrary_mailbox2);
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index ef4f902..b923533 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -7,10 +7,6 @@
#include <limits>
#include <string>
-#if defined(OS_ANDROID)
-#include "base/android/sys_utils.h"
-#endif
-
#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
@@ -280,12 +276,6 @@ scoped_ptr<RenderWidgetCompositor> RenderWidgetCompositor::Create(
// Android WebView handles root layer flings itself.
settings.ignore_root_layer_flings =
widget->UsingSynchronousRendererCompositor();
- // RGBA_4444 textures are only enabled for low end devices
- // and are disabled for Android WebView as it doesn't support the format.
- settings.use_rgba_4444_textures =
- base::android::SysUtils::IsLowEndDevice() &&
- !widget->UsingSynchronousRendererCompositor() &&
- !cmd->HasSwitch(cc::switches::kDisable4444Textures);
#elif !defined(OS_MACOSX)
if (cmd->HasSwitch(switches::kEnableOverlayScrollbars)) {
settings.scrollbar_animator = cc::LayerTreeSettings::Thinning;
diff --git a/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc b/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc
index 5aaabf4..8de7d58a 100644
--- a/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc
+++ b/gpu/command_buffer/service/async_pixel_transfer_manager_android.cc
@@ -4,7 +4,6 @@
#include "gpu/command_buffer/service/async_pixel_transfer_manager.h"
-#include "base/android/sys_utils.h"
#include "base/debug/trace_event.h"
#include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h"
#include "gpu/command_buffer/service/async_pixel_transfer_manager_idle.h"
@@ -39,8 +38,6 @@ bool IsImagination() {
// - The heap size is large enough.
// TODO(kaanb|epenner): Remove the IsImagination() check pending the
// resolution of crbug.com/249147
-// TODO(kaanb|epenner): Remove the IsLowEndDevice() check pending the
-// resolution of crbug.com/271929
AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
gfx::GLContext* context) {
TRACE_EVENT0("gpu", "AsyncPixelTransferManager::Create");
@@ -53,8 +50,7 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
context->HasExtension("EGL_KHR_gl_texture_2D_image") &&
context->HasExtension("GL_OES_EGL_image") &&
!IsBroadcom() &&
- !IsImagination() &&
- !base::android::SysUtils::IsLowEndDevice()) {
+ !IsImagination()) {
return new AsyncPixelTransferManagerEGL;
}
LOG(INFO) << "Async pixel transfers not supported";
diff --git a/gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc b/gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc
index dc57f5e..64e1f32 100644
--- a/gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc
+++ b/gpu/command_buffer/service/async_pixel_transfer_manager_egl.cc
@@ -170,8 +170,7 @@ class TransferStateInternal
"width", define_params_.width,
"height", define_params_.height);
DCHECK(texture_id_);
- if (EGL_NO_IMAGE_KHR == egl_image_)
- return;
+ DCHECK_NE(EGL_NO_IMAGE_KHR, egl_image_);
glBindTexture(GL_TEXTURE_2D, texture_id_);
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_);
@@ -204,8 +203,7 @@ class TransferStateInternal
egl_buffer,
egl_attrib_list);
- DLOG_IF(ERROR, EGL_NO_IMAGE_KHR == egl_image_)
- << "eglCreateImageKHR failed";
+ DCHECK_NE(EGL_NO_IMAGE_KHR, egl_image_);
}
void CreateEglImageOnUploadThread() {
@@ -261,10 +259,7 @@ class TransferStateInternal
tex_params.height);
DCHECK(!thread_texture_id_);
DCHECK_EQ(0, tex_params.level);
- if (EGL_NO_IMAGE_KHR == egl_image_) {
- MarkAsCompleted();
- return;
- }
+ DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_);
void* data =
AsyncPixelTransferDelegate::GetAddress(safe_shared_memory, mem_params);