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

Visual plugin is loaded multiple times #1647

Open
srmainwaring opened this issue Aug 13, 2022 · 1 comment
Open

Visual plugin is loaded multiple times #1647

srmainwaring opened this issue Aug 13, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@srmainwaring
Copy link
Contributor

srmainwaring commented Aug 13, 2022

Environment

  • OS Version: macOS Big Sur 11.6.2

  • Source or binary build? build: source, branch: gz-sim7, commit: d90fab2

  • If this is a GUI or sensor rendering bug, describe your GPU and rendering system. Otherwise delete this section.

    • Rendering plugin: [ogre2].
      • [ x ] running on real hardware
      • [ x ] GPU is concurrently used for other tasks
        • [ x ] desktop acceleration
    • Rendering system info:
2022-08-13 15:45:06.469 system_profiler[80028:24179151] Device PreExisted [000000010000096a] AMD Radeon Pro W5700X
Graphics/Displays:

    AMD Radeon Pro W5700X:

      Chipset Model: AMD Radeon Pro W5700X
      Type: GPU
      Bus: PCIe
      Slot: Slot-1
      PCIe Lane Width: x16
      VRAM (Total): 16 GB
      Vendor: AMD (0x1002)
      Device ID: 0x7310
      Revision ID: 0x0000
      ROM Revision: 113-D1860W-213
      VBIOS Version: 113-D186A2XT-019
      Option ROM Version: 113-D186A2XT-019
      EFI Driver Version: 01.01.200
      Metal Family: Supported, Metal GPUFamily macOS 2
      Displays:
        Cinema HD:
          Display Type: LCD
          Resolution: 2560 x 1600
          UI Looks like: 2560 x 1600
          Framebuffer Depth: 30-Bit Color (ARGB2101010)
          Display Serial Number: CY628129UG1
          Main Display: Yes
          Mirror: Off
          Online: Yes
          Rotation: Supported
          Automatically Adjust Brightness: Yes
          Connection Type: DVI or HDMI
          Adapter Firmware Version: 2.21

Description

  • Expected behaviour: a single copy of the visual plugin is constructed and configured.
  • Actual behaviour: multiple copies of the visual plugin are constructed and configured.

Bisection indicates that change is due to #1352, and in particular src/gui/plugins/scene_manager/GzSceneManager.cc. Reverting this file restores the previous behaviour.

Steps to reproduce

  1. Edit src/systems/shader_param/ShaderParam.cc and add the following messages in ShaderParam::Configure after the entity has been captured (L238-240).
  gzmsg << "ShaderParam: configuring\n";
  gzmsg << "ShaderParam: entity: " << this->dataPtr->entity << "\n";
  gzmsg << "ShaderParam: visualName: " << this->dataPtr->visualName << "\n";
  1. Rebuild and run the shader_params example
gz sim -v4 -r shader_param.sdf

Output

Output from VSCode Debug Console filtering on ShaderParam

Warning [Utils.cc:129] [/sdf/plugin[@name="gz::sim::systems::ShaderParam"]:<data-string>:L1]: XML Element[plugin], child of element[sdf], not defined in SDF. Copying[plugin] as children of [sdf].
[GUI] [Msg] ShaderParam: configuring
[GUI] [Msg] ShaderParam: entity: 6
[GUI] [Msg] ShaderParam: visualName: sphere_visual
[GUI] [Dbg] [GuiRunner.cc:375] Loaded system [gz::sim::systems::ShaderParam] for entity [6] in GUI
[GUI] [Msg] ShaderParam: configuring
[GUI] [Msg] ShaderParam: entity: 6
[GUI] [Msg] ShaderParam: visualName: sphere_visual
[GUI] [Dbg] [GuiRunner.cc:375] Loaded system [gz::sim::systems::ShaderParam] for entity [6] in GUI
[GUI] [Msg] ShaderParam: configuring
[GUI] [Msg] ShaderParam: entity: 6
[GUI] [Msg] ShaderParam: visualName: sphere_visual
[GUI] [Dbg] [GuiRunner.cc:375] Loaded system [gz::sim::systems::ShaderParam] for entity [6] in GUI
[GUI] [Msg] ShaderParam: configuring
[GUI] [Msg] ShaderParam: entity: 6
[GUI] [Msg] ShaderParam: visualName: sphere_visual
[GUI] [Dbg] [GuiRunner.cc:375] Loaded system [gz::sim::systems::ShaderParam] for entity [6] in GUI
Warning [Utils.cc:129] [/sdf/plugin[@name="gz::sim::systems::ShaderParam"]:<data-string>:L1]: XML Element[plugin], child of element[sdf], not defined in SDF. Copying[plugin] as children of [sdf].

Impact

The changed behaviour breaks downstream visual plugins that expect to be loaded and initialised only once per entity.

Findings so far

  • When the ECM is queried for components::Visual, components::SystemPluginInfo in GzSceneManager::Update, the visual (entity: 6 in this example) has a SystemPluginInfo component that contains 2 entries for the visual plugin rather than the expected one.

  • This can be verified by inspecting sdf::Plugins convertedPlugins in L146,

  • Or alternatively by displaying the DebugString of the msgs::SerializedStepMap message in GuiRunner::OnStateQt.

  • => it seems the ECM state from the server is being populated with an additional copy of the plugin component.

  • An extra pair of visual plugins are loaded because GzSceneManager::Update emits events for both the new VisualPlugins event and the deprecated VisualPlugin event. Disabling the deprecated event leaves just the pair pf plugins coming from the Plugins vector in the ECM.

Ongoing investigations

  • Locating where the duplicate copy of the plugin details is entered into the ECM msgs::SerializedStepMap on the server.
@srmainwaring srmainwaring added the bug Something isn't working label Aug 13, 2022
@azeey
Copy link
Contributor

azeey commented Oct 17, 2022

I've reproduced this locally. @nkoenig do you have time to look into this?

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
Status: To do
Development

No branches or pull requests

3 participants