diff options
author | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-12 02:19:01 +0000 |
---|---|---|
committer | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-12 02:19:01 +0000 |
commit | 900db441ac70a0a0b55fa185ff0383914f7a92f2 (patch) | |
tree | 7cd26003dfe706440d1a888ab7e8ee4a0f9850ab /cc | |
parent | 58e2806f18c789e91f89c0a836013f29926e8028 (diff) | |
download | chromium_src-900db441ac70a0a0b55fa185ff0383914f7a92f2.zip chromium_src-900db441ac70a0a0b55fa185ff0383914f7a92f2.tar.gz chromium_src-900db441ac70a0a0b55fa185ff0383914f7a92f2.tar.bz2 |
cc: ContextProvider::Capabilities compose gpu::Capabilities
Clean up after introducing gpu::Capabilities.
BUG=285390
Review URL: https://codereview.chromium.org/132783003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244408 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/output/context_provider.cc | 28 | ||||
-rw-r--r-- | cc/output/context_provider.h | 17 | ||||
-rw-r--r-- | cc/output/delegating_renderer.cc | 7 | ||||
-rw-r--r-- | cc/output/gl_renderer.cc | 13 | ||||
-rw-r--r-- | cc/output/gl_renderer_unittest.cc | 6 | ||||
-rw-r--r-- | cc/resources/resource_provider.cc | 8 | ||||
-rw-r--r-- | cc/test/test_web_graphics_context_3d.h | 14 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest.cc | 4 |
9 files changed, 32 insertions, 69 deletions
diff --git a/cc/output/context_provider.cc b/cc/output/context_provider.cc index 11b4bc5..23a8e2c 100644 --- a/cc/output/context_provider.cc +++ b/cc/output/context_provider.cc @@ -9,32 +9,6 @@ namespace cc { ContextProvider::Capabilities::Capabilities() - : egl_image_external(false), - fast_npot_mo8_textures(false), - iosurface(false), - map_image(false), - post_sub_buffer(false), - texture_format_bgra8888(false), - texture_format_etc1(false), - texture_rectangle(false), - texture_storage(false), - texture_usage(false), - discard_framebuffer(false), - max_transfer_buffer_usage_bytes(std::numeric_limits<size_t>::max()) {} - -ContextProvider::Capabilities::Capabilities( - const gpu::Capabilities& gpu_capabilities) - : egl_image_external(gpu_capabilities.egl_image_external), - fast_npot_mo8_textures(gpu_capabilities.fast_npot_mo8_textures), - iosurface(gpu_capabilities.iosurface), - map_image(gpu_capabilities.map_image), - post_sub_buffer(gpu_capabilities.post_sub_buffer), - texture_format_bgra8888(gpu_capabilities.texture_format_bgra8888), - texture_format_etc1(gpu_capabilities.texture_format_etc1), - texture_rectangle(gpu_capabilities.texture_rectangle), - texture_storage(gpu_capabilities.texture_storage), - texture_usage(gpu_capabilities.texture_usage), - discard_framebuffer(gpu_capabilities.discard_framebuffer), - max_transfer_buffer_usage_bytes(std::numeric_limits<size_t>::max()) {} + : max_transfer_buffer_usage_bytes(std::numeric_limits<size_t>::max()) {} } // namespace cc diff --git a/cc/output/context_provider.h b/cc/output/context_provider.h index 0b6d482..7f1737a 100644 --- a/cc/output/context_provider.h +++ b/cc/output/context_provider.h @@ -36,25 +36,12 @@ class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { virtual void MakeGrContextCurrent() = 0; struct Capabilities { - bool egl_image_external : 1; - bool fast_npot_mo8_textures : 1; - bool iosurface : 1; - bool map_image : 1; - bool post_sub_buffer : 1; - bool texture_format_bgra8888 : 1; - bool texture_format_etc1 : 1; - bool texture_rectangle : 1; - bool texture_storage : 1; - bool texture_usage : 1; - bool discard_framebuffer : 1; + gpu::Capabilities gpu; size_t max_transfer_buffer_usage_bytes; CC_EXPORT Capabilities(); - - // TODO(boliu): Compose a gpu::Capabilities instead and remove this - // constructor. - explicit CC_EXPORT Capabilities(const gpu::Capabilities& gpu_capabilities); }; + // Returns the capabilities of the currently bound 3d context. virtual Capabilities ContextCapabilities() = 0; diff --git a/cc/output/delegating_renderer.cc b/cc/output/delegating_renderer.cc index b75d097..1ad5291 100644 --- a/cc/output/delegating_renderer.cc +++ b/cc/output/delegating_renderer.cc @@ -70,10 +70,11 @@ bool DelegatingRenderer::Initialize() { const ContextProvider::Capabilities& caps = output_surface_->context_provider()->ContextCapabilities(); - DCHECK(!caps.iosurface || caps.texture_rectangle); + DCHECK(!caps.gpu.iosurface || caps.gpu.texture_rectangle); - capabilities_.using_egl_image = caps.egl_image_external; - capabilities_.using_map_image = settings_->use_map_image && caps.map_image; + capabilities_.using_egl_image = caps.gpu.egl_image_external; + capabilities_.using_map_image = + settings_->use_map_image && caps.gpu.map_image; return true; } diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 65dc0da..52e2178 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -185,11 +185,11 @@ GLRenderer::GLRenderer(RendererClient* client, output_surface_->context_provider()->ContextCapabilities(); capabilities_.using_partial_swap = - settings_->partial_swap_enabled && context_caps.post_sub_buffer; + settings_->partial_swap_enabled && context_caps.gpu.post_sub_buffer; - DCHECK(!context_caps.iosurface || context_caps.texture_rectangle); + DCHECK(!context_caps.gpu.iosurface || context_caps.gpu.texture_rectangle); - capabilities_.using_egl_image = context_caps.egl_image_external; + capabilities_.using_egl_image = context_caps.gpu.egl_image_external; capabilities_.max_texture_size = resource_provider_->max_texture_size(); capabilities_.best_texture_format = resource_provider_->best_texture_format(); @@ -199,14 +199,15 @@ GLRenderer::GLRenderer(RendererClient* client, // Check for texture fast paths. Currently we always use MO8 textures, // so we only need to avoid POT textures if we have an NPOT fast-path. - capabilities_.avoid_pow2_textures = context_caps.fast_npot_mo8_textures; + capabilities_.avoid_pow2_textures = context_caps.gpu.fast_npot_mo8_textures; capabilities_.using_offscreen_context3d = true; capabilities_.using_map_image = - settings_->use_map_image && context_caps.map_image; + settings_->use_map_image && context_caps.gpu.map_image; - capabilities_.using_discard_framebuffer = context_caps.discard_framebuffer; + capabilities_.using_discard_framebuffer = + context_caps.gpu.discard_framebuffer; InitializeSharedObjects(); } diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index 272ddbc..1f05ff9 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -594,7 +594,7 @@ TEST_F(GLRendererTest, InitializationWithQuicklyLostContextDoesNotAssert) { class ClearCountingContext : public TestWebGraphicsContext3D { public: - ClearCountingContext() { test_capabilities_.discard_framebuffer = true; } + ClearCountingContext() { test_capabilities_.gpu.discard_framebuffer = true; } MOCK_METHOD3(discardFramebufferEXT, void(GLenum target, @@ -814,7 +814,7 @@ TEST_F(GLRendererTest, VisibilityChangeIsLastCall) { class TextureStateTrackingContext : public TestWebGraphicsContext3D { public: TextureStateTrackingContext() : active_texture_(GL_INVALID_ENUM) { - test_capabilities_.egl_image_external = true; + test_capabilities_.gpu.egl_image_external = true; } MOCK_METHOD3(texParameteri, void(GLenum target, GLenum pname, GLint param)); @@ -1681,7 +1681,7 @@ TEST_F(GLRendererShaderTest, DrawSolidColorShader) { class OutputSurfaceMockContext : public TestWebGraphicsContext3D { public: - OutputSurfaceMockContext() { test_capabilities_.post_sub_buffer = true; } + OutputSurfaceMockContext() { test_capabilities_.gpu.post_sub_buffer = true; } // Specifically override methods even if they are unused (used in conjunction // with StrictMock). We need to make sure that GLRenderer does not issue diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc index 464d0a9..9b03b67 100644 --- a/cc/resources/resource_provider.cc +++ b/cc/resources/resource_provider.cc @@ -925,10 +925,10 @@ bool ResourceProvider::InitializeGL() { const ContextProvider::Capabilities& caps = output_surface_->context_provider()->ContextCapabilities(); - bool use_bgra = caps.texture_format_bgra8888; - use_texture_storage_ext_ = caps.texture_storage; - use_texture_usage_hint_ = caps.texture_usage; - use_compressed_texture_etc1_ = caps.texture_format_etc1; + bool use_bgra = caps.gpu.texture_format_bgra8888; + use_texture_storage_ext_ = caps.gpu.texture_storage; + use_texture_usage_hint_ = caps.gpu.texture_usage; + use_compressed_texture_etc1_ = caps.gpu.texture_format_etc1; GLES2Interface* gl = ContextGL(); DCHECK(gl); diff --git a/cc/test/test_web_graphics_context_3d.h b/cc/test/test_web_graphics_context_3d.h index db85b19..d8bab3d2 100644 --- a/cc/test/test_web_graphics_context_3d.h +++ b/cc/test/test_web_graphics_context_3d.h @@ -215,23 +215,23 @@ class TestWebGraphicsContext3D : public FakeWebGraphicsContext3D { void ResetUsedTextures() { used_textures_.clear(); } void set_have_extension_io_surface(bool have) { - test_capabilities_.iosurface = have; - test_capabilities_.texture_rectangle = have; + test_capabilities_.gpu.iosurface = have; + test_capabilities_.gpu.texture_rectangle = have; } void set_have_extension_egl_image(bool have) { - test_capabilities_.egl_image_external = have; + test_capabilities_.gpu.egl_image_external = have; } void set_have_post_sub_buffer(bool have) { - test_capabilities_.post_sub_buffer = have; + test_capabilities_.gpu.post_sub_buffer = have; } void set_have_discard_framebuffer(bool have) { - test_capabilities_.discard_framebuffer = have; + test_capabilities_.gpu.discard_framebuffer = have; } void set_support_compressed_texture_etc1(bool support) { - test_capabilities_.texture_format_etc1 = support; + test_capabilities_.gpu.texture_format_etc1 = support; } void set_support_texture_storage(bool support) { - test_capabilities_.texture_storage = support; + test_capabilities_.gpu.texture_storage = support; } // When this context is lost, all contexts in its share group are also lost. diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 206e686..74171b6 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -113,9 +113,9 @@ GLenum GetMapImageTextureTarget(cc::ContextProvider* context_provider) { // TODO(reveman): Determine if GL_TEXTURE_EXTERNAL_OES works well on // Android before we enable this. crbug.com/322780 #if !defined(OS_ANDROID) - if (context_provider->ContextCapabilities().egl_image_external) + if (context_provider->ContextCapabilities().gpu.egl_image_external) return GL_TEXTURE_EXTERNAL_OES; - if (context_provider->ContextCapabilities().texture_rectangle) + if (context_provider->ContextCapabilities().gpu.texture_rectangle) return GL_TEXTURE_RECTANGLE_ARB; #endif diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index ad17438..d01fbae 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -2806,8 +2806,8 @@ SINGLE_THREAD_TEST_F(LayerTreeHostTestChangeLayerPropertiesInPaintContents); class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D { public: MockIOSurfaceWebGraphicsContext3D() { - test_capabilities_.iosurface = true; - test_capabilities_.texture_rectangle = true; + test_capabilities_.gpu.iosurface = true; + test_capabilities_.gpu.texture_rectangle = true; } virtual GLuint createTexture() OVERRIDE { |