Merge branch 'master' into separate-int-word-sizes

This commit is contained in:
gingerBill
2023-05-03 17:06:37 +01:00
62 changed files with 1586 additions and 169 deletions
+30
View File
@@ -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 Load Diff
+86 -6
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -133,6 +133,8 @@ Region :: struct {
SamplePosition :: distinct [2]f32
ResourceID :: distinct u64
ScissorRect :: struct {
x: NS.Integer,
y: NS.Integer,
+11
View File
@@ -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")
+3 -4
View File
@@ -26,13 +26,11 @@ import "core:c"
import "core:intrinsics"
when ODIN_OS == .Windows {
foreign import _lib "SDL2.lib"
foreign import lib "SDL2.lib"
} else {
foreign import _lib "system:SDL2"
foreign import lib "system:SDL2"
}
lib :: _lib
version :: struct {
major: u8, /**< major version */
minor: u8, /**< minor version */
@@ -47,6 +45,7 @@ PATCHLEVEL :: 16
foreign lib {
GetVersion :: proc(ver: ^version) ---
GetRevision :: proc() -> cstring ---
}
InitFlag :: enum u32 {
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
/**
* \brief Audio format flags.
*
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
/**
* \brief The blend mode used in SDL_RenderCopy() and drawing operations.
*/
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
/* This is a guess for the cacheline size used for padding.
* Most x86 processors have a 64 byte cache line.
* The 64-bit PowerPC processors have a 128 byte cache line.
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
RELEASED :: 0
PRESSED :: 1
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
GameController :: struct {}
GameControllerType :: enum c.int {
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
// Gesture
GestureID :: distinct i64
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
HINT_ACCELEROMETER_AS_JOYSTICK :: "SDL_ACCELEROMETER_AS_JOYSTICK"
HINT_ALLOW_ALT_TAB_WHILE_GRABBED :: "SDL_ALLOW_ALT_TAB_WHILE_GRABBED"
HINT_ALLOW_TOPMOST :: "SDL_ALLOW_TOPMOST"
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
Joystick :: struct {}
JoystickGUID :: struct {
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
Keysym :: struct {
scancode: Scancode, /**< SDL physical key code - see ::SDL_Scancode for details */
sym: Keycode, /**< SDL virtual key code - see ::SDL_Keycode for details */
+1
View File
@@ -1,5 +1,6 @@
package sdl2
SCANCODE_MASK :: 1<<30
SCANCODE_TO_KEYCODE :: #force_inline proc "c" (X: Scancode) -> Keycode {
return Keycode(i32(X) | SCANCODE_MASK)
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
MAX_LOG_MESSAGE :: 4096
LogCategory :: enum c.int {
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
MessageBoxFlag :: enum u32 {
_ = 0,
ERROR = 4, /**< error dialog */
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
MetalView :: distinct rawptr
@(default_calling_convention="c", link_prefix="SDL_")
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
Cursor :: struct {}
BUTTON :: #force_inline proc "c" (X: c.int) -> c.int { return 1 << u32(X-1) }
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
MUTEX_TIMEDOUT :: 1
MUTEX_MAXWAIT :: ~u32(0)
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
ALPHA_OPAQUE :: 255
ALPHA_TRANSPARENT :: 0
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
Point :: struct {
x: c.int,
y: c.int,
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
RendererFlag :: enum u32 {
SOFTWARE = 0, /**< The renderer is a software fallback */
ACCELERATED = 1, /**< The renderer uses hardware acceleration */
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
/* RWops Types */
RWOPS_UNKNOWN :: 0 /**< Unknown stream type */
RWOPS_WINFILE :: 1 /**< Win32 file */
+6
View File
@@ -5,6 +5,12 @@ import "core:intrinsics"
import "core:runtime"
_, _ :: intrinsics, runtime
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
bool :: distinct b32
#assert(size_of(bool) == size_of(c.int))
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
SWSURFACE :: 0 /**< Just here for compatibility */
PREALLOC :: 0x00000001 /**< Surface uses preallocated memory */
RLEACCEL :: 0x00000002 /**< Surface is RLE encoded */
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
// General
@(default_calling_convention="c", link_prefix="SDL_")
foreign lib {
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
SYSWM_TYPE :: enum c.int {
UNKNOWN,
WINDOWS,
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
Thread :: struct {}
threadID :: distinct c.ulong
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
TimerCallback :: proc "c" (interval: u32, param: rawptr) -> u32
TimerID :: distinct c.int
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
TouchID :: distinct i64
FingerID :: distinct i64
+6
View File
@@ -2,6 +2,12 @@ package sdl2
import "core:c"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
DisplayMode :: struct {
format: u32, /**< pixel format */
w: c.int, /**< width, in screen coordinates */
+6
View File
@@ -3,6 +3,12 @@ package sdl2
import "core:c"
import vk "vendor:vulkan"
when ODIN_OS == .Windows {
foreign import lib "SDL2.lib"
} else {
foreign import lib "system:SDL2"
}
VkInstance :: vk.Instance
VkSurfaceKHR :: vk.SurfaceKHR