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

Add Metal support for the Ogre2 Render Engine #463

Merged

Conversation

srmainwaring
Copy link
Contributor

@srmainwaring srmainwaring commented Oct 9, 2021

🎉 New feature

Summary

This PR adds Metal Render System support to the ogre2 render engine.

Relates to: #461 and discussions in #422.

Marked as draft as not all shaders have been ported to Metal and some examples are not working correctly.

Test it

A number of the examples have been modified to allow the Metal to be used with the ogre2 render engine instead of GL3+. For example to use Metal with the simple_demo example run:

./simple_demo ogre2 metal

For a list of tasks and the status of the examples see the accompanying feature request: #461

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

@srmainwaring srmainwaring requested a review from iche033 as a code owner October 9, 2021 22:43
@github-actions github-actions bot added 🌱 garden Ignition Garden 🏯 fortress Ignition Fortress labels Oct 9, 2021
@srmainwaring srmainwaring marked this pull request as draft October 10, 2021 11:26
@chapulina chapulina requested a review from ahcorde October 11, 2021 18:44
@chapulina chapulina added the macOS macOS support label Oct 11, 2021
@srmainwaring
Copy link
Contributor Author

@ahcorde I have put together an example to test the depth camera based on the examples segmentation_camera and thermal_camera. I used it to check the Metal depth camera shaders were working as the integration test was failing but the render pipeline looked ok. It also runs for ogre (not working for ogre2 / GL3+ on macOS though).

I'm wondering whether to push it to this PR or to a create new one and then cherry pick it in later, as there is quite a lot here already?

metal_example_depth_camera

@iche033
Copy link
Contributor

iche033 commented Oct 11, 2021

I'm wondering whether to push it to this PR or to a create new one and then cherry pick it in later, as there is quite a lot here already?

+1 on creating a new PR for this. Makes it easier to review. Thanks!

@srmainwaring srmainwaring mentioned this pull request Oct 12, 2021
8 tasks
@ahcorde
Copy link
Contributor

ahcorde commented Oct 12, 2021

Hi @srmainwaring

I'm testing your code but I found this issue:

[Msg] Loading plugin [ignition-rendering-ogre2]
Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Mesh2
Registering ResourceManager for type OldSkeleton
MovableObjectFactory for type 'ParticleSystem' registered.
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
ArchiveFactory for archive type EmbeddedZip registered.
DDS codec registering
FreeImage version: 3.18.0
This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,psb,cut,xbm,xpm,gif,hdr,g3,sgi,rgb,rgba,bw,exr,j2k,j2c,jp2,pfm,pct,pict,pic,3fr,arw,bay,bmq,cap,cine,cr2,crw,cs1,dc2,dcr,drf,dsc,dng,erf,fff,ia,iiq,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,ptx,pxn,qtk,raf,raw,rdc,rw2,rwl,rwz,sr2,srf,srw,sti,x3f,webp,jxr,wdp,hdp
OITD codec registering
Registering ResourceManager for type HighLevelGpuProgram
MovableObjectFactory for type 'Decal' registered.
MovableObjectFactory for type 'InternalCubemapProbe' registered.
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Item' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'Rectangle2Dv2' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject2' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
MovableObjectFactory for type 'WireAabb' registered.
*-*-* OGRE Initialising
*-*-* Version 2.2.6 (Cerberus)
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
Loading library /usr/local/opt/ogre2.2/lib/OGRE-2.2/OGRE/RenderSystem_GL3Plus.dylib
Installing plugin: GL 3+ RenderSystem
OpenGL 3+ Rendering Subsystem created.
Plugin successfully installed
Loading library /usr/local/opt/ogre2.2/lib/OGRE-2.2/OGRE/Plugin_ParticleFX.dylib
Installing plugin: ParticleFX
Particle Emitter Type 'Point' registered
Particle Emitter Type 'Box' registered
Particle Emitter Type 'Ellipsoid' registered
Particle Emitter Type 'Cylinder' registered
Particle Emitter Type 'Ring' registered
Particle Emitter Type 'HollowEllipsoid' registered
Particle Affector Type 'LinearForce' registered
Particle Affector Type 'ColourFader' registered
Particle Affector Type 'ColourFader2' registered
Particle Affector Type 'ColourImage' registered
Particle Affector Type 'ColourInterpolator' registered
Particle Affector Type 'Scaler' registered
Particle Affector Type 'Rotator' registered
Particle Affector Type 'DirectionRandomiser' registered
Particle Affector Type 'DeflectorPlane' registered
Plugin successfully installed
Loading library /usr/local/opt/ogre2.2/lib/OGRE-2.2/OGRE/RenderSystem_Metal.dylib
Installing plugin: Metal RenderSystem
Metal: Devices Detection Starts
Metal: "Intel Iris Pro Graphics"
Metal: Devices Detection Ends
Plugin successfully installed
CPU Identifier & Features
-------------------------
 *   CPU ID: GenuineIntel: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
 *   Logical cores: 8
 *      SSE: yes
 *     SSE2: yes
 *     SSE3: yes
 *      MMX: yes
 *   MMXEXT: yes
 *    3DNOW: no
 * 3DNOWEXT: no
 *     CMOV: yes
 *      TSC: yes
 *      FPU: yes
 *      PRO: yes
 *       HT: no
-------------------------
Metal: Devices Detection Starts
Metal: "Intel Iris Pro Graphics"
Metal: Devices Detection Ends
Metal: Requested "(default)", selected "Intel Iris Pro Graphics (system default)"
Supports: OSX_GPUFamily1_v1
Registering ResourceManager for type GpuProgram
DefaultWorkQueue('Root') initialising on thread main.
Particle Renderer Type 'billboard' registered
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/2.0/scripts/Compositors' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/2.0/scripts/materials/Common' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/2.0/scripts/materials/Common/GLSL' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/2.0/scripts/materials/Common/GLSLES' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/2.0/scripts/materials/Terra' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/2.0/scripts/materials/Terra/GLSL' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/2.0/scripts/materials/Common/Metal' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/2.0/scripts/materials/Terra/Metal' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/materials/programs' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/materials/programs/GLSL' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/materials/programs/Metal' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/materials/scripts' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/ahcorde/ignition_fortress/install/share/ignition/ignition-rendering6/ogre2/media/materials/textures' of type 'FileSystem' to resource group 'General'
Parsing scripts for resource group Autodetect
Finished parsing scripts for resource group Autodetect
Creating resources for group Autodetect
All done
Parsing scripts for resource group General
Parsing script Quad.program
Shader Ogre/Compositor/Quad_vs_Metal compiled successfully.
Shader Ogre/Compositor/QuadCameraDir_vs_Metal compiled successfully.
Parsing script EsmGaussianBlurLogFilter.material
Shader ESM/GaussianLogFilterH_ps_Metal compiled successfully.
Shader ESM/GaussianLogFilterV_ps_Metal compiled successfully.
Parsing script DPSM.material
Shader Ogre/DPSM/CubeToDpsm_ps_Metal compiled successfully.
Shader Ogre/DPSM/CubeToDpsm_Colour_ps_Metal compiled successfully.
Parsing script DepthUtils.material
Shader Ogre/Depth/DownscaleMax_ps_Metal compiled successfully.
Parsing script Copyback.material
Shader Ogre/Copy/4xFP32_ps_Metal compiled successfully.
Shader Ogre/Copy/3xFP32_ps_Metal compiled successfully.
Shader Ogre/Copy/1xFP32_ps_Metal compiled successfully.
Shader Ogre/Resolve/1xFP32_Subsample0_ps_Metal compiled successfully.
Parsing script GpuNormalMapper.material
Shader Terra/GpuNormalMapper_ps_Metal compiled successfully.
Parsing script selection_buffer.material
Compiler error: reference to a non existing object in selection_buffer.material(52)
Shader selection_buffer_fs_Metal compiled successfully.
[Err] [Ogre2RenderEngine.cc:333] Failed to initialize render-engine
[Err] [BaseRenderEngine.cc:215] Render-engine has not been initialized
Segmentation fault: 11

I commented out theses lines:

      // Make this pass use the vertex shader defined above
      vertex_program_ref DepthCameraVS
      {
      }

But I'm still getting the segfault. any ideas ? should I cherry-pick some other commit ?

@srmainwaring
Copy link
Contributor Author

srmainwaring commented Oct 12, 2021

Hi @ahcorde - thanks for reviewing.

I'm wondering if the issue you are seeing is related to #456? The selection buffer material (and a few others) reference other shader aliases. The error message is a bit cryptic but it looks like it may not be finding DepthCameraVS which is define as a unified shader in depth_camera.material

https://github.com/srmainwaring/ign-rendering/blob/f504e4fb8140a7ce9ba72e7def978578f11b3c74/ogre2/src/media/materials/scripts/selection_buffer.material#L29-L54

Permalink does not seem to be working... L52 is the reference vertex_program_ref DepthCameraVS

// Metal shaders
fragment_program selection_buffer_fs_Metal metal
{
  source selection_buffer_fs.metal
  shader_reflection_pair_hint DepthCameraVS_Metal
}


// Unified shaders
fragment_program selection_buffer_fs unified
{
  delegate selection_buffer_fs_GLSL
  delegate selection_buffer_fs_Metal
}


material SelectionBuffer
{
  // Material has one technique
  technique
  {
    // This technique has one pass
    pass
    {
      // Make this pass use the vertex shader defined above
      vertex_program_ref DepthCameraVS
      {
      }

Also I've found Metal to be unforgiving if anything fails while setting up the command buffer, the OpenGL version will usually carry on and render whatever works and only cause a segmentation fault on compile errors.

Edit: as this looks to be a potential cause of error, I'll update the material scripts to only reference locally defined vertex and fragment program definitions.

Edit2: the gpu_rays.material potentially has the same issue as material GpuRaysScan2nd references Ogre/Compositor/Quad_vs. I'll leave off changing it for now but if it causes a compile error I'll patch it as well,

@ahcorde
Copy link
Contributor

ahcorde commented Oct 12, 2021

Thank you for the quick patch. I'm not getting the segfault, but the window is completely black.

@srmainwaring
Copy link
Contributor Author

srmainwaring commented Oct 12, 2021

I'm not getting the segfault, but the window is completely black.

That's not good. What example are you running (simple_demo?) and on what version of macOS and Xcode?

@ahcorde
Copy link
Contributor

ahcorde commented Oct 12, 2021

macOS Big Sur 11.6 and XCODE Version 12.5.1 (I think I can update to version 13.0.0)

@srmainwaring
Copy link
Contributor Author

I'm on Big Sur 11.4 with Xcode 12.5, so I don't think that's it. I'm using a later version of Ogre v2.2 than the one in the osrf/simulation/ogre2.2.rb formula so that may be a cause? I'll roll back and check that next.

Other than that I'm a bit stumped. Does anything show up when you look at the frame debugger in Xcode?

simple_demo_xcode

@ahcorde
Copy link
Contributor

ahcorde commented Oct 12, 2021

I tried this other PR #467 and I'm able to visualize the depth camera.

I have never run the code with xcode, let me try it

@srmainwaring
Copy link
Contributor Author

srmainwaring commented Oct 12, 2021

Is the depth_camera example running with ogre2 metal? It seems a bit odd that that would work but not simple_demo, but it could be some of the other shaders are not being loaded or found.

To use Xcode with the examples I create another build folder in the example folder, say build_xcode, then run cmake .. -GXcode and load the project.

This is the frame debugger guide: https://developer.apple.com/documentation/metal/frame_capture_debugging_tools/enabling_frame_capture

I found I had to set GPU Frame Capture to Metal aa otherwise the camera icon will not appear in the debug window. The command line and environment variables can be set in the same Edit Scheme window.

@ahcorde
Copy link
Contributor

ahcorde commented Oct 12, 2021

This is the output. It looks different

simple_demo

@srmainwaring
Copy link
Contributor Author

That is odd. The depth buffer is rendering, and it's hard to see at the zoom level, but it looks like the second to last render of Command Buffer 2 has a valid colour texture (expand Command Buffer 2 and look at Render 9) - although I'm seeing 4 attachments and it looks like there are only 3 in your case. This could indicate a different workflow (i.e. different versions of Ogre v2.2).

If you expand Render 9 further and hover your mouse over the calls you will get a preview showing the progress of the render as you mouse down. For some reason that's failing for you. I'll install the osrf/simulation version of Ogre2.2 and see if that makes a difference in my case.

@ahcorde
Copy link
Contributor

ahcorde commented Oct 13, 2021

I checked the image again and I added the last part of the diagram.

simple_demo2

@srmainwaring
Copy link
Contributor Author

I've rolled back Ogre2.2 to match the osrf/simulation brew version and cannot replicate the issue you're seeing. Could you export the gpu trace and make it available on a shared drive (dropbox or equivalent).

To export: highlight the project in the left-hand pane, then from the menu: File > Export and you should get a simple_demo.gputrace file about 2.8 MB in size. Xcode can replay this, so I can run a side by side comparison to see what is going one.

Are you able to get any of the other examples working using ogre2 metal on the command line? All the ones listed as complete in #461 (comment) should now work.

In the meanwhile I will try to get this project set up on another machine - a MacBook this time to see if there's a hardware issue, and I'll also look into moving to Big Sur 11.6 and Xcode 12.5.1 on that machine so see if there is anything in that.

@ahcorde
Copy link
Contributor

ahcorde commented Oct 13, 2021

here we go:

simple_demo.gputrace.zip

@srmainwaring
Copy link
Contributor Author

srmainwaring commented Oct 13, 2021

Thanks for the trace. The first thing I can see is that the trace will not run on my Mac Pro as it says no compatible devices connected. So it may be a hardware issue. IIRC there are some differences in how you use Metal on devices running Apple's own chipsets, and it may be that some work is required to support that. Could you please post the specs of your MacBook Pro for comparison.

Edit: ok, so the trace won't play on my MacBook Pro (2013) either, but it has a very similar spec to your machine (same card and model is MacBookPro11,1). Perhaps it the OS and Xcode version?

@ahcorde
Copy link
Contributor

ahcorde commented Oct 13, 2021

Nombre del modelo:	MacBook Pro
  Identificador del modelo:	MacBookPro11,2
  Nombre del procesador:	Intel Core i7 de 4 núcleos
  Velocidad del procesador:	2,2 GHz
  Cantidad de procesadores:	1
  Cantidad total de núcleos:	4
  Caché de nivel 2 (por núcleo):	256 KB
  Caché de nivel 3:	6 MB
  Tecnología Hyper-Threading:	Activado
  Memoria:	16 GB
  Versión del firmware del sistema:	431.140.6.0.0
  Versión SMC (sistema):	2.18f15

Graphics:


  Modelo de chipset:	Intel Iris Pro
  Tipo:	GPU
  Bus:	Integrado
  VRAM (dinámica, máx.):	1536 MB
  Fabricante:	Intel
  ID del dispositivo:	0x0d26
  ID de la revisión:	0x0008
  Familia Metal:	Compatible, Metal GPUFamily macOS 1
  Pantallas:
LCD a color:
  Tipo de pantalla:	LCD Retina integrada
  Resolución:	Retina de 2880 x 1800
  Profundidad del framebuffer:	Color de 24 bits (ARGB8888)
  Pantalla principal:	Sí
  Duplicado:	Desactivado
  En línea:	Sí
  Ajustar brillo automáticamente:	Sí
  Tipo de conexión:	Interno

@srmainwaring
Copy link
Contributor Author

@ahcorde I can replicate the behaviour on my MacBook Pro.

The camera examples work:

  • segmentation_camera
  • thermal_camera

But the other examples that use the regular camera are not working.

I think the problem might be that the Ogre HlmsUnlit materials use Metal 2 syntax in the vertex shader. Both our MacBook Pro's only support Metal GPUFamily macOS 1. My Mac Pro workstation supports Metal GPUFamily macOS 2.

I'll need to check with @darksylinc to confirm.

@darksylinc
Copy link
Contributor

I stick to the earliest syntax I can for best iOS compatibility.

Anyway, syntax support boils down to macOS version, not GPU version (*). If we're using a newer syntax it will fail to compile and a new OS version is needed

(*) As long as we're not using a feature specific for nee GPUs, which afaik we don't

@darksylinc
Copy link
Contributor

One simple cause could be load/store actions. If they're incorrectly set, some GPUs will completely ignore it while on others rendering will be garbage.

Since we support load/store in all APIs try hooking rendedoc+gl+linux because RenserDoc has debugging facilities to easily spot incorrect use of dont_care.

The debug looks like this:

@darksylinc
Copy link
Contributor

darksylinc commented Oct 13, 2021

Bte I suspect msaa is involved (call it a sixth sense) try disabling msaa, iirc it's on by default in ignition

- Revert debug output in Ogre2RenderEngine
- Fix codecheck issue with variable declaration shadows previous local
- Revert changes to simple_demo_qml
- Move useMetalRenderSystem to Ogre2RenderEnginePrivate

Signed-off-by: Rhys Mainwaring <[email protected]>
- Add enum class GraphicsAPI to RenderEngine.hh
- Add utils class GraphicsAPIUtils for setting enum from string
- Update Ogre2RenderEngine to use GraphicsAPI enum
- Update examples to use GraphicsAPI enum

Signed-off-by: Rhys Mainwaring <[email protected]>
- Move GraphicsAPI to own file

Signed-off-by: Rhys Mainwaring <[email protected]>
- Fix custom_scene_viewer

Signed-off-by: Rhys Mainwaring <[email protected]>
- Fix code check
- Change GraphicsAPIUtils class documentation
- Improve graphics API check in Ogre2RenderEngine

Signed-off-by: Rhys Mainwaring <[email protected]>
- Fix code check - uninitialised variable warning

Signed-off-by: Rhys Mainwaring <[email protected]>
@ahcorde
Copy link
Contributor

ahcorde commented Nov 15, 2021

Hi @srmainwaring,

I'm trying to compile your changes but I'm not able.

  • ign-rendering: feature/ign-rendering6-metal-macos
  • ign-gui: feature/ign-gui7-metal
  • ign-gazebo: feature/ign-gazebo7-metal

But I'm getting this error:

minimal_scene/MinimalSceneRhiMetal.mm:86:12: error: no member named 'RenderTextureMetalId' in 'ignition::rendering::Camera'
  _camera->RenderTextureMetalId(&texturePtr);
  ~~~~~~~~~^

Are these the right branches ?

@srmainwaring
Copy link
Contributor Author

srmainwaring commented Nov 15, 2021

@ahcorde you need to use main for ign-rendering as the changes to expose the Metal texture were ABI breaking.

Let me know if there are any issues getting the gui and gazebo branches to build and I’ll patch them up. They should be ok as I checked them on an old macbook as well as a workstation. I have to update the gui changes to use the GraphicsAPI enum, but would like to do this once this PR has been merged and bumped to main.

Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latest changes look good to me! The ABI build failure is being tracked in #488.

@iche033
Copy link
Contributor

iche033 commented Nov 17, 2021

@ahcorde do you want give this another test on your mac machine? As of now, you'll need to test this branch by itself. The other PRs for full ign-gazebo + Metal integration will likely target Garden and not Fortress.

@ahcorde
Copy link
Contributor

ahcorde commented Nov 17, 2021

yes @iche033, I will test it today

@ahcorde
Copy link
Contributor

ahcorde commented Nov 19, 2021

I was able to compile it but I'm getting this trace when I try to run it:

ign gazebo -v 4 -g ```bash

ign gazebo -v 4 -g
[Msg] Ignition Gazebo GUI v7.0.0~pre1
[Dbg] [Application.cc:87] Initializing application.
[Dbg] [Application.cc:105] Qt using Metal rendering interface
[GUI] [Dbg] [Application.cc:456] Create main window
[GUI] [Wrn] [Application.cc:698] [QT] Populating font family aliases took 639 ms. Replace uses of missing font family "Roboto" with one that exists to avoid this cost.
[GUI] [Wrn] [Application.cc:698] [QT] qrc:/qml/StyleDialog.qml:112:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Wrn] [Application.cc:698] [QT] qrc:/qml/StyleDialog.qml:105:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Wrn] [Application.cc:698] [QT] qrc:/qml/StyleDialog.qml:98:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Wrn] [Application.cc:698] [QT] qrc:qml/Main.qml:83:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Wrn] [Application.cc:698] [QT] qrc:/qml/PluginMenu.qml:27:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Dbg] [PathManager.cc:66] Requesting resource paths through [/gazebo/resource_paths/get]
[GUI] [Wrn] [Application.cc:698] [QT] file::/Gazebo/GazeboDrawer.qml:241:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Wrn] [Application.cc:698] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:698] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Dbg] [Gui.cc:149] GUI requesting list of world names. The server may be busy downloading resources. Please be patient.
[GUI] [Dbg] [PathManager.cc:55] Received resource paths.
[GUI] [Dbg] [Gui.cc:208] Requesting GUI from [/world/default/gui/info]...
[GUI] [Dbg] [GuiRunner.cc:110] Requesting initial state from [/world/default/state]...
[GUI] [Msg] Loading config [/Users/ahcorde/.ignition/gazebo/7/gui.config]
[GUI] [Dbg] [Application.cc:336] Loading plugin [MinimalScene]
[GUI] [Dbg] [Application.cc:692] [QT] Creating ign-renderering interface for OpenGL
[GUI] [Dbg] [Application.cc:692] [QT] Creating ign-renderering interface for OpenGL
[GUI] [Dbg] [Application.cc:692] [QT] Creating render thread interface for OpenGL
[GUI] [Msg] Added plugin [3D View] to main window
[GUI] [Msg] Loaded plugin [MinimalScene] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gui-7/plugins/libMinimalScene.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [EntityContextMenuPlugin]
[GUI] [Wrn] [Application.cc:698] [QT] file::/EntityContextMenuPlugin/EntityContextMenuPlugin.qml:33:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Msg] Added plugin [EntityContextMenu] to main window
[GUI] [Msg] Loaded plugin [EntityContextMenuPlugin] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gazebo-7/plugins/gui/libEntityContextMenuPlugin.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [GzSceneManager]
[GUI] [Msg] Added plugin [Scene Manager] to main window
[GUI] [Msg] Loaded plugin [GzSceneManager] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gazebo-7/plugins/gui/libGzSceneManager.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [InteractiveViewControl]
[GUI] [Msg] Camera view controller topic advertised on [/gui/camera/view_control]
[GUI] [Msg] Added plugin [] to main window
[GUI] [Msg] Loaded plugin [InteractiveViewControl] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gui-7/plugins/libInteractiveViewControl.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [CameraTracking]
[GUI] [Msg] Added plugin [Camera tracking] to main window
[GUI] [Msg] Loaded plugin [CameraTracking] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gui-7/plugins/libCameraTracking.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [MarkerManager]
[GUI] [Msg] Listening to stats on [/world/default/stats]
[GUI] [Msg] Added plugin [Marker Manager] to main window
[GUI] [Msg] Loaded plugin [MarkerManager] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gui-7/plugins/libMarkerManager.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [SelectEntities]
[GUI] [Msg] Added plugin [Select entities] to main window
[GUI] [Msg] Loaded plugin [SelectEntities] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gazebo-7/plugins/gui/libSelectEntities.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [Spawn]
[GUI] [Wrn] [Application.cc:698] [QT] file::/Spawn/Spawn.qml:28:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Msg] Added plugin [Spawn] to main window
[GUI] [Msg] Loaded plugin [Spawn] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gazebo-7/plugins/gui/libSpawn.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [VisualizationCapabilities]
[GUI] [Msg] View as transparent service on [/gui/view/transparent]
[GUI] [Msg] View as wireframes service on [/gui/view/wireframes]
[GUI] [Msg] View center of mass service on [/gui/view/com]
[GUI] [Msg] View inertia service on [/gui/view/inertia]
[GUI] [Msg] View collisions service on [/gui/view/collisions]
[GUI] [Msg] View joints service on [/gui/view/joints]
[GUI] [Msg] Added plugin [VisualizationCapabilities] to main window
[GUI] [Msg] Loaded plugin [VisualizationCapabilities] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gazebo-7/plugins/gui/libVisualizationCapabilities.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [WorldControl]
[GUI] [Wrn] [Application.cc:698] [QT] file::/WorldControl/WorldControl.qml:30:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Msg] Using world control service [/world/default/control]
[GUI] [Msg] Listening to stats on [/world/default/stats]
[GUI] [Msg] Added plugin [World control] to main window
[GUI] [Msg] Loaded plugin [WorldControl] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gui-7/plugins/libWorldControl.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [WorldStats]
[GUI] [Msg] Listening to stats on [/world/default/stats]
[GUI] [Msg] Added plugin [World stats] to main window
[GUI] [Msg] Loaded plugin [WorldStats] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gui-7/plugins/libWorldStats.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [Shapes]
[GUI] [Msg] Added plugin [Shapes] to main window
[GUI] [Msg] Loaded plugin [Shapes] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gazebo-7/plugins/gui/libShapes.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [Lights]
[GUI] [Msg] Added plugin [Lights] to main window
[GUI] [Msg] Loaded plugin [Lights] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gazebo-7/plugins/gui/libLights.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [TransformControl]
[GUI] [Wrn] [Application.cc:698] [QT] file::/TransformControl/TransformControl.qml:104:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Wrn] [Application.cc:698] [QT] file::/TransformControl/TransformControl.qml:99:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Wrn] [Application.cc:698] [QT] file::/TransformControl/TransformControl.qml:94:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Wrn] [Application.cc:698] [QT] file::/TransformControl/TransformControl.qml:89:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Dbg] [TransformControl.cc:219] Legacy mode is disabled; this plugin must be used with MinimalScene.
[GUI] [Msg] Added plugin [Transform control] to main window
[GUI] [Msg] Loaded plugin [TransformControl] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gazebo-7/plugins/gui/libTransformControl.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [Screenshot]
[GUI] [Wrn] [Application.cc:698] [QT] file::/Screenshot/Screenshot.qml:33:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }
[GUI] [Msg] Screenshot service on [/gui/screenshot]
[GUI] [Msg] Added plugin [Screenshot] to main window
[GUI] [Msg] Loaded plugin [Screenshot] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gui-7/plugins/libScreenshot.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [ComponentInspector]
[GUI] [Msg] Added plugin [Component inspector] to main window
[GUI] [Msg] Loaded plugin [ComponentInspector] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gazebo-7/plugins/gui/libComponentInspector.dylib]
[GUI] [Dbg] [Application.cc:336] Loading plugin [EntityTree]
[GUI] [Msg] Added plugin [Entity tree] to main window
[GUI] [Msg] Loaded plugin [EntityTree] from path [/Users/ahcorde/ignition_fortress/install/lib/ign-gazebo-7/plugins/gui/libEntityTree.dylib]
[GUI] [Dbg] [Application.cc:289] Loading window config
[GUI] [Dbg] [Application.cc:470] Applying config
[GUI] [Wrn] [Application.cc:698] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Dbg] [Application.cc:692] [QT] Creating ign-renderering interface for OpenGL
[GUI] [Dbg] [Application.cc:692] [QT] Creating render thread interface for OpenGL
Stack trace (most recent call last):
#31 Object "CoreFoundation", at 0x7fff20555f8c, in CFRunLoopRunSpecific + 563
#30 Object "CoreFoundation", at 0x7fff20556998, in __CFRunLoopRun + 841
#29 Object "CoreFoundation", at 0x7fff20557505, in __CFRunLoopDoObservers + 543
#28 Object "CoreFoundation", at 0x7fff20557671, in CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
#27 Object "AppKit", at 0x7fff23639332, in ___NSRunLoopObserverCreateWithHandler_block_invoke + 41
#26 Object "AppKit 0x00007fff22ee386c", at 0x7fff22ee386c, in NS_setFlushesWithDisplayLink]_block_invoke + 285
#25 Object "QuartzCore", at 0x7fff26cc8b6f, in CA::Transaction::commit() + 713
#24 Object "QuartzCore", at 0x7fff26e32bee, in CA::Context::commit_transaction(CA::Transaction*, double, double*) + 666
#23 Object "QuartzCore", at 0x7fff26ce76f3, in CA::Layer::display_if_needed(CA::Transaction*) + 863
#22 Object "QuartzCore 0x00007fff26ce7ead", at 0x7fff26ce7ead, in display] + 183
#21 Object "libqcocoa.dylib", at 0x10cd32ff5, in qt_plugin_instance + 132629
#20 Object "libqcocoa.dylib", at 0x10cd2a8c6, in qt_plugin_instance + 98022
#19 Object "QtGui", at 0x1055de9d1, in void QWindowSystemInterface::handleExposeEventQWindowSystemInterface::SynchronousDelivery(QWindow*, QRegion const&) + 273
#18 Object "QtGui", at 0x1055fa3b2, in QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*) + 306
#17 Object "QtCore", at 0x105d9ad66, in QCoreApplication::notifyInternal2(QObject*, QEvent*) + 166
#16 Object "QtWidgets", at 0x1050256ad, in QApplication::notify(QObject*, QEvent*) + 477
#15 Object "QtWidgets", at 0x1050242f6, in QApplicationPrivate::notify_helper(QObject*, QEvent*) + 262
#14 Object "QtQuick", at 0x103f66a31, in QQuickWindow::event(QEvent*) + 241
#13 Object "QtGui", at 0x105606024, in QWindow::event(QEvent*) + 692
#12 Object "QtQuick", at 0x103ee8755, in QSGRenderLoop::handleContextCreationFailure(QQuickWindow*) + 8645
#11 Object "QtQuick", at 0x103ee7e94, in QSGRenderLoop::handleContextCreationFailure(QQuickWindow*) + 6404
#10 Object "QtQuick", at 0x103f5e9d9, in QQuickWindowPrivate::syncSceneGraph() + 361
#9 Object "QtQuick", at 0x103f5ed64, in QQuickWindowPrivate::updateDirtyNodes() + 356
#8 Object "QtQuick", at 0x103f70fc5, in QQuickWindowPrivate::updateDirtyNode(QQuickItem*) + 2901
#7 Object "libMinimalScene.dylib", at 0x1437b0704, in ignition::gui::plugins::RenderWindowItem::updatePaintNode(QSGNode*, QQuickItem::UpdatePaintNodeData*) + 1124
#6 Object "QtGui", at 0x10563d9de, in QOpenGLContext::doneCurrent() + 14
#5 Object "libsystem_platform.dylib", at 0x7fff204a5d7c, in _sigtramp + 28
#4 Object "libignition-tools-backward.dylib", at 0x1014f5242, in backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 34
#3 Object "libignition-tools-backward.dylib", at 0x1014f548a, in backward::SignalHandling::handleSignal(int, __siginfo*, void*) + 106
#2 Object "libignition-tools-backward.dylib", at 0x1014f55a8, in backward::StackTraceImplbackward::system_tag::darwin_tag::load_from(void*, unsigned long, void*, void*) + 56
#1 Object "libignition-tools-backward.dylib", at 0x1014f5701, in backward::StackTraceImplbackward::system_tag::darwin_tag::load_here(unsigned long, void*, void*) + 129
#0 Object "libignition-tools-backward.dylib", at 0x1014f6f60, in unsigned long backward::details::unwind<backward::StackTraceImplbackward::system_tag::darwin_tag::callback>(backward::StackTraceImplbackward::system_tag::darwin_tag::callback, unsigned long) + 32


</details>

This are my collection of ignition libraries

<details>
<summary>Collection of Ignition Libraries</summary>

```bash
./ign-utils
* ign-utils1

./ign-gazebo
  ahcorde/improve/install_instructions
  ahcorde/pybind11
* feature/ign-gazebo7-metal
  ign-gazebo6
  main
 M CMakeLists.txt
 M src/systems/CMakeLists.txt

./ign-plugin
* ign-plugin1

./ign-rendering
  ahcorde/install/macos
  feature/ign-rendering6-metal-macos
  ign-rendering6
* main

./ign-math
  ahcorde/macos/install
  ahcorde/python/triangle
  ahcorde/python_all
* ign-math6

./ign-sensors
  ahcorde/macos/install
  ign-sensors6
* main

./ign-launch
  ahcorde/fix/install_instructions
* ign-launch5
  main

./pybind11
* master

./ign-cmake
* ign-cmake2

./ign-tools
* ign-tools1

./ign-msgs
* main

./ign-transport
  ahcorde/docs/tweaks
* ign-transport11
  main
 M example/CMakeLists.txt

./ign-gui
  ahcorde/macos/install
* feature/ign-gui7-metal
  ign-gui6
  main
 M CMakeLists.txt

./ign-fuel-tools
* main

./ign-common
  ahcorde/macos/install
* ign-common4

./ign-physics
  ahcorde/improve/readme.md
* ign-physics5
  main

./sdformat
  main
* sdf12

@srmainwaring
Copy link
Contributor Author

srmainwaring commented Nov 19, 2021

I was able to compile it but I'm getting this trace when I try to run it:

Hi @ahcorde it looks like you may be missing the <render_system>metal</render_system> element from the XML for the MinimalScene plugin (the branches with Metal support currently hardcode the Metal QML backend but dynamically determine which render system to load for the MinimalScene plugin - that you're seeing a reference to an OpenGL context in the trace means the plugin is not loading the Metal version). You need something like this in gui.config or the world <gui> block:

<plugin filename="MinimalScene" name="3D View">
  <ignition-gui>
    <title>3D View</title>
    <property type="bool" key="showTitleBar">false</property>
    <property type="string" key="state">docked</property>
  </ignition-gui>
  <engine>ogre2</engine>
  <scene>scene</scene>
  <ambient_light>0.4 0.4 0.4</ambient_light>
  <background_color>0.8 0.8 0.8</background_color>
  <camera_pose>-6 0 6 0 0.5 0</camera_pose>
  <render_system>metal</render_system>
</plugin>

How about we move the discussion of the ign-gui and ign-gazebo support to gazebosim/gz-gui#314 as they build upon this PR but don't affect it directly (I've probably confused issues by referencing the gui / gazebo work in this thread).

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! but I think you should target main, right @iche033

@chapulina
Copy link
Contributor

I think you should target main

I don't see any API/ABI changes in public headers, so we're good on that front. Does it break behavior or affect users negatively any other way?

Maybe we should revert #407 and see if the Ogre 2 tests pass on macOS CI with this PR?

@chapulina chapulina removed the 🌱 garden Ignition Garden label Nov 24, 2021
@srmainwaring
Copy link
Contributor Author

Maybe we should revert #407 and see if the Ogre 2 tests pass on macOS CI with this PR?

The PR was set up to not change the default behaviour for macOS, so it will not alter the current CI tests for macOS (which will still use the OpenGL graphics API with Ogre2). I do have a local branch with a set of proposed changes to the tests which allow an additional graphics API parameter to be passed to the gtest runners, but thought it better to leave that for a separate PR as it has a wider impact and there is already a lot in this one.

@srmainwaring
Copy link
Contributor Author

LGTM! but I think you should target main, right @iche033

Thanks for the review @ahcorde. I think it's ok to stay in ign-rendering6. Any other changes required?

@srmainwaring srmainwaring requested a review from ahcorde November 25, 2021 06:46
@ahcorde ahcorde merged commit 8e7b7fb into gazebosim:ign-rendering6 Nov 25, 2021
@ahcorde
Copy link
Contributor

ahcorde commented Nov 25, 2021

@srmainwaring awesome contribution! Thank you!

@srmainwaring srmainwaring deleted the feature/ign-rendering6-metal-macos branch November 25, 2021 10:15
@srmainwaring
Copy link
Contributor Author

@iche033 and @ahcorde thanks for the review and feedback and for getting this merged.

One request please: could the ign-rendering6 branch with these changes be merged into main? I need the Metal ABI breaking change from main and this PR to prepare the Metal support PRs for ign-gui and ign-gazebo.

@ahcorde
Copy link
Contributor

ahcorde commented Nov 29, 2021

@srmainwaring #496

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏯 fortress Ignition Fortress macOS macOS support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants