Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Metal] Add support for Xcode15. (#19379)
This PR brings all the changes from the new Metal APIs. During the review pay special attention to the changes done in the Protocols in order to add tvOS support. The main problem we have had doing this PR is that tvOS was not done on time before the NET branching, that left us with a lot of memebers that were NOT added in tvOS that are abstract on dotnet, which has left use in a pickle. Lets use the following code as an example. Code found before this commit: ```csharp [Mac (11, 0), iOS (14, 0), NoTV] [MacCatalyst (14, 0)] #if NET [Abstract] #endif [Export ("accelerationStructureCommandEncoder")] IMTLAccelerationStructureCommandEncoder CreateAccelerationStructureCommandEncoder (); ``` A naive approach would be to add just the tvOS suppor as follows: ```csharp [Mac (11, 0), iOS (14, 0), TV (16,0)] [MacCatalyst (14, 0)] #if NET [Abstract] #endif [Export ("accelerationStructureCommandEncoder")] IMTLAccelerationStructureCommandEncoder CreateAccelerationStructureCommandEncoder (); ``` The above change represents and API braking change on the donet tvOS dll because it adds a new Abstrtact members, so this is no an acceptable solution. There is a second naive approach we can take which is as follows: ```csharp [Mac (11, 0), iOS (14, 0), TV (16,0)] [MacCatalyst (14, 0)] #if NET &!TVOS [Abstract] #endif [Export ("accelerationStructureCommandEncoder")] IMTLAccelerationStructureCommandEncoder CreateAccelerationStructureCommandEncoder (); ``` Yet again, the naive approach has an issue with it. In this case, all the extension methods that are generated for tvOS (something the generator writes when methods are not abstract) will be decorated with availability attributes for all the other platforms, which is incorrect and will make developers life worse. That leaves us with the following approach: ```csharp #if NET #if !TVOS [Mac (11, 0), iOS (14, 0), NoTV, MacCatalyst (14, 0)] [Abstract] #else [NoMac, NoiOS, TV (16,0), NoMacCatalyst] #endif #else [Mac (11, 0), iOS (14, 0), TV (16,0), MacCatalyst (14, 0)] #endif [Export ("accelerationStructureCommandEncoder")] IMTLAccelerationStructureCommandEncoder CreateAccelerationStructureCommandEncoder (); ``` With the above change, we do not add an abstract method in tvOS and we only add the tvOS abailabity attribute to the extension methods, and use NoiOS etc for all the other platforms. The change had to be done to ALL methods that added tvOS support. The good news are that our cecil tests and our introspection tests catch the two naive approaces :) --------- Co-authored-by: GitHub Actions Autoformatter <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]> Co-authored-by: Haritha Mohan <[email protected]> Co-authored-by: Alex Soto <[email protected]>
- Loading branch information
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.