Improved parsing of MBS2 structure#2
Merged
BiOpenly merged 4 commits intoPanfrost:masterfrom Aug 2, 2017
Merged
Conversation
A lot of blocks seem to be "container blocks" that have nothing more than a size followed by a bunch of other blocks. Thus, blocks have a tree structure where blocks can contain other blocks. Represent that by increasing the indentation for sub-blocks of a given block, and restructure the code to make parsing these blocks easier. Make the MBS2 block the first container block.
Now we always use the size in the header instead of guessing (often incorrectly) the block size. I've also added some more details, and removed some assertions that were tripping. Altogether, this is enough to be able to parse a simple fragment shader from the malisc offline shader compiler.
Seems like part of the EBIN block is a list of uniform relocations.
This should make the disassembly of get_program_binary output reasonable again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
As it turns out, every block always starts with a cookie followed by the length of the block. This lets us make the parsing much more robust without having to fully understand everything. I also fixed up a few other things along the way, so now it can handle most things you would throw at it using the offline compiler.