Browse Source

Update to Metal 3

gingerBill 2 years ago
parent
commit
827f36e2c0

+ 30 - 0
vendor/darwin/Foundation/NSNotification.odin

@@ -27,4 +27,34 @@ Notification_object :: proc(self: ^Notification) -> ^Object {
 @(objc_type=Notification, objc_name="userInfo")
 Notification_userInfo :: proc(self: ^Notification) -> ^Dictionary {
 	return msgSend(^Dictionary, self, "userInfo")
+}
+
+NotificationName :: ^String
+
+@(objc_class="NSNotificationCenter")
+NotificationCenter :: struct{using _: Object}
+
+
+@(objc_type=NotificationCenter, objc_name="alloc", objc_is_class_method=true)
+NotificationCenter_alloc :: proc() -> ^NotificationCenter {
+	return msgSend(^NotificationCenter, NotificationCenter, "alloc")
+}
+
+@(objc_type=NotificationCenter, objc_name="init")
+NotificationCenter_init :: proc(self: ^NotificationCenter) -> ^NotificationCenter {
+	return msgSend(^NotificationCenter, self, "init")
+}
+
+@(objc_type=NotificationCenter, objc_name="defaultCenter", objc_is_class_method=true)
+NotificationCenter_defaultCenter :: proc() -> ^NotificationCenter {
+	return msgSend(^NotificationCenter, NotificationCenter, "defaultCenter")
+}
+
+@(objc_type=NotificationCenter, objc_name="addObserver")
+NotificationCenter_addObserverName :: proc(self: ^NotificationCenter, name: NotificationName, pObj: ^Object, pQueue: rawptr, block: ^Block) -> ^Object {
+	return msgSend(^Object, self, "addObserverName:object:queue:block:", name, pObj, pQueue, block)
+}
+@(objc_type=NotificationCenter, objc_name="removeObserver")
+NotificationCenter_removeObserver :: proc(self: ^NotificationCenter, pObserver: ^Object) {
+	msgSend(nil, self, "removeObserver:", pObserver)
 }

File diff suppressed because it is too large
+ 845 - 0
vendor/darwin/Metal/MetalClasses.odin


+ 86 - 6
vendor/darwin/Metal/MetalEnums.odin

@@ -17,6 +17,14 @@ AccelerationStructureInstanceOption :: enum u32 {
 	NonOpaque                                  = 3,
 }
 
+
+AccelerationStructureRefitOptions :: distinct bit_set[AccelerationStructureRefitOption; NS.UInteger]
+AccelerationStructureRefitOption :: enum NS.UInteger {
+	VertexData       = 0,
+	PerPrimitiveData = 1,
+}
+
+
 MotionBorderMode :: enum u32 {
 	Clamp  = 0,
 	Vanish = 1,
@@ -148,6 +156,21 @@ BinaryArchiveError :: enum NS.UInteger {
 	InvalidFile        = 1,
 	UnexpectedElement  = 2,
 	CompilationFailure = 3,
+	InternalError      = 4,
+}
+
+BindingType :: enum NS.Integer {
+	Buffer                         = 0,
+	ThreadgroupMemory              = 1,
+	Texture                        = 2,
+	Sampler                        = 3,
+	ImageblockData                 = 16,
+	Imageblock                     = 17,
+	VisibleFunctionTable           = 24,
+	PrimitiveAccelerationStructure = 25,
+	InstanceAccelerationStructure  = 26,
+	IntersectionFunctionTable      = 27,
+	ObjectPayload                  = 34,
 }
 
 BlitOptionFlag :: enum NS.UInteger {
@@ -171,15 +194,16 @@ CaptureDestination :: enum NS.Integer {
 
 CommandBufferStatus :: enum NS.UInteger {
 	NotEnqueued = 0,
-	Enqueued = 1,
-	Committed = 2,
-	Scheduled = 3,
-	Completed = 4,
-	Error = 5,
+	Enqueued    = 1,
+	Committed   = 2,
+	Scheduled   = 3,
+	Completed   = 4,
+	Error       = 5,
 }
 
 CommandBufferError :: enum NS.UInteger {
 	None            = 0,
+	Internal        = 1,
 	Timeout         = 2,
 	PageFault       = 3,
 	AccessRevoked   = 4,
@@ -232,6 +256,7 @@ BarrierScope :: distinct bit_set[BarrierScopeFlag; NS.UInteger]
 CounterSampleBufferError :: enum NS.Integer {
 	OutOfMemory = 0,
 	Invalid     = 1,
+	Internal    = 2,
 }
 
 CompareFunction :: enum NS.UInteger {
@@ -312,6 +337,13 @@ GPUFamily :: enum NS.Integer {
 	Common3      = 3003,
 	MacCatalyst1 = 4001,
 	MacCatalyst2 = 4002,
+	Metal3       = 5001,
+}
+
+SparsePageSize :: enum NS.Integer {
+	Size16  = 101,
+	Size64  = 102,
+	Size256 = 103,
 }
 
 DeviceLocation :: enum NS.UInteger {
@@ -409,6 +441,9 @@ FunctionType :: enum NS.UInteger {
 	Kernel       = 3,
 	Visible      = 5,
 	Intersection = 6,
+	Mesh         = 7,
+	Object       = 8,
+
 }
 
 
@@ -421,15 +456,22 @@ LanguageVersion :: enum NS.UInteger {
 	Version2_2 = 131074,
 	Version2_3 = 131075,
 	Version2_4 = 131076,
+	Version3_0 = 196608,
 }
 
 LibraryType :: enum NS.Integer {
 	Executable = 0,
-	Dynamic = 1,
+	Dynamic    = 1,
+}
+
+LibraryOptimizationLevel :: enum NS.Integer {
+	Default = 0,
+	Size    = 1,
 }
 
 LibraryError :: enum NS.UInteger {
 	Unsupported      = 1,
+	Internal         = 2,
 	CompileFailure   = 3,
 	CompileWarning   = 4,
 	FunctionNotFound = 5,
@@ -624,6 +666,8 @@ RenderStage :: enum NS.UInteger {
 	Vertex   = 0,
 	Fragment = 1,
 	Tile     = 2,
+	Object   = 3,
+	Mesh     = 4,
 }
 RenderStages :: distinct bit_set[RenderStage; NS.UInteger]
 
@@ -861,6 +905,42 @@ IndexType :: enum NS.UInteger {
 	UInt32 = 1,
 }
 
+IOPriority :: enum NS.Integer {
+	High   = 0,
+	Normal = 1,
+	Low    = 2,
+}
+
+IOCommandQueueType :: enum NS.Integer {
+	Concurrent = 0,
+	Serial     = 1,
+}
+
+IOError :: enum NS.Integer {
+	URLInvalid = 1,
+	Internal   = 2,
+}
+
+IOStatus :: enum NS.Integer {
+	Pending   = 0,
+	Cancelled = 1,
+	Error     = 2,
+	Complete  = 3,
+}
+
+IOCompressionMethod :: enum NS.Integer {
+	Zlib     = 0,
+	LZFSE    = 1,
+	LZ4      = 2,
+	LZMA     = 3,
+	LZBitmap = 4,
+}
+
+IOCompressionStatus :: enum NS.Integer {
+	Complete = 0,
+	Error    = 1,
+}
+
 StepFunction :: enum NS.UInteger {
 	Constant                     = 0,
 	PerVertex                    = 1,

+ 12 - 2
vendor/darwin/Metal/MetalErrors.odin

@@ -4,9 +4,11 @@ import NS "vendor:darwin/Foundation"
 
 foreign import "system:Metal.framework"
 
-CommonCounter :: ^NS.String
-CommonCounterSet :: ^NS.String
+CommonCounter          :: ^NS.String
+CommonCounterSet       :: ^NS.String
 DeviceNotificationName :: ^NS.String
+ErrorUserInfoKey       :: ^NS.ErrorUserInfoKey
+ErrorDomain            :: ^NS.ErrorDomain
 
 foreign Metal {
 	@(linkage="weak") CommonCounterTimestamp:                         CommonCounter
@@ -36,4 +38,12 @@ foreign Metal {
 	@(linkage="weak") DeviceWasAddedNotification:         DeviceNotificationName
 	@(linkage="weak") DeviceRemovalRequestedNotification: DeviceNotificationName
 	@(linkage="weak") DeviceWasRemovedNotification:       DeviceNotificationName
+}
+
+foreign Metal {
+	@(linkage="weak") CommandBufferEncoderInfoErrorKey: ErrorUserInfoKey
+}
+
+foreign Metal {
+	@(linkage="weak") IOErrorDomain: ErrorDomain
 }

+ 7 - 0
vendor/darwin/Metal/MetalProcedures.odin

@@ -1,6 +1,7 @@
 package objc_Metal
 
 import NS "vendor:darwin/Foundation"
+import "core:c"
 
 @(require)
 foreign import "system:Metal.framework"
@@ -11,6 +12,12 @@ foreign Metal {
 	CopyAllDevicesWithObserver :: proc(observer: ^id, handler: DeviceNotificationHandler) -> ^NS.Array ---
 	CreateSystemDefaultDevice  :: proc() -> ^Device ---
 	RemoveDeviceObserver       :: proc(observer: id) ---
+
+
+	IOCompressionContextDefaultChunkSize :: proc() -> c.size_t ---
+	IOCreateCompressionContext           :: proc(path: cstring, type: IOCompressionMethod, chuckSize: c.size_t) -> rawptr ---
+	IOCompressionContextAppendData       :: proc(ctx: rawptr, data: rawptr, size: c.size_t) ---
+	IOFlushAndDestroyCompressionContext  :: proc(ctx: rawptr) -> IOCompressionStatus ---
 }
 
 

+ 2 - 0
vendor/darwin/Metal/MetalTypes.odin

@@ -133,6 +133,8 @@ Region :: struct {
 
 SamplePosition :: distinct [2]f32
 
+ResourceID :: distinct u64
+
 ScissorRect :: struct {
 	x:      NS.Integer,
 	y:      NS.Integer,

+ 11 - 0
vendor/darwin/QuartzCore/QuartzCore.odin

@@ -56,6 +56,17 @@ MetalLayer_setFramebufferOnly :: proc(self: ^MetalLayer, ok: NS.BOOL) {
 	msgSend(nil, self, "setFramebufferOnly:", ok)
 }
 
+
+@(objc_type=MetalLayer, objc_name="drawableSize")
+MetalLayer_drawableSize :: proc(self: ^MetalLayer) -> NS.Size {
+	return msgSend(NS.Size, self, "drawableSize")
+}
+@(objc_type=MetalLayer, objc_name="setDrawableSize")
+MetalLayer_setDrawableSize :: proc(self: ^MetalLayer, drawableSize: NS.Size) {
+	msgSend(nil, self, "setDrawableSize:", drawableSize)
+}
+
+
 @(objc_type=MetalLayer, objc_name="frame")
 MetalLayer_frame :: proc(self: ^MetalLayer) -> NS.Rect {
 	return msgSend(NS.Rect, self, "frame")

Some files were not shown because too many files changed in this diff