mirror of
https://github.com/darlinghq/darling-metal.git
synced 2024-11-26 22:20:22 +00:00
Make Metal an optional part of the build
See the corresponding commit in the main repo
This commit is contained in:
parent
b93743008c
commit
ac46a16f60
@ -4,7 +4,9 @@ remove_sdk_framework(Metal)
|
||||
remove_sdk_framework(MetalKit)
|
||||
remove_sdk_framework(MetalPerformanceShaders)
|
||||
|
||||
add_subdirectory(deps/indium)
|
||||
if (BUILD_METAL)
|
||||
add_subdirectory(deps/indium)
|
||||
endif()
|
||||
|
||||
add_compile_options(
|
||||
-fvisibility=hidden
|
||||
@ -24,6 +26,12 @@ generate_sdk_framework(Metal
|
||||
HEADER "include/Metal"
|
||||
)
|
||||
|
||||
if (BUILD_METAL)
|
||||
set(METAL_LINK_INDIUM indium)
|
||||
else()
|
||||
set(METAL_LINK_INDIUM "")
|
||||
endif()
|
||||
|
||||
add_framework(Metal
|
||||
# Metal is not supported in 32-bit apps, but it does still link successfully into such apps.
|
||||
# thus, we have to provide a 32-bit build of the framework, but it doesn't have to provide any
|
||||
@ -51,7 +59,7 @@ add_framework(Metal
|
||||
system
|
||||
objc
|
||||
Foundation
|
||||
indium
|
||||
${METAL_LINK_INDIUM}
|
||||
cxx
|
||||
)
|
||||
|
||||
@ -79,6 +87,12 @@ target_include_directories(Metal_private INTERFACE
|
||||
private-include
|
||||
)
|
||||
|
||||
if (BUILD_METAL)
|
||||
target_compile_definitions(Metal PUBLIC
|
||||
DARLING_METAL_ENABLED=1
|
||||
)
|
||||
endif()
|
||||
|
||||
#
|
||||
# MetalKit
|
||||
#
|
||||
|
@ -37,6 +37,12 @@ int main(int argc, char** argv) {
|
||||
window.styleMask |= NSWindowStyleMaskResizable;
|
||||
|
||||
id<MTLDevice> device = [MTLCreateSystemDefaultDevice() autorelease];
|
||||
|
||||
if (!device) {
|
||||
fprintf(stderr, "Failed to create system default device. Metal may not be supported on your system.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
MTKView* view = [[[MTKView alloc] initWithFrame: NSMakeRect(0, 0, 800, 600) device: device] autorelease];
|
||||
AAPLRenderer* renderer = [[[AAPLRenderer alloc] initWithMetalKitView: view] autorelease];
|
||||
|
||||
|
@ -22,15 +22,19 @@
|
||||
|
||||
#import <Metal/MTLBuffer.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
@interface MTLBufferInternal : NSObject <MTLBuffer>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
@property(readonly) std::shared_ptr<Indium::Buffer> buffer;
|
||||
|
||||
- (instancetype)initWithBuffer: (std::shared_ptr<Indium::Buffer>)buffer
|
||||
device: (id<MTLDevice>)device
|
||||
resourceOptions: (MTLResourceOptions)options;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
@ -19,11 +19,15 @@
|
||||
|
||||
#import <Metal/MTLCommandBuffer.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
@interface MTLCommandBufferInternal : NSObject <MTLCommandBuffer>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
- (instancetype)initWithCommandBuffer: (std::shared_ptr<Indium::CommandBuffer>)commandBuffer
|
||||
commandQueue: (id<MTLCommandQueue>)commandQueue;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
@ -22,12 +22,16 @@
|
||||
|
||||
#import <Metal/MTLCommandQueue.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
@interface MTLCommandQueueInternal : NSObject <MTLCommandQueue>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
- (instancetype)initWithQueue: (std::shared_ptr<Indium::CommandQueue>)queue
|
||||
device: (id<MTLDevice>)device;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
@ -19,7 +19,9 @@
|
||||
|
||||
#import <Metal/MTLComputeCommandEncoder.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
@interface MTLComputePassSampleBufferAttachmentDescriptorArray (Internal) <NSCopying>
|
||||
|
||||
@ -27,13 +29,17 @@
|
||||
|
||||
@interface MTLComputePassDescriptor (Internal)
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
- (Indium::ComputePassDescriptor)asIndiumDescriptor;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@interface MTLComputeCommandEncoderInternal : NSObject <MTLComputeCommandEncoder>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
- (instancetype)initWithEncoder: (std::shared_ptr<Indium::ComputeCommandEncoder>)encoder
|
||||
device: (id<MTLDevice>)device;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
@ -22,21 +22,27 @@
|
||||
|
||||
#import <Metal/MTLComputePipeline.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
@interface MTLComputePipelineDescriptor (Internal)
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
- (Indium::ComputePipelineDescriptor)asIndiumDescriptor;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@interface MTLComputePipelineStateInternal : NSObject <MTLComputePipelineState>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
@property(readonly) std::shared_ptr<Indium::ComputePipelineState> state;
|
||||
|
||||
- (instancetype)initWithState: (std::shared_ptr<Indium::ComputePipelineState>)state
|
||||
device: (id<MTLDevice>)device
|
||||
label: (NSString*)label;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
@ -22,12 +22,15 @@
|
||||
|
||||
#import <Metal/MTLDevice.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
void MTLDeviceDestroyAll(void);
|
||||
|
||||
@interface MTLDeviceInternal : NSObject <MTLDevice>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
@property(readonly) std::shared_ptr<Indium::Device> device;
|
||||
|
||||
- (instancetype)initWithDevice: (std::shared_ptr<Indium::Device>)device;
|
||||
@ -35,6 +38,7 @@ void MTLDeviceDestroyAll(void);
|
||||
- (void)stopPolling;
|
||||
|
||||
- (void)waitUntilPollingIsStopped;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
@ -22,17 +22,23 @@
|
||||
|
||||
#import <Metal/MTLDrawable.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
@protocol MTLDrawableInternal <MTLDrawable>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
@property(readonly) std::shared_ptr<Indium::Drawable> drawable;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@interface MTLDrawableInternal : NSObject <MTLDrawableInternal>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
- (instancetype)initWithDrawable: (std::shared_ptr<Indium::Drawable>)drawable;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
@ -22,21 +22,27 @@
|
||||
|
||||
#import <Metal/MTLLibrary.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
@interface MTLFunctionInternal : NSObject <MTLFunction>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
@property(readonly) std::shared_ptr<Indium::Function> function;
|
||||
|
||||
- (instancetype)initWithFunction: (std::shared_ptr<Indium::Function>)function
|
||||
device: (id<MTLDevice>)device;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@interface MTLLibraryInternal : NSObject <MTLLibrary>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
- (instancetype)initWithLibrary: (std::shared_ptr<Indium::Library>)library
|
||||
device: (id<MTLDevice>)device;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
@ -22,17 +22,23 @@
|
||||
|
||||
#import <Metal/MTLPipeline.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
@interface MTLPipelineBufferDescriptor (Internal)
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
- (Indium::PipelineBufferDescriptor)asIndiumDescriptor;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@interface MTLPipelineBufferDescriptorArray (Internal) <NSCopying>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
- (std::unordered_map<size_t, Indium::PipelineBufferDescriptor>)asIndiumDescriptors;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
@ -19,7 +19,9 @@
|
||||
|
||||
#import <Metal/MTLPixelFormat.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
METAL_DECLARATIONS_BEGIN
|
||||
|
||||
|
@ -22,10 +22,13 @@
|
||||
|
||||
#import <Metal/MTLRenderCommandEncoder.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
METAL_DECLARATIONS_BEGIN
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
NS_INLINE
|
||||
Indium::ClearColor MTLClearColorToIndium(MTLClearColor clearColor) {
|
||||
return Indium::ClearColor { clearColor.red, clearColor.green, clearColor.blue, clearColor.alpha };
|
||||
@ -90,13 +93,16 @@ Indium::ScissorRect MTLScissorRectToIndium(MTLScissorRect rect) {
|
||||
- (Indium::RenderPassDescriptor)asIndiumDescriptor;
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface MTLRenderCommandEncoderInternal : NSObject <MTLRenderCommandEncoder>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
@property(readonly) std::shared_ptr<Indium::RenderCommandEncoder> encoder;
|
||||
|
||||
- (instancetype)initWithEncoder: (std::shared_ptr<Indium::RenderCommandEncoder>)encoder
|
||||
device: (id<MTLDevice>)device;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
@ -22,12 +22,15 @@
|
||||
|
||||
#import <Metal/MTLRenderPipeline.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
METAL_DECLARATIONS_BEGIN
|
||||
|
||||
@protocol MTLDevice;
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
@interface MTLRenderPipelineDescriptor (Internal)
|
||||
|
||||
- (Indium::RenderPipelineDescriptor)asIndiumDescriptor;
|
||||
@ -47,14 +50,17 @@ METAL_DECLARATIONS_BEGIN
|
||||
- (Indium::RenderPipelineColorAttachmentDescriptor)asIndiumDescriptor;
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface MTLRenderPipelineStateInternal : NSObject <MTLRenderPipelineState>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
@property(readonly) std::shared_ptr<Indium::RenderPipelineState> state;
|
||||
|
||||
- (instancetype)initWithState: (std::shared_ptr<Indium::RenderPipelineState>)state
|
||||
device: (id<MTLDevice>)device
|
||||
label: (NSString*)label;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
@ -22,8 +22,11 @@
|
||||
|
||||
#import <Metal/MTLTexture.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
NS_INLINE
|
||||
Indium::TextureSwizzleChannels MTLTextureSwizzleChannelsToIndium(MTLTextureSwizzleChannels channels) {
|
||||
return Indium::TextureSwizzleChannels {
|
||||
@ -43,16 +46,19 @@ MTLTextureSwizzleChannels MTLTextureSwizzleChannelsFromIndium(Indium::TextureSwi
|
||||
static_cast<MTLTextureSwizzle>(channels.alpha),
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
// private export
|
||||
MTL_EXPORT
|
||||
@interface MTLTextureInternal : NSObject <MTLTexture>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
@property(readonly) std::shared_ptr<Indium::Texture> texture;
|
||||
|
||||
- (instancetype)initWithTexture: (std::shared_ptr<Indium::Texture>)texture
|
||||
device: (id<MTLDevice>)device
|
||||
resourceOptions: (MTLResourceOptions)options;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#import <Metal/MTLTypes.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
|
||||
NS_INLINE
|
||||
@ -41,5 +42,6 @@ Indium::Region MTLRegionToIndium(MTLRegion region) {
|
||||
Indium::Size { region.size.width, region.size.height, region.size.depth },
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // _METAL_MTLTYPESINTERNAL_H_
|
||||
|
@ -34,11 +34,14 @@
|
||||
abort(); \
|
||||
}
|
||||
|
||||
#if !__OBJC2__
|
||||
#if !__OBJC2__ || !DARLING_METAL_ENABLED
|
||||
// shut Clang up about unimplemented methods and properties
|
||||
#pragma clang diagnostic ignored "-Wobjc-property-implementation"
|
||||
#pragma clang diagnostic ignored "-Wprotocol"
|
||||
#pragma clang diagnostic ignored "-Wincomplete-implementation"
|
||||
#pragma clang diagnostic ignored "-Wobjc-protocol-property-synthesis"
|
||||
|
||||
#undef DARLING_METAL_ENABLED
|
||||
#endif
|
||||
|
||||
#endif // _METAL_STUBS_H_
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
@implementation MTLBufferInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize buffer = _buffer;
|
||||
@synthesize device = _device;
|
||||
@ -88,6 +88,15 @@
|
||||
|
||||
#else
|
||||
|
||||
@dynamic length;
|
||||
@dynamic gpuAddress;
|
||||
@dynamic device;
|
||||
@dynamic cpuCacheMode;
|
||||
@dynamic storageMode;
|
||||
@dynamic hazardTrackingMode;
|
||||
@dynamic resourceOptions;
|
||||
@dynamic label;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
|
@ -25,6 +25,7 @@
|
||||
#import <Metal/stubs.h>
|
||||
#import <Metal/MTLRenderCommandEncoderInternal.h>
|
||||
|
||||
#if DARLING_METAL_ENABLED
|
||||
// used to take care of RR while passing the block around in C++ code
|
||||
struct MTLCommandBufferHandlerWrapper {
|
||||
MTLCommandBufferHandler handler = nil;
|
||||
@ -59,10 +60,11 @@ struct MTLCommandBufferHandlerWrapper {
|
||||
handler(commandBuffer);
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
@implementation MTLCommandBufferInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
{
|
||||
std::shared_ptr<Indium::CommandBuffer> _commandBuffer;
|
||||
@ -150,6 +152,10 @@ struct MTLCommandBufferHandlerWrapper {
|
||||
|
||||
#else
|
||||
|
||||
@dynamic commandQueue;
|
||||
@dynamic device;
|
||||
@dynamic label;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
@implementation MTLCommandQueueInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
{
|
||||
std::shared_ptr<Indium::CommandQueue> _queue;
|
||||
@ -62,6 +62,9 @@
|
||||
|
||||
#else
|
||||
|
||||
@dynamic device;
|
||||
@dynamic label;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
@implementation MTLComputePassSampleBufferAttachmentDescriptor
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (id)copyWithZone: (NSZone*)zone
|
||||
{
|
||||
@ -46,6 +46,10 @@
|
||||
|
||||
#else
|
||||
|
||||
@dynamic sampleBuffer;
|
||||
@dynamic startOfEncoderSampleIndex;
|
||||
@dynamic endOfEncoderSampleIndex;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -54,7 +58,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLComputePassSampleBufferAttachmentDescriptorArray
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
{
|
||||
NSMutableDictionary<NSNumber*, MTLComputePassSampleBufferAttachmentDescriptor*>* _dict;
|
||||
@ -108,7 +112,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLComputePassSampleBufferAttachmentDescriptorArray (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (id)copyWithZone: (NSZone*)zone
|
||||
{
|
||||
@ -121,7 +125,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLComputePassDescriptor
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
+ (MTLComputePassDescriptor*)computePassDescriptor
|
||||
{
|
||||
@ -154,6 +158,9 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#else
|
||||
|
||||
@dynamic dispatchType;
|
||||
@dynamic sampleBufferAttachments;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -162,7 +169,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLComputePassDescriptor (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (Indium::ComputePassDescriptor)asIndiumDescriptor
|
||||
{
|
||||
@ -178,7 +185,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLComputeCommandEncoderInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
{
|
||||
std::shared_ptr<Indium::ComputeCommandEncoder> _encoder;
|
||||
@ -269,6 +276,10 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#else
|
||||
|
||||
@dynamic dispatchType;
|
||||
@dynamic device;
|
||||
@dynamic label;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
@implementation MTLComputePipelineDescriptor
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
@ -112,6 +112,20 @@
|
||||
|
||||
#else
|
||||
|
||||
@dynamic computeFunction;
|
||||
@dynamic threadGroupSizeIsMultipleOfThreadExecutionWidth;
|
||||
@dynamic maxTotalThreadsPerThreadgroup;
|
||||
@dynamic maxCallStackDepth;
|
||||
@dynamic stageInputDescriptor;
|
||||
@dynamic buffers;
|
||||
@dynamic supportIndirectCommandBuffers;
|
||||
@dynamic preloadedLibraries;
|
||||
@dynamic insertLibraries;
|
||||
@dynamic linkedFunctions;
|
||||
@dynamic supportAddingBinaryFunctions;
|
||||
@dynamic binaryArchives;
|
||||
@dynamic label;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -120,7 +134,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLComputePipelineDescriptor (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (Indium::ComputePipelineDescriptor)asIndiumDescriptor
|
||||
{
|
||||
@ -145,7 +159,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLComputePipelineStateInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize device = _device;
|
||||
@synthesize state = _pso;
|
||||
@ -223,6 +237,13 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#else
|
||||
|
||||
@dynamic maxTotalThreadsPerThreadgroup;
|
||||
@dynamic threadExecutionWidth;
|
||||
@dynamic staticThreadgroupMemoryLength;
|
||||
@dynamic device;
|
||||
@dynamic supportIndirectCommandBuffers;
|
||||
@dynamic label;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@ MTL_EXTERN const MTLDeviceNotificationName MTLDeviceWasAddedNotification = @"MTL
|
||||
MTL_EXTERN const MTLDeviceNotificationName MTLDeviceRemovalRequestedNotification = @"MTLDeviceRemovalRequested";
|
||||
MTL_EXTERN const MTLDeviceNotificationName MTLDeviceWasRemovedNotification = @"MTLDeviceWasRemoved";
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
static NSMutableArray<MTLDeviceInternal*>* devices = nil;
|
||||
static dispatch_once_t devicesInitToken = 0;
|
||||
@ -68,7 +68,7 @@ void MTLDeviceDestroyAll(void) {
|
||||
|
||||
MTL_EXTERN
|
||||
id<MTLDevice> MTLCreateSystemDefaultDevice(void) {
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
ensureDevices();
|
||||
if (systemDefaultDevice) {
|
||||
return [systemDefaultDevice retain];
|
||||
@ -79,7 +79,7 @@ id<MTLDevice> MTLCreateSystemDefaultDevice(void) {
|
||||
|
||||
MTL_EXTERN
|
||||
NSArray<id<MTLDevice>>* MTLCopyAllDevices(void) {
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
ensureDevices();
|
||||
return [devices copy];
|
||||
#else
|
||||
@ -104,7 +104,7 @@ void MTLRemoveDeviceObserver(id<NSObject> observer) {
|
||||
|
||||
@implementation MTLDeviceInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
{
|
||||
NSThread* _pollingThread;
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
@implementation MTLDrawableInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize drawable = _drawable;
|
||||
|
||||
@ -72,6 +72,9 @@
|
||||
|
||||
#else
|
||||
|
||||
@dynamic drawableID;
|
||||
@dynamic presentedTime;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
@implementation MTLFunctionInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize function = _function;
|
||||
@synthesize device = _device;
|
||||
@ -76,6 +76,17 @@
|
||||
|
||||
#else
|
||||
|
||||
@dynamic device;
|
||||
@dynamic functionType;
|
||||
@dynamic name;
|
||||
@dynamic options;
|
||||
@dynamic patchType;
|
||||
@dynamic patchControlPointCount;
|
||||
@dynamic vertexAttributes;
|
||||
@dynamic stageInputAttributes;
|
||||
@dynamic functionConstantsDictionary;
|
||||
@dynamic label;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -84,7 +95,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLLibraryInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
{
|
||||
std::shared_ptr<Indium::Library> _library;
|
||||
@ -135,6 +146,12 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#else
|
||||
|
||||
@dynamic installName;
|
||||
@dynamic type;
|
||||
@dynamic functionNames;
|
||||
@dynamic device;
|
||||
@dynamic label;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
@implementation MTLPipelineBufferDescriptor
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
@ -45,6 +45,8 @@
|
||||
|
||||
#else
|
||||
|
||||
@dynamic mutability;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -53,7 +55,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLPipelineBufferDescriptor (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (Indium::PipelineBufferDescriptor)asIndiumDescriptor
|
||||
{
|
||||
@ -68,7 +70,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLPipelineBufferDescriptorArray
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
{
|
||||
NSMutableDictionary<NSNumber*, MTLPipelineBufferDescriptor*>* _dict;
|
||||
@ -122,7 +124,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLPipelineBufferDescriptorArray (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (id)copyWithZone: (NSZone*)zone
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
@implementation MTLRenderPassAttachmentDescriptor
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize texture = _texture;
|
||||
@synthesize level = _level;
|
||||
@ -87,6 +87,18 @@
|
||||
|
||||
#else
|
||||
|
||||
@dynamic texture;
|
||||
@dynamic level;
|
||||
@dynamic slice;
|
||||
@dynamic depthPlane;
|
||||
@dynamic loadAction;
|
||||
@dynamic storeAction;
|
||||
@dynamic storeActionOptions;
|
||||
@dynamic resolveTexture;
|
||||
@dynamic resolveLevel;
|
||||
@dynamic resolveSlice;
|
||||
@dynamic resolveDepthPlane;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -95,7 +107,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPassAttachmentDescriptor (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (Indium::RenderPassAttachmentDescriptor)asIndiumDescriptor
|
||||
{
|
||||
@ -120,7 +132,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPassColorAttachmentDescriptor
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize clearColor = _clearColor;
|
||||
|
||||
@ -149,6 +161,8 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#else
|
||||
|
||||
@dynamic clearColor;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -157,7 +171,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPassColorAttachmentDescriptor (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (Indium::RenderPassColorAttachmentDescriptor)asIndiumDescriptor
|
||||
{
|
||||
@ -173,7 +187,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPassDepthAttachmentDescriptor
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize clearDepth = _clearDepth;
|
||||
@synthesize depthResolveFilter = _depthResolveFilter;
|
||||
@ -204,6 +218,9 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#else
|
||||
|
||||
@dynamic clearDepth;
|
||||
@dynamic depthResolveFilter;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -212,7 +229,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPassDepthAttachmentDescriptor (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (Indium::RenderPassDepthAttachmentDescriptor)asIndiumDescriptor
|
||||
{
|
||||
@ -229,7 +246,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPassStencilAttachmentDescriptor
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize stencilResolveFilter = _stencilResolveFilter;
|
||||
@synthesize clearStencil = _clearStencil;
|
||||
@ -259,6 +276,9 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#else
|
||||
|
||||
@dynamic stencilResolveFilter;
|
||||
@dynamic clearStencil;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -267,7 +287,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPassStencilAttachmentDescriptor (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (Indium::RenderPassStencilAttachmentDescriptor)asIndiumDescriptor
|
||||
{
|
||||
@ -284,7 +304,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPassColorAttachmentDescriptorArray
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
{
|
||||
NSMutableDictionary<NSNumber*, MTLRenderPassColorAttachmentDescriptor*>* _dict;
|
||||
@ -338,7 +358,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPassColorAttachmentDescriptorArray (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (id)copyWithZone: (NSZone*)zone
|
||||
{
|
||||
@ -375,7 +395,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPassDescriptor
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize colorAttachments = _colorAttachments;
|
||||
@synthesize depthAttachment = _depthAttachment;
|
||||
@ -469,6 +489,21 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#else
|
||||
|
||||
@dynamic colorAttachments;
|
||||
@dynamic depthAttachment;
|
||||
@dynamic stencilAttachment;
|
||||
@dynamic visibilityResultBuffer;
|
||||
@dynamic renderTargetArrayLength;
|
||||
@dynamic renderTargetWidth;
|
||||
@dynamic renderTargetHeight;
|
||||
@dynamic imageblockSampleLength;
|
||||
@dynamic threadgroupMemoryLength;
|
||||
@dynamic tileWidth;
|
||||
@dynamic tileHeight;
|
||||
@dynamic defaultRasterSampleCount;
|
||||
@dynamic rasterizationRateMap;
|
||||
@dynamic sampleBufferAttachments;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -477,7 +512,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPassDescriptor (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (Indium::RenderPassDescriptor)asIndiumDescriptor
|
||||
{
|
||||
@ -506,7 +541,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderCommandEncoderInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize device = _device;
|
||||
@synthesize encoder = _encoder;
|
||||
@ -714,6 +749,9 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#else
|
||||
|
||||
@dynamic device;
|
||||
@dynamic label;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
@implementation MTLRenderPipelineDescriptor
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize vertexFunction = _vertexFunction;
|
||||
@synthesize fragmentFunction = _fragmentFunction;
|
||||
@ -169,6 +169,40 @@
|
||||
|
||||
#else
|
||||
|
||||
@dynamic vertexFunction;
|
||||
@dynamic fragmentFunction;
|
||||
@dynamic maxVertexCallStackDepth;
|
||||
@dynamic maxFragmentCallStackDepth;
|
||||
@dynamic vertexDescriptor;
|
||||
@dynamic vertexBuffers;
|
||||
@dynamic fragmentBuffers;
|
||||
@dynamic colorAttachments;
|
||||
@dynamic depthAttachmentPixelFormat;
|
||||
@dynamic stencilAttachmentPixelFormat;
|
||||
@dynamic sampleCount;
|
||||
@dynamic alphaToCoverageEnabled;
|
||||
@dynamic alphaToOneEnabled;
|
||||
@dynamic rasterizationEnabled;
|
||||
@dynamic inputPrimitiveTopology;
|
||||
@dynamic rasterSampleCount;
|
||||
@dynamic maxTessellationFactor;
|
||||
@dynamic tessellationFactorScaleEnabled;
|
||||
@dynamic tessellationFactorFormat;
|
||||
@dynamic tessellationControlPointIndexType;
|
||||
@dynamic tessellationFactorStepFunction;
|
||||
@dynamic tessellationOutputWindingOrder;
|
||||
@dynamic tessellationPartitionMode;
|
||||
@dynamic supportIndirectCommandBuffers;
|
||||
@dynamic maxVertexAmplificationCount;
|
||||
@dynamic supportAddingVertexBinaryFunctions;
|
||||
@dynamic supportAddingFragmentBinaryFunctions;
|
||||
@dynamic binaryArchives;
|
||||
@dynamic vertexLinkedFunctions;
|
||||
@dynamic fragmentLinkedFunctions;
|
||||
@dynamic fragmentPreloadedLibraries;
|
||||
@dynamic vertexPreloadedLibraries;
|
||||
@dynamic label;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -177,7 +211,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPipelineDescriptor (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (Indium::RenderPipelineDescriptor)asIndiumDescriptor
|
||||
{
|
||||
@ -220,7 +254,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPipelineColorAttachmentDescriptorArray
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
{
|
||||
NSMutableDictionary<NSNumber*, MTLRenderPipelineColorAttachmentDescriptor*>* _dict;
|
||||
@ -274,7 +308,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPipelineColorAttachmentDescriptorArray (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (id)copyWithZone: (NSZone*)zone
|
||||
{
|
||||
@ -311,7 +345,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPipelineColorAttachmentDescriptor
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize pixelFormat = _pixelFormat;
|
||||
@synthesize writeMask = _writeMask;
|
||||
@ -358,6 +392,16 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#else
|
||||
|
||||
@dynamic pixelFormat;
|
||||
@dynamic writeMask;
|
||||
@dynamic blendingEnabled;
|
||||
@dynamic alphaBlendOperation;
|
||||
@dynamic rgbBlendOperation;
|
||||
@dynamic destinationAlphaBlendFactor;
|
||||
@dynamic destinationRGBBlendFactor;
|
||||
@dynamic sourceAlphaBlendFactor;
|
||||
@dynamic sourceRGBBlendFactor;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
@ -366,7 +410,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPipelineColorAttachmentDescriptor (Internal)
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
- (Indium::RenderPipelineColorAttachmentDescriptor)asIndiumDescriptor
|
||||
{
|
||||
@ -389,7 +433,7 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
@implementation MTLRenderPipelineStateInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize state = _state;
|
||||
@synthesize device = _device;
|
||||
@ -417,6 +461,9 @@ MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#else
|
||||
|
||||
@dynamic device;
|
||||
@dynamic label;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
@implementation MTLTextureInternal
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
@synthesize texture = _texture;
|
||||
@synthesize device = _device;
|
||||
@ -215,6 +215,20 @@
|
||||
|
||||
#else
|
||||
|
||||
@dynamic textureType;
|
||||
@dynamic pixelFormat;
|
||||
@dynamic width;
|
||||
@dynamic height;
|
||||
@dynamic depth;
|
||||
@dynamic mipmapLevelCount;
|
||||
@dynamic arrayLength;
|
||||
@dynamic sampleCount;
|
||||
@dynamic framebufferOnly;
|
||||
@dynamic usage;
|
||||
@dynamic allowGPUOptimizedContents;
|
||||
@dynamic shareable;
|
||||
@dynamic swizzle;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
|
@ -18,10 +18,13 @@
|
||||
*/
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
#if DARLING_METAL_ENABLED
|
||||
#include <indium/indium.hpp>
|
||||
#endif
|
||||
#import <Metal/MTLDeviceInternal.h>
|
||||
#import <Metal/stubs.h>
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
// TODO: add some extension here that MetalKit needs.
|
||||
//
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
@implementation MTKView
|
||||
|
||||
#if __OBJC2__
|
||||
#if DARLING_METAL_ENABLED
|
||||
|
||||
{
|
||||
id<MTKViewDelegate> _delegate;
|
||||
@ -379,6 +379,32 @@
|
||||
|
||||
#else
|
||||
|
||||
@dynamic delegate;
|
||||
@dynamic device;
|
||||
@dynamic preferredDevice;
|
||||
@dynamic colorPixelFormat;
|
||||
@dynamic colorspace;
|
||||
@dynamic framebufferOnly;
|
||||
@dynamic drawableSize;
|
||||
@dynamic preferredDrawableSize;
|
||||
@dynamic autoResizeDrawable;
|
||||
@dynamic clearColor;
|
||||
@dynamic depthStencilPixelFormat;
|
||||
@dynamic depthStencilAttachmentTextureUsage;
|
||||
@dynamic clearDepth;
|
||||
@dynamic clearStencil;
|
||||
@dynamic sampleCount;
|
||||
@dynamic multisampleColorAttachmentTextureUsage;
|
||||
@dynamic currentRenderPassDescriptor;
|
||||
@dynamic currentDrawable;
|
||||
@dynamic depthStencilTexture;
|
||||
@dynamic multisampleColorTexture;
|
||||
@dynamic preferredFramesPerSecond;
|
||||
@dynamic paused;
|
||||
@dynamic enableSetNeedsDisplay;
|
||||
@dynamic presentsWithTransaction;
|
||||
@dynamic depthStencilStorageMode;
|
||||
|
||||
MTL_UNSUPPORTED_CLASS
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user