Move Objective-C libraries located in core:sys/darwin/* to vendor:darwin/*

This commit is contained in:
gingerBill
2022-02-16 00:06:25 +00:00
parent 855e7beab1
commit a3bcacee27
24 changed files with 0 additions and 0 deletions
-42
View File
@@ -1,42 +0,0 @@
package objc_Foundation
import "core:intrinsics"
@(objc_class="NSArray")
Array :: struct {
using _: Copying(Array),
}
@(objc_type=Array, objc_name="alloc", objc_is_class_method=true)
Array_alloc :: proc() -> ^Array {
return msgSend(^Array, Array, "alloc")
}
@(objc_type=Array, objc_name="init")
Array_init :: proc(self: ^Array) -> ^Array {
return msgSend(^Array, self, "init")
}
@(objc_type=Array, objc_name="initWithObjects")
Array_initWithObjects :: proc(self: ^Array, objects: [^]^Object, count: UInteger) -> ^Array {
return msgSend(^Array, self, "initWithObjects:count:", objects, count)
}
@(objc_type=Array, objc_name="initWithCoder")
Array_initWithCoder :: proc(self: ^Array, coder: ^Coder) -> ^Array {
return msgSend(^Array, self, "initWithCoder:", coder)
}
@(objc_type=Array, objc_name="object")
Array_object :: proc(self: ^Array, index: UInteger) -> ^Object {
return msgSend(^Object, self, "objectAtIndex:", index)
}
@(objc_type=Array, objc_name="objectAs")
Array_objectAs :: proc(self: ^Array, index: UInteger, $T: typeid) -> T where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
return (T)(Array_object(self, index))
}
@(objc_type=Array, objc_name="count")
Array_count :: proc(self: ^Array) -> UInteger {
return msgSend(UInteger, self, "count")
}
@@ -1,33 +0,0 @@
package objc_Foundation
@(objc_class="NSAutoreleasePool")
AutoreleasePool :: struct {using _: Object}
@(objc_type=AutoreleasePool, objc_name="alloc", objc_is_class_method=true)
AutoreleasePool_alloc :: proc() -> ^AutoreleasePool {
return msgSend(^AutoreleasePool, AutoreleasePool, "alloc")
}
@(objc_type=AutoreleasePool, objc_name="init")
AutoreleasePool_init :: proc(self: ^AutoreleasePool) -> ^AutoreleasePool {
return msgSend(^AutoreleasePool, self, "init")
}
@(objc_type=AutoreleasePool, objc_name="drain")
AutoreleasePool_drain :: proc(self: ^AutoreleasePool) {
msgSend(nil, self, "drain")
}
@(objc_type=AutoreleasePool, objc_name="addObject")
AutoreleasePool_addObject :: proc(self: ^AutoreleasePool, obj: ^Object) {
msgSend(nil, self, "addObject:", obj)
}
@(objc_type=AutoreleasePool, objc_name="showPools")
AutoreleasePool_showPools :: proc(self: ^AutoreleasePool, obj: ^Object) {
msgSend(nil, self, "showPools")
}
@(deferred_out=AutoreleasePool_drain)
scoped_autoreleasepool :: proc() -> ^AutoreleasePool {
return AutoreleasePool.alloc()->init()
}
-191
View File
@@ -1,191 +0,0 @@
package objc_Foundation
@(objc_class="NSBundle")
Bundle :: struct { using _: Object }
@(objc_type=Bundle, objc_name="mainBundle", objc_is_class_method=true)
Bundle_mainBundle :: proc() -> ^Bundle {
return msgSend(^Bundle, Bundle, "mainBundle")
}
@(objc_type=Bundle, objc_name="bundleWithPath", objc_is_class_method=true)
Bundle_bundleWithPath :: proc(path: ^String) -> ^Bundle {
return msgSend(^Bundle, Bundle, "bundleWithPath:", path)
}
@(objc_type=Bundle, objc_name="bundleWithURL", objc_is_class_method=true)
Bundle_bundleWithURL :: proc(url: ^URL) -> ^Bundle {
return msgSend(^Bundle, Bundle, "bundleWithUrl:", url)
}
@(objc_type=Bundle, objc_name="alloc", objc_is_class_method=true)
Bundle_alloc :: proc() -> ^Bundle {
return msgSend(^Bundle, Bundle, "alloc")
}
@(objc_type=Bundle, objc_name="init")
Bundle_init :: proc(self: ^Bundle) -> ^Bundle {
return msgSend(^Bundle, self, "init")
}
@(objc_type=Bundle, objc_name="initWithPath")
Bundle_initWithPath :: proc(self: ^Bundle, path: ^String) -> ^Bundle {
return msgSend(^Bundle, self, "initWithPath:", path)
}
@(objc_type=Bundle, objc_name="initWithURL")
Bundle_initWithURL :: proc(self: ^Bundle, url: ^URL) -> ^Bundle {
return msgSend(^Bundle, self, "initWithUrl:", url)
}
@(objc_type=Bundle, objc_name="allBundles")
Bundle_allBundles :: proc() -> (all: ^Array) {
return msgSend(type_of(all), Bundle, "allBundles")
}
@(objc_type=Bundle, objc_name="allFrameworks")
Bundle_allFrameworks :: proc() -> (all: ^Array) {
return msgSend(type_of(all), Bundle, "allFrameworks")
}
@(objc_type=Bundle, objc_name="load")
Bundle_load :: proc(self: ^Bundle) -> BOOL {
return msgSend(BOOL, self, "load")
}
@(objc_type=Bundle, objc_name="unload")
Bundle_unload :: proc(self: ^Bundle) -> BOOL {
return msgSend(BOOL, self, "unload")
}
@(objc_type=Bundle, objc_name="isLoaded")
Bundle_isLoaded :: proc(self: ^Bundle) -> BOOL {
return msgSend(BOOL, self, "isLoaded")
}
@(objc_type=Bundle, objc_name="preflightAndReturnError")
Bundle_preflightAndReturnError :: proc(self: ^Bundle) -> (ok: BOOL, error: ^Error) {
ok = msgSend(BOOL, self, "preflightAndReturnError:", &error)
return
}
@(objc_type=Bundle, objc_name="loadAndReturnError")
Bundle_loadAndReturnError :: proc(self: ^Bundle) -> (ok: BOOL, error: ^Error) {
ok = msgSend(BOOL, self, "loadAndReturnError:", &error)
return
}
@(objc_type=Bundle, objc_name="bundleURL")
Bundle_bundleURL :: proc(self: ^Bundle) -> ^URL {
return msgSend(^URL, self, "bundleURL")
}
@(objc_type=Bundle, objc_name="resourceURL")
Bundle_resourceURL :: proc(self: ^Bundle) -> ^URL {
return msgSend(^URL, self, "resourceURL")
}
@(objc_type=Bundle, objc_name="executableURL")
Bundle_executableURL :: proc(self: ^Bundle) -> ^URL {
return msgSend(^URL, self, "executableURL")
}
@(objc_type=Bundle, objc_name="URLForAuxiliaryExecutable")
Bundle_URLForAuxiliaryExecutable :: proc(self: ^Bundle, executableName: ^String) -> ^URL {
return msgSend(^URL, self, "URLForAuxiliaryExecutable:", executableName)
}
@(objc_type=Bundle, objc_name="privateFrameworksURL")
Bundle_privateFrameworksURL :: proc(self: ^Bundle) -> ^URL {
return msgSend(^URL, self, "privateFrameworksURL")
}
@(objc_type=Bundle, objc_name="sharedFrameworksURL")
Bundle_sharedFrameworksURL :: proc(self: ^Bundle) -> ^URL {
return msgSend(^URL, self, "sharedFrameworksURL")
}
@(objc_type=Bundle, objc_name="sharedSupportURL")
Bundle_sharedSupportURL :: proc(self: ^Bundle) -> ^URL {
return msgSend(^URL, self, "sharedSupportURL")
}
@(objc_type=Bundle, objc_name="builtInPlugInsURL")
Bundle_builtInPlugInsURL :: proc(self: ^Bundle) -> ^URL {
return msgSend(^URL, self, "builtInPlugInsURL")
}
@(objc_type=Bundle, objc_name="appStoreReceiptURL")
Bundle_appStoreReceiptURL :: proc(self: ^Bundle) -> ^URL {
return msgSend(^URL, self, "appStoreReceiptURL")
}
@(objc_type=Bundle, objc_name="bundlePath")
Bundle_bundlePath :: proc(self: ^Bundle) -> ^String {
return msgSend(^String, self, "bundlePath")
}
@(objc_type=Bundle, objc_name="resourcePath")
Bundle_resourcePath :: proc(self: ^Bundle) -> ^String {
return msgSend(^String, self, "resourcePath")
}
@(objc_type=Bundle, objc_name="executablePath")
Bundle_executablePath :: proc(self: ^Bundle) -> ^String {
return msgSend(^String, self, "executablePath")
}
@(objc_type=Bundle, objc_name="PathForAuxiliaryExecutable")
Bundle_PathForAuxiliaryExecutable :: proc(self: ^Bundle, executableName: ^String) -> ^String {
return msgSend(^String, self, "PathForAuxiliaryExecutable:", executableName)
}
@(objc_type=Bundle, objc_name="privateFrameworksPath")
Bundle_privateFrameworksPath :: proc(self: ^Bundle) -> ^String {
return msgSend(^String, self, "privateFrameworksPath")
}
@(objc_type=Bundle, objc_name="sharedFrameworksPath")
Bundle_sharedFrameworksPath :: proc(self: ^Bundle) -> ^String {
return msgSend(^String, self, "sharedFrameworksPath")
}
@(objc_type=Bundle, objc_name="sharedSupportPath")
Bundle_sharedSupportPath :: proc(self: ^Bundle) -> ^String {
return msgSend(^String, self, "sharedSupportPath")
}
@(objc_type=Bundle, objc_name="builtInPlugInsPath")
Bundle_builtInPlugInsPath :: proc(self: ^Bundle) -> ^String {
return msgSend(^String, self, "builtInPlugInsPath")
}
@(objc_type=Bundle, objc_name="appStoreReceiptPath")
Bundle_appStoreReceiptPath :: proc(self: ^Bundle) -> ^String {
return msgSend(^String, self, "appStoreReceiptPath")
}
@(objc_type=Bundle, objc_name="bundleIdentifier")
Bundle_bundleIdentifier :: proc(self: ^Bundle) -> ^String {
return msgSend(^String, self, "bundleIdentifier")
}
@(objc_type=Bundle, objc_name="infoDictionary")
Bundle_infoDictionary :: proc(self: ^Bundle) -> ^Dictionary {
return msgSend(^Dictionary, self, "infoDictionary")
}
@(objc_type=Bundle, objc_name="localizedInfoDictionary")
Bundle_localizedInfoDictionary :: proc(self: ^Bundle) -> ^Dictionary {
return msgSend(^Dictionary, self, "localizedInfoDictionary")
}
@(objc_type=Bundle, objc_name="objectForInfoDictionaryKey")
Bundle_objectForInfoDictionaryKey :: proc(self: ^Bundle, key: ^String) -> ^Object {
return msgSend(^Object, self, "objectForInfoDictionaryKey:", key)
}
@(objc_type=Bundle, objc_name="localizedStringForKey")
Bundle_localizedStringForKey :: proc(self: ^Bundle, key: ^String, value: ^String = nil, tableName: ^String = nil) -> ^String {
return msgSend(^String, self, "localizedStringForKey:value:table:", key, value, tableName)
}
-24
View File
@@ -1,24 +0,0 @@
package objc_Foundation
@(objc_class="NSData")
Data :: struct {using _: Copying(Data)}
@(objc_type=Data, objc_name="alloc", objc_is_class_method=true)
Data_alloc :: proc() -> ^Data {
return msgSend(^Data, Data, "alloc")
}
@(objc_type=Data, objc_name="init")
Data_init :: proc(self: ^Data) -> ^Data {
return msgSend(^Data, self, "init")
}
@(objc_type=Data, objc_name="mutableBytes")
Data_mutableBytes :: proc(self: ^Data) -> rawptr {
return msgSend(rawptr, self, "mutableBytes")
}
@(objc_type=Data, objc_name="length")
Data_length :: proc(self: ^Data) -> UInteger {
return msgSend(UInteger, self, "length")
}
-19
View File
@@ -1,19 +0,0 @@
package objc_Foundation
@(objc_class="NSDate")
Date :: struct {using _: Copying(Date)}
@(objc_type=Date, objc_name="alloc", objc_is_class_method=true)
Date_alloc :: proc() -> ^Date {
return msgSend(^Date, Date, "alloc")
}
@(objc_type=Date, objc_name="init")
Date_init :: proc(self: ^Date) -> ^Date {
return msgSend(^Date, self, "init")
}
@(objc_type=Date, objc_name="dateWithTimeIntervalSinceNow")
Date_dateWithTimeIntervalSinceNow :: proc(secs: TimeInterval) -> ^Date {
return msgSend(^Date, Date, "dateWithTimeIntervalSinceNow:", secs)
}
@@ -1,50 +0,0 @@
package objc_Foundation
@(objc_class="NSDictionary")
Dictionary :: struct {using _: Copying(Dictionary)}
@(objc_type=Dictionary, objc_name="dictionary", objc_is_class_method=true)
Dictionary_dictionary :: proc() -> ^Dictionary {
return msgSend(^Dictionary, Dictionary, "dictionary")
}
@(objc_type=Dictionary, objc_name="dictionaryWithObject", objc_is_class_method=true)
Dictionary_dictionaryWithObject :: proc(object: ^Object, forKey: ^Object) -> ^Dictionary {
return msgSend(^Dictionary, Dictionary, "dictionaryWithObject:forKey:", object, forKey)
}
@(objc_type=Dictionary, objc_name="dictionaryWithObjects", objc_is_class_method=true)
Dictionary_dictionaryWithObjects :: proc(objects: [^]^Object, forKeys: [^]^Object, count: UInteger) -> ^Dictionary {
return msgSend(^Dictionary, Dictionary, "dictionaryWithObjects:forKeys:count", objects, forKeys, count)
}
@(objc_type=Dictionary, objc_name="alloc", objc_is_class_method=true)
Dictionary_alloc :: proc() -> ^Dictionary {
return msgSend(^Dictionary, Dictionary, "alloc")
}
@(objc_type=Dictionary, objc_name="init")
Dictionary_init :: proc(self: ^Dictionary) -> ^Dictionary {
return msgSend(^Dictionary, self, "init")
}
@(objc_type=Dictionary, objc_name="initWithObjects")
Dictionary_initWithObjects :: proc(self: ^Dictionary, objects: [^]^Object, forKeys: [^]^Object, count: UInteger) -> ^Dictionary {
return msgSend(^Dictionary, self, "initWithObjects:forKeys:count", objects, forKeys, count)
}
@(objc_type=Dictionary, objc_name="objectForKey")
Dictionary_objectForKey :: proc(self: ^Dictionary, key: ^Object) -> ^Object {
return msgSend(^Dictionary, self, "objectForKey:", key)
}
@(objc_type=Dictionary, objc_name="count")
Dictionary_count :: proc(self: ^Dictionary) -> UInteger {
return msgSend(UInteger, self, "count")
}
@(objc_type=Dictionary, objc_name="keyEnumerator")
Dictionary_keyEnumerator :: proc(self: ^Dictionary, $KeyType: typeid) -> (enumerator: ^Enumerator(KeyType)) {
return msgSend(type_of(enumerator), self, "keyEnumerator")
}
@@ -1,50 +0,0 @@
package objc_Foundation
import "core:c"
import "core:intrinsics"
FastEnumerationState :: struct #packed {
state: c.ulong,
itemsPtr: [^]^Object,
mutationsPtr: [^]c.ulong,
extra: [5]c.ulong,
}
@(objc_class="NSFastEnumeration")
FastEnumeration :: struct {using _: Object}
@(objc_class="NSEnumerator")
Enumerator :: struct($T: typeid) where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
using _: FastEnumeration,
}
@(objc_type=FastEnumeration, objc_name="alloc", objc_is_class_method=true)
FastEnumeration_alloc :: proc() -> ^FastEnumeration {
return msgSend(^FastEnumeration, FastEnumeration, "alloc")
}
@(objc_type=FastEnumeration, objc_name="init")
FastEnumeration_init :: proc(self: ^FastEnumeration) -> ^FastEnumeration {
return msgSend(^FastEnumeration, self, "init")
}
@(objc_type=FastEnumeration, objc_name="countByEnumerating")
FastEnumeration_countByEnumerating :: proc(self: ^FastEnumeration, state: ^FastEnumerationState, buffer: [^]^Object, len: UInteger) -> UInteger {
return msgSend(UInteger, self, "countByEnumeratingWithState:objects:count:", state, buffer, len)
}
Enumerator_nextObject :: proc(self: ^$E/Enumerator($T)) -> T {
return msgSend(T, self, "nextObject")
}
Enumerator_allObjects :: proc(self: ^$E/Enumerator($T)) -> (all: ^Array) {
return msgSend(type_of(all), self, "allObjects")
}
Enumerator_iterator :: proc(self: ^$E/Enumerator($T)) -> (obj: T, ok: bool) {
obj = msgSend(T, self, "nextObject")
ok = obj != nil
return
}
-88
View File
@@ -1,88 +0,0 @@
package objc_Foundation
foreign import "system:Foundation.framework"
ErrorDomain :: ^String
foreign Foundation {
@(linkage="weak") CocoaErrorDomain: ErrorDomain
@(linkage="weak") POSIXErrorDomain: ErrorDomain
@(linkage="weak") OSStatusErrorDomain: ErrorDomain
@(linkage="weak") MachErrorDomain: ErrorDomain
}
ErrorUserInfoKey :: ^String
foreign Foundation {
@(linkage="weak") UnderlyingErrorKey: ErrorUserInfoKey
@(linkage="weak") LocalizedDescriptionKey: ErrorUserInfoKey
@(linkage="weak") LocalizedFailureReasonErrorKey: ErrorUserInfoKey
@(linkage="weak") LocalizedRecoverySuggestionErrorKey: ErrorUserInfoKey
@(linkage="weak") LocalizedRecoveryOptionsErrorKey: ErrorUserInfoKey
@(linkage="weak") RecoveryAttempterErrorKey: ErrorUserInfoKey
@(linkage="weak") HelpAnchorErrorKey: ErrorUserInfoKey
@(linkage="weak") DebugDescriptionErrorKey: ErrorUserInfoKey
@(linkage="weak") LocalizedFailureErrorKey: ErrorUserInfoKey
@(linkage="weak") StringEncodingErrorKey: ErrorUserInfoKey
@(linkage="weak") URLErrorKey: ErrorUserInfoKey
@(linkage="weak") FilePathErrorKey: ErrorUserInfoKey
}
@(objc_class="NSError")
Error :: struct { using _: Copying(Error) }
@(objc_type=Error, objc_name="alloc", objc_is_class_method=true)
Error_alloc :: proc() -> ^Error {
return msgSend(^Error, Error, "alloc")
}
@(objc_type=Error, objc_name="init")
Error_init :: proc(self: ^Error) -> ^Error {
return msgSend(^Error, self, "init")
}
@(objc_type=Error, objc_name="errorWithDomain", objc_is_class_method=true)
Error_errorWithDomain :: proc(domain: ErrorDomain, code: Integer, userInfo: ^Dictionary) -> ^Error {
return msgSend(^Error, Error, "errorWithDomain:code:userInfo:", domain, code, userInfo)
}
@(objc_type=Error, objc_name="initWithDomain")
Error_initWithDomain :: proc(self: ^Error, domain: ErrorDomain, code: Integer, userInfo: ^Dictionary) -> ^Error {
return msgSend(^Error, self, "initWithDomain:code:userInfo:", domain, code, userInfo)
}
@(objc_type=Error, objc_name="code")
Error_code :: proc(self: ^Error) -> Integer {
return msgSend(Integer, self, "code")
}
@(objc_type=Error, objc_name="domain")
Error_domain :: proc(self: ^Error) -> ErrorDomain {
return msgSend(ErrorDomain, self, "domain")
}
@(objc_type=Error, objc_name="userInfo")
Error_userInfo :: proc(self: ^Error) -> ^Dictionary {
return msgSend(^Dictionary, self, "userInfo")
}
@(objc_type=Error, objc_name="localizedDescription")
Error_localizedDescription :: proc(self: ^Error) -> ^String {
return msgSend(^String, self, "localizedDescription")
}
@(objc_type=Error, objc_name="localizedRecoveryOptions")
Error_localizedRecoveryOptions :: proc(self: ^Error) -> (options: ^Array) {
return msgSend(type_of(options), self, "localizedRecoveryOptions")
}
@(objc_type=Error, objc_name="localizedRecoverySuggestion")
Error_localizedRecoverySuggestion :: proc(self: ^Error) -> ^String {
return msgSend(^String, self, "localizedRecoverySuggestion")
}
@(objc_type=Error, objc_name="localizedFailureReason")
Error_localizedFailureReason :: proc(self: ^Error) -> ^String {
return msgSend(^String, self, "localizedFailureReason")
}
-53
View File
@@ -1,53 +0,0 @@
package objc_Foundation
Locking :: struct($T: typeid) {using _: Object}
Locking_lock :: proc(self: ^Locking($T)) {
msgSend(nil, self, "lock")
}
Locking_unlock :: proc(self: ^Locking($T)) {
msgSend(nil, self, "unlock")
}
@(objc_class="NSCondition")
Condition :: struct {using _: Locking(Condition) }
@(objc_type=Condition, objc_name="alloc", objc_is_class_method=true)
Condition_alloc :: proc() -> ^Condition {
return msgSend(^Condition, Condition, "alloc")
}
@(objc_type=Condition, objc_name="init")
Condition_init :: proc(self: ^Condition) -> ^Condition {
return msgSend(^Condition, self, "init")
}
@(objc_type=Condition, objc_name="wait")
Condition_wait :: proc(self: ^Condition) {
msgSend(nil, self, "wait")
}
@(objc_type=Condition, objc_name="waitUntilDate")
Condition_waitUntilDate :: proc(self: ^Condition, limit: ^Date) -> BOOL {
return msgSend(BOOL, self, "waitUntilDate:", limit)
}
@(objc_type=Condition, objc_name="signal")
Condition_signal :: proc(self: ^Condition) {
msgSend(nil, self, "signal")
}
@(objc_type=Condition, objc_name="broadcast")
Condition_broadcast :: proc(self: ^Condition) {
msgSend(nil, self, "broadcast")
}
@(objc_type=Condition, objc_name="lock")
Condition_lock :: proc(self: ^Condition) {
msgSend(nil, self, "lock")
}
@(objc_type=Condition, objc_name="unlock")
Condition_unlock :: proc(self: ^Condition) {
msgSend(nil, self, "unlock")
}
@@ -1,30 +0,0 @@
package objc_Foundation
@(objc_class="NSNotification")
Notification :: struct{using _: Object}
@(objc_type=Notification, objc_name="alloc", objc_is_class_method=true)
Notification_alloc :: proc() -> ^Notification {
return msgSend(^Notification, Notification, "alloc")
}
@(objc_type=Notification, objc_name="init")
Notification_init :: proc(self: ^Notification) -> ^Notification {
return msgSend(^Notification, self, "init")
}
@(objc_type=Notification, objc_name="name")
Notification_name :: proc(self: ^Notification) -> ^String {
return msgSend(^String, self, "name")
}
@(objc_type=Notification, objc_name="object")
Notification_object :: proc(self: ^Notification) -> ^Object {
return msgSend(^Object, self, "object")
}
@(objc_type=Notification, objc_name="userInfo")
Notification_userInfo :: proc(self: ^Notification) -> ^Dictionary {
return msgSend(^Dictionary, self, "userInfo")
}
-151
View File
@@ -1,151 +0,0 @@
package objc_Foundation
import "core:c"
#assert(size_of(c.long) == size_of(int))
#assert(size_of(c.ulong) == size_of(uint))
@(objc_class="NSValue")
Value :: struct{using _: Copying(Value)}
@(objc_type=Value, objc_name="alloc", objc_is_class_method=true)
Value_alloc :: proc() -> ^Value {
return msgSend(^Value, Value, "alloc")
}
@(objc_type=Value, objc_name="init")
Value_init :: proc(self: ^Value) -> ^Value {
return msgSend(^Value, self, "init")
}
@(objc_type=Value, objc_name="valueWithBytes", objc_is_class_method=true)
Value_valueWithBytes :: proc(value: rawptr, type: cstring) -> ^Value {
return msgSend(^Value, Value, "valueWithBytes:objCType:", value, type)
}
@(objc_type=Value, objc_name="valueWithPointer", objc_is_class_method=true)
Value_valueWithPointer :: proc(pointer: rawptr) -> ^Value {
return msgSend(^Value, Value, "valueWithPointer:", pointer)
}
@(objc_type=Value, objc_name="initWithBytes")
Value_initWithBytes :: proc(self: ^Value, value: rawptr, type: cstring) -> ^Value {
return msgSend(^Value, self, "initWithBytes:objCType:", value, type)
}
@(objc_type=Value, objc_name="initWithCoder")
Value_initWithCoder :: proc(self: ^Value, coder: ^Coder) -> ^Value {
return msgSend(^Value, self, "initWithCoder:", coder)
}
@(objc_type=Value, objc_name="getValue")
Value_getValue :: proc(self: ^Value, value: rawptr, size: UInteger) {
msgSend(nil, self, "getValue:size:", value, size)
}
@(objc_type=Value, objc_name="objCType")
Value_objCType :: proc(self: ^Value) -> cstring {
return msgSend(cstring, self, "objCType")
}
@(objc_type=Value, objc_name="isEqualToValue")
Value_isEqualToValue :: proc(self, other: ^Value) -> BOOL {
return msgSend(BOOL, self, "isEqualToValue:", other)
}
@(objc_type=Value, objc_name="pointerValue")
Value_pointerValue :: proc(self: ^Value) -> rawptr {
return msgSend(rawptr, self, "pointerValue")
}
@(objc_class="NSNumber")
Number :: struct{using _: Copying(Number), using _: Value}
@(objc_type=Number, objc_name="alloc", objc_is_class_method=true)
Number_alloc :: proc() -> ^Number {
return msgSend(^Number, Number, "alloc")
}
@(objc_type=Number, objc_name="init")
Number_init :: proc(self: ^Number) -> ^Number {
return msgSend(^Number, self, "init")
}
@(objc_type=Number, objc_name="numberWithI8", objc_is_class_method=true) Number_numberWithI8 :: proc(value: i8) -> ^Number { return msgSend(^Number, Number, "numberWithChar:", value) }
@(objc_type=Number, objc_name="numberWithU8", objc_is_class_method=true) Number_numberWithU8 :: proc(value: u8) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedChar:", value) }
@(objc_type=Number, objc_name="numberWithI16", objc_is_class_method=true) Number_numberWithI16 :: proc(value: i16) -> ^Number { return msgSend(^Number, Number, "numberWithShort:", value) }
@(objc_type=Number, objc_name="numberWithU16", objc_is_class_method=true) Number_numberWithU16 :: proc(value: u16) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedShort:", value) }
@(objc_type=Number, objc_name="numberWithI32", objc_is_class_method=true) Number_numberWithI32 :: proc(value: i32) -> ^Number { return msgSend(^Number, Number, "numberWithInt:", value) }
@(objc_type=Number, objc_name="numberWithU32", objc_is_class_method=true) Number_numberWithU32 :: proc(value: u32) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedInt:", value) }
@(objc_type=Number, objc_name="numberWithInt", objc_is_class_method=true) Number_numberWithInt :: proc(value: int) -> ^Number { return msgSend(^Number, Number, "numberWithLong:", value) }
@(objc_type=Number, objc_name="numberWithUint", objc_is_class_method=true) Number_numberWithUint :: proc(value: uint) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedLong:", value) }
@(objc_type=Number, objc_name="numberWithU64", objc_is_class_method=true) Number_numberWithU64 :: proc(value: u64) -> ^Number { return msgSend(^Number, Number, "numberWithLongLong:", value) }
@(objc_type=Number, objc_name="numberWithI64", objc_is_class_method=true) Number_numberWithI64 :: proc(value: i64) -> ^Number { return msgSend(^Number, Number, "numberWithUnsignedLongLong:", value) }
@(objc_type=Number, objc_name="numberWithF32", objc_is_class_method=true) Number_numberWithF32 :: proc(value: f32) -> ^Number { return msgSend(^Number, Number, "numberWithFloat:", value) }
@(objc_type=Number, objc_name="numberWithF64", objc_is_class_method=true) Number_numberWithF64 :: proc(value: f64) -> ^Number { return msgSend(^Number, Number, "numberWithDouble:", value) }
@(objc_type=Number, objc_name="numberWithBool", objc_is_class_method=true) Number_numberWithBool :: proc(value: BOOL) -> ^Number { return msgSend(^Number, Number, "numberWithBool:", value) }
Number_number :: proc{
Number_numberWithI8,
Number_numberWithU8,
Number_numberWithI16,
Number_numberWithU16,
Number_numberWithI32,
Number_numberWithU32,
Number_numberWithInt,
Number_numberWithUint,
Number_numberWithU64,
Number_numberWithI64,
Number_numberWithF32,
Number_numberWithF64,
Number_numberWithBool,
}
@(objc_type=Number, objc_name="initWithI8") Number_initWithI8 :: proc(self: ^Number, value: i8) -> ^Number { return msgSend(^Number, self, "initWithChar:", value) }
@(objc_type=Number, objc_name="initWithU8") Number_initWithU8 :: proc(self: ^Number, value: u8) -> ^Number { return msgSend(^Number, self, "initWithUnsignedChar:", value) }
@(objc_type=Number, objc_name="initWithI16") Number_initWithI16 :: proc(self: ^Number, value: i16) -> ^Number { return msgSend(^Number, self, "initWithShort:", value) }
@(objc_type=Number, objc_name="initWithU16") Number_initWithU16 :: proc(self: ^Number, value: u16) -> ^Number { return msgSend(^Number, self, "initWithUnsignedShort:", value) }
@(objc_type=Number, objc_name="initWithI32") Number_initWithI32 :: proc(self: ^Number, value: i32) -> ^Number { return msgSend(^Number, self, "initWithInt:", value) }
@(objc_type=Number, objc_name="initWithU32") Number_initWithU32 :: proc(self: ^Number, value: u32) -> ^Number { return msgSend(^Number, self, "initWithUnsignedInt:", value) }
@(objc_type=Number, objc_name="initWithInt") Number_initWithInt :: proc(self: ^Number, value: int) -> ^Number { return msgSend(^Number, self, "initWithLong:", value) }
@(objc_type=Number, objc_name="initWithUint") Number_initWithUint :: proc(self: ^Number, value: uint) -> ^Number { return msgSend(^Number, self, "initWithUnsignedLong:", value) }
@(objc_type=Number, objc_name="initWithU64") Number_initWithU64 :: proc(self: ^Number, value: u64) -> ^Number { return msgSend(^Number, self, "initWithLongLong:", value) }
@(objc_type=Number, objc_name="initWithI64") Number_initWithI64 :: proc(self: ^Number, value: i64) -> ^Number { return msgSend(^Number, self, "initWithUnsignedLongLong:", value) }
@(objc_type=Number, objc_name="initWithF32") Number_initWithF32 :: proc(self: ^Number, value: f32) -> ^Number { return msgSend(^Number, self, "initWithFloat:", value) }
@(objc_type=Number, objc_name="initWithF64") Number_initWithF64 :: proc(self: ^Number, value: f64) -> ^Number { return msgSend(^Number, self, "initWithDouble:", value) }
@(objc_type=Number, objc_name="initWithBool") Number_initWithBool :: proc(self: ^Number, value: BOOL) -> ^Number { return msgSend(^Number, self, "initWithBool:", value) }
@(objc_type=Number, objc_name="i8Value") Number_i8Value :: proc(self: ^Number) -> i8 { return msgSend(i8, self, "charValue") }
@(objc_type=Number, objc_name="u8Value") Number_u8Value :: proc(self: ^Number) -> u8 { return msgSend(u8, self, "unsignedCharValue") }
@(objc_type=Number, objc_name="i16Value") Number_i16Value :: proc(self: ^Number) -> i16 { return msgSend(i16, self, "shortValue") }
@(objc_type=Number, objc_name="u16Value") Number_u16Value :: proc(self: ^Number) -> u16 { return msgSend(u16, self, "unsignedShortValue") }
@(objc_type=Number, objc_name="i32Value") Number_i32Value :: proc(self: ^Number) -> i32 { return msgSend(i32, self, "intValue") }
@(objc_type=Number, objc_name="u32Value") Number_u32Value :: proc(self: ^Number) -> u32 { return msgSend(u32, self, "unsignedIntValue") }
@(objc_type=Number, objc_name="intValue") Number_intValue :: proc(self: ^Number) -> int { return msgSend(int, self, "longValue") }
@(objc_type=Number, objc_name="uintValue") Number_uintValue :: proc(self: ^Number) -> uint { return msgSend(uint, self, "unsignedLongValue") }
@(objc_type=Number, objc_name="u64Value") Number_u64Value :: proc(self: ^Number) -> u64 { return msgSend(u64, self, "longLongValue") }
@(objc_type=Number, objc_name="i64Value") Number_i64Value :: proc(self: ^Number) -> i64 { return msgSend(i64, self, "unsignedLongLongValue") }
@(objc_type=Number, objc_name="f32Value") Number_f32Value :: proc(self: ^Number) -> f32 { return msgSend(f32, self, "floatValue") }
@(objc_type=Number, objc_name="f64Value") Number_f64Value :: proc(self: ^Number) -> f64 { return msgSend(f64, self, "doubleValue") }
@(objc_type=Number, objc_name="boolValue") Number_boolValue :: proc(self: ^Number) -> BOOL { return msgSend(BOOL, self, "boolValue") }
@(objc_type=Number, objc_name="integerValue") Number_integerValue :: proc(self: ^Number) -> Integer { return msgSend(Integer, self, "integerValue") }
@(objc_type=Number, objc_name="uintegerValue") Number_uintegerValue :: proc(self: ^Number) -> UInteger { return msgSend(UInteger, self, "unsignedIntegerValue") }
@(objc_type=Number, objc_name="stringValue") Number_stringValue :: proc(self: ^Number) -> ^String { return msgSend(^String, self, "stringValue") }
@(objc_type=Number, objc_name="compare")
Number_compare :: proc(self, other: ^Number) -> ComparisonResult {
return msgSend(ComparisonResult, self, "compare:", other)
}
@(objc_type=Number, objc_name="isEqualToNumber")
Number_isEqualToNumber :: proc(self, other: ^Number) -> BOOL {
return msgSend(BOOL, self, "isEqualToNumber:", other)
}
@(objc_type=Number, objc_name="descriptionWithLocale")
Number_descriptionWithLocale :: proc(self: ^Number, locale: ^Object) -> ^String {
return msgSend(^String, self, "descriptionWithLocale:", locale)
}
-86
View File
@@ -1,86 +0,0 @@
package objc_Foundation
import "core:intrinsics"
methodSignatureForSelector :: proc "c" (obj: ^Object, selector: SEL) -> rawptr {
return msgSend(rawptr, obj, "methodSignatureForSelector:", selector)
}
respondsToSelector :: proc "c" (obj: ^Object, selector: SEL) -> BOOL {
return msgSend(BOOL, obj, "respondsToSelector:", selector)
}
msgSendSafeCheck :: proc "c" (obj: ^Object, selector: SEL) -> BOOL {
return respondsToSelector(obj, selector) || methodSignatureForSelector(obj, selector) != nil
}
@(objc_class="NSObject")
Object :: struct {using _: intrinsics.objc_object}
@(objc_class="NSObject")
Copying :: struct($T: typeid) {using _: Object}
alloc :: proc($T: typeid) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
return msgSend(^T, T, "alloc")
}
init :: proc(self: ^$T) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
return msgSend(^T, self, "init")
}
copy :: proc(self: ^Copying($T)) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
return msgSend(^T, self, "copy")
}
new :: proc($T: typeid) -> ^T where intrinsics.type_is_subtype_of(T, Object) {
return init(alloc(T))
}
@(objc_type=Object, objc_name="retain")
retain :: proc(self: ^Object) {
_ = msgSend(^Object, self, "retain")
}
@(objc_type=Object, objc_name="release")
release :: proc(self: ^Object) {
msgSend(nil, self, "release")
}
@(objc_type=Object, objc_name="autorelease")
autorelease :: proc(self: ^Object) {
msgSend(nil, self, "autorelease")
}
@(objc_type=Object, objc_name="retainCount")
retainCount :: proc(self: ^Object) -> UInteger {
return msgSend(UInteger, self, "retainCount")
}
@(objc_type=Object, objc_name="hash")
hash :: proc(self: ^Object) -> UInteger {
return msgSend(UInteger, self, "hash")
}
@(objc_type=Object, objc_name="isEqual")
isEqual :: proc(self, pObject: ^Object) -> BOOL {
return msgSend(BOOL, self, "isEqual:", pObject)
}
@(objc_type=Object, objc_name="description")
description :: proc(self: ^Object) -> ^String {
return msgSend(^String, self, "description")
}
@(objc_type=Object, objc_name="debugDescription")
debugDescription :: proc(self: ^Object) -> ^String {
if msgSendSafeCheck(self, intrinsics.objc_find_selector("debugDescription")) {
return msgSend(^String, self, "debugDescription")
}
return nil
}
bridgingCast :: proc($T: typeid, obj: ^Object) where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
return (T)(obj)
}
@(objc_class="NSCoder")
Coder :: struct {using _: Object}
// TODO(bill): Implement all the methods for this massive type
-22
View File
@@ -1,22 +0,0 @@
package objc_Foundation
Range :: struct {
location: UInteger,
length: UInteger,
}
Range_Make :: proc(loc, len: UInteger) -> Range {
return Range{loc, len}
}
Range_Equal :: proc(a, b: Range) -> BOOL {
return a == b
}
Range_LocationInRange :: proc(self: Range, loc: UInteger) -> BOOL {
return !((loc < self.location) && ((loc - self.location) < self.length))
}
Range_Max :: proc(self: Range) -> UInteger {
return self.location + self.length
}
-136
View File
@@ -1,136 +0,0 @@
package objc_Foundation
foreign import "system:Foundation.framework"
@(objc_class="NSString")
String :: struct {using _: Copying(String)}
StringEncoding :: enum UInteger {
ASCII = 1,
NEXTSTEP = 2,
JapaneseEUC = 3,
UTF8 = 4,
ISOLatin1 = 5,
Symbol = 6,
NonLossyASCII = 7,
ShiftJIS = 8,
ISOLatin2 = 9,
Unicode = 10,
WindowsCP1251 = 11,
WindowsCP1252 = 12,
WindowsCP1253 = 13,
WindowsCP1254 = 14,
WindowsCP1250 = 15,
ISO2022JP = 21,
MacOSRoman = 30,
UTF16 = Unicode,
UTF16BigEndian = 0x90000100,
UTF16LittleEndian = 0x94000100,
UTF32 = 0x8c000100,
UTF32BigEndian = 0x98000100,
UTF32LittleEndian = 0x9c000100,
}
StringCompareOptions :: distinct bit_set[StringCompareOption; UInteger]
StringCompareOption :: enum UInteger {
CaseInsensitive = 0,
LiteralSearch = 1,
BackwardsSearch = 2,
AnchoredSearch = 3,
NumericSearch = 6,
DiacriticInsensitive = 7,
WidthInsensitive = 8,
ForcedOrdering = 9,
RegularExpression = 10,
}
unichar :: distinct u16
AT :: MakeConstantString
MakeConstantString :: proc "c" (#const c: cstring) -> ^String {
foreign Foundation {
__CFStringMakeConstantString :: proc "c" (c: cstring) -> ^String ---
}
return __CFStringMakeConstantString(c)
}
@(objc_type=String, objc_name="alloc", objc_is_class_method=true)
String_alloc :: proc() -> ^String {
return msgSend(^String, String, "alloc")
}
@(objc_type=String, objc_name="init")
String_init :: proc(self: ^String) -> ^String {
return msgSend(^String, self, "init")
}
@(objc_type=String, objc_name="initWithString")
String_initWithString :: proc(self: ^String, other: ^String) -> ^String {
return msgSend(^String, self, "initWithString:", other)
}
@(objc_type=String, objc_name="initWithCString")
String_initWithCString :: proc(self: ^String, pString: cstring, encoding: StringEncoding) -> ^String {
return msgSend(^String, self, "initWithCstring:encoding:", pString, encoding)
}
@(objc_type=String, objc_name="initWithBytesNoCopy")
String_initWithBytesNoCopy :: proc(self: ^String, pBytes: rawptr, length: UInteger, encoding: StringEncoding, freeWhenDone: bool) -> ^String {
return msgSend(^String, self, "initWithBytesNoCopy:length:encoding:freeWhenDone:", pBytes, length, encoding, freeWhenDone)
}
@(objc_type=String, objc_name="initWithOdinString")
String_initWithOdinString :: proc(self: ^String, str: string) -> ^String {
return String_initWithBytesNoCopy(self, raw_data(str), UInteger(len(str)), .UTF8, false)
}
@(objc_type=String, objc_name="characterAtIndex")
String_characterAtIndex :: proc(self: ^String, index: UInteger) -> unichar {
return msgSend(unichar, self, "characterAtIndex:", index)
}
@(objc_type=String, objc_name="length")
String_length :: proc(self: ^String) -> UInteger {
return msgSend(UInteger, self, "length")
}
@(objc_type=String, objc_name="cstringUsingEncoding")
String_cstringUsingEncoding :: proc(self: ^String, encoding: StringEncoding) -> cstring {
return msgSend(cstring, self, "cStringUsingEncoding:", encoding)
}
@(objc_type=String, objc_name="UTF8String")
String_UTF8String :: proc(self: ^String) -> cstring {
return msgSend(cstring, self, "UTF8String")
}
@(objc_type=String, objc_name="odinString")
String_odinString :: proc(self: ^String) -> string {
return string(String_UTF8String(self))
}
@(objc_type=String, objc_name="maximumLengthOfBytesUsingEncoding")
String_maximumLengthOfBytesUsingEncoding :: proc(self: ^String, encoding: StringEncoding) -> UInteger {
return msgSend(UInteger, self, "maximumLengthOfBytesUsingEncoding:", encoding)
}
@(objc_type=String, objc_name="lengthOfBytesUsingEncoding")
String_lengthOfBytesUsingEncoding :: proc(self: ^String, encoding: StringEncoding) -> UInteger {
return msgSend(UInteger, self, "lengthOfBytesUsingEncoding:", encoding)
}
@(objc_type=String, objc_name="isEqualToString")
String_isEqualToString :: proc(self, other: ^String) -> BOOL {
return msgSend(BOOL, self, "isEqualToString:", other)
}
@(objc_type=String, objc_name="rangeOfString")
String_rangeOfString :: proc(self, other: ^String, options: StringCompareOptions) -> Range {
return msgSend(Range, self, "rangeOfString:options:", other, options)
}
-35
View File
@@ -1,35 +0,0 @@
package objc_Foundation
import "core:intrinsics"
@(private) msgSend :: intrinsics.objc_send
id :: ^intrinsics.objc_object
SEL :: ^intrinsics.objc_selector
Class :: ^intrinsics.objc_class
TimeInterval :: distinct f64
Integer :: distinct int
UInteger :: distinct uint
IntegerMax :: max(Integer)
Integermin :: min(Integer)
UIntegerMax :: max(UInteger)
BOOL :: bool // TODO(bill): should this be `distinct`?
YES :: true
NO :: false
OperatingSystemVersion :: struct #packed {
majorVersion: Integer,
minorVersion: Integer,
patchVersion: Integer,
}
ComparisonResult :: enum Integer {
OrderedAscending = -1,
OrderedSame = 0,
OrderedDescending = 1,
}
NotFound :: IntegerMax
-30
View File
@@ -1,30 +0,0 @@
package objc_Foundation
@(objc_class="NSURL")
URL :: struct{using _: Copying(URL)}
@(objc_type=URL, objc_name="alloc", objc_is_class_method=true)
URL_alloc :: proc() -> ^URL {
return msgSend(^URL, URL, "alloc")
}
@(objc_type=URL, objc_name="init")
URL_init :: proc(self: ^URL) -> ^URL {
return msgSend(^URL, self, "init")
}
@(objc_type=URL, objc_name="initWithString")
URL_initWithString :: proc(self: ^URL, value: ^String) -> ^URL {
return msgSend(^URL, self, "initWithString:", value)
}
@(objc_type=URL, objc_name="initFileURLWithPath")
URL_initFileURLWithPath :: proc(self: ^URL, path: ^String) -> ^URL {
return msgSend(^URL, self, "initFileURLWithPath:", path)
}
@(objc_type=URL, objc_name="fileSystemRepresentation")
URL_fileSystemRepresentation :: proc(self: ^URL) -> ^String {
return msgSend(^String, self, "fileSystemRepresentation")
}
-74
View File
@@ -1,74 +0,0 @@
package objc_Foundation
import NS "core:sys/darwin/Foundation"
Rect :: struct {
x, y: f64,
width, height: f64,
}
@(objc_class="NSColor")
Color :: struct {using _: Object}
@(objc_class="CALayer")
Layer :: struct { using _: NS.Object }
@(objc_class="NSResponder")
Responder :: struct {using _: Object}
@(objc_class="NSView")
View :: struct {using _: Responder}
@(objc_type=View, objc_name="layer")
View_layer :: proc(self: ^View) -> ^Layer {
return msgSend(^Layer, self, "layer")
}
@(objc_type=View, objc_name="setLayer")
View_setLayer :: proc(self: ^View, layer: ^Layer) {
msgSend(nil, self, "setLayer:", layer)
}
@(objc_type=View, objc_name="setSubLayer")
View_setSubLayer :: proc(self: ^View, layer: ^Layer) {
msgSend(nil, self, "setSubLayer:", layer)
}
@(objc_type=View, objc_name="wantsLayer")
View_wantsLayer :: proc(self: ^View) -> BOOL {
return msgSend(BOOL, self, "wantsLayer")
}
@(objc_type=View, objc_name="setWantsLayer")
View_setWantsLayer :: proc(self: ^View, wantsLayer: BOOL) {
msgSend(nil, self, "setWantsLayer:", wantsLayer)
}
@(objc_class="NSWindow")
Window :: struct {using _: Responder}
@(objc_type=Window, objc_name="contentView")
Window_contentView :: proc(self: ^Window) -> ^View {
return msgSend(^View, self, "contentView")
}
@(objc_type=Window, objc_name="frame")
Window_frame :: proc(self: ^Window) -> Rect {
return msgSend(Rect, self, "frame")
}
@(objc_type=Window, objc_name="setFrame")
Window_setFrame :: proc(self: ^Window, frame: Rect) {
msgSend(nil, self, "setFrame:", frame)
}
@(objc_type=Window, objc_name="opaque")
Window_opaque :: proc(self: ^Window) -> NS.BOOL {
return msgSend(NS.BOOL, self, "opaque")
}
@(objc_type=Window, objc_name="setOpaque")
Window_setOpaque :: proc(self: ^Window, ok: NS.BOOL) {
msgSend(nil, self, "setOpaque:", ok)
}
@(objc_type=Window, objc_name="backgroundColor")
Window_backgroundColor :: proc(self: ^Window) -> ^NS.Color {
return msgSend(^NS.Color, self, "backgroundColor")
}
@(objc_type=Window, objc_name="setBackgroundColor")
Window_setBackgroundColor :: proc(self: ^Window, color: ^NS.Color) {
msgSend(nil, self, "setBackgroundColor:", color)
}
File diff suppressed because it is too large Load Diff
-972
View File
@@ -1,972 +0,0 @@
package objc_Metal
import NS "core:sys/darwin/Foundation"
AccelerationStructureUsage :: distinct bit_set[AccelerationStructureUsageFlag; NS.UInteger]
AccelerationStructureUsageFlag :: enum NS.UInteger {
Refit = 0,
PreferFastBuild = 1,
ExtendedLimits = 2,
}
AccelerationStructureInstanceOptions :: distinct bit_set[AccelerationStructureInstanceOption; u32]
AccelerationStructureInstanceOption :: enum u32 {
DisableTriangleCulling = 0,
TriangleFrontFacingWindingCounterClockwise = 1,
Opaque = 2,
NonOpaque = 3,
}
MotionBorderMode :: enum u32 {
Clamp = 0,
Vanish = 1,
}
AccelerationStructureInstanceDescriptorType :: enum NS.UInteger {
Default = 0,
UserID = 1,
Motion = 2,
};
DataType :: enum NS.UInteger {
None = 0,
Struct = 1,
Array = 2,
Float = 3,
Float2 = 4,
Float3 = 5,
Float4 = 6,
Float2x2 = 7,
Float2x3 = 8,
Float2x4 = 9,
Float3x2 = 10,
Float3x3 = 11,
Float3x4 = 12,
Float4x2 = 13,
Float4x3 = 14,
Float4x4 = 15,
Half = 16,
Half2 = 17,
Half3 = 18,
Half4 = 19,
Half2x2 = 20,
Half2x3 = 21,
Half2x4 = 22,
Half3x2 = 23,
Half3x3 = 24,
Half3x4 = 25,
Half4x2 = 26,
Half4x3 = 27,
Half4x4 = 28,
Int = 29,
Int2 = 30,
Int3 = 31,
Int4 = 32,
UInt = 33,
UInt2 = 34,
UInt3 = 35,
UInt4 = 36,
Short = 37,
Short2 = 38,
Short3 = 39,
Short4 = 40,
UShort = 41,
UShort2 = 42,
UShort3 = 43,
UShort4 = 44,
Char = 45,
Char2 = 46,
Char3 = 47,
Char4 = 48,
UChar = 49,
UChar2 = 50,
UChar3 = 51,
UChar4 = 52,
Bool = 53,
Bool2 = 54,
Bool3 = 55,
Bool4 = 56,
Texture = 58,
Sampler = 59,
Pointer = 60,
R8Unorm = 62,
R8Snorm = 63,
R16Unorm = 64,
R16Snorm = 65,
RG8Unorm = 66,
RG8Snorm = 67,
RG16Unorm = 68,
RG16Snorm = 69,
RGBA8Unorm = 70,
RGBA8Unorm_sRGB = 71,
RGBA8Snorm = 72,
RGBA16Unorm = 73,
RGBA16Snorm = 74,
RGB10A2Unorm = 75,
RG11B10Float = 76,
RGB9E5Float = 77,
RenderPipeline = 78,
ComputePipeline = 79,
IndirectCommandBuffer = 80,
Long = 81,
Long2 = 82,
Long3 = 83,
Long4 = 84,
ULong = 85,
ULong2 = 86,
ULong3 = 87,
ULong4 = 88,
VisibleFunctionTable = 115,
IntersectionFunctionTable = 116,
PrimitiveAccelerationStructure = 117,
InstanceAccelerationStructure = 118,
}
ArgumentType :: enum NS.UInteger {
Buffer = 0,
ThreadgroupMemory = 1,
Texture = 2,
Sampler = 3,
ImageblockData = 16,
Imageblock = 17,
VisibleFunctionTable = 24,
PrimitiveAccelerationStructure = 25,
InstanceAccelerationStructure = 26,
IntersectionFunctionTable = 27,
}
ArgumentAccess :: enum NS.UInteger {
ReadOnly = 0,
ReadWrite = 1,
WriteOnly = 2,
}
BinaryArchiveError :: enum NS.UInteger {
None = 0,
InvalidFile = 1,
UnexpectedElement = 2,
CompilationFailure = 3,
}
BlitOptionFlag :: enum NS.UInteger {
DepthFromDepthStencil = 0,
StencilFromDepthStencil = 1,
RowLinearPVRTC = 2,
}
BlitOption :: distinct bit_set[BlitOptionFlag; NS.UInteger]
CaptureError :: enum NS.Integer {
NotSupported = 1,
AlreadyCapturing = 2,
InvalidDescriptor = 3,
}
CaptureDestination :: enum NS.Integer {
DeveloperTools = 1,
GPUTraceDocument = 2,
}
CommandBufferStatus :: enum NS.UInteger {
NotEnqueued = 0,
Enqueued = 1,
Committed = 2,
Scheduled = 3,
Completed = 4,
Error = 5,
}
CommandBufferError :: enum NS.UInteger {
None = 0,
Timeout = 2,
PageFault = 3,
AccessRevoked = 4,
Blacklisted = 4,
NotPermitted = 7,
OutOfMemory = 8,
InvalidResource = 9,
Memoryless = 10,
DeviceRemoved = 11,
StackOverflow = 12,
}
CommandBufferErrorOptionFlag :: enum NS.UInteger {
EncoderExecutionStatus = 0,
}
CommandBufferErrorOption :: distinct bit_set[CommandBufferErrorOptionFlag; NS.UInteger]
CommandEncoderErrorState :: enum NS.Integer {
Unknown = 0,
Completed = 1,
Affected = 2,
Pending = 3,
Faulted = 4,
}
CommandBufferHandler :: distinct rawptr
DispatchType :: enum NS.UInteger {
Serial = 0,
Concurrent = 1,
}
ResourceUsageFlag :: enum NS.UInteger {
Read = 0,
Write = 1,
Sample = 2,
}
ResourceUsage :: distinct bit_set[ResourceUsageFlag; NS.UInteger]
BarrierScopeFlag :: enum NS.UInteger {
Buffers = 0,
Textures = 1,
RenderTargets = 2,
}
BarrierScope :: distinct bit_set[BarrierScopeFlag; NS.UInteger]
CounterSampleBufferError :: enum NS.Integer {
OutOfMemory = 0,
Invalid = 1,
}
CompareFunction :: enum NS.UInteger {
Never = 0,
Less = 1,
Equal = 2,
LessEqual = 3,
Greater = 4,
NotEqual = 5,
GreaterEqual = 6,
Always = 7,
}
StencilOperation :: enum NS.UInteger {
Keep = 0,
Zero = 1,
Replace = 2,
IncrementClamp = 3,
DecrementClamp = 4,
Invert = 5,
IncrementWrap = 6,
DecrementWrap = 7,
}
FeatureSet :: enum NS.UInteger {
iOS_GPUFamily1_v1 = 0,
iOS_GPUFamily2_v1 = 1,
iOS_GPUFamily1_v2 = 2,
iOS_GPUFamily2_v2 = 3,
iOS_GPUFamily3_v1 = 4,
iOS_GPUFamily1_v3 = 5,
iOS_GPUFamily2_v3 = 6,
iOS_GPUFamily3_v2 = 7,
iOS_GPUFamily1_v4 = 8,
iOS_GPUFamily2_v4 = 9,
iOS_GPUFamily3_v3 = 10,
iOS_GPUFamily4_v1 = 11,
iOS_GPUFamily1_v5 = 12,
iOS_GPUFamily2_v5 = 13,
iOS_GPUFamily3_v4 = 14,
iOS_GPUFamily4_v2 = 15,
iOS_GPUFamily5_v1 = 16,
macOS_GPUFamily1_v1 = 10000,
OSX_GPUFamily1_v1 = 10000,
macOS_GPUFamily1_v2 = 10001,
OSX_GPUFamily1_v2 = 10001,
OSX_ReadWriteTextureTier2 = 10002,
macOS_ReadWriteTextureTier2 = 10002,
macOS_GPUFamily1_v3 = 10003,
macOS_GPUFamily1_v4 = 10004,
macOS_GPUFamily2_v1 = 10005,
watchOS_GPUFamily1_v1 = 20000,
WatchOS_GPUFamily1_v1 = 20000,
watchOS_GPUFamily2_v1 = 20001,
WatchOS_GPUFamily2_v1 = 20001,
tvOS_GPUFamily1_v1 = 30000,
TVOS_GPUFamily1_v1 = 30000,
tvOS_GPUFamily1_v2 = 30001,
tvOS_GPUFamily1_v3 = 30002,
tvOS_GPUFamily2_v1 = 30003,
tvOS_GPUFamily1_v4 = 30004,
tvOS_GPUFamily2_v2 = 30005,
}
GPUFamily :: enum NS.Integer {
Apple1 = 1001,
Apple2 = 1002,
Apple3 = 1003,
Apple4 = 1004,
Apple5 = 1005,
Apple6 = 1006,
Apple7 = 1007,
Apple8 = 1008,
Mac1 = 2001,
Mac2 = 2002,
Common1 = 3001,
Common2 = 3002,
Common3 = 3003,
MacCatalyst1 = 4001,
MacCatalyst2 = 4002,
}
DeviceLocation :: enum NS.UInteger {
BuiltIn = 0,
Slot = 1,
External = 2,
Unspecified = NS.UIntegerMax,
}
PipelineOptionFlag :: enum NS.UInteger {
ArgumentInfo = 0,
BufferTypeInfo = 1,
FailOnBinaryArchiveMiss = 2,
}
PipelineOption :: distinct bit_set[PipelineOptionFlag; NS.UInteger]
ReadWriteTextureTier :: enum NS.UInteger {
TierNone = 0,
Tier1 = 1,
Tier2 = 2,
}
ArgumentBuffersTier :: enum NS.UInteger {
Tier1 = 0,
Tier2 = 1,
}
SparseTextureRegionAlignmentMode :: enum NS.UInteger {
Outward = 0,
Inward = 1,
}
CounterSamplingPoint :: enum NS.UInteger {
AtStageBoundary = 0,
AtDrawBoundary = 1,
AtDispatchBoundary = 2,
AtTileDispatchBoundary = 3,
AtBlitBoundary = 4,
}
DynamicLibraryError :: enum NS.UInteger {
None = 0,
InvalidFile = 1,
CompilationFailure = 2,
UnresolvedInstallName = 3,
DependencyLoadFailure = 4,
Unsupported = 5,
}
FunctionOption :: enum NS.UInteger {
CompileToBinary = 0,
}
FunctionOptions :: distinct bit_set[FunctionOption; NS.UInteger]
FunctionLogType :: enum NS.UInteger {
Validation = 0,
}
HeapType :: enum NS.Integer {
Automatic = 0,
Placement = 1,
Sparse = 2,
}
IndirectCommandTypeFlag :: enum NS.UInteger {
Draw = 0,
DrawIndexed = 1,
DrawPatches = 2,
DrawIndexedPatches = 3,
ConcurrentDispatch = 5,
ConcurrentDispatchThreads = 6,
}
IndirectCommandType :: distinct bit_set[IndirectCommandTypeFlag; NS.UInteger]
IntersectionFunctionSignatureFlag :: enum NS.UInteger {
Instancing = 0,
TriangleData = 1,
WorldSpaceData = 2,
InstanceMotion = 3,
PrimitiveMotion = 4,
ExtendedLimits = 5,
}
IntersectionFunctionSignature :: distinct bit_set[IntersectionFunctionSignatureFlag; NS.UInteger]
PatchType :: enum NS.UInteger {
None = 0,
Triangle = 1,
Quad = 2,
}
FunctionType :: enum NS.UInteger {
Vertex = 1,
Fragment = 2,
Kernel = 3,
Visible = 5,
Intersection = 6,
}
LanguageVersion :: enum NS.UInteger {
Version1_0 = 65536,
Version1_1 = 65537,
Version1_2 = 65538,
Version2_0 = 131072,
Version2_1 = 131073,
Version2_2 = 131074,
Version2_3 = 131075,
Version2_4 = 131076,
}
LibraryType :: enum NS.Integer {
Executable = 0,
Dynamic = 1,
}
LibraryError :: enum NS.UInteger {
Unsupported = 1,
CompileFailure = 3,
CompileWarning = 4,
FunctionNotFound = 5,
FileNotFound = 6,
}
Mutability :: enum NS.UInteger {
Default = 0,
Mutable = 1,
Immutable = 2,
}
PixelFormat :: enum NS.UInteger {
Invalid = 0,
A8Unorm = 1,
R8Unorm = 10,
R8Unorm_sRGB = 11,
R8Snorm = 12,
R8Uint = 13,
R8Sint = 14,
R16Unorm = 20,
R16Snorm = 22,
R16Uint = 23,
R16Sint = 24,
R16Float = 25,
RG8Unorm = 30,
RG8Unorm_sRGB = 31,
RG8Snorm = 32,
RG8Uint = 33,
RG8Sint = 34,
B5G6R5Unorm = 40,
A1BGR5Unorm = 41,
ABGR4Unorm = 42,
BGR5A1Unorm = 43,
R32Uint = 53,
R32Sint = 54,
R32Float = 55,
RG16Unorm = 60,
RG16Snorm = 62,
RG16Uint = 63,
RG16Sint = 64,
RG16Float = 65,
RGBA8Unorm = 70,
RGBA8Unorm_sRGB = 71,
RGBA8Snorm = 72,
RGBA8Uint = 73,
RGBA8Sint = 74,
BGRA8Unorm = 80,
BGRA8Unorm_sRGB = 81,
RGB10A2Unorm = 90,
RGB10A2Uint = 91,
RG11B10Float = 92,
RGB9E5Float = 93,
BGR10A2Unorm = 94,
RG32Uint = 103,
RG32Sint = 104,
RG32Float = 105,
RGBA16Unorm = 110,
RGBA16Snorm = 112,
RGBA16Uint = 113,
RGBA16Sint = 114,
RGBA16Float = 115,
RGBA32Uint = 123,
RGBA32Sint = 124,
RGBA32Float = 125,
BC1_RGBA = 130,
BC1_RGBA_sRGB = 131,
BC2_RGBA = 132,
BC2_RGBA_sRGB = 133,
BC3_RGBA = 134,
BC3_RGBA_sRGB = 135,
BC4_RUnorm = 140,
BC4_RSnorm = 141,
BC5_RGUnorm = 142,
BC5_RGSnorm = 143,
BC6H_RGBFloat = 150,
BC6H_RGBUfloat = 151,
BC7_RGBAUnorm = 152,
BC7_RGBAUnorm_sRGB = 153,
PVRTC_RGB_2BPP = 160,
PVRTC_RGB_2BPP_sRGB = 161,
PVRTC_RGB_4BPP = 162,
PVRTC_RGB_4BPP_sRGB = 163,
PVRTC_RGBA_2BPP = 164,
PVRTC_RGBA_2BPP_sRGB = 165,
PVRTC_RGBA_4BPP = 166,
PVRTC_RGBA_4BPP_sRGB = 167,
EAC_R11Unorm = 170,
EAC_R11Snorm = 172,
EAC_RG11Unorm = 174,
EAC_RG11Snorm = 176,
EAC_RGBA8 = 178,
EAC_RGBA8_sRGB = 179,
ETC2_RGB8 = 180,
ETC2_RGB8_sRGB = 181,
ETC2_RGB8A1 = 182,
ETC2_RGB8A1_sRGB = 183,
ASTC_4x4_sRGB = 186,
ASTC_5x4_sRGB = 187,
ASTC_5x5_sRGB = 188,
ASTC_6x5_sRGB = 189,
ASTC_6x6_sRGB = 190,
ASTC_8x5_sRGB = 192,
ASTC_8x6_sRGB = 193,
ASTC_8x8_sRGB = 194,
ASTC_10x5_sRGB = 195,
ASTC_10x6_sRGB = 196,
ASTC_10x8_sRGB = 197,
ASTC_10x10_sRGB = 198,
ASTC_12x10_sRGB = 199,
ASTC_12x12_sRGB = 200,
ASTC_4x4_LDR = 204,
ASTC_5x4_LDR = 205,
ASTC_5x5_LDR = 206,
ASTC_6x5_LDR = 207,
ASTC_6x6_LDR = 208,
ASTC_8x5_LDR = 210,
ASTC_8x6_LDR = 211,
ASTC_8x8_LDR = 212,
ASTC_10x5_LDR = 213,
ASTC_10x6_LDR = 214,
ASTC_10x8_LDR = 215,
ASTC_10x10_LDR = 216,
ASTC_12x10_LDR = 217,
ASTC_12x12_LDR = 218,
ASTC_4x4_HDR = 222,
ASTC_5x4_HDR = 223,
ASTC_5x5_HDR = 224,
ASTC_6x5_HDR = 225,
ASTC_6x6_HDR = 226,
ASTC_8x5_HDR = 228,
ASTC_8x6_HDR = 229,
ASTC_8x8_HDR = 230,
ASTC_10x5_HDR = 231,
ASTC_10x6_HDR = 232,
ASTC_10x8_HDR = 233,
ASTC_10x10_HDR = 234,
ASTC_12x10_HDR = 235,
ASTC_12x12_HDR = 236,
GBGR422 = 240,
BGRG422 = 241,
Depth16Unorm = 250,
Depth32Float = 252,
Stencil8 = 253,
Depth24Unorm_Stencil8 = 255,
Depth32Float_Stencil8 = 260,
X32_Stencil8 = 261,
X24_Stencil8 = 262,
BGRA10_XR = 552,
BGRA10_XR_sRGB = 553,
BGR10_XR = 554,
BGR10_XR_sRGB = 555,
}
PrimitiveType :: enum NS.UInteger {
Point = 0,
Line = 1,
LineStrip = 2,
Triangle = 3,
TriangleStrip = 4,
}
VisibilityResultMode :: enum NS.UInteger {
Disabled = 0,
Boolean = 1,
Counting = 2,
}
CullMode :: enum NS.UInteger {
None = 0,
Front = 1,
Back = 2,
}
Winding :: enum NS.UInteger {
Clockwise = 0,
CounterClockwise = 1,
}
DepthClipMode :: enum NS.UInteger {
Clip = 0,
Clamp = 1,
}
TriangleFillMode :: enum NS.UInteger {
Fill = 0,
Lines = 1,
}
RenderStage :: enum NS.UInteger {
Vertex = 0,
Fragment = 1,
Tile = 2,
}
RenderStages :: distinct bit_set[RenderStage; NS.UInteger]
LoadAction :: enum NS.UInteger {
DontCare = 0,
Load = 1,
Clear = 2,
}
StoreAction :: enum NS.UInteger {
DontCare = 0,
Store = 1,
MultisampleResolve = 2,
StoreAndMultisampleResolve = 3,
Unknown = 4,
CustomSampleDepthStore = 5,
}
StoreActionOption :: enum NS.UInteger {
CustomSamplePositions = 1,
}
StoreActionOptions :: distinct bit_set[StoreActionOption; NS.UInteger]
MultisampleDepthResolveFilter :: enum NS.UInteger {
Sample0 = 0,
Min = 1,
Max = 2,
}
MultisampleStencilResolveFilter :: enum NS.UInteger {
Sample0 = 0,
DepthResolvedSample = 1,
}
BlendFactor :: enum NS.UInteger {
Zero = 0,
One = 1,
SourceColor = 2,
OneMinusSourceColor = 3,
SourceAlpha = 4,
OneMinusSourceAlpha = 5,
DestinationColor = 6,
OneMinusDestinationColor = 7,
DestinationAlpha = 8,
OneMinusDestinationAlpha = 9,
SourceAlphaSaturated = 10,
BlendColor = 11,
OneMinusBlendColor = 12,
BlendAlpha = 13,
OneMinusBlendAlpha = 14,
Source1Color = 15,
OneMinusSource1Color = 16,
Source1Alpha = 17,
OneMinusSource1Alpha = 18,
}
BlendOperation :: enum NS.UInteger {
Add = 0,
Subtract = 1,
ReverseSubtract = 2,
Min = 3,
Max = 4,
}
ColorWriteMaskFlag :: enum NS.UInteger {
Alpha = 0,
Blue = 1,
Green = 2,
Red = 3,
}
ColorWriteMask :: distinct bit_set[ColorWriteMaskFlag; NS.UInteger]
ColorWriteMaskAll :: ColorWriteMask{.Alpha, .Blue, .Green, .Red}
PrimitiveTopologyClass :: enum NS.UInteger {
Unspecified = 0,
Point = 1,
Line = 2,
Triangle = 3,
}
TessellationPartitionMode :: enum NS.UInteger {
Pow2 = 0,
Integer = 1,
FractionalOdd = 2,
FractionalEven = 3,
}
TessellationFactorStepFunction :: enum NS.UInteger {
Constant = 0,
PerPatch = 1,
PerInstance = 2,
PerPatchAndPerInstance = 3,
}
TessellationFactorFormat :: enum NS.UInteger {
Half = 0,
}
TessellationControlPointIndexType :: enum NS.UInteger {
None = 0,
UInt16 = 1,
UInt32 = 2,
}
PurgeableState :: enum NS.UInteger {
KeepCurrent = 1,
NonVolatile = 2,
Volatile = 3,
Empty = 4,
}
CPUCacheMode :: enum NS.UInteger {
DefaultCache = 0,
WriteCombined = 1,
}
StorageMode :: enum NS.UInteger {
Shared = 0,
Managed = 1,
Private = 2,
Memoryless = 3,
}
HazardTrackingMode :: enum NS.UInteger {
Default = 0,
Untracked = 1,
Tracked = 2,
}
ResourceOption :: enum NS.UInteger {
CPUCacheModeWriteCombined = 0,
StorageModeManaged = 4,
StorageModePrivate = 5,
HazardTrackingModeUntracked = 8,
HazardTrackingModeTracked = 9,
}
ResourceOptions :: distinct bit_set[ResourceOption; NS.UInteger]
ResourceStorageModeShared :: ResourceOptions{}
ResourceHazardTrackingModeDefault :: ResourceOptions{}
ResourceCPUCacheModeDefaultCache :: ResourceOptions{}
ResourceOptionCPUCacheModeDefault :: ResourceOptions{}
ResourceStorageModeMemoryless :: ResourceOptions{.StorageModeManaged, .StorageModePrivate}
SparseTextureMappingMode :: enum NS.UInteger {
Map = 0,
Unmap = 1,
}
SamplerMinMagFilter :: enum NS.UInteger {
Nearest = 0,
Linear = 1,
}
SamplerMipFilter :: enum NS.UInteger {
NotMipmapped = 0,
Nearest = 1,
Linear = 2,
}
SamplerAddressMode :: enum NS.UInteger {
ClampToEdge = 0,
MirrorClampToEdge = 1,
Repeat = 2,
MirrorRepeat = 3,
ClampToZero = 4,
ClampToBorderColor = 5,
}
SamplerBorderColor :: enum NS.UInteger {
TransparentBlack = 0,
OpaqueBlack = 1,
OpaqueWhite = 2,
}
AttributeFormat :: enum NS.UInteger {
Invalid = 0,
UChar2 = 1,
UChar3 = 2,
UChar4 = 3,
Char2 = 4,
Char3 = 5,
Char4 = 6,
UChar2Normalized = 7,
UChar3Normalized = 8,
UChar4Normalized = 9,
Char2Normalized = 10,
Char3Normalized = 11,
Char4Normalized = 12,
UShort2 = 13,
UShort3 = 14,
UShort4 = 15,
Short2 = 16,
Short3 = 17,
Short4 = 18,
UShort2Normalized = 19,
UShort3Normalized = 20,
UShort4Normalized = 21,
Short2Normalized = 22,
Short3Normalized = 23,
Short4Normalized = 24,
Half2 = 25,
Half3 = 26,
Half4 = 27,
Float = 28,
Float2 = 29,
Float3 = 30,
Float4 = 31,
Int = 32,
Int2 = 33,
Int3 = 34,
Int4 = 35,
UInt = 36,
UInt2 = 37,
UInt3 = 38,
UInt4 = 39,
Int1010102Normalized = 40,
UInt1010102Normalized = 41,
UChar4Normalized_BGRA = 42,
UChar = 45,
Char = 46,
UCharNormalized = 47,
CharNormalized = 48,
UShort = 49,
Short = 50,
UShortNormalized = 51,
ShortNormalized = 52,
Half = 53,
}
IndexType :: enum NS.UInteger {
UInt16 = 0,
UInt32 = 1,
}
StepFunction :: enum NS.UInteger {
Constant = 0,
PerVertex = 1,
PerInstance = 2,
PerPatch = 3,
PerPatchControlPoint = 4,
ThreadPositionInGridX = 5,
ThreadPositionInGridY = 6,
ThreadPositionInGridXIndexed = 7,
ThreadPositionInGridYIndexed = 8,
}
TextureType :: enum NS.UInteger {
Type1D = 0,
Type1DArray = 1,
Type2D = 2,
Type2DArray = 3,
Type2DMultisample = 4,
TypeCube = 5,
TypeCubeArray = 6,
Type3D = 7,
Type2DMultisampleArray = 8,
TypeTextureBuffer = 9,
}
TextureSwizzle :: enum u8 {
Zero = 0,
One = 1,
Red = 2,
Green = 3,
Blue = 4,
Alpha = 5,
}
TextureUsageFlag :: enum NS.UInteger {
ShaderRead = 0,
ShaderWrite = 1,
RenderTarget = 2,
PixelFormatView = 4,
}
TextureUsage :: distinct bit_set[TextureUsageFlag; NS.UInteger]
TextureCompressionType :: enum NS.Integer {
Lossless = 0,
Lossy = 1,
}
VertexFormat :: enum NS.UInteger {
Invalid = 0,
UChar2 = 1,
UChar3 = 2,
UChar4 = 3,
Char2 = 4,
Char3 = 5,
Char4 = 6,
UChar2Normalized = 7,
UChar3Normalized = 8,
UChar4Normalized = 9,
Char2Normalized = 10,
Char3Normalized = 11,
Char4Normalized = 12,
UShort2 = 13,
UShort3 = 14,
UShort4 = 15,
Short2 = 16,
Short3 = 17,
Short4 = 18,
UShort2Normalized = 19,
UShort3Normalized = 20,
UShort4Normalized = 21,
Short2Normalized = 22,
Short3Normalized = 23,
Short4Normalized = 24,
Half2 = 25,
Half3 = 26,
Half4 = 27,
Float = 28,
Float2 = 29,
Float3 = 30,
Float4 = 31,
Int = 32,
Int2 = 33,
Int3 = 34,
Int4 = 35,
UInt = 36,
UInt2 = 37,
UInt3 = 38,
UInt4 = 39,
Int1010102Normalized = 40,
UInt1010102Normalized = 41,
UChar4Normalized_BGRA = 42,
UChar = 45,
Char = 46,
UCharNormalized = 47,
CharNormalized = 48,
UShort = 49,
Short = 50,
UShortNormalized = 51,
ShortNormalized = 52,
Half = 53,
}
VertexStepFunction :: enum NS.UInteger {
Constant = 0,
PerVertex = 1,
PerInstance = 2,
PerPatch = 3,
PerPatchControlPoint = 4,
}
-39
View File
@@ -1,39 +0,0 @@
package objc_Metal
import NS "core:sys/darwin/Foundation"
foreign import "system:Metal.framework"
CommonCounter :: ^NS.String
CommonCounterSet :: ^NS.String
DeviceNotificationName :: ^NS.String
foreign Metal {
@(linkage="weak") CommonCounterTimestamp: CommonCounter
@(linkage="weak") CommonCounterTessellationInputPatches: CommonCounter
@(linkage="weak") CommonCounterVertexInvocations: CommonCounter
@(linkage="weak") CommonCounterPostTessellationVertexInvocations: CommonCounter
@(linkage="weak") CommonCounterClipperInvocations: CommonCounter
@(linkage="weak") CommonCounterClipperPrimitivesOut: CommonCounter
@(linkage="weak") CommonCounterFragmentInvocations: CommonCounter
@(linkage="weak") CommonCounterFragmentsPassed: CommonCounter
@(linkage="weak") CommonCounterComputeKernelInvocations: CommonCounter
@(linkage="weak") CommonCounterTotalCycles: CommonCounter
@(linkage="weak") CommonCounterVertexCycles: CommonCounter
@(linkage="weak") CommonCounterTessellationCycles: CommonCounter
@(linkage="weak") CommonCounterPostTessellationVertexCycles: CommonCounter
@(linkage="weak") CommonCounterFragmentCycles: CommonCounter
@(linkage="weak") CommonCounterRenderTargetWriteCycles: CommonCounter
}
foreign Metal {
@(linkage="weak") CommonCounterSetTimestamp: CommonCounterSet
@(linkage="weak") CommonCounterSetStageUtilization: CommonCounterSet
@(linkage="weak") CommonCounterSetStatistic: CommonCounterSet
}
foreign Metal {
@(linkage="weak") DeviceWasAddedNotification: DeviceNotificationName
@(linkage="weak") DeviceRemovalRequestedNotification: DeviceNotificationName
@(linkage="weak") DeviceWasRemovedNotification: DeviceNotificationName
}
@@ -1,14 +0,0 @@
package objc_Metal
import NS "core:sys/darwin/Foundation"
@(require)
foreign import "system:Metal.framework"
@(default_calling_convention="c", link_prefix="MTL")
foreign Metal {
CopyAllDevices :: proc() -> ^NS.Array ---
CopyAllDevicesWithObserver :: proc(observer: ^id, handler: DeviceNotificationHandler) -> ^NS.Array ---
CreateSystemDefaultDevice :: proc() -> ^Device ---
RemoveDeviceObserver :: proc(observer: id) ---
}
-199
View File
@@ -1,199 +0,0 @@
package objc_Metal
import NS "core:sys/darwin/Foundation"
import "core:intrinsics"
BOOL :: NS.BOOL
id :: ^NS.Object
CFTimeInterval :: NS.TimeInterval
IOSurfaceRef :: distinct rawptr
dispatch_queue_t :: id
dispatch_data_t :: id
@(private)
msgSend :: intrinsics.objc_send
AccelerationStructureInstanceDescriptor :: struct {
transformationMatrix: PackedFloat4x3,
options: AccelerationStructureInstanceOptions,
mask: u32,
intersectionFunctionTableOffset: u32,
accelerationStructureIndex: u32,
}
AccelerationStructureSizes :: struct {
accelerationStructureSize: NS.Integer,
buildScratchBufferSize: NS.Integer,
refitScratchBufferSize: NS.Integer,
}
AxisAlignedBoundingBox :: struct {
min: PackedFloat3,
max: PackedFloat3,
}
ClearColor :: struct {
red: f64,
green: f64,
blue: f64,
alpha: f64,
}
Coordinate2D :: struct {
x: f32,
y: f32,
}
CounterResultStageUtilization :: struct {
totalCycles: u64,
vertexCycles: u64,
tessellationCycles: u64,
postTessellationVertexCycles: u64,
fragmentCycles: u64,
renderTargetCycles: u64,
}
CounterResultStatistic :: struct {
tessellationInputPatches: u64,
vertexInvocations: u64,
postTessellationVertexInvocations: u64,
clipperInvocations: u64,
clipperPrimitivesOut: u64,
fragmentInvocations: u64,
fragmentsPassed: u64,
computeKernelInvocations: u64,
}
CounterResultTimestamp :: struct {
timestamp: u64,
}
DispatchThreadgroupsIndirectArguments :: struct {
threadgroupsPerGrid: [3]u32,
}
DrawIndexedPrimitivesIndirectArguments :: struct {
indexCount: u32,
instanceCount: u32,
indexStart: u32,
baseVertex: i32,
baseInstance: u32,
}
DrawPatchIndirectArguments :: struct {
patchCount: u32,
instanceCount: u32,
patchStart: u32,
baseInstance: u32,
}
DrawPrimitivesIndirectArguments :: struct {
vertexCount: u32,
instanceCount: u32,
vertexStart: u32,
baseInstance: u32,
}
IndirectCommandBufferExecutionRange :: struct {
location: u32,
length: u32,
}
MapIndirectArguments :: struct {
regionOriginX: u32,
regionOriginY: u32,
regionOriginZ: u32,
regionSizeWidth: u32,
regionSizeHeight: u32,
regionSizeDepth: u32,
mipMapLevel: u32,
sliceId: u32,
}
Origin :: distinct [3]NS.Integer
PackedFloat3 :: distinct [3]f32
PackedFloat4x3 :: struct {
columns: [4]PackedFloat3,
}
QuadTessellationFactorsHalf :: struct {
edgeTessellationFactor: [4]u16,
insideTessellationFactor: [2]u16,
}
Region :: struct {
origin: Origin,
size: Size,
}
SamplePosition :: distinct [2]f32
ScissorRect :: struct {
x: NS.Integer,
y: NS.Integer,
width: NS.Integer,
height: NS.Integer,
}
Size :: struct {
width: NS.Integer,
height: NS.Integer,
depth: NS.Integer,
}
SizeAndAlign :: struct {
size: NS.UInteger,
align: NS.UInteger,
}
StageInRegionIndirectArguments :: struct {
stageInOrigin: [3]u32,
stageInSize: [3]u32,
}
TextureSwizzleChannels :: struct {
red: TextureSwizzle,
green: TextureSwizzle,
blue: TextureSwizzle,
alpha: TextureSwizzle,
}
TriangleTessellationFactorsHalf :: struct {
edgeTessellationFactor: [3]u16,
insideTessellationFactor: u16,
}
VertexAmplificationViewMapping :: struct {
viewportArrayIndexOffset: u32,
renderTargetArrayIndexOffset: u32,
}
Viewport :: struct {
originX: f64,
originY: f64,
width: f64,
height: f64,
znear: f64,
zfar: f64,
}
Timestamp :: distinct u64
DeviceNotificationHandler :: distinct rawptr
AutoreleasedComputePipelineReflection :: ^ComputePipelineReflection
AutoreleasedRenderPipelineReflection :: ^RenderPipelineReflection
NewLibraryCompletionHandler :: distinct rawptr
NewRenderPipelineStateCompletionHandler :: distinct rawptr
NewRenderPipelineStateWithReflectionCompletionHandler :: distinct rawptr
NewComputePipelineStateCompletionHandler :: distinct rawptr
NewComputePipelineStateWithReflectionCompletionHandler :: distinct rawptr
SharedEventNotificationBlock :: distinct rawptr
DrawablePresentedHandler :: distinct rawptr
AutoreleasedArgument :: ^Argument
-155
View File
@@ -1,155 +0,0 @@
## About
**metal-odin** is a low overhead Odin interface for Metal that helps developers add Metal functionality to graphics applications that are written in Odin. **metal-odin** removes the need to create a shim and allows developers to call Metal functions directly from anywhere in their existing Odin code.
## Highlights
- Drop in Odin alternative interface to the Metal Objective-C headers.
- Direct mapping of all Metal Objective-C classes, constants, enums and bit_sets to Odin
- No measurable overhead compared to calling Metal Objective-C headers, due to inlining of Odin procedure calls.
- No usage of wrapper containers that require additional allocations.
- Identical header files and procedure/constant/enum availability for iOS, macOS and tvOS.
- Backwards compatibility: All `MTL.Device.supports...()` procedure check if their required selectors exist and automatically return `false` if not.
- String (`ErrorDomain`) constants are `@(linkage="weak")` and automatically set to `nil` if not available.
## Memory Allocation Policy
**metal-odin** follows the object allocation policies of Cocoa and Cocoa Touch. Understanding those rules is especially important when using `metal-odin`, as Odin values are not eligible for automatic reference counting (ARC).
**metal-odin** objects are reference counted. To help convey and manage object lifecycles, the following conventions are observed:
### AutoreleasePools and Objects
Several methods that create temporary objects in **metal-odin** add them to an `AutoreleasePool` to help manage their lifetimes. In these situations, after **metal-odin** creates the object, it adds it to an `AutoreleasePool`, which will release its objects when you release (or drain) it.
By adding temporary objects to an AutoreleasePool, you do not need to explicitly call `release()` to deallocate them. Instead, you can rely on the `AutoreleasePool` to implicitly manage those lifetimes.
If you create an object with a method that does not begin with `alloc`, or `copy`, the creating method adds the object to an autorelease pool.
The typical scope of an `AutoreleasePool` is one frame of rendering for the main thread of the program. When the thread returns control to the RunLoop (an object responsible for receiving input and events from the windowing system), the pool is *drained*, releasing its objects.
You can create and manage additional `AutoreleasePool`s at smaller scopes to reduce your program's working set, and you are required to do so for any additional threads your program creates.
If an object's lifecycle needs to be extended beyond the `AutoreleasePool`'s scope, you can claim ownership of it (avoiding its release beyond the pool's scope) by calling its `retain()` method before its pool is drained. In these cases, you will be responsible for making the appropriate `release()` call on the object after you no longer need it.
You can find a more-detailed introduction to the memory management rules here: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html.
For more details about the application's RunLoop, please find its documentation here: https://developer.apple.com/documentation/foundation/nsrunloop
### Use and debug AutoreleasePools
When you create an autoreleased object and there is no enclosing `AutoreleasePool`, the object is leaked.
To prevent this, you normally create an `AutoreleasePool` in your program's `main` procedure, and in the entry procedure for every thread you create. You may also create additional `AutoreleasePool`s to avoid growing your program's high memory watermark when you create several autoreleased objects, such as when rendering.
Use the Environment Variable `OBJC_DEBUG_MISSING_POOLS=YES` to print a runtime warning when an autoreleased object is leaked because no enclosing `AutoreleasePool` is available for its thread.
You can also run `leaks --autoreleasePools` on a memgraph file or a process ID (macOS only) to view a listing of your program's `AutoreleasePool`s and all objects they contain.
### nil
Similar to Objective-C, it is legal to call any method, including `retain()` and `release()`, on `nil` "objects". While calling methods on `nil` still does incur in procedure call overhead, the effective result is equivalent of a NOP.
Conversely, do not assume that because calling a method on a pointer did not result in a crash, that the pointed-to object is valid.
## Adding `metal-odin` to a Project
Simply `import MTL "core:sys/darwin/Metal"`. To ensure that the selector and class symbols are linked.
```odin
import MTL "core:sys/darwin/Metal"
```
## Examples
#### Creating the device
###### Objective-C (with automatic reference counting)
```objc
id< MTLDevice > device = MTLCreateSystemDefaultDevice();
// ...
```
###### Objective-C
```objc
id< MTLDevice > device = MTLCreateSystemDefaultDevice();
// ...
[device release];
```
###### Odin
```odin
device := MTL.CreateSystemDefaultDevice()
// ...
device->release()
```
#### Metal function calls map directly to Odin
###### Objective-C (with automatic reference counting)
```objc
MTLSamplerDescriptor* samplerDescriptor = [[MTLSamplerDescriptor alloc] init];
[samplerDescriptor setSAddressMode: MTLSamplerAddressModeRepeat];
[samplerDescriptor setTAddressMode: MTLSamplerAddressModeRepeat];
[samplerDescriptor setRAddressMode: MTLSamplerAddressModeRepeat];
[samplerDescriptor setMagFilter: MTLSamplerMinMagFilterLinear];
[samplerDescriptor setMinFilter: MTLSamplerMinMagFilterLinear];
[samplerDescriptor setMipFilter: MTLSamplerMipFilterLinear];
[samplerDescriptor setSupportArgumentBuffers: YES];
id< MTLSamplerState > samplerState = [device newSamplerStateWithDescriptor:samplerDescriptor];
```
###### Objective-C
```objc
MTLSamplerDescriptor* samplerDescriptor = [[MTLSamplerDescriptor alloc] init];
[samplerDescriptor setSAddressMode: MTLSamplerAddressModeRepeat];
[samplerDescriptor setTAddressMode: MTLSamplerAddressModeRepeat];
[samplerDescriptor setRAddressMode: MTLSamplerAddressModeRepeat];
[samplerDescriptor setMagFilter: MTLSamplerMinMagFilterLinear];
[samplerDescriptor setMinFilter: MTLSamplerMinMagFilterLinear];
[samplerDescriptor setMipFilter: MTLSamplerMipFilterLinear];
[samplerDescriptor setSupportArgumentBuffers: YES];
id< MTLSamplerState > samplerState = [device newSamplerStateWithDescriptor:samplerDescriptor];
[samplerDescriptor release];
// ...
[samplerState release];
```
###### Odin
```odin
samplerDescriptor := MTL.SamplerDescriptor.alloc()->init()
samplerDescriptor->setSAddressMode(.Repeat)
samplerDescriptor->setTAddressMode(.Repeat)
samplerDescriptor->setRAddressMode(.Repeat)
samplerDescriptor->setMagFilter(.Linear)
samplerDescriptor->setMinFilter(.Linear)
samplerDescriptor->setMipFilter(.Linear)
samplerDescriptor->setSupportArgumentBuffers(true)
samplerState := device->newSamplerState(samplerDescriptor)
samplerDescriptor->release()
// ...
samplerState->release()
```
@@ -1,87 +0,0 @@
package objc_QuartzCore
import NS "core:sys/darwin/Foundation"
import MTL "core:sys/darwin/Metal"
import "core:intrinsics"
@(private)
msgSend :: intrinsics.objc_send
@(objc_class="CAMetalLayer")
MetalLayer :: struct{ using _: NS.Layer}
@(objc_type=MetalLayer, objc_name="layer", objc_is_class_method=true)
MetalLayer_layer :: proc() -> ^MetalLayer {
return msgSend(^MetalLayer, MetalLayer, "layer")
}
@(objc_type=MetalLayer, objc_name="device")
MetalLayer_device :: proc(self: ^MetalLayer) -> ^MTL.Device {
return msgSend(^MTL.Device, self, "device")
}
@(objc_type=MetalLayer, objc_name="setDevice")
MetalLayer_setDevice :: proc(self: ^MetalLayer, device: ^MTL.Device) {
msgSend(nil, self, "setDevice:", device)
}
@(objc_type=MetalLayer, objc_name="opaque")
MetalLayer_opaque :: proc(self: ^MetalLayer) -> NS.BOOL {
return msgSend(NS.BOOL, self, "opaque")
}
@(objc_type=MetalLayer, objc_name="setOpaque")
MetalLayer_setOpaque :: proc(self: ^MetalLayer, opaque: NS.BOOL) {
msgSend(nil, self, "setOpaque:", opaque)
}
@(objc_type=MetalLayer, objc_name="preferredDevice")
MetalLayer_preferredDevice :: proc(self: ^MetalLayer) -> ^MTL.Device {
return msgSend(^MTL.Device, self, "preferredDevice")
}
@(objc_type=MetalLayer, objc_name="pixelFormat")
MetalLayer_pixelFormat :: proc(self: ^MetalLayer) -> MTL.PixelFormat {
return msgSend(MTL.PixelFormat, self, "pixelFormat")
}
@(objc_type=MetalLayer, objc_name="setPixelFormat")
MetalLayer_setPixelFormat :: proc(self: ^MetalLayer, pixelFormat: MTL.PixelFormat) {
msgSend(nil, self, "setPixelFormat:", pixelFormat)
}
@(objc_type=MetalLayer, objc_name="framebufferOnly")
MetalLayer_framebufferOnly :: proc(self: ^MetalLayer) -> NS.BOOL {
return msgSend(NS.BOOL, self, "framebufferOnly")
}
@(objc_type=MetalLayer, objc_name="setFramebufferOnly")
MetalLayer_setFramebufferOnly :: proc(self: ^MetalLayer, ok: NS.BOOL) {
msgSend(nil, self, "setFramebufferOnly:", ok)
}
@(objc_type=MetalLayer, objc_name="frame")
MetalLayer_frame :: proc(self: ^MetalLayer) -> NS.Rect {
return msgSend(NS.Rect, self, "frame")
}
@(objc_type=MetalLayer, objc_name="setFrame")
MetalLayer_setFrame :: proc(self: ^MetalLayer, frame: NS.Rect) {
msgSend(nil, self, "setFrame:", frame)
}
@(objc_type=MetalLayer, objc_name="nextDrawable")
MetalLayer_nextDrawable :: proc(self: ^MetalLayer) -> ^MetalDrawable {
return msgSend(^MetalDrawable, self, "nextDrawable")
}
@(objc_class="CAMetalDrawable")
MetalDrawable :: struct { using _: MTL.Drawable }
@(objc_type=MetalDrawable, objc_name="layer")
MetalDrawable_layer :: proc(self: ^MetalDrawable) -> ^MetalLayer {
return msgSend(^MetalLayer, self, "layer")
}
@(objc_type=MetalDrawable, objc_name="texture")
MetalDrawable_texture :: proc(self: ^MetalDrawable) -> ^MTL.Texture {
return msgSend(^MTL.Texture, self, "texture")
}