Assorted fixes for more robust handling of asset corner cases #1915
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Enables shader texture transform only if it's actually textured. If it's not (for example if a texture failed to load or if the material data are strange in some way), then the shader construction would assert with
This change doesn't fix any root causes of a texture missing or failing to load, it only makes it not abort anymore.
Also removed a now-irrelevant TODO and a branch in flat material data setup -- that check should have been done in the shader setup code in the first place anyway, which is how it's done now.The TODO was about a different thing, reverted that back.Fixed a crash if the
BasisImporter
plugin wouldn't be present for whatever reason. (I disabled it in order to be able to test the above assert, and discovered this crash.)And fixed a case where files without a default scene would be treated as having no scene at all. This is the case for example with glTF files produced by
gltfpack
.How Has This Been Tested
With the
BasisImporter
plugin disabled, loading gltfpack-produced files shared by @mukulkhanna no longer dies with the above shader assertion.Originally the assertion was a consequence of this error:
... which as far as I can tell isn't reproducible on current
main
anymore. It was fixed by mosra/magnum@569ae5a (which delegates toBasisImporter
ifKtxImporter
isn't found), which was merged into Habitat with #1853.Types of changes