diff --git a/thermion_dart/native/include/generated/ThermionTextureSwiftObjCAPI.h b/thermion_dart/native/include/generated/ThermionTextureSwiftObjCAPI.h index 3fb65fbe..86242ee8 100644 --- a/thermion_dart/native/include/generated/ThermionTextureSwiftObjCAPI.h +++ b/thermion_dart/native/include/generated/ThermionTextureSwiftObjCAPI.h @@ -310,7 +310,7 @@ SWIFT_CLASS("_TtC12swift_module20ThermionTextureSwift") @property (nonatomic, strong) id _Nullable metalTexture; @property (nonatomic) NSInteger metalTextureAddress; - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; -- (nonnull instancetype)initWithWidth:(int64_t)width height:(int64_t)height isDepth:(BOOL)isDepth OBJC_DESIGNATED_INITIALIZER; +- (nonnull instancetype)initWithWidth:(int64_t)width height:(int64_t)height isDepth:(BOOL)isDepth isStencil:(BOOL)isStencil OBJC_DESIGNATED_INITIALIZER; - (void)destroyTexture; - (BOOL)fillWithPNGImageWithImageURL:(NSURL * _Nonnull)imageURL SWIFT_WARN_UNUSED_RESULT; - (void)fillColor; diff --git a/thermion_dart/native/macos/ThermionTexture.swift b/thermion_dart/native/macos/ThermionTexture.swift index 5f1d3a30..90364aaf 100644 --- a/thermion_dart/native/macos/ThermionTexture.swift +++ b/thermion_dart/native/macos/ThermionTexture.swift @@ -21,7 +21,7 @@ import GLKit } - @objc public init(width:Int64, height:Int64, isDepth:Bool) { + @objc public init(width:Int64, height:Int64, isDepth:Bool, isStencil:Bool) { if(self.metalDevice == nil) { self.metalDevice = MTLCreateSystemDefaultDevice()! } @@ -30,7 +30,7 @@ import GLKit print("Creating depth texture") // Create a proper depth texture without IOSurface backing let textureDescriptor = MTLTextureDescriptor.texture2DDescriptor( - pixelFormat: .depth32Float, + pixelFormat: isStencil ? .depth24Unorm_stencil8 : .depth32Float_stencil8, width: Int(width), height: Int(height), mipmapped: false) @@ -45,9 +45,6 @@ import GLKit print("Creating color texture") - - // let pixelFormat: MTLPixelFormat = isDepth ? .depth32Float : .bgra8Unorm - // let cvPixelFormat = isDepth ? kCVPixelFormatType_DepthFloat32 : kCVPixelFormatType_32BGRA if(CVPixelBufferCreate(kCFAllocatorDefault, Int(width), Int(height), kCVPixelFormatType_32BGRA, pixelBufferAttrs, &pixelBuffer) != kCVReturnSuccess) {