diff options
author | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-05 15:41:19 +0000 |
---|---|---|
committer | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-05 15:41:19 +0000 |
commit | 956aec5a0fe6dd7a35ed20947c07c88ab1632a5c (patch) | |
tree | 4df3200cdd65d4fc8d7246247a69edd92d5e0cd2 | |
parent | faca50ae7596c14eaadc18a7afe5367bf961518b (diff) | |
download | chromium_src-956aec5a0fe6dd7a35ed20947c07c88ab1632a5c.zip chromium_src-956aec5a0fe6dd7a35ed20947c07c88ab1632a5c.tar.gz chromium_src-956aec5a0fe6dd7a35ed20947c07c88ab1632a5c.tar.bz2 |
FeatureInfo: Remove allowed_extensions and init workarounds early
This removes passing allowed_extensions all the way through, since it
was ignored anyways. It also initializes the workarounds from the
commandline during FeatureInfo construction so it can be used to
make decisions before the first context is created and initialized.
Review URL: https://chromiumcodereview.appspot.com/23660006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221438 0039d316-1c4b-4281-b951-d872f2087c98
31 files changed, 93 insertions, 174 deletions
diff --git a/content/browser/android/in_process/synchronous_compositor_impl.cc b/content/browser/android/in_process/synchronous_compositor_impl.cc index b3a7b96..67590eb 100644 --- a/content/browser/android/in_process/synchronous_compositor_impl.cc +++ b/content/browser/android/in_process/synchronous_compositor_impl.cc @@ -106,7 +106,6 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { if (!gfx::GLSurface::InitializeOneOff()) return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); - const char* allowed_extensions = "*"; const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; WebKit::WebGraphicsContext3D::Attributes attributes; @@ -122,7 +121,6 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { NULL, gfx::Size(1, 1), attributes.shareResources, - allowed_extensions, in_process_attribs, gpu_preference)); diff --git a/content/browser/android/in_process/synchronous_compositor_output_surface.cc b/content/browser/android/in_process/synchronous_compositor_output_surface.cc index 40c8a3b..2760a62 100644 --- a/content/browser/android/in_process/synchronous_compositor_output_surface.cc +++ b/content/browser/android/in_process/synchronous_compositor_output_surface.cc @@ -34,7 +34,6 @@ CreateWebGraphicsContext3D(scoped_refptr<gfx::GLSurface> surface) { if (!gfx::GLSurface::InitializeOneOff()) return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); - const char* allowed_extensions = "*"; const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; WebKit::WebGraphicsContext3D::Attributes attributes; @@ -48,7 +47,6 @@ CreateWebGraphicsContext3D(scoped_refptr<gfx::GLSurface> surface) { scoped_ptr<gpu::GLInProcessContext> context( gpu::GLInProcessContext::CreateWithSurface(surface, attributes.shareResources, - allowed_extensions, in_process_attribs, gpu_preference)); diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc index 2ee9f8e..27c71de 100644 --- a/content/common/gpu/client/gpu_channel_host.cc +++ b/content/common/gpu/client/gpu_channel_host.cc @@ -110,7 +110,6 @@ bool GpuChannelHost::Send(IPC::Message* msg) { CommandBufferProxyImpl* GpuChannelHost::CreateViewCommandBuffer( int32 surface_id, CommandBufferProxyImpl* share_group, - const std::string& allowed_extensions, const std::vector<int32>& attribs, const GURL& active_url, gfx::GpuPreference gpu_preference) { @@ -122,7 +121,6 @@ CommandBufferProxyImpl* GpuChannelHost::CreateViewCommandBuffer( GPUCreateCommandBufferConfig init_params; init_params.share_group_id = share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE; - init_params.allowed_extensions = allowed_extensions; init_params.attribs = attribs; init_params.active_url = active_url; init_params.gpu_preference = gpu_preference; @@ -142,7 +140,6 @@ CommandBufferProxyImpl* GpuChannelHost::CreateViewCommandBuffer( CommandBufferProxyImpl* GpuChannelHost::CreateOffscreenCommandBuffer( const gfx::Size& size, CommandBufferProxyImpl* share_group, - const std::string& allowed_extensions, const std::vector<int32>& attribs, const GURL& active_url, gfx::GpuPreference gpu_preference) { @@ -151,7 +148,6 @@ CommandBufferProxyImpl* GpuChannelHost::CreateOffscreenCommandBuffer( GPUCreateCommandBufferConfig init_params; init_params.share_group_id = share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE; - init_params.allowed_extensions = allowed_extensions; init_params.attribs = attribs; init_params.active_url = active_url; init_params.gpu_preference = gpu_preference; diff --git a/content/common/gpu/client/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h index 9aa3673..5efa98d 100644 --- a/content/common/gpu/client/gpu_channel_host.h +++ b/content/common/gpu/client/gpu_channel_host.h @@ -109,7 +109,6 @@ class GpuChannelHost : public IPC::Sender, CommandBufferProxyImpl* CreateViewCommandBuffer( int32 surface_id, CommandBufferProxyImpl* share_group, - const std::string& allowed_extensions, const std::vector<int32>& attribs, const GURL& active_url, gfx::GpuPreference gpu_preference); @@ -118,7 +117,6 @@ class GpuChannelHost : public IPC::Sender, CommandBufferProxyImpl* CreateOffscreenCommandBuffer( const gfx::Size& size, CommandBufferProxyImpl* share_group, - const std::string& allowed_extensions, const std::vector<int32>& attribs, const GURL& active_url, gfx::GpuPreference gpu_preference); diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc index 80f4ebd..421e57d 100644 --- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc @@ -305,8 +305,7 @@ bool WebGraphicsContext3DCommandBufferImpl::Initialize( return true; } -bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL( - const char* allowed_extensions) { +bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { if (initialized_) return true; @@ -315,11 +314,7 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL( TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::MaybeInitializeGL"); - const char* preferred_extensions = "*"; - - if (!CreateContext(surface_id_ != 0, - allowed_extensions ? - allowed_extensions : preferred_extensions)) { + if (!CreateContext(surface_id_ != 0)) { Destroy(); initialize_failed_ = true; return false; @@ -372,8 +367,7 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL( } bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer( - bool onscreen, - const char* allowed_extensions) { + bool onscreen) { if (!host_.get()) return false; // We need to lock g_all_shared_contexts to ensure that the context we picked @@ -407,7 +401,6 @@ bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer( command_buffer_.reset(host_->CreateViewCommandBuffer( surface_id_, share_group, - allowed_extensions, attribs, active_url_, gpu_preference_)); @@ -415,7 +408,6 @@ bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer( command_buffer_.reset(host_->CreateOffscreenCommandBuffer( gfx::Size(1, 1), share_group, - allowed_extensions, attribs, active_url_, gpu_preference_)); @@ -429,15 +421,12 @@ bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer( } bool WebGraphicsContext3DCommandBufferImpl::CreateContext( - bool onscreen, - const char* allowed_extensions) { - + bool onscreen) { // Ensure the gles2 library is initialized first in a thread safe way. g_gles2_initializer.Get(); if (!command_buffer_ && - !InitializeCommandBuffer(onscreen, - allowed_extensions)) { + !InitializeCommandBuffer(onscreen)) { return false; } @@ -499,7 +488,7 @@ bool WebGraphicsContext3DCommandBufferImpl::CreateContext( } bool WebGraphicsContext3DCommandBufferImpl::makeContextCurrent() { - if (!MaybeInitializeGL(NULL)) + if (!MaybeInitializeGL()) return false; gles2::SetGLContext(gl_); if (command_buffer_->GetLastError() != gpu::error::kNoError) diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h index 363ff62..e17a796 100644 --- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h @@ -671,11 +671,9 @@ class WebGraphicsContext3DCommandBufferImpl // and subsequent calls are ignored. Must be called from the thread that is // going to use this object to issue GL commands (which might not be the main // thread). - bool MaybeInitializeGL(const char* allowed_extensions); + bool MaybeInitializeGL(); - bool InitializeCommandBuffer( - bool onscreen, - const char* allowed_extensions); + bool InitializeCommandBuffer(bool onscreen); void Destroy(); @@ -692,8 +690,7 @@ class WebGraphicsContext3DCommandBufferImpl // allocate both fake PluginWindowHandles and NativeViewIds and map // from fake NativeViewIds to PluginWindowHandles, but this seems like // unnecessary complexity at the moment. - bool CreateContext(bool onscreen, - const char* allowed_extensions); + bool CreateContext(bool onscreen); // SwapBuffers callback. void OnSwapBuffersComplete(); diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc index 3078887..1876250 100644 --- a/content/common/gpu/gpu_channel.cc +++ b/content/common/gpu/gpu_channel.cc @@ -638,7 +638,6 @@ void GpuChannel::CreateViewCommandBuffer( image_manager_.get(), gfx::Size(), disallowed_features_, - init_params.allowed_extensions, init_params.attribs, init_params.gpu_preference, use_virtualized_gl_context, @@ -868,7 +867,6 @@ void GpuChannel::OnCreateOffscreenCommandBuffer( image_manager_.get(), size, disallowed_features_, - init_params.allowed_extensions, init_params.attribs, init_params.gpu_preference, false, diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index b5ee308..e86ef01 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -109,7 +109,6 @@ GpuCommandBufferStub::GpuCommandBufferStub( gpu::gles2::ImageManager* image_manager, const gfx::Size& size, const gpu::gles2::DisallowedFeatures& disallowed_features, - const std::string& allowed_extensions, const std::vector<int32>& attribs, gfx::GpuPreference gpu_preference, bool use_virtualized_gl_context, @@ -122,7 +121,6 @@ GpuCommandBufferStub::GpuCommandBufferStub( handle_(handle), initial_size_(size), disallowed_features_(disallowed_features), - allowed_extensions_(allowed_extensions), requested_attribs_(attribs), gpu_preference_(gpu_preference), use_virtualized_gl_context_(use_virtualized_gl_context), @@ -503,7 +501,6 @@ void GpuCommandBufferStub::OnInitialize( !surface_id(), initial_size_, disallowed_features_, - allowed_extensions_.c_str(), requested_attribs_)) { DLOG(ERROR) << "Failed to initialize decoder."; OnInitializeFailed(reply_message); diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index 505b026..292c20b 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -70,7 +70,6 @@ class GpuCommandBufferStub gpu::gles2::ImageManager* image_manager, const gfx::Size& size, const gpu::gles2::DisallowedFeatures& disallowed_features, - const std::string& allowed_extensions, const std::vector<int32>& attribs, gfx::GpuPreference gpu_preference, bool use_virtualized_gl_context, @@ -214,7 +213,6 @@ class GpuCommandBufferStub gfx::GLSurfaceHandle handle_; gfx::Size initial_size_; gpu::gles2::DisallowedFeatures disallowed_features_; - std::string allowed_extensions_; std::vector<int32> requested_attribs_; gfx::GpuPreference gpu_preference_; bool use_virtualized_gl_context_; diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index 033d00d..24d9946 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -40,7 +40,6 @@ IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig) IPC_STRUCT_MEMBER(int32, share_group_id) - IPC_STRUCT_MEMBER(std::string, allowed_extensions) IPC_STRUCT_MEMBER(std::vector<int>, attribs) IPC_STRUCT_MEMBER(GURL, active_url) IPC_STRUCT_MEMBER(gfx::GpuPreference, gpu_preference) diff --git a/content/renderer/pepper/pepper_platform_context_3d.cc b/content/renderer/pepper/pepper_platform_context_3d.cc index 1611e83..e080e16 100644 --- a/content/renderer/pepper/pepper_platform_context_3d.cc +++ b/content/renderer/pepper/pepper_platform_context_3d.cc @@ -96,7 +96,6 @@ bool PlatformContext3D::Init(const int32* attrib_list, command_buffer_ = channel_->CreateOffscreenCommandBuffer( surface_size, share_buffer, - "*", attribs, GURL::EmptyGURL(), gpu_preference); diff --git a/gpu/command_buffer/client/gl_in_process_context.cc b/gpu/command_buffer/client/gl_in_process_context.cc index a8e33b6..cf0c8a7 100644 --- a/gpu/command_buffer/client/gl_in_process_context.cc +++ b/gpu/command_buffer/client/gl_in_process_context.cc @@ -57,7 +57,6 @@ class GLInProcessContextImpl bool share_resources, gfx::AcceleratedWidget window, const gfx::Size& size, - const char* allowed_extensions, const GLInProcessContextAttribs& attribs, gfx::GpuPreference gpu_preference); @@ -153,7 +152,6 @@ bool GLInProcessContextImpl::Initialize( bool share_resources, gfx::AcceleratedWidget window, const gfx::Size& size, - const char* allowed_extensions, const GLInProcessContextAttribs& attribs, gfx::GpuPreference gpu_preference) { DCHECK(size.width() >= 0 && size.height() >= 0); @@ -233,7 +231,6 @@ bool GLInProcessContextImpl::Initialize( share_resources, window, size, - allowed_extensions, attrib_vector, gpu_preference, wrapped_callback, @@ -367,7 +364,6 @@ GLInProcessContext* GLInProcessContext::CreateContext( gfx::AcceleratedWidget window, const gfx::Size& size, bool share_resources, - const char* allowed_extensions, const GLInProcessContextAttribs& attribs, gfx::GpuPreference gpu_preference) { scoped_ptr<GLInProcessContextImpl> context( @@ -378,7 +374,6 @@ GLInProcessContext* GLInProcessContext::CreateContext( share_resources, window, size, - allowed_extensions, attribs, gpu_preference)) return NULL; @@ -390,7 +385,6 @@ GLInProcessContext* GLInProcessContext::CreateContext( GLInProcessContext* GLInProcessContext::CreateWithSurface( scoped_refptr<gfx::GLSurface> surface, bool share_resources, - const char* allowed_extensions, const GLInProcessContextAttribs& attribs, gfx::GpuPreference gpu_preference) { scoped_ptr<GLInProcessContextImpl> context( @@ -401,7 +395,6 @@ GLInProcessContext* GLInProcessContext::CreateWithSurface( share_resources, gfx::kNullAcceleratedWidget, surface->GetSize(), - allowed_extensions, attribs, gpu_preference)) return NULL; diff --git a/gpu/command_buffer/client/gl_in_process_context.h b/gpu/command_buffer/client/gl_in_process_context.h index 3fe82aa..1be0d9d 100644 --- a/gpu/command_buffer/client/gl_in_process_context.h +++ b/gpu/command_buffer/client/gl_in_process_context.h @@ -54,7 +54,6 @@ class GLES2_IMPL_EXPORT GLInProcessContext { gfx::AcceleratedWidget window, const gfx::Size& size, bool share_resources, - const char* allowed_extensions, const GLInProcessContextAttribs& attribs, gfx::GpuPreference gpu_preference); @@ -65,7 +64,6 @@ class GLES2_IMPL_EXPORT GLInProcessContext { static GLInProcessContext* CreateWithSurface( scoped_refptr<gfx::GLSurface> surface, bool share_resources, - const char* allowed_extensions, const GLInProcessContextAttribs& attribs, gfx::GpuPreference gpu_preference); diff --git a/gpu/command_buffer/service/buffer_manager_unittest.cc b/gpu/command_buffer/service/buffer_manager_unittest.cc index f6fb838..444c393 100644 --- a/gpu/command_buffer/service/buffer_manager_unittest.cc +++ b/gpu/command_buffer/service/buffer_manager_unittest.cc @@ -27,7 +27,7 @@ class BufferManagerTestBase : public testing::Test { ::gfx::GLInterface::SetGLInterface(gl_.get()); if (feature_info) { TestHelper::SetupFeatureInfoInitExpectations(gl_.get(), extensions); - feature_info->Initialize(NULL); + feature_info->Initialize(); } error_state_.reset(new MockErrorState()); manager_.reset(new BufferManager(memory_tracker, feature_info)); diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc index ac3f318..bb6ad71 100644 --- a/gpu/command_buffer/service/context_group.cc +++ b/gpu/command_buffer/service/context_group.cc @@ -77,15 +77,14 @@ static void GetIntegerv(GLenum pname, uint32* var) { bool ContextGroup::Initialize( GLES2Decoder* decoder, - const DisallowedFeatures& disallowed_features, - const char* allowed_features) { + const DisallowedFeatures& disallowed_features) { // If we've already initialized the group just add the context. if (HaveContexts()) { decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); return true; } - if (!feature_info_->Initialize(disallowed_features, allowed_features)) { + if (!feature_info_->Initialize(disallowed_features)) { LOG(ERROR) << "ContextGroup::Initialize failed because FeatureInfo " << "initialization failed."; return false; diff --git a/gpu/command_buffer/service/context_group.h b/gpu/command_buffer/service/context_group.h index 13d031a..dd236ff 100644 --- a/gpu/command_buffer/service/context_group.h +++ b/gpu/command_buffer/service/context_group.h @@ -54,8 +54,7 @@ class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { // call to destroy if it succeeds. bool Initialize( GLES2Decoder* decoder, - const DisallowedFeatures& disallowed_features, - const char* allowed_features); + const DisallowedFeatures& disallowed_features); // Destroys all the resources when called for the last context in the group. // It should only be called by GLES2Decoder. diff --git a/gpu/command_buffer/service/context_group_unittest.cc b/gpu/command_buffer/service/context_group_unittest.cc index c80f619..59bc796 100644 --- a/gpu/command_buffer/service/context_group_unittest.cc +++ b/gpu/command_buffer/service/context_group_unittest.cc @@ -72,7 +72,7 @@ TEST_F(ContextGroupTest, Basic) { TEST_F(ContextGroupTest, InitializeNoExtensions) { TestHelper::SetupContextGroupInitExpectations(gl_.get(), DisallowedFeatures(), ""); - group_->Initialize(decoder_.get(), DisallowedFeatures(), ""); + group_->Initialize(decoder_.get(), DisallowedFeatures()); EXPECT_EQ(static_cast<uint32>(TestHelper::kNumVertexAttribs), group_->max_vertex_attribs()); EXPECT_EQ(static_cast<uint32>(TestHelper::kNumTextureUnits), @@ -107,8 +107,8 @@ TEST_F(ContextGroupTest, MultipleContexts) { scoped_ptr<MockGLES2Decoder> decoder2_(new MockGLES2Decoder()); TestHelper::SetupContextGroupInitExpectations(gl_.get(), DisallowedFeatures(), ""); - group_->Initialize(decoder_.get(), DisallowedFeatures(), ""); - group_->Initialize(decoder2_.get(), DisallowedFeatures(), ""); + group_->Initialize(decoder_.get(), DisallowedFeatures()); + group_->Initialize(decoder2_.get(), DisallowedFeatures()); EXPECT_TRUE(group_->buffer_manager() != NULL); EXPECT_TRUE(group_->framebuffer_manager() != NULL); diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index 453b43d..eeeabd9 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc @@ -133,6 +133,22 @@ FeatureInfo::Workarounds::Workarounds() : } FeatureInfo::FeatureInfo() { + InitializeBasicState(*CommandLine::ForCurrentProcess()); +} + +FeatureInfo::FeatureInfo(const CommandLine& command_line) { + InitializeBasicState(command_line); +} + +void FeatureInfo::InitializeBasicState(const CommandLine& command_line) { + if (command_line.HasSwitch(switches::kGpuDriverBugWorkarounds)) { + std::string types = command_line.GetSwitchValueASCII( + switches::kGpuDriverBugWorkarounds); + StringToWorkarounds(types, &workarounds_); + } + feature_flags_.enable_shader_name_hashing = + !command_line.HasSwitch(switches::kDisableShaderNameHashing); + static const GLenum kAlphaTypes[] = { GL_UNSIGNED_BYTE, }; @@ -168,33 +184,23 @@ FeatureInfo::FeatureInfo() { } } -bool FeatureInfo::Initialize(const char* allowed_features) { +bool FeatureInfo::Initialize() { disallowed_features_ = DisallowedFeatures(); - AddFeatures(*CommandLine::ForCurrentProcess()); + InitializeFeatures(); return true; } -bool FeatureInfo::Initialize(const DisallowedFeatures& disallowed_features, - const char* allowed_features) { +bool FeatureInfo::Initialize(const DisallowedFeatures& disallowed_features) { disallowed_features_ = disallowed_features; - AddFeatures(*CommandLine::ForCurrentProcess()); + InitializeFeatures(); return true; } -void FeatureInfo::AddFeatures(const CommandLine& command_line) { +void FeatureInfo::InitializeFeatures() { // Figure out what extensions to turn on. StringSet extensions( reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); - if (command_line.HasSwitch(switches::kGpuDriverBugWorkarounds)) { - std::string types = command_line.GetSwitchValueASCII( - switches::kGpuDriverBugWorkarounds); - StringToWorkarounds(types, &workarounds_); - } - - feature_flags_.enable_shader_name_hashing = - !command_line.HasSwitch(switches::kDisableShaderNameHashing); - bool npot_ok = false; AddExtensionString("GL_ANGLE_translated_shader_source"); diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h index 8b33bb1..782b3a8 100644 --- a/gpu/command_buffer/service/feature_info.h +++ b/gpu/command_buffer/service/feature_info.h @@ -64,16 +64,15 @@ class GPU_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> { GLint max_cube_map_texture_size; }; + // Constructor with workarounds taken from the current process's CommandLine FeatureInfo(); - // If allowed features = NULL or "*", all features are allowed. Otherwise - // only features that match the strings in allowed_features are allowed. - bool Initialize(const char* allowed_features); - bool Initialize(const DisallowedFeatures& disallowed_features, - const char* allowed_features); + // Constructor with workarounds taken from |command_line| + FeatureInfo(const CommandLine& command_line); - // Turns on certain features if they can be turned on. - void AddFeatures(const CommandLine& command_line); + // Initializes the feature information. Needs a current GL context. + bool Initialize(); + bool Initialize(const DisallowedFeatures& disallowed_features); const Validators* validators() const { return &validators_; @@ -106,6 +105,8 @@ class GPU_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> { ~FeatureInfo(); void AddExtensionString(const std::string& str); + void InitializeBasicState(const CommandLine& command_line); + void InitializeFeatures(); Validators validators_; diff --git a/gpu/command_buffer/service/feature_info_unittest.cc b/gpu/command_buffer/service/feature_info_unittest.cc index 1d1cba4..97cc76b 100644 --- a/gpu/command_buffer/service/feature_info_unittest.cc +++ b/gpu/command_buffer/service/feature_info_unittest.cc @@ -45,13 +45,30 @@ class FeatureInfoTest : public testing::Test { const char* extensions, const char* version) { TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( gl_.get(), extensions, version); + info_ = new FeatureInfo(); + info_->Initialize(); + } + + void SetupWithCommandLine(const CommandLine& command_line) { + info_ = new FeatureInfo(command_line); + } + + void SetupInitExpectationsWithCommandLine( + const char* extensions, const CommandLine& command_line) { + TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( + gl_.get(), extensions, ""); + info_ = new FeatureInfo(command_line); + info_->Initialize(); + } + + void SetupWithoutInit() { + info_ = new FeatureInfo(); } protected: virtual void SetUp() { gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); ::gfx::GLInterface::SetGLInterface(gl_.get()); - info_ = new FeatureInfo(); } virtual void TearDown() { @@ -75,6 +92,7 @@ struct FormatInfo { } // anonymous namespace. TEST_F(FeatureInfoTest, Basic) { + SetupWithoutInit(); // Test it starts off uninitialized. EXPECT_FALSE(info_->feature_flags().chromium_framebuffer_multisample); EXPECT_FALSE(info_->feature_flags().multisampled_render_to_texture); @@ -199,7 +217,6 @@ TEST_F(FeatureInfoTest, Basic) { TEST_F(FeatureInfoTest, InitializeNoExtensions) { SetupInitExpectations(""); - info_->Initialize(NULL); // Check default extensions are there EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_resource_safe")); EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_strict_attribs")); @@ -272,21 +289,18 @@ TEST_F(FeatureInfoTest, InitializeNoExtensions) { TEST_F(FeatureInfoTest, InitializeNPOTExtensionGLES) { SetupInitExpectations("GL_OES_texture_npot"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_npot")); EXPECT_TRUE(info_->feature_flags().npot_ok); } TEST_F(FeatureInfoTest, InitializeNPOTExtensionGL) { SetupInitExpectations("GL_ARB_texture_non_power_of_two"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_npot")); EXPECT_TRUE(info_->feature_flags().npot_ok); } TEST_F(FeatureInfoTest, InitializeDXTExtensionGLES2) { SetupInitExpectations("GL_EXT_texture_compression_dxt1"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_compression_dxt1")); EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid( @@ -301,7 +315,6 @@ TEST_F(FeatureInfoTest, InitializeDXTExtensionGLES2) { TEST_F(FeatureInfoTest, InitializeDXTExtensionGL) { SetupInitExpectations("GL_EXT_texture_compression_s3tc"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_compression_dxt1")); EXPECT_THAT(info_->extensions(), @@ -320,7 +333,6 @@ TEST_F(FeatureInfoTest, InitializeDXTExtensionGL) { TEST_F(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888GLES2) { SetupInitExpectations("GL_EXT_texture_format_BGRA8888"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888")); EXPECT_TRUE(info_->validators()->texture_format.IsValid( @@ -333,7 +345,6 @@ TEST_F(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888GLES2) { TEST_F(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888GL) { SetupInitExpectations("GL_EXT_bgra"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888")); EXPECT_THAT(info_->extensions(), @@ -350,7 +361,6 @@ TEST_F(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888GL) { TEST_F(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888Apple) { SetupInitExpectations("GL_APPLE_texture_format_BGRA8888"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_format_BGRA8888")); EXPECT_TRUE(info_->validators()->texture_format.IsValid( @@ -363,7 +373,6 @@ TEST_F(FeatureInfoTest, InitializeEXT_texture_format_BGRA8888Apple) { TEST_F(FeatureInfoTest, InitializeEXT_read_format_bgra) { SetupInitExpectations("GL_EXT_read_format_bgra"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_read_format_bgra")); EXPECT_FALSE(info_->validators()->texture_format.IsValid( @@ -376,7 +385,6 @@ TEST_F(FeatureInfoTest, InitializeEXT_read_format_bgra) { TEST_F(FeatureInfoTest, InitializeOES_texture_floatGLES2) { SetupInitExpectations("GL_OES_texture_float"); - info_->Initialize(NULL); EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear); EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_float")); @@ -411,7 +419,6 @@ TEST_F(FeatureInfoTest, InitializeOES_texture_floatGLES2) { TEST_F(FeatureInfoTest, InitializeOES_texture_float_linearGLES2) { SetupInitExpectations("GL_OES_texture_float GL_OES_texture_float_linear"); - info_->Initialize(NULL); EXPECT_TRUE(info_->feature_flags().enable_texture_float_linear); EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_texture_float")); @@ -445,7 +452,6 @@ TEST_F(FeatureInfoTest, InitializeOES_texture_float_linearGLES2) { TEST_F(FeatureInfoTest, InitializeOES_texture_half_floatGLES2) { SetupInitExpectations("GL_OES_texture_half_float"); - info_->Initialize(NULL); EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear); EXPECT_FALSE(info_->feature_flags().enable_texture_half_float_linear); EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_float"))); @@ -481,7 +487,6 @@ TEST_F(FeatureInfoTest, InitializeOES_texture_half_floatGLES2) { TEST_F(FeatureInfoTest, InitializeOES_texture_half_float_linearGLES2) { SetupInitExpectations( "GL_OES_texture_half_float GL_OES_texture_half_float_linear"); - info_->Initialize(NULL); EXPECT_FALSE(info_->feature_flags().enable_texture_float_linear); EXPECT_TRUE(info_->feature_flags().enable_texture_half_float_linear); EXPECT_THAT(info_->extensions(), Not(HasSubstr("GL_OES_texture_float"))); @@ -516,7 +521,6 @@ TEST_F(FeatureInfoTest, InitializeOES_texture_half_float_linearGLES2) { TEST_F(FeatureInfoTest, InitializeEXT_framebuffer_multisample) { SetupInitExpectations("GL_EXT_framebuffer_multisample"); - info_->Initialize(NULL); EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample); EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_framebuffer_multisample")); @@ -534,7 +538,6 @@ TEST_F(FeatureInfoTest, InitializeEXT_framebuffer_multisample) { TEST_F(FeatureInfoTest, InitializeEXT_multisampled_render_to_texture) { SetupInitExpectations("GL_EXT_multisampled_render_to_texture"); - info_->Initialize(NULL); EXPECT_TRUE(info_->feature_flags( ).multisampled_render_to_texture); EXPECT_FALSE(info_->feature_flags( @@ -551,7 +554,6 @@ TEST_F(FeatureInfoTest, InitializeEXT_multisampled_render_to_texture) { TEST_F(FeatureInfoTest, InitializeIMG_multisampled_render_to_texture) { SetupInitExpectations("GL_IMG_multisampled_render_to_texture"); - info_->Initialize(NULL); EXPECT_TRUE(info_->feature_flags( ).use_img_for_multisampled_render_to_texture); EXPECT_TRUE(info_->feature_flags( @@ -568,7 +570,6 @@ TEST_F(FeatureInfoTest, InitializeIMG_multisampled_render_to_texture) { TEST_F(FeatureInfoTest, InitializeEXT_texture_filter_anisotropic) { SetupInitExpectations("GL_EXT_texture_filter_anisotropic"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_texture_filter_anisotropic")); EXPECT_TRUE(info_->validators()->texture_parameter.IsValid( @@ -579,7 +580,6 @@ TEST_F(FeatureInfoTest, InitializeEXT_texture_filter_anisotropic) { TEST_F(FeatureInfoTest, InitializeEXT_ARB_depth_texture) { SetupInitExpectations("GL_ARB_depth_texture"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_GOOGLE_depth_texture")); EXPECT_THAT(info_->extensions(), @@ -600,7 +600,6 @@ TEST_F(FeatureInfoTest, InitializeEXT_ARB_depth_texture) { TEST_F(FeatureInfoTest, InitializeOES_ARB_depth_texture) { SetupInitExpectations("GL_OES_depth_texture"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_GOOGLE_depth_texture")); EXPECT_THAT(info_->extensions(), @@ -621,7 +620,6 @@ TEST_F(FeatureInfoTest, InitializeOES_ARB_depth_texture) { TEST_F(FeatureInfoTest, InitializeANGLE_depth_texture) { SetupInitExpectations("GL_ANGLE_depth_texture"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_GOOGLE_depth_texture")); EXPECT_THAT(info_->extensions(), @@ -650,7 +648,6 @@ TEST_F(FeatureInfoTest, InitializeANGLE_depth_texture) { TEST_F(FeatureInfoTest, InitializeEXT_packed_depth_stencil) { SetupInitExpectations("GL_EXT_packed_depth_stencil"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_packed_depth_stencil")); EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid( @@ -664,7 +661,6 @@ TEST_F(FeatureInfoTest, InitializeEXT_packed_depth_stencil) { TEST_F(FeatureInfoTest, InitializeOES_packed_depth_stencil) { SetupInitExpectations("GL_OES_packed_depth_stencil"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_packed_depth_stencil")); EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid( @@ -679,7 +675,6 @@ TEST_F(FeatureInfoTest, InitializeOES_packed_depth_stencil) { TEST_F(FeatureInfoTest, InitializeOES_packed_depth_stencil_and_GL_ARB_depth_texture) { SetupInitExpectations("GL_OES_packed_depth_stencil GL_ARB_depth_texture"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_packed_depth_stencil")); EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid( @@ -700,7 +695,6 @@ TEST_F(FeatureInfoTest, TEST_F(FeatureInfoTest, InitializeOES_depth24) { SetupInitExpectations("GL_OES_depth24"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_depth24")); EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid( GL_DEPTH_COMPONENT24)); @@ -708,7 +702,6 @@ TEST_F(FeatureInfoTest, InitializeOES_depth24) { TEST_F(FeatureInfoTest, InitializeOES_standard_derivatives) { SetupInitExpectations("GL_OES_standard_derivatives"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_standard_derivatives")); EXPECT_TRUE(info_->feature_flags().oes_standard_derivatives); EXPECT_TRUE(info_->validators()->hint_target.IsValid( @@ -719,7 +712,6 @@ TEST_F(FeatureInfoTest, InitializeOES_standard_derivatives) { TEST_F(FeatureInfoTest, InitializeOES_rgb8_rgba8) { SetupInitExpectations("GL_OES_rgb8_rgba8"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_rgb8_rgba8")); EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid( @@ -730,7 +722,6 @@ TEST_F(FeatureInfoTest, InitializeOES_rgb8_rgba8) { TEST_F(FeatureInfoTest, InitializeOES_EGL_image_external) { SetupInitExpectations("GL_OES_EGL_image_external"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_EGL_image_external")); EXPECT_TRUE(info_->feature_flags().oes_egl_image_external); @@ -746,7 +737,6 @@ TEST_F(FeatureInfoTest, InitializeOES_EGL_image_external) { TEST_F(FeatureInfoTest, InitializeOES_compressed_ETC1_RGB8_texture) { SetupInitExpectations("GL_OES_compressed_ETC1_RGB8_texture"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_compressed_ETC1_RGB8_texture")); EXPECT_TRUE(info_->validators()->compressed_texture_format.IsValid( @@ -757,7 +747,6 @@ TEST_F(FeatureInfoTest, InitializeOES_compressed_ETC1_RGB8_texture) { TEST_F(FeatureInfoTest, InitializeCHROMIUM_stream_texture) { SetupInitExpectations("GL_CHROMIUM_stream_texture"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_stream_texture")); EXPECT_TRUE(info_->feature_flags().chromium_stream_texture); @@ -765,7 +754,6 @@ TEST_F(FeatureInfoTest, InitializeCHROMIUM_stream_texture) { TEST_F(FeatureInfoTest, InitializeEXT_occlusion_query_boolean) { SetupInitExpectations("GL_EXT_occlusion_query_boolean"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_occlusion_query_boolean")); EXPECT_TRUE(info_->feature_flags().occlusion_query_boolean); @@ -777,7 +765,6 @@ TEST_F(FeatureInfoTest, InitializeEXT_occlusion_query_boolean) { TEST_F(FeatureInfoTest, InitializeARB_occlusion_query) { SetupInitExpectations("GL_ARB_occlusion_query"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_occlusion_query_boolean")); EXPECT_TRUE(info_->feature_flags().occlusion_query_boolean); @@ -789,7 +776,6 @@ TEST_F(FeatureInfoTest, InitializeARB_occlusion_query) { TEST_F(FeatureInfoTest, InitializeARB_occlusion_query2) { SetupInitExpectations("GL_ARB_occlusion_query2 GL_ARB_occlusion_query2"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_occlusion_query_boolean")); EXPECT_TRUE(info_->feature_flags().occlusion_query_boolean); @@ -801,7 +787,6 @@ TEST_F(FeatureInfoTest, InitializeARB_occlusion_query2) { TEST_F(FeatureInfoTest, InitializeOES_vertex_array_object) { SetupInitExpectations("GL_OES_vertex_array_object"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_vertex_array_object")); EXPECT_TRUE(info_->feature_flags().native_vertex_array_object); @@ -809,7 +794,6 @@ TEST_F(FeatureInfoTest, InitializeOES_vertex_array_object) { TEST_F(FeatureInfoTest, InitializeARB_vertex_array_object) { SetupInitExpectations("GL_ARB_vertex_array_object"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_vertex_array_object")); EXPECT_TRUE(info_->feature_flags().native_vertex_array_object); @@ -817,7 +801,6 @@ TEST_F(FeatureInfoTest, InitializeARB_vertex_array_object) { TEST_F(FeatureInfoTest, InitializeAPPLE_vertex_array_object) { SetupInitExpectations("GL_APPLE_vertex_array_object"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_vertex_array_object")); EXPECT_TRUE(info_->feature_flags().native_vertex_array_object); @@ -825,7 +808,6 @@ TEST_F(FeatureInfoTest, InitializeAPPLE_vertex_array_object) { TEST_F(FeatureInfoTest, InitializeNo_vertex_array_object) { SetupInitExpectations(""); - info_->Initialize(NULL); // Even if the native extensions are not available the implementation // may still emulate the GL_OES_vertex_array_object functionality. In this // scenario native_vertex_array_object must be false. @@ -836,39 +818,35 @@ TEST_F(FeatureInfoTest, InitializeNo_vertex_array_object) { TEST_F(FeatureInfoTest, InitializeOES_element_index_uint) { SetupInitExpectations("GL_OES_element_index_uint"); - info_->Initialize(NULL); EXPECT_THAT(info_->extensions(), HasSubstr("GL_OES_element_index_uint")); EXPECT_TRUE(info_->validators()->index_type.IsValid(GL_UNSIGNED_INT)); } TEST_F(FeatureInfoTest, InitializeVAOsWithClientSideArrays) { - SetupInitExpectations("GL_OES_vertex_array_object"); CommandLine command_line(0, NULL); command_line.AppendSwitchASCII( switches::kGpuDriverBugWorkarounds, base::IntToString(gpu::USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); - info_->AddFeatures(command_line); + SetupInitExpectationsWithCommandLine("GL_OES_vertex_array_object", + command_line); EXPECT_TRUE(info_->workarounds().use_client_side_arrays_for_stream_buffers); EXPECT_FALSE(info_->feature_flags().native_vertex_array_object); } TEST_F(FeatureInfoTest, InitializeEXT_frag_depth) { SetupInitExpectations("GL_EXT_frag_depth"); - info_->Initialize(NULL); EXPECT_TRUE(info_->feature_flags().ext_frag_depth); EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_frag_depth")); } TEST_F(FeatureInfoTest, InitializeSamplersWithARBSamplerObjects) { SetupInitExpectationsWithGLVersion("GL_ARB_sampler_objects", "OpenGL 3.0"); - info_->Initialize(NULL); EXPECT_TRUE(info_->feature_flags().enable_samplers); } TEST_F(FeatureInfoTest, InitializeWithES3) { SetupInitExpectationsWithGLVersion("", "OpenGL ES 3.0"); - info_->Initialize(NULL); EXPECT_TRUE(info_->feature_flags().enable_samplers); EXPECT_TRUE(info_->feature_flags().map_buffer_range); EXPECT_FALSE(info_->feature_flags().use_async_readpixels); @@ -876,39 +854,33 @@ TEST_F(FeatureInfoTest, InitializeWithES3) { TEST_F(FeatureInfoTest, InitializeWithoutSamplers) { SetupInitExpectationsWithGLVersion("", "OpenGL GL 3.0"); - info_->Initialize(NULL); EXPECT_FALSE(info_->feature_flags().enable_samplers); } TEST_F(FeatureInfoTest, InitializeWithES3AndFences) { SetupInitExpectationsWithGLVersion("EGL_KHR_fence_sync", "OpenGL ES 3.0"); - info_->Initialize(NULL); EXPECT_TRUE(info_->feature_flags().use_async_readpixels); } TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsSingle) { - SetupInitExpectations(""); CommandLine command_line(0, NULL); command_line.AppendSwitchASCII( switches::kGpuDriverBugWorkarounds, base::IntToString(gpu::EXIT_ON_CONTEXT_LOST)); - EXPECT_FALSE(info_->workarounds().exit_on_context_lost); - info_->AddFeatures(command_line); + // Workarounds should get parsed without the need for a context. + SetupWithCommandLine(command_line); EXPECT_TRUE(info_->workarounds().exit_on_context_lost); } TEST_F(FeatureInfoTest, ParseDriverBugWorkaroundsMultiple) { - SetupInitExpectations(""); CommandLine command_line(0, NULL); command_line.AppendSwitchASCII( switches::kGpuDriverBugWorkarounds, base::IntToString(gpu::EXIT_ON_CONTEXT_LOST) + "," + base::IntToString(gpu::MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024) + "," + base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096)); - EXPECT_FALSE(info_->workarounds().exit_on_context_lost); - EXPECT_EQ(0, info_->workarounds().max_cube_map_texture_size); - EXPECT_EQ(0, info_->workarounds().max_texture_size); - info_->AddFeatures(command_line); + // Workarounds should get parsed without the need for a context. + SetupWithCommandLine(command_line); EXPECT_TRUE(info_->workarounds().exit_on_context_lost); EXPECT_EQ(1024, info_->workarounds().max_cube_map_texture_size); EXPECT_EQ(4096, info_->workarounds().max_texture_size); diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 1489fc6..050010f 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -541,7 +541,6 @@ class GLES2DecoderImpl : public GLES2Decoder { bool offscreen, const gfx::Size& size, const DisallowedFeatures& disallowed_features, - const char* allowed_extensions, const std::vector<int32>& attribs) OVERRIDE; virtual void Destroy(bool have_context) OVERRIDE; virtual void SetSurface( @@ -2121,7 +2120,6 @@ bool GLES2DecoderImpl::Initialize( bool offscreen, const gfx::Size& size, const DisallowedFeatures& disallowed_features, - const char* allowed_extensions, const std::vector<int32>& attribs) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); DCHECK(context->IsCurrent(surface.get())); @@ -2149,7 +2147,7 @@ bool GLES2DecoderImpl::Initialize( context_ = context; surface_ = surface; - if (!group_->Initialize(this, disallowed_features, allowed_extensions)) { + if (!group_->Initialize(this, disallowed_features)) { LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " << "failed to initialize."; group_ = NULL; // Must not destroy ContextGroup if it is not initialized. @@ -8720,7 +8718,7 @@ error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( const cmds::GetRequestableExtensionsCHROMIUM& c) { Bucket* bucket = CreateBucket(c.bucket_id); scoped_refptr<FeatureInfo> info(new FeatureInfo()); - info->Initialize(disallowed_features_, NULL); + info->Initialize(disallowed_features_); bucket->SetFromString(info->extensions().c_str()); return error::kNoError; } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h index 57445c7..e518702 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder.h @@ -103,9 +103,6 @@ class GPU_EXPORT GLES2Decoder : public base::SupportsWeakPtr<GLES2Decoder>, // bound, offscreen contexts render to an internal buffer, onscreen ones // to the surface. // size: the size if the GL context is offscreen. - // allowed_extensions: A string in the same format as - // glGetString(GL_EXTENSIONS) that lists the extensions this context - // should allow. Passing NULL or "*" means allow all extensions. // Returns: // true if successful. virtual bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, @@ -113,7 +110,6 @@ class GPU_EXPORT GLES2Decoder : public base::SupportsWeakPtr<GLES2Decoder>, bool offscreen, const gfx::Size& size, const DisallowedFeatures& disallowed_features, - const char* allowed_extensions, const std::vector<int32>& attribs) = 0; // Destroys the graphics context. diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h index e6c497f..e993a5e 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h @@ -34,13 +34,12 @@ class MockGLES2Decoder : public GLES2Decoder { MockGLES2Decoder(); virtual ~MockGLES2Decoder(); - MOCK_METHOD7(Initialize, + MOCK_METHOD6(Initialize, bool(const scoped_refptr<gfx::GLSurface>& surface, const scoped_refptr<gfx::GLContext>& context, bool offscreen, const gfx::Size& size, const DisallowedFeatures& disallowed_features, - const char* allowed_extensions, const std::vector<int32>& attribs)); MOCK_METHOD1(Destroy, void(bool have_context)); MOCK_METHOD1(SetSurface, void(const scoped_refptr<gfx::GLSurface>& surface)); diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc index e2e3551..3ce4520 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -119,7 +119,7 @@ void GLES2DecoderTestBase::InitDecoder( // will initialize itself. mock_decoder_.reset(new MockGLES2Decoder()); EXPECT_TRUE( - group_->Initialize(mock_decoder_.get(), DisallowedFeatures(), NULL)); + group_->Initialize(mock_decoder_.get(), DisallowedFeatures())); AddExpectationsForVertexAttribManager(); @@ -267,9 +267,12 @@ void GLES2DecoderTestBase::InitDecoder( decoder_.reset(GLES2Decoder::Create(group_.get())); decoder_->GetLogger()->set_log_synthesized_gl_errors(false); - decoder_->Initialize( - surface_, context_, false, surface_->GetSize(), DisallowedFeatures(), - NULL, attribs); + decoder_->Initialize(surface_, + context_, + false, + surface_->GetSize(), + DisallowedFeatures(), + attribs); decoder_->MakeCurrent(); decoder_->set_engine(engine_.get()); diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc index 3c1249a..972533c 100644 --- a/gpu/command_buffer/service/in_process_command_buffer.cc +++ b/gpu/command_buffer/service/in_process_command_buffer.cc @@ -299,7 +299,6 @@ bool InProcessCommandBuffer::Initialize( bool share_resources, gfx::AcceleratedWidget window, const gfx::Size& size, - const char* allowed_extensions, const std::vector<int32>& attribs, gfx::GpuPreference gpu_preference, const base::Closure& context_lost_callback, @@ -322,7 +321,6 @@ bool InProcessCommandBuffer::Initialize( is_offscreen, window, size, - allowed_extensions, attribs, gpu_preference); @@ -338,7 +336,6 @@ bool InProcessCommandBuffer::InitializeOnGpuThread( bool is_offscreen, gfx::AcceleratedWidget window, const gfx::Size& size, - const char* allowed_extensions, const std::vector<int32>& attribs, gfx::GpuPreference gpu_preference) { CheckSequencedThread(); @@ -465,7 +462,6 @@ bool InProcessCommandBuffer::InitializeOnGpuThread( is_offscreen, size, disallowed_features, - allowed_extensions, attribs)) { LOG(ERROR) << "Could not initialize decoder."; DestroyOnGpuThread(); diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h index 64b466f..e63e11a 100644 --- a/gpu/command_buffer/service/in_process_command_buffer.h +++ b/gpu/command_buffer/service/in_process_command_buffer.h @@ -82,7 +82,6 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, bool share_resources, gfx::AcceleratedWidget window, const gfx::Size& size, - const char* allowed_extensions, const std::vector<int32>& attribs, gfx::GpuPreference gpu_preference, const base::Closure& context_lost_callback, @@ -134,7 +133,6 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, bool InitializeOnGpuThread(bool is_offscreen, gfx::AcceleratedWidget window, const gfx::Size& size, - const char* allowed_extensions, const std::vector<int32>& attribs, gfx::GpuPreference gpu_preference); bool DestroyOnGpuThread(); diff --git a/gpu/command_buffer/service/query_manager_unittest.cc b/gpu/command_buffer/service/query_manager_unittest.cc index 63ad4f5..0c08293 100644 --- a/gpu/command_buffer/service/query_manager_unittest.cc +++ b/gpu/command_buffer/service/query_manager_unittest.cc @@ -47,7 +47,7 @@ class QueryManagerTest : public testing::Test { gl_.get(), "GL_EXT_occlusion_query_boolean"); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize("*"); + feature_info->Initialize(); manager_.reset(new QueryManager(decoder_.get(), feature_info.get())); } @@ -474,7 +474,7 @@ TEST_F(QueryManagerTest, ARBOcclusionQuery2) { gl_.get(), "GL_ARB_occlusion_query2"); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize("*"); + feature_info->Initialize(); scoped_ptr<QueryManager> manager( new QueryManager(decoder_.get(), feature_info.get())); @@ -508,7 +508,7 @@ TEST_F(QueryManagerTest, ARBOcclusionQuery) { gl_.get(), "GL_ARB_occlusion_query"); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize("*"); + feature_info->Initialize(); scoped_ptr<QueryManager> manager( new QueryManager(decoder_.get(), feature_info.get())); @@ -537,7 +537,7 @@ TEST_F(QueryManagerTest, GetErrorQuery) { TestHelper::SetupFeatureInfoInitExpectations(gl_.get(), ""); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize("*"); + feature_info->Initialize(); scoped_ptr<QueryManager> manager( new QueryManager(decoder_.get(), feature_info.get())); diff --git a/gpu/command_buffer/service/texture_manager_unittest.cc b/gpu/command_buffer/service/texture_manager_unittest.cc index 402cc8d..483aaf2 100644 --- a/gpu/command_buffer/service/texture_manager_unittest.cc +++ b/gpu/command_buffer/service/texture_manager_unittest.cc @@ -318,7 +318,7 @@ TEST_F(TextureManagerTest, ValidForTargetNPOT) { TestHelper::SetupFeatureInfoInitExpectations( gl_.get(), "GL_OES_texture_npot"); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize(NULL); + feature_info->Initialize(); TextureManager manager( NULL, feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); // Check NPOT width on level 0 @@ -356,7 +356,7 @@ class TextureTestBase : public testing::Test { if (!extensions.empty()) { TestHelper::SetupFeatureInfoInitExpectations(gl_.get(), extensions.c_str()); - feature_info_->Initialize(NULL); + feature_info_->Initialize(); } manager_.reset(new TextureManager( @@ -796,7 +796,7 @@ TEST_F(TextureTest, NPOT2DNPOTOK) { TestHelper::SetupFeatureInfoInitExpectations( gl_.get(), "GL_OES_texture_npot"); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize(NULL); + feature_info->Initialize(); TextureManager manager( NULL, feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); manager.CreateTexture(kClient1Id, kService1Id); @@ -1087,7 +1087,7 @@ TEST_F(TextureTest, FloatNotLinear) { TestHelper::SetupFeatureInfoInitExpectations( gl_.get(), "GL_OES_texture_float"); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize(NULL); + feature_info->Initialize(); TextureManager manager( NULL, feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); manager.CreateTexture(kClient1Id, kService1Id); @@ -1114,7 +1114,7 @@ TEST_F(TextureTest, FloatLinear) { TestHelper::SetupFeatureInfoInitExpectations( gl_.get(), "GL_OES_texture_float GL_OES_texture_float_linear"); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize(NULL); + feature_info->Initialize(); TextureManager manager( NULL, feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); manager.CreateTexture(kClient1Id, kService1Id); @@ -1133,7 +1133,7 @@ TEST_F(TextureTest, HalfFloatNotLinear) { TestHelper::SetupFeatureInfoInitExpectations( gl_.get(), "GL_OES_texture_half_float"); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize(NULL); + feature_info->Initialize(); TextureManager manager( NULL, feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); manager.CreateTexture(kClient1Id, kService1Id); @@ -1160,7 +1160,7 @@ TEST_F(TextureTest, HalfFloatLinear) { TestHelper::SetupFeatureInfoInitExpectations( gl_.get(), "GL_OES_texture_half_float GL_OES_texture_half_float_linear"); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize(NULL); + feature_info->Initialize(); TextureManager manager( NULL, feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); manager.CreateTexture(kClient1Id, kService1Id); @@ -1179,7 +1179,7 @@ TEST_F(TextureTest, EGLImageExternal) { TestHelper::SetupFeatureInfoInitExpectations( gl_.get(), "GL_OES_EGL_image_external"); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize(NULL); + feature_info->Initialize(); TextureManager manager( NULL, feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); manager.CreateTexture(kClient1Id, kService1Id); @@ -1196,7 +1196,7 @@ TEST_F(TextureTest, DepthTexture) { TestHelper::SetupFeatureInfoInitExpectations( gl_.get(), "GL_ANGLE_depth_texture"); scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); - feature_info->Initialize(NULL); + feature_info->Initialize(); TextureManager manager( NULL, feature_info.get(), kMaxTextureSize, kMaxCubeMapTextureSize); manager.CreateTexture(kClient1Id, kService1Id); diff --git a/gpu/command_buffer/tests/gl_manager.cc b/gpu/command_buffer/tests/gl_manager.cc index 82a01f0..4568c53 100644 --- a/gpu/command_buffer/tests/gl_manager.cc +++ b/gpu/command_buffer/tests/gl_manager.cc @@ -107,7 +107,6 @@ void GLManager::Initialize(const GLManager::Options& options) { share_group ? share_group : new gfx::GLShareGroup; gfx::GpuPreference gpu_preference(gfx::PreferDiscreteGpu); - const char* allowed_extensions = "*"; std::vector<int32> attribs; gles2::ContextCreationAttribHelper attrib_helper; attrib_helper.red_size_ = 8; @@ -172,7 +171,6 @@ void GLManager::Initialize(const GLManager::Options& options) { true, options.size, ::gpu::gles2::DisallowedFeatures(), - allowed_extensions, attribs)) << "could not initialize decoder"; command_buffer_->SetPutOffsetChangeCallback( diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc index 7de9e36..87bd809 100644 --- a/gpu/gles2_conform_support/egl/display.cc +++ b/gpu/gles2_conform_support/egl/display.cc @@ -165,7 +165,6 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config, gl_surface_->IsOffscreen(), size, gpu::gles2::DisallowedFeatures(), - NULL, attribs)) { return EGL_NO_SURFACE; } diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc index 9207ef9..6ef1a7f 100644 --- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc +++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc @@ -148,8 +148,6 @@ bool WebGraphicsContext3DInProcessCommandBufferImpl::MaybeInitializeGL() { g_gles2_initializer.Get(); if (!context_) { - const char* preferred_extensions = "*"; - // TODO(kbr): More work will be needed in this implementation to // properly support GPU switching. Like in the out-of-process // command buffer implementation, all previously created contexts @@ -165,7 +163,6 @@ bool WebGraphicsContext3DInProcessCommandBufferImpl::MaybeInitializeGL() { window_, gfx::Size(1, 1), attributes_.shareResources, - preferred_extensions, attrib_struct, gpu_preference)); } |