Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove reliance on
IRCompiler
in unrelated objects
In the previous PR we separated the loaded function pointers (strictly: "just the library") from a created `IRCompiler` instance, because those instances need to be mutated and are not thread-safe. We also borrowed the `IRCompiler` inside `IRObject` to pass into some other `fn new()` constructors, making sure that they would use the same compiler instead of taking that as a separate argument. This is super inconvenient, because `IRCompiler` cannot be mutated (mutably borrowed) while an `IRObject` is live. And for no good reason: when splitting `IRCompiler` we forgot to make sure that most constructor functions only take the function pointers as they don't need the full `IRCompiler` in the first place. By replacing it with the function pointers in every constructor we no longer need to borrow `IRCompiler` inside `IRObject`. Also move some public constructor functions directly on the `MetalIrConverter` struct instead of having to pass it in as borrowed argument. For constructor functions that don't need to be used publicly (i.e. only via special getter functions that create an object before filling it with data, specifically `IRShaderReflection` and `IRMetalLibBinary`), the constructor is made private and takes the function pointer structure directly.
- Loading branch information