Skip to content

AssimpImporter: clean up STL types + update tests to 5.2.5 - #130

Closed
pezcode wants to merge 20 commits into
mosra:masterfrom
pezcode:assimp-cleanup-5_2_5
Closed

pezcode wants to merge 20 commits into
mosra:masterfrom
pezcode:assimp-cleanup-5_2_5

Conversation

@pezcode

@pezcode pezcode commented Sep 10, 2022

Copy link
Copy Markdown
Contributor

5.2.5 just got released and finally fixes the issues with glTF and multiple sets of vertex joint weights. I just wanted to update the tests but then got caught in a cleanup session 👀

Some of these changes may not be desired so I tried to keep them as granular as possible, so they can be reverted/dropped individually.

Mostly, this removes the majority of std types that have equivalents in Corrade::Containers, except for unordered_map and a few cases of std::string required by the assimp or importer API.

Tests got adapted to:

  • 5.2.3 not outright failing to import glTFs with multiple skinning attribute sets anymore
  • XFAIL 5.2.4 temporarily breaking skinning attributes for all file types
  • 5.2.5 correctly importing all(!) skinning attributes, for all file types

@mosra mosra added this to the 2022.0a milestone Sep 13, 2022

@mosra mosra left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Ohh, this is a nice surprise cleanup. Thank you!

/* For each mesh, map from mesh-relative bones to merged bone list */
std::vector<std::vector<UnsignedInt>> boneMap;
std::vector<const aiBone*> mergedBones;
Containers::Array<Containers::Array<UnsignedInt>> boneMap;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Because the boneMap is filled sequentially (if I see correctly), I was wondering if we could avoid the nested allocations by having just one array and an offset array to index into that? If it's not too much extra testing effort.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea 👍 I'll check if the current tests cover this well enough, otherwise I'll extend them a bit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I extended the tests a bit and I feel like I've hit a bug either with assimp or the bone merging logic in our code. Not too much time to investigate before I leave on vacation for ~2 weeks, but I'll pick this back up afterwards.

@mosra mosra Sep 19, 2022 •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

In that case, can you just push/rebase the remaining changes except this one? This particular optimization can wait two weeks, but I now have 5.2.5 on my system (and I expect Homebrew will soon as well) and it'd be nice to have this merged to have tests passing again.

Thank you!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I pushed everything except this change. https://github.com/pezcode/magnum-plugins/tree/assimp-skin-merge-better-test has the change + extended tests that fail, if you care to look at it.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Awesome, thanks :) Looked at the commit, but didn't see anything suspicious. Strange library, strange bugs.

Anyway, enjoy your vacation! 🌴

@mosra

mosra commented Sep 17, 2022

Copy link
Copy Markdown
Owner

Oh, and the stupid ARM test crash is fixed in c0337ef. I was neglecting it because I expected some alignment issues deep inside stb_image_resize, but turns out it wasn't that at all. If you rebase, the build will pass and a Codecov report gets triggered properly.

@codecov

codecov Bot commented Sep 18, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #130 (4b08c3f) into master (477cace) will decrease coverage by 0.00%.
The diff coverage is 98.82%.

@@            Coverage Diff             @@
##           master     #130      +/-   ##
==========================================
- Coverage   96.76%   96.76%   -0.01%     
==========================================
  Files         130      130              
  Lines       13665    13687      +22     
==========================================
+ Hits        13223    13244      +21     
- Misses        442      443       +1     
Impacted Files Coverage Δ
...rc/MagnumPlugins/AssimpImporter/AssimpImporter.cpp 90.43% <98.82%> (+0.10%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

This whole ordeal was apparently already solved elsewhere
Since we always report all custom mesh attributes when a file is open
regardless of whether any mesh uses them, it makes no sense to store
them per scene
To make up for Array not overallocating when growing (unlike vector) and
one instance of unordered_map without memory reservation
It's completely broken, reporting wrong attribute count or just wrong
attribute data. For some reason it works with glTF files but that might
just be a weird interaction with the other brokenness there. It got
fixed right away in 5.2.5, and the importer can't really detect or
handle it anyway, so no change there.
…weights from glTF

Adapt the check and warning to only run on affected versions, and limit
the XFAIL as well
…dling

And always report them, regardless of whether a file is opened
Useless attempt to micro-optimize memory when assimp just eats it by the
bucket anyway
@mosra made some nice changes to make this possible
@pezcode
pezcode force-pushed the assimp-cleanup-5_2_5 branch 2 times, most recently from 00a7ab1 to d5385bc Compare September 19, 2022 22:14
@pezcode

pezcode commented Sep 19, 2022

Copy link
Copy Markdown
Contributor Author

Some Linux CIs are failing because of old GCC not liking my array initialization syntax. I feel like I've fixed this before, but before I waste CI minutes on this, do you know what's wrong there?

constexpr Containers::StringView objectNames[]{
    "Mesh_1"_s, "Mesh_2"_s, "Plane"_s
};
constexpr Containers::StringView jointNames[][2]{
    {"Node_1"_s, "Node_2"_s},
    {"Node_3"_s, "Node_4"_s}
};

AssimpImporterTest.cpp:1382:5: error: array must be initialized with a brace-enclosed initializer

@mosra

mosra commented Sep 19, 2022 •

Copy link
Copy Markdown
Owner

Try with just const and not constexpr? That's what usually makes it go crazy.

Or maybe it doesn't like the implicit size? No idea.

@mosra

mosra commented Sep 20, 2022

Copy link
Copy Markdown
Owner

I squashed in some of the fixup commits and merged the commit series as 477cace...549486d. Now the only remaining test failure for me locally is glslang which I have to look at, Assimp is sparkling clean ✨

Thank you!

@mosra mosra closed this Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants