diff options
Diffstat (limited to 'o3d/plugin')
-rw-r--r-- | o3d/plugin/cross/o3d_glue.cc | 23 | ||||
-rw-r--r-- | o3d/plugin/idl/idl.gyp | 12 |
2 files changed, 17 insertions, 18 deletions
diff --git a/o3d/plugin/cross/o3d_glue.cc b/o3d/plugin/cross/o3d_glue.cc index ea64a84..b5d2d58 100644 --- a/o3d/plugin/cross/o3d_glue.cc +++ b/o3d/plugin/cross/o3d_glue.cc @@ -257,12 +257,13 @@ void PluginObject::TearDown() { } void PluginObject::CreateRenderer(const o3d::DisplayWindow& display_window) { + bool software_renderer = false; // In case CreateRenderer is called more than once, reset to the // uninitialized state.. DeleteRenderer(); renderer_init_status_ = o3d::Renderer::UNINITIALIZED; - if (features_->render_modes() != Renderer::RENDER_MODE_2D) { + if (features_->render_mode() != Renderer::RENDER_MODE_2D) { if (!o3d::CheckConfig(npp_)) { renderer_init_status_ = o3d::Renderer::GPU_NOT_UP_TO_SPEC; } else { @@ -273,17 +274,24 @@ void PluginObject::CreateRenderer(const o3d::DisplayWindow& display_window) { renderer_init_status_ = renderer_->Init(display_window, false); if (renderer_init_status_ != o3d::Renderer::SUCCESS) { DeleteRenderer(); + } else { + ClientInfoManager* client_info_manager = + service_locator()->GetService<ClientInfoManager>(); + software_renderer = + client_info_manager->client_info().software_renderer(); } } -#if !defined(SUPPORT_CAIRO) - } else { - // The caller requested 2D only mode, but this platform does not support 2d - renderer_init_status_ = o3d::Renderer::INITIALIZATION_ERROR; } -#else + if (software_renderer && + (features_->render_mode() == Renderer::RENDER_MODE_AUTO)) { + // If the client is OK with 2d mode, we prefer to use cairo instead of a + // software renderer. We don't need the 3D renderer we just created. + DeleteRenderer(); + renderer_init_status_ = o3d::Renderer::GPU_NOT_UP_TO_SPEC; + DLOG(INFO) << "Software renderer detected. Falling back to o2d."; } if ((renderer_init_status_ != o3d::Renderer::SUCCESS) && - (features_->render_modes() != Renderer::RENDER_MODE_3D)) { + (features_->render_mode() != Renderer::RENDER_MODE_3D)) { // Attempt to fall back to o2d renderer renderer_ = o3d::Renderer::Create2DRenderer(&service_locator_); if (renderer_) { @@ -297,7 +305,6 @@ void PluginObject::CreateRenderer(const o3d::DisplayWindow& display_window) { } } } -#endif } void PluginObject::DeleteRenderer() { diff --git a/o3d/plugin/idl/idl.gyp b/o3d/plugin/idl/idl.gyp index c70dbad..81ead55 100644 --- a/o3d/plugin/idl/idl.gyp +++ b/o3d/plugin/idl/idl.gyp @@ -12,16 +12,8 @@ 'static_glue_dir': '../../../<(nixysadir)/static_glue/npapi', 'idl_files': [ '<!@(python get_idl_files.py)', - ], - 'conditions': [ - ['support_cairo == 1', - { - 'idl_files': [ - 'layer.idl', - 'pattern.idl', - ], - }, - ], + 'layer.idl', + 'pattern.idl', ], }, 'target_defaults': { |