vsgExamples icon indicating copy to clipboard operation
vsgExamples copied to clipboard

vsgcoordinateframe example fails on MacOS

Open rainergericke opened this issue 1 year ago • 11 comments

The new vsgcoodinateframe example does not work on MacOS 15.2 / Vulkan 1.3.296.

viewpoint [0. universe_view] ref_ptr<vsg::Object>(vsg::Group 0x140378008) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140379b3c) 
viewpoint [1. _1_sun_view] ref_ptr<vsg::Object>(vsg::Group 0x140378008) ref_ptr<vsg::Object>(vsg::CoordinateFrame 0x140378dc0) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140378c98) 
viewpoint [1. _2_orbit_view] ref_ptr<vsg::Object>(vsg::Group 0x140378008) ref_ptr<vsg::Object>(vsg::CoordinateFrame 0x140378dc0) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140378990) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x1403788c0) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140378804) 
viewpoint [1. _3_palace_view] ref_ptr<vsg::Object>(vsg::Group 0x140378008) ref_ptr<vsg::Object>(vsg::CoordinateFrame 0x140378dc0) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140378990) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x1403788c0) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140378724) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140378668) 
viewpoint [2. _1_sun_view] ref_ptr<vsg::Object>(vsg::Group 0x140378008) ref_ptr<vsg::Object>(vsg::CoordinateFrame 0x140379a34) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x14037990c) 
viewpoint [2. _2_orbit_view] ref_ptr<vsg::Object>(vsg::Group 0x140378008) ref_ptr<vsg::Object>(vsg::CoordinateFrame 0x140379a34) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140379604) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140379534) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140379478) 
viewpoint [2. _3_palace_view] ref_ptr<vsg::Object>(vsg::Group 0x140378008) ref_ptr<vsg::Object>(vsg::CoordinateFrame 0x140379a34) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140379604) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140379534) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x140379398) ref_ptr<vsg::Object>(vsg::MatrixTransform 0x1403792dc) 
info: universe bounds computeBounds.bounds = 
    -3.99994e+09 -3.99997e+09 -3.99995e+09
    3.99993e+09 3.99998e+09 4e+09

info: initial viewpoint : 0. universe_view
[mvk-error] VK_ERROR_INITIALIZATION_FAILED: Render pipeline compile failed (Error code 2):
Vertex attribute vsg_Normal(1) is missing from the vertex descriptor.
libc++abi: terminating due to uncaught exception of type vsg::Exception
zsh: abort      vsgcoordinateframe

rainergericke avatar Jan 11 '25 06:01 rainergericke

vsgcoordinateframe doesn't do anything novel w.r.t graphics pipeline, it just uses vsg::Builder and vsg::TileDatabase.

Have you updated VSG, vsgXchange and vsgExamples?

What happens when you run vsgtiledatabase?

robertosfield avatar Jan 11 '25 08:01 robertosfield

First: my build script m_vsg_current_sh.txt

vsgtiledatabase crashes: vsgtiledatabase_dump.txt

vsgcoordinateframe leads to this dump: vsgcoordinateframe_dump.txt

Does it work on your Mac?

rainergericke avatar Jan 11 '25 09:01 rainergericke

What happens when you run:

vsgviewer models/openstreetmap.vsgt

I am using my mac right now, but just for doing a bit of email support away from my office. I haven't had time to learn and install all what is required to get a dev environment on this mac yet. I've had a long TODO list of tasks that I've been steadily working through. Next week is likely filled with reviewing submissions and resolving issues. I'm hoping to get to setting this Mac up after that work is cleared.

robertosfield avatar Jan 11 '25 11:01 robertosfield

vsgviewer models/openstreetmap.vsgt also fails.

vsg_openstreetmap_dump.txt

rainergericke avatar Jan 11 '25 12:01 rainergericke

In some ways that is good news it at least suggests it's an issue with paging/TileDataset rather any one specific example, so each of these examples are probably fine, but paging needs looking at. Has the paging functionality ever work on macOS?

When paging there are lots of parts that work together, we have the threads loading the data, with have the main thread doing the main loop, syncing the newly loaded data and deleting expired data, doing the record traversal and submitting the recorded command buffers to the Vulkan queue.

Any one of these parts could be the problem, or perhaps just the Vulkan driver itself.

robertosfield avatar Jan 11 '25 15:01 robertosfield

The paging functionality worked up to vsg v1.1.5. I install it with this script: m_vsg_work_sh.txt

rainergericke avatar Jan 11 '25 16:01 rainergericke

Knowing when it last worked is helpful. So v.1.1.6 is likely the culprit, with the vsg::Allocator changes being the most likely. I recall us chatting about this before.

I wonder if the macOS compilers/linking/runtime is adding some extra constraints to memory allocation/deletions that the new IntrusiveAllocator isn't accounting for as neither Windows and Linux have shown any issues with the introduction of the InstrusiveAllocator.

robertosfield avatar Jan 11 '25 17:01 robertosfield

@rainergericke I have collaborated with @reedev to get to the bottom of crash on the Rasberry Pi and NVidia Jetson when rendering paged databases. It looks like there was an issue with the vsg::IntrusiveAllocator defaulting to 4 byte alignment, bumping it up to 8 byte alignment has fixed the crash and paging is working perfectly now. As issues with paging is common with the issues on macOS there is chance that problem is the same. The fix to the alignment is now checked into VSG master:

https://github.com/vsg-dev/VulkanSceneGraph/commit/ed467381eae707969b502280702c188aa1906fbd

Could you checkout VSG, vsgXchange, vsgImGui (if you are using ImGui) and vsgExamples master and then test the paged models like models/openstreetmap.vsgt and see if things are resolved. Thanks.

robertosfield avatar Feb 01 '25 14:02 robertosfield

Sounds good. These examples work now on the Mac:

vsghelloworld
vsgviewer models/openstreetmap.vsgt
vsgtiledatabase
vsgpagedlod

also working now:

vsgtexturearray
vsgtexturprojection

rainergericke avatar Feb 01 '25 15:02 rainergericke

Wahhhooooo!!!! That's great news. Such a simple change. It's a shame that there weren't more obvious indicators that this was the problem.

Does vsgcoordinateframe work as well?

Could you close the Issues that are now addressed by this change?

robertosfield avatar Feb 01 '25 16:02 robertosfield

vsgcoordinateframe crashes on the Mac.

vsgcoordinateframe_dump.txt vsgcoordinateframe_err.txt

A few others don't work as well. I will work it out and show it in the discussions.

rainergericke avatar Feb 01 '25 17:02 rainergericke