I know this might be a peeve of mine, but looking into programming a simple Metal4 Compute Shader example, essentially updating the Performing Calculations on a GPU example code to work with CPP and Metal4.
I found that MTL::Allocation and MTL::Buffer pointers can't be used interchangeably when you are trying to add allocations to a MTL::ResidencySet, this is forcing you to:
- Know by heart that they inherit from each other and that you can just cast them (this is a bit suspicious though, it did work for me).
- Forcefully either
C-castorreinterpret_casttheMTL::Bufferpointer to aMTL::Allocationpointer as theMTL::ResidencySetwill only accept that type.
I might as well just be plain wrong about how this is used, any tips on correct usage in that case?
Is there any expectation to either provide a typecast operator or add inheritance to support the expected behaviour seen in Swift and ObjC, which is just passing the thing?
Opened a report with # FB24534953 with some extra information. Bear in mind that the example code uses Premake5, but it can generate an Xcode solution easily.