Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeatedly calling rendering::sceneFromFirstRenderEngine loads the engine plugin every time #959

Closed
azeey opened this issue Jan 19, 2024 · 0 comments · Fixed by #961
Closed
Labels
bug Something isn't working

Comments

@azeey
Copy link
Contributor

azeey commented Jan 19, 2024

Environment

  • OS Version: Ubuntu 22.04
  • Source or binary build? gz-rendering8, dad0364

Description

  • Expected behavior: rendering::sceneFromFirstRenderEngine should load the engine plugin only the first time it's called.
  • Actual behavior: It loads the plugin every time. I suspect that the cache for which engines have been loaded uses the filename of the library as the key to a map, but RenderEngineManager::Engine tries to look up the engine by its name.
    this->engines[_filename] = renderPlugin->Engine();

and

EngineInfo info{_name, nullptr};
std::lock_guard<std::recursive_mutex> lock(this->dataPtr->enginesMutex);
// check in the list of available engines
auto iter = this->dataPtr->engines.find(_name);
if (iter != this->dataPtr->engines.end())

Steps to reproduce

The easiest way to see this to run a gz-sim plugin that calls rendering::sceneFromFirstRenderEngine on every OnRender callback.

  1. gz sim -s -r -v3 --iterations 50 model_photo_shoot.sdf

This will repeatedly print

[Msg] Loading plugin [gz-rendering-ogre2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant