Skip to content

Commit

Permalink
vision os target support
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckyIYI authored Jul 22, 2024
1 parent b809567 commit db76d9f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public extension MTLDevice {
return supportsFeatureSet(.iOS_GPUFamily4_v1)
#elseif os(macOS)
return supportsFeatureSet(.macOS_GPUFamily1_v3)
#elseif os(visionOS)
return false
#endif
case .tileShaders:
return supportsFamily(.apple4)
Expand All @@ -50,7 +52,7 @@ public extension MTLDevice {
var familiesWithReadWriteCubeMapSupport: [MTLGPUFamily] = [
.apple4, .apple5, .apple6, .apple7, .apple8, .mac2
]
if #available(iOS 16.0, macOS 13.0, *) {
if #available(iOS 16.0, macOS 13.0, visionOS 1.0, *) {
familiesWithReadWriteCubeMapSupport.append(.metal3)
}
for family in familiesWithReadWriteCubeMapSupport where supportsFamily(family) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public extension MTLPixelFormat {
case .a8Unorm:
return false
case .rgb9e5Float:
#if os(iOS) && !targetEnvironment(macCatalyst)
#if (os(iOS) || os(visionOS)) && !targetEnvironment(macCatalyst)
return true
#elseif os(macOS) || (os(iOS) && targetEnvironment(macCatalyst))
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import MetalKit
import MetalPerformanceShaders

public extension MTLTexture {
#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
#if os(iOS) || os(tvOS) || os(visionOS) || targetEnvironment(macCatalyst)
typealias NSUIImage = UIImage
#elseif os(macOS) && !targetEnvironment(macCatalyst)
typealias NSUIImage = NSImage
Expand Down Expand Up @@ -174,7 +174,7 @@ public extension MTLTexture {
/// This method first converts the texture to a `CGImage` and then creates a `NSUIImage` from it.
func image(colorSpace: CGColorSpace? = nil) throws -> NSUIImage {
let cgImage = try self.cgImage(colorSpace: colorSpace)
#if os(iOS)
#if (os(iOS) || os(visionOS))
return UIImage(cgImage: cgImage)
#elseif os(macOS)
return NSImage(
Expand Down

0 comments on commit db76d9f

Please sign in to comment.