mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Update to Metal 3
This commit is contained in:
+30
@@ -27,4 +27,34 @@ Notification_object :: proc(self: ^Notification) -> ^Object {
|
|||||||
@(objc_type=Notification, objc_name="userInfo")
|
@(objc_type=Notification, objc_name="userInfo")
|
||||||
Notification_userInfo :: proc(self: ^Notification) -> ^Dictionary {
|
Notification_userInfo :: proc(self: ^Notification) -> ^Dictionary {
|
||||||
return msgSend(^Dictionary, self, "userInfo")
|
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)
|
||||||
}
|
}
|
||||||
+875
File diff suppressed because it is too large
Load Diff
Vendored
+86
-6
@@ -17,6 +17,14 @@ AccelerationStructureInstanceOption :: enum u32 {
|
|||||||
NonOpaque = 3,
|
NonOpaque = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AccelerationStructureRefitOptions :: distinct bit_set[AccelerationStructureRefitOption; NS.UInteger]
|
||||||
|
AccelerationStructureRefitOption :: enum NS.UInteger {
|
||||||
|
VertexData = 0,
|
||||||
|
PerPrimitiveData = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MotionBorderMode :: enum u32 {
|
MotionBorderMode :: enum u32 {
|
||||||
Clamp = 0,
|
Clamp = 0,
|
||||||
Vanish = 1,
|
Vanish = 1,
|
||||||
@@ -148,6 +156,21 @@ BinaryArchiveError :: enum NS.UInteger {
|
|||||||
InvalidFile = 1,
|
InvalidFile = 1,
|
||||||
UnexpectedElement = 2,
|
UnexpectedElement = 2,
|
||||||
CompilationFailure = 3,
|
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 {
|
BlitOptionFlag :: enum NS.UInteger {
|
||||||
@@ -171,15 +194,16 @@ CaptureDestination :: enum NS.Integer {
|
|||||||
|
|
||||||
CommandBufferStatus :: enum NS.UInteger {
|
CommandBufferStatus :: enum NS.UInteger {
|
||||||
NotEnqueued = 0,
|
NotEnqueued = 0,
|
||||||
Enqueued = 1,
|
Enqueued = 1,
|
||||||
Committed = 2,
|
Committed = 2,
|
||||||
Scheduled = 3,
|
Scheduled = 3,
|
||||||
Completed = 4,
|
Completed = 4,
|
||||||
Error = 5,
|
Error = 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandBufferError :: enum NS.UInteger {
|
CommandBufferError :: enum NS.UInteger {
|
||||||
None = 0,
|
None = 0,
|
||||||
|
Internal = 1,
|
||||||
Timeout = 2,
|
Timeout = 2,
|
||||||
PageFault = 3,
|
PageFault = 3,
|
||||||
AccessRevoked = 4,
|
AccessRevoked = 4,
|
||||||
@@ -232,6 +256,7 @@ BarrierScope :: distinct bit_set[BarrierScopeFlag; NS.UInteger]
|
|||||||
CounterSampleBufferError :: enum NS.Integer {
|
CounterSampleBufferError :: enum NS.Integer {
|
||||||
OutOfMemory = 0,
|
OutOfMemory = 0,
|
||||||
Invalid = 1,
|
Invalid = 1,
|
||||||
|
Internal = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
CompareFunction :: enum NS.UInteger {
|
CompareFunction :: enum NS.UInteger {
|
||||||
@@ -312,6 +337,13 @@ GPUFamily :: enum NS.Integer {
|
|||||||
Common3 = 3003,
|
Common3 = 3003,
|
||||||
MacCatalyst1 = 4001,
|
MacCatalyst1 = 4001,
|
||||||
MacCatalyst2 = 4002,
|
MacCatalyst2 = 4002,
|
||||||
|
Metal3 = 5001,
|
||||||
|
}
|
||||||
|
|
||||||
|
SparsePageSize :: enum NS.Integer {
|
||||||
|
Size16 = 101,
|
||||||
|
Size64 = 102,
|
||||||
|
Size256 = 103,
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceLocation :: enum NS.UInteger {
|
DeviceLocation :: enum NS.UInteger {
|
||||||
@@ -409,6 +441,9 @@ FunctionType :: enum NS.UInteger {
|
|||||||
Kernel = 3,
|
Kernel = 3,
|
||||||
Visible = 5,
|
Visible = 5,
|
||||||
Intersection = 6,
|
Intersection = 6,
|
||||||
|
Mesh = 7,
|
||||||
|
Object = 8,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -421,15 +456,22 @@ LanguageVersion :: enum NS.UInteger {
|
|||||||
Version2_2 = 131074,
|
Version2_2 = 131074,
|
||||||
Version2_3 = 131075,
|
Version2_3 = 131075,
|
||||||
Version2_4 = 131076,
|
Version2_4 = 131076,
|
||||||
|
Version3_0 = 196608,
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryType :: enum NS.Integer {
|
LibraryType :: enum NS.Integer {
|
||||||
Executable = 0,
|
Executable = 0,
|
||||||
Dynamic = 1,
|
Dynamic = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
LibraryOptimizationLevel :: enum NS.Integer {
|
||||||
|
Default = 0,
|
||||||
|
Size = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryError :: enum NS.UInteger {
|
LibraryError :: enum NS.UInteger {
|
||||||
Unsupported = 1,
|
Unsupported = 1,
|
||||||
|
Internal = 2,
|
||||||
CompileFailure = 3,
|
CompileFailure = 3,
|
||||||
CompileWarning = 4,
|
CompileWarning = 4,
|
||||||
FunctionNotFound = 5,
|
FunctionNotFound = 5,
|
||||||
@@ -624,6 +666,8 @@ RenderStage :: enum NS.UInteger {
|
|||||||
Vertex = 0,
|
Vertex = 0,
|
||||||
Fragment = 1,
|
Fragment = 1,
|
||||||
Tile = 2,
|
Tile = 2,
|
||||||
|
Object = 3,
|
||||||
|
Mesh = 4,
|
||||||
}
|
}
|
||||||
RenderStages :: distinct bit_set[RenderStage; NS.UInteger]
|
RenderStages :: distinct bit_set[RenderStage; NS.UInteger]
|
||||||
|
|
||||||
@@ -861,6 +905,42 @@ IndexType :: enum NS.UInteger {
|
|||||||
UInt32 = 1,
|
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 {
|
StepFunction :: enum NS.UInteger {
|
||||||
Constant = 0,
|
Constant = 0,
|
||||||
PerVertex = 1,
|
PerVertex = 1,
|
||||||
|
|||||||
Vendored
+12
-2
@@ -4,9 +4,11 @@ import NS "vendor:darwin/Foundation"
|
|||||||
|
|
||||||
foreign import "system:Metal.framework"
|
foreign import "system:Metal.framework"
|
||||||
|
|
||||||
CommonCounter :: ^NS.String
|
CommonCounter :: ^NS.String
|
||||||
CommonCounterSet :: ^NS.String
|
CommonCounterSet :: ^NS.String
|
||||||
DeviceNotificationName :: ^NS.String
|
DeviceNotificationName :: ^NS.String
|
||||||
|
ErrorUserInfoKey :: ^NS.ErrorUserInfoKey
|
||||||
|
ErrorDomain :: ^NS.ErrorDomain
|
||||||
|
|
||||||
foreign Metal {
|
foreign Metal {
|
||||||
@(linkage="weak") CommonCounterTimestamp: CommonCounter
|
@(linkage="weak") CommonCounterTimestamp: CommonCounter
|
||||||
@@ -36,4 +38,12 @@ foreign Metal {
|
|||||||
@(linkage="weak") DeviceWasAddedNotification: DeviceNotificationName
|
@(linkage="weak") DeviceWasAddedNotification: DeviceNotificationName
|
||||||
@(linkage="weak") DeviceRemovalRequestedNotification: DeviceNotificationName
|
@(linkage="weak") DeviceRemovalRequestedNotification: DeviceNotificationName
|
||||||
@(linkage="weak") DeviceWasRemovedNotification: DeviceNotificationName
|
@(linkage="weak") DeviceWasRemovedNotification: DeviceNotificationName
|
||||||
|
}
|
||||||
|
|
||||||
|
foreign Metal {
|
||||||
|
@(linkage="weak") CommandBufferEncoderInfoErrorKey: ErrorUserInfoKey
|
||||||
|
}
|
||||||
|
|
||||||
|
foreign Metal {
|
||||||
|
@(linkage="weak") IOErrorDomain: ErrorDomain
|
||||||
}
|
}
|
||||||
+7
@@ -1,6 +1,7 @@
|
|||||||
package objc_Metal
|
package objc_Metal
|
||||||
|
|
||||||
import NS "vendor:darwin/Foundation"
|
import NS "vendor:darwin/Foundation"
|
||||||
|
import "core:c"
|
||||||
|
|
||||||
@(require)
|
@(require)
|
||||||
foreign import "system:Metal.framework"
|
foreign import "system:Metal.framework"
|
||||||
@@ -11,6 +12,12 @@ foreign Metal {
|
|||||||
CopyAllDevicesWithObserver :: proc(observer: ^id, handler: DeviceNotificationHandler) -> ^NS.Array ---
|
CopyAllDevicesWithObserver :: proc(observer: ^id, handler: DeviceNotificationHandler) -> ^NS.Array ---
|
||||||
CreateSystemDefaultDevice :: proc() -> ^Device ---
|
CreateSystemDefaultDevice :: proc() -> ^Device ---
|
||||||
RemoveDeviceObserver :: proc(observer: id) ---
|
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 ---
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
@@ -133,6 +133,8 @@ Region :: struct {
|
|||||||
|
|
||||||
SamplePosition :: distinct [2]f32
|
SamplePosition :: distinct [2]f32
|
||||||
|
|
||||||
|
ResourceID :: distinct u64
|
||||||
|
|
||||||
ScissorRect :: struct {
|
ScissorRect :: struct {
|
||||||
x: NS.Integer,
|
x: NS.Integer,
|
||||||
y: NS.Integer,
|
y: NS.Integer,
|
||||||
|
|||||||
+11
@@ -56,6 +56,17 @@ MetalLayer_setFramebufferOnly :: proc(self: ^MetalLayer, ok: NS.BOOL) {
|
|||||||
msgSend(nil, self, "setFramebufferOnly:", ok)
|
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")
|
@(objc_type=MetalLayer, objc_name="frame")
|
||||||
MetalLayer_frame :: proc(self: ^MetalLayer) -> NS.Rect {
|
MetalLayer_frame :: proc(self: ^MetalLayer) -> NS.Rect {
|
||||||
return msgSend(NS.Rect, self, "frame")
|
return msgSend(NS.Rect, self, "frame")
|
||||||
|
|||||||
Reference in New Issue
Block a user