diff options
author | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-12 00:33:42 +0000 |
---|---|---|
committer | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-12 00:33:42 +0000 |
commit | 32fc6ab6167aa03a7197d37aea94e3ee98d70c59 (patch) | |
tree | edbf41f0b79362ecced16a82dd4e459200eacace /gpu | |
parent | ec029c308d1a7b64f8ae0981023ffb7acbb10bff (diff) | |
download | chromium_src-32fc6ab6167aa03a7197d37aea94e3ee98d70c59.zip chromium_src-32fc6ab6167aa03a7197d37aea94e3ee98d70c59.tar.gz chromium_src-32fc6ab6167aa03a7197d37aea94e3ee98d70c59.tar.bz2 |
Connect up --disable-gl-multisampling to command buffer
Plumb the --disable-gl-multisampling flag in to the command buffer, so it won't report the extension to any consumers.
BUG=75181
TEST=webgl antialias test
Review URL: http://codereview.chromium.org/6623063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77899 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
18 files changed, 114 insertions, 56 deletions
diff --git a/gpu/command_buffer/client/gles2_demo.cc b/gpu/command_buffer/client/gles2_demo.cc index 05c0003..962cd332 100644 --- a/gpu/command_buffer/client/gles2_demo.cc +++ b/gpu/command_buffer/client/gles2_demo.cc @@ -59,6 +59,7 @@ bool GLES2Demo::Setup(void* hwnd, int32 size) { GPUProcessor* gpu_processor = new GPUProcessor(command_buffer.get(), NULL); if (!gpu_processor->Initialize(reinterpret_cast<HWND>(hwnd), gfx::Size(), + gpu::gles2::DisallowedExtensions(), NULL, std::vector<int32>(), NULL, diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc index b542d51..764cc64 100644 --- a/gpu/command_buffer/service/context_group.cc +++ b/gpu/command_buffer/service/context_group.cc @@ -7,6 +7,7 @@ #include "gpu/command_buffer/common/id_allocator.h" #include "gpu/command_buffer/service/buffer_manager.h" #include "gpu/command_buffer/service/framebuffer_manager.h" +#include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "gpu/command_buffer/service/program_manager.h" #include "gpu/command_buffer/service/renderbuffer_manager.h" #include "gpu/command_buffer/service/shader_manager.h" @@ -38,12 +39,13 @@ static void GetIntegerv(GLenum pname, uint32* var) { *var = value; } -bool ContextGroup::Initialize(const char* allowed_features) { +bool ContextGroup::Initialize(const DisallowedExtensions& disallowed_extensions, + const char* allowed_features) { if (initialized_) { return true; } - if (!feature_info_.Initialize(allowed_features)) { + if (!feature_info_.Initialize(disallowed_extensions, allowed_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 f3ae4b7..80b2e46 100644 --- a/gpu/command_buffer/service/context_group.h +++ b/gpu/command_buffer/service/context_group.h @@ -27,6 +27,7 @@ class RenderbufferManager; class ProgramManager; class ShaderManager; class TextureManager; +struct DisallowedExtensions; // A Context Group helps manage multiple GLES2Decoders that share // resources. @@ -38,7 +39,8 @@ class ContextGroup : public base::RefCounted<ContextGroup> { ~ContextGroup(); // This should only be called by GLES2Decoder. - bool Initialize(const char* allowed_features); + bool Initialize(const DisallowedExtensions& disallowed_extensions, + const char* allowed_features); // Sets the ContextGroup has having a lost context. void set_have_context(bool have_context) { diff --git a/gpu/command_buffer/service/context_group_unittest.cc b/gpu/command_buffer/service/context_group_unittest.cc index 78accf9..19d8522 100644 --- a/gpu/command_buffer/service/context_group_unittest.cc +++ b/gpu/command_buffer/service/context_group_unittest.cc @@ -71,8 +71,9 @@ TEST_F(ContextGroupTest, Basic) { } TEST_F(ContextGroupTest, InitializeNoExtensions) { - TestHelper::SetupContextGroupInitExpectations(gl_.get(), ""); - group_->Initialize(""); + TestHelper::SetupContextGroupInitExpectations(gl_.get(), + DisallowedExtensions(), ""); + group_->Initialize(DisallowedExtensions(), ""); EXPECT_EQ(static_cast<uint32>(TestHelper::kNumVertexAttribs), group_->max_vertex_attribs()); EXPECT_EQ(static_cast<uint32>(TestHelper::kNumTextureUnits), diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index ad85737..7a38bf3 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc @@ -79,6 +79,14 @@ class ExtensionHelper { }; bool FeatureInfo::Initialize(const char* allowed_features) { + disallowed_extensions_ = DisallowedExtensions(); + AddFeatures(allowed_features); + return true; +} + +bool FeatureInfo::Initialize(const DisallowedExtensions& disallowed_extensions, + const char* allowed_features) { + disallowed_extensions_ = disallowed_extensions; AddFeatures(allowed_features); return true; } @@ -275,7 +283,8 @@ void FeatureInfo::AddFeatures(const char* desired_features) { } // Check for multisample support - if (ext.Desire("GL_CHROMIUM_framebuffer_multisample") && + if (!disallowed_extensions_.multisampling && + ext.Desire("GL_CHROMIUM_framebuffer_multisample") && (ext.Have("GL_EXT_framebuffer_multisample") || ext.Have("GL_ANGLE_framebuffer_multisample"))) { feature_flags_.chromium_framebuffer_multisample = true; diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h index a11aa70..4eb80cc 100644 --- a/gpu/command_buffer/service/feature_info.h +++ b/gpu/command_buffer/service/feature_info.h @@ -6,6 +6,7 @@ #define GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ #include <string> +#include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "gpu/command_buffer/service/gles2_cmd_validation.h" namespace gpu { @@ -37,6 +38,8 @@ class 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 DisallowedExtensions& disallowed_extensions, + const char* allowed_features); // Turns on certain features if they can be turned on. NULL turns on // all available features. @@ -59,6 +62,8 @@ class FeatureInfo { Validators validators_; + DisallowedExtensions disallowed_extensions_; + // The extensions string returned by glGetString(GL_EXTENSIONS); std::string extensions_; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index b42c220..0d9f326 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -670,6 +670,7 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, // Overridden from GLES2Decoder. virtual bool Initialize(gfx::GLContext* context, const gfx::Size& size, + const DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, const std::vector<int32>& attribs, GLES2Decoder* parent, @@ -1442,6 +1443,8 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, scoped_ptr<ShaderTranslator> vertex_translator_; scoped_ptr<ShaderTranslator> fragment_translator_; + DisallowedExtensions disallowed_extensions_; + // Cached from ContextGroup const Validators* validators_; FeatureInfo* feature_info_; @@ -1787,12 +1790,14 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) } } -bool GLES2DecoderImpl::Initialize(gfx::GLContext* context, - const gfx::Size& size, - const char* allowed_extensions, - const std::vector<int32>& attribs, - GLES2Decoder* parent, - uint32 parent_client_texture_id) { +bool GLES2DecoderImpl::Initialize( + gfx::GLContext* context, + const gfx::Size& size, + const DisallowedExtensions& disallowed_extensions, + const char* allowed_extensions, + const std::vector<int32>& attribs, + GLES2Decoder* parent, + uint32 parent_client_texture_id) { DCHECK(context); DCHECK(!context_.get()); @@ -1811,7 +1816,7 @@ bool GLES2DecoderImpl::Initialize(gfx::GLContext* context, return false; } - if (!group_->Initialize(allowed_extensions)) { + if (!group_->Initialize(disallowed_extensions, allowed_extensions)) { LOG(ERROR) << "GPUProcessor::InitializeCommon failed because group " << "failed to initialize."; Destroy(); @@ -1819,6 +1824,7 @@ bool GLES2DecoderImpl::Initialize(gfx::GLContext* context, } CHECK_GL_ERROR(); + disallowed_extensions_ = disallowed_extensions; vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); @@ -6168,7 +6174,7 @@ error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( const gles2::GetRequestableExtensionsCHROMIUM& c) { Bucket* bucket = CreateBucket(c.bucket_id); scoped_ptr<FeatureInfo> info(new FeatureInfo()); - info->Initialize(NULL); + info->Initialize(disallowed_extensions_, NULL); 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 88d1892..92d5300 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder.h @@ -25,6 +25,10 @@ namespace gles2 { class ContextGroup; class GLES2Util; +struct DisallowedExtensions { + bool multisampling; +}; + // This class implements the AsyncAPIInterface interface, decoding GLES2 // commands and calling GL. class GLES2Decoder : public CommonDecoder { @@ -61,6 +65,7 @@ class GLES2Decoder : public CommonDecoder { // true if successful. virtual bool Initialize(gfx::GLContext* context, const gfx::Size& size, + const DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, const std::vector<int32>& attribs, GLES2Decoder* parent, diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h index 0282709..37a7e72 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h @@ -25,12 +25,14 @@ class MockGLES2Decoder : public GLES2Decoder { MockGLES2Decoder(); virtual ~MockGLES2Decoder(); - MOCK_METHOD6(Initialize, bool(gfx::GLContext* context, - const gfx::Size& size, - const char* allowed_extensions, - const std::vector<int32>& attribs, - GLES2Decoder* parent, - uint32 parent_texture_id)); + MOCK_METHOD7(Initialize, + bool(gfx::GLContext* context, + const gfx::Size& size, + const DisallowedExtensions& disallowed_extensions, + const char* allowed_extensions, + const std::vector<int32>& attribs, + GLES2Decoder* parent, + uint32 parent_texture_id)); MOCK_METHOD0(Destroy, void()); MOCK_METHOD1(ResizeOffscreenFrameBuffer, void(const gfx::Size& size)); MOCK_METHOD0(UpdateOffscreenFrameBufferSize, bool()); 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 18a920f..0699e3b 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -57,9 +57,10 @@ void GLES2DecoderTestBase::InitDecoder( InSequence sequence; - TestHelper::SetupContextGroupInitExpectations(gl_.get(), extensions); + TestHelper::SetupContextGroupInitExpectations(gl_.get(), + DisallowedExtensions(), extensions); - EXPECT_TRUE(group_->Initialize(extensions)); + EXPECT_TRUE(group_->Initialize(DisallowedExtensions(), extensions)); EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) .WillOnce(SetArgumentPointee<1>(has_alpha_backbuffer ? 8 : 0)) @@ -129,7 +130,8 @@ void GLES2DecoderTestBase::InitDecoder( decoder_.reset(GLES2Decoder::Create(group_.get())); decoder_->Initialize( - context_, context_->GetSize(), NULL, std::vector<int32>(), NULL, 0); + context_, context_->GetSize(), DisallowedExtensions(), + NULL, std::vector<int32>(), NULL, 0); decoder_->set_engine(engine_.get()); EXPECT_CALL(*gl_, GenBuffersARB(_, _)) diff --git a/gpu/command_buffer/service/gpu_processor.cc b/gpu/command_buffer/service/gpu_processor.cc index b36db6a..45d21d7 100644 --- a/gpu/command_buffer/service/gpu_processor.cc +++ b/gpu/command_buffer/service/gpu_processor.cc @@ -52,12 +52,14 @@ GPUProcessor::~GPUProcessor() { Destroy(); } -bool GPUProcessor::InitializeCommon(gfx::GLContext* context, - const gfx::Size& size, - const char* allowed_extensions, - const std::vector<int32>& attribs, - gles2::GLES2Decoder* parent_decoder, - uint32 parent_texture_id) { +bool GPUProcessor::InitializeCommon( + gfx::GLContext* context, + const gfx::Size& size, + const gles2::DisallowedExtensions& disallowed_extensions, + const char* allowed_extensions, + const std::vector<int32>& attribs, + gles2::GLES2Decoder* parent_decoder, + uint32 parent_texture_id) { DCHECK(context); if (!context->MakeCurrent()) @@ -90,6 +92,7 @@ bool GPUProcessor::InitializeCommon(gfx::GLContext* context, // Initialize the decoder with either the view or pbuffer GLContext. if (!decoder_->Initialize(context, size, + disallowed_extensions, allowed_extensions, attribs, parent_decoder, diff --git a/gpu/command_buffer/service/gpu_processor.h b/gpu/command_buffer/service/gpu_processor.h index b76b6e3..6816d16 100644 --- a/gpu/command_buffer/service/gpu_processor.h +++ b/gpu/command_buffer/service/gpu_processor.h @@ -52,6 +52,7 @@ class GPUProcessor : public CommandBufferEngine { // Perform platform specific and common initialization. bool Initialize(gfx::PluginWindowHandle hwnd, const gfx::Size& size, + const gles2::DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, const std::vector<int32>& attribs, GPUProcessor* parent, @@ -116,12 +117,14 @@ class GPUProcessor : public CommandBufferEngine { protected: // Perform common initialization. Takes ownership of GLContext. - bool InitializeCommon(gfx::GLContext* context, - const gfx::Size& size, - const char* allowed_extensions, - const std::vector<int32>& attribs, - gles2::GLES2Decoder* parent_decoder, - uint32 parent_texture_id); + bool InitializeCommon( + gfx::GLContext* context, + const gfx::Size& size, + const gles2::DisallowedExtensions& disallowed_extensions, + const char* allowed_extensions, + const std::vector<int32>& attribs, + gles2::GLES2Decoder* parent_decoder, + uint32 parent_texture_id); private: diff --git a/gpu/command_buffer/service/gpu_processor_linux.cc b/gpu/command_buffer/service/gpu_processor_linux.cc index cca8663..5627d63 100644 --- a/gpu/command_buffer/service/gpu_processor_linux.cc +++ b/gpu/command_buffer/service/gpu_processor_linux.cc @@ -9,12 +9,14 @@ using ::base::SharedMemory; namespace gpu { -bool GPUProcessor::Initialize(gfx::PluginWindowHandle window, - const gfx::Size& size, - const char* allowed_extensions, - const std::vector<int32>& attribs, - GPUProcessor* parent, - uint32 parent_texture_id) { +bool GPUProcessor::Initialize( + gfx::PluginWindowHandle window, + const gfx::Size& size, + const gles2::DisallowedExtensions& disallowed_extensions, + const char* allowed_extensions, + const std::vector<int32>& attribs, + GPUProcessor* parent, + uint32 parent_texture_id) { // Get the parent decoder and the GLContext to share IDs with, if any. gles2::GLES2Decoder* parent_decoder = NULL; gfx::GLContext* parent_context = NULL; @@ -45,6 +47,7 @@ bool GPUProcessor::Initialize(gfx::PluginWindowHandle window, return InitializeCommon(context.release(), size, + disallowed_extensions, allowed_extensions, attribs, parent_decoder, diff --git a/gpu/command_buffer/service/gpu_processor_mac.cc b/gpu/command_buffer/service/gpu_processor_mac.cc index 4d9ba18..757de57 100644 --- a/gpu/command_buffer/service/gpu_processor_mac.cc +++ b/gpu/command_buffer/service/gpu_processor_mac.cc @@ -9,12 +9,14 @@ using ::base::SharedMemory; namespace gpu { -bool GPUProcessor::Initialize(gfx::PluginWindowHandle window, - const gfx::Size& size, - const char* allowed_extensions, - const std::vector<int32>& attribs, - GPUProcessor* parent, - uint32 parent_texture_id) { +bool GPUProcessor::Initialize( + gfx::PluginWindowHandle window, + const gfx::Size& size, + const gles2::DisallowedExtensions& disallowed_extensions, + const char* allowed_extensions, + const std::vector<int32>& attribs, + GPUProcessor* parent, + uint32 parent_texture_id) { // Get the parent decoder and the GLContext to share IDs with, if any. gles2::GLES2Decoder* parent_decoder = NULL; gfx::GLContext* parent_context = NULL; @@ -53,6 +55,7 @@ bool GPUProcessor::Initialize(gfx::PluginWindowHandle window, return InitializeCommon(context.release(), size, + disallowed_extensions, allowed_extensions, attribs, parent_decoder, diff --git a/gpu/command_buffer/service/gpu_processor_win.cc b/gpu/command_buffer/service/gpu_processor_win.cc index 0ec6b1c..465cf5a 100644 --- a/gpu/command_buffer/service/gpu_processor_win.cc +++ b/gpu/command_buffer/service/gpu_processor_win.cc @@ -11,12 +11,14 @@ using ::base::SharedMemory; namespace gpu { -bool GPUProcessor::Initialize(gfx::PluginWindowHandle window, - const gfx::Size& size, - const char* allowed_extensions, - const std::vector<int32>& attribs, - GPUProcessor* parent, - uint32 parent_texture_id) { +bool GPUProcessor::Initialize( + gfx::PluginWindowHandle window, + const gfx::Size& size, + const gles2::DisallowedExtensions& disallowed_extensions, + const char* allowed_extensions, + const std::vector<int32>& attribs, + GPUProcessor* parent, + uint32 parent_texture_id) { // Get the parent decoder and the GLContext to share IDs with, if any. gles2::GLES2Decoder* parent_decoder = NULL; gfx::GLContext* parent_context = NULL; @@ -44,6 +46,7 @@ bool GPUProcessor::Initialize(gfx::PluginWindowHandle window, return InitializeCommon(context.release(), size, + disallowed_extensions, allowed_extensions, attribs, parent_decoder, diff --git a/gpu/command_buffer/service/test_helper.cc b/gpu/command_buffer/service/test_helper.cc index 9deac87..3de75d5 100644 --- a/gpu/command_buffer/service/test_helper.cc +++ b/gpu/command_buffer/service/test_helper.cc @@ -92,7 +92,9 @@ void TestHelper::SetupTextureManagerInitExpectations( } void TestHelper::SetupContextGroupInitExpectations( - ::gfx::MockGLInterface* gl, const char* extensions) { + ::gfx::MockGLInterface* gl, + const DisallowedExtensions& disallowed_extensions, + const char* extensions) { InSequence sequence; SetupFeatureInfoInitExpectations(gl, extensions); diff --git a/gpu/command_buffer/service/test_helper.h b/gpu/command_buffer/service/test_helper.h index 6c56224..b23a7f1 100644 --- a/gpu/command_buffer/service/test_helper.h +++ b/gpu/command_buffer/service/test_helper.h @@ -11,6 +11,8 @@ namespace gpu { namespace gles2 { +struct DisallowedExtensions; + class TestHelper { public: static const GLuint kServiceBlackTexture2dId = 701; @@ -34,7 +36,9 @@ class TestHelper { static const GLint kMaxVertexUniformComponents = kMaxVertexUniformVectors * 4; static void SetupContextGroupInitExpectations( - ::gfx::MockGLInterface* gl, const char* extensions); + ::gfx::MockGLInterface* gl, + const DisallowedExtensions& disallowed_extensions, + const char* extensions); static void SetupFeatureInfoInitExpectations( ::gfx::MockGLInterface* gl, const char* extensions); static void SetupTextureManagerInitExpectations(::gfx::MockGLInterface* gl); diff --git a/gpu/demos/framework/window.cc b/gpu/demos/framework/window.cc index 825025ef..1440110 100644 --- a/gpu/demos/framework/window.cc +++ b/gpu/demos/framework/window.cc @@ -61,7 +61,9 @@ bool Window::CreateRenderContext(gfx::PluginWindowHandle hwnd) { GPUProcessor* gpu_processor( new GPUProcessor(command_buffer.get(), NULL)); - if (!gpu_processor->Initialize(hwnd, gfx::Size(), NULL, std::vector<int32>(), + if (!gpu_processor->Initialize(hwnd, gfx::Size(), + gpu::gles2::DisallowedExtensions(), + NULL, std::vector<int32>(), NULL, 0)) { return false; } |