Update calling convention to the most appropriate

- "odin" if the `context` is needed for `assert`
- "contextless" if multiple return values are needed (better for optimizations)
- "c" otherwise
This commit is contained in:
gingerBill
2023-05-22 15:04:33 +01:00
parent 8f563df7c5
commit 9fc9981a9e
3 changed files with 1620 additions and 1620 deletions
+1556 -1556
View File
File diff suppressed because it is too large Load Diff
+47 -47
View File
@@ -24,34 +24,34 @@ ViewDelegate :: struct {
View :: struct {using _: NS.View}
@(objc_type=View, objc_name="alloc", objc_is_class_method=true)
View_alloc :: proc() -> ^View {
View_alloc :: proc "c" () -> ^View {
return msgSend(^View, View, "alloc")
}
@(objc_type=View, objc_name="initWithFrame")
View_initWithFrame :: proc(self: ^View, frame: NS.Rect, device: ^MTL.Device) -> ^View {
View_initWithFrame :: proc "c" (self: ^View, frame: NS.Rect, device: ^MTL.Device) -> ^View {
return msgSend(^View, self, "initWithFrame:device:", frame, device)
}
@(objc_type=View, objc_name="initWithCoder")
View_initWithCoder :: proc(self: ^View, coder: ^NS.Coder) -> ^View {
View_initWithCoder :: proc "c" (self: ^View, coder: ^NS.Coder) -> ^View {
return msgSend(^View, self, "initWithCoder:", coder)
}
@(objc_type=View, objc_name="setDevice")
View_setDevice :: proc(self: ^View, device: ^MTL.Device) {
View_setDevice :: proc "c" (self: ^View, device: ^MTL.Device) {
msgSend(nil, self, "setDevice:", device)
}
@(objc_type=View, objc_name="device")
View_device :: proc(self: ^View) -> ^MTL.Device {
View_device :: proc "c" (self: ^View) -> ^MTL.Device {
return msgSend(^MTL.Device, self, "device")
}
@(objc_type=View, objc_name="draw")
View_draw :: proc(self: ^View) {
View_draw :: proc "c" (self: ^View) {
msgSend(nil, self, "draw")
}
@(objc_type=View, objc_name="setDelegate")
View_setDelegate :: proc(self: ^View, delegate: ^ViewDelegate) {
View_setDelegate :: proc "c" (self: ^View, delegate: ^ViewDelegate) {
drawDispatch :: proc "c" (self: ^NS.Value, cmd: NS.SEL, view: ^View) {
del := (^ViewDelegate)(self->pointerValue())
del->drawInMTKView(view)
@@ -72,7 +72,7 @@ View_setDelegate :: proc(self: ^View, delegate: ^ViewDelegate) {
}
@(objc_type=View, objc_name="delegate")
View_delegate :: proc(self: ^View) -> ^ViewDelegate {
View_delegate :: proc "c" (self: ^View) -> ^ViewDelegate {
wrapper := msgSend(^NS.Value, self, "delegate")
if wrapper != nil {
return (^ViewDelegate)(wrapper->pointerValue())
@@ -81,179 +81,179 @@ View_delegate :: proc(self: ^View) -> ^ViewDelegate {
}
@(objc_type=View, objc_name="currentDrawable")
View_currentDrawable :: proc(self: ^View) -> ^CA.MetalDrawable {
View_currentDrawable :: proc "c" (self: ^View) -> ^CA.MetalDrawable {
return msgSend(^CA.MetalDrawable, self, "currentDrawable")
}
@(objc_type=View, objc_name="setFramebufferOnly")
View_setFramebufferOnly :: proc(self: ^View, framebufferOnly: bool) {
View_setFramebufferOnly :: proc "c" (self: ^View, framebufferOnly: bool) {
msgSend(nil, self, "setFramebufferOnly:", framebufferOnly)
}
@(objc_type=View, objc_name="framebufferOnly")
View_framebufferOnly :: proc(self: ^View) -> bool {
View_framebufferOnly :: proc "c" (self: ^View) -> bool {
return msgSend(bool, self, "framebufferOnly")
}
@(objc_type=View, objc_name="setDepthStencilAttachmentTextureUsage")
View_setDepthStencilAttachmentTextureUsage :: proc(self: ^View, textureUsage: MTL.TextureUsage) {
View_setDepthStencilAttachmentTextureUsage :: proc "c" (self: ^View, textureUsage: MTL.TextureUsage) {
msgSend(nil, self, "setDepthStencilAttachmentTextureUsage:", textureUsage)
}
@(objc_type=View, objc_name="depthStencilAttachmentTextureUsage")
View_depthStencilAttachmentTextureUsage :: proc(self: ^View) -> MTL.TextureUsage {
View_depthStencilAttachmentTextureUsage :: proc "c" (self: ^View) -> MTL.TextureUsage {
return msgSend(MTL.TextureUsage, self, "depthStencilAttachmentTextureUsage")
}
@(objc_type=View, objc_name="setMultisampleColorAttachmentTextureUsage")
View_setMultisampleColorAttachmentTextureUsage :: proc(self: ^View, textureUsage: MTL.TextureUsage) {
View_setMultisampleColorAttachmentTextureUsage :: proc "c" (self: ^View, textureUsage: MTL.TextureUsage) {
msgSend(nil, self, "setMultisampleColorAttachmentTextureUsage:", textureUsage)
}
@(objc_type=View, objc_name="multisampleColorAttachmentTextureUsage")
View_multisampleColorAttachmentTextureUsage :: proc(self: ^View) -> MTL.TextureUsage {
View_multisampleColorAttachmentTextureUsage :: proc "c" (self: ^View) -> MTL.TextureUsage {
return msgSend(MTL.TextureUsage, self, "multisampleColorAttachmentTextureUsage")
}
@(objc_type=View, objc_name="setPresentsWithTransaction")
View_setPresentsWithTransaction :: proc(self: ^View, presentsWithTransaction: bool) {
View_setPresentsWithTransaction :: proc "c" (self: ^View, presentsWithTransaction: bool) {
msgSend(nil, self, "setPresentsWithTransaction:", presentsWithTransaction)
}
@(objc_type=View, objc_name="presentsWithTransaction")
View_presentsWithTransaction :: proc(self: ^View) -> bool {
View_presentsWithTransaction :: proc "c" (self: ^View) -> bool {
return msgSend(bool, self, "presentsWithTransaction")
}
@(objc_type=View, objc_name="setColorPixelFormat")
View_setColorPixelFormat :: proc(self: ^View, colorPixelFormat: MTL.PixelFormat) {
View_setColorPixelFormat :: proc "c" (self: ^View, colorPixelFormat: MTL.PixelFormat) {
msgSend(nil, self, "setColorPixelFormat:", colorPixelFormat)
}
@(objc_type=View, objc_name="colorPixelFormat")
View_colorPixelFormat :: proc(self: ^View) -> MTL.PixelFormat {
View_colorPixelFormat :: proc "c" (self: ^View) -> MTL.PixelFormat {
return msgSend(MTL.PixelFormat, self, "colorPixelFormat")
}
@(objc_type=View, objc_name="setDepthStencilPixelFormat")
View_setDepthStencilPixelFormat :: proc(self: ^View, colorPixelFormat: MTL.PixelFormat) {
View_setDepthStencilPixelFormat :: proc "c" (self: ^View, colorPixelFormat: MTL.PixelFormat) {
msgSend(nil, self, "setDepthStencilPixelFormat:", colorPixelFormat)
}
@(objc_type=View, objc_name="depthStencilPixelFormat")
View_depthStencilPixelFormat :: proc(self: ^View) -> MTL.PixelFormat {
View_depthStencilPixelFormat :: proc "c" (self: ^View) -> MTL.PixelFormat {
return msgSend(MTL.PixelFormat, self, "depthStencilPixelFormat")
}
@(objc_type=View, objc_name="setSampleCount")
View_setSampleCount :: proc(self: ^View, sampleCount: NS.UInteger) {
View_setSampleCount :: proc "c" (self: ^View, sampleCount: NS.UInteger) {
msgSend(nil, self, "setSampleCount:", sampleCount)
}
@(objc_type=View, objc_name="sampleCount")
View_sampleCount :: proc(self: ^View) -> NS.UInteger {
View_sampleCount :: proc "c" (self: ^View) -> NS.UInteger {
return msgSend(NS.UInteger, self, "sampleCount")
}
@(objc_type=View, objc_name="setClearColor")
View_setClearColor :: proc(self: ^View, clearColor: MTL.ClearColor) {
View_setClearColor :: proc "c" (self: ^View, clearColor: MTL.ClearColor) {
msgSend(nil, self, "setClearColor:", clearColor)
}
@(objc_type=View, objc_name="clearColor")
View_clearColor :: proc(self: ^View) -> MTL.ClearColor {
View_clearColor :: proc "c" (self: ^View) -> MTL.ClearColor {
return msgSend(MTL.ClearColor, self, "clearColor")
}
@(objc_type=View, objc_name="setClearDepth")
View_setClearDepth :: proc(self: ^View, clearDepth: f64) {
View_setClearDepth :: proc "c" (self: ^View, clearDepth: f64) {
msgSend(nil, self, "setClearDepth:", clearDepth)
}
@(objc_type=View, objc_name="clearDepth")
View_clearDepth :: proc(self: ^View) -> f64 {
View_clearDepth :: proc "c" (self: ^View) -> f64 {
return msgSend(f64, self, "clearDepth")
}
@(objc_type=View, objc_name="setClearStencil")
View_setClearStencil :: proc(self: ^View, clearStencil: u32) {
View_setClearStencil :: proc "c" (self: ^View, clearStencil: u32) {
msgSend(nil, self, "setClearStencil:", clearStencil)
}
@(objc_type=View, objc_name="clearStencil")
View_clearStencil :: proc(self: ^View) -> u32 {
View_clearStencil :: proc "c" (self: ^View) -> u32 {
return msgSend(u32, self, "clearStencil")
}
@(objc_type=View, objc_name="depthStencilTexture")
View_depthStencilTexture :: proc(self: ^View) -> ^MTL.Texture {
View_depthStencilTexture :: proc "c" (self: ^View) -> ^MTL.Texture {
return msgSend(^MTL.Texture, self, "depthStencilTexture")
}
@(objc_type=View, objc_name="multisampleColorTexture")
View_multisampleColorTexture :: proc(self: ^View) -> ^MTL.Texture {
View_multisampleColorTexture :: proc "c" (self: ^View) -> ^MTL.Texture {
return msgSend(^MTL.Texture, self, "multisampleColorTexture")
}
@(objc_type=View, objc_name="releaseDrawables")
View_releaseDrawables :: proc(self: ^View) {
View_releaseDrawables :: proc "c" (self: ^View) {
msgSend(nil, self, "releaseDrawables")
}
@(objc_type=View, objc_name="currentRenderPassDescriptor")
View_currentRenderPassDescriptor :: proc(self: ^View) -> ^MTL.RenderPassDescriptor {
View_currentRenderPassDescriptor :: proc "c" (self: ^View) -> ^MTL.RenderPassDescriptor {
return msgSend(^MTL.RenderPassDescriptor, self, "currentRenderPassDescriptor")
}
@(objc_type=View, objc_name="setPreferredFramesPerSecond")
View_setPreferredFramesPerSecond :: proc(self: ^View, preferredFramesPerSecond: NS.Integer) {
View_setPreferredFramesPerSecond :: proc "c" (self: ^View, preferredFramesPerSecond: NS.Integer) {
msgSend(nil, self, "setPreferredFramesPerSecond:", preferredFramesPerSecond)
}
@(objc_type=View, objc_name="preferredFramesPerSecond")
View_preferredFramesPerSecond :: proc(self: ^View) -> NS.Integer {
View_preferredFramesPerSecond :: proc "c" (self: ^View) -> NS.Integer {
return msgSend(NS.Integer, self, "preferredFramesPerSecond")
}
@(objc_type=View, objc_name="setEnableSetNeedsDisplay")
View_setEnableSetNeedsDisplay :: proc(self: ^View, enableSetNeedsDisplay: bool) {
View_setEnableSetNeedsDisplay :: proc "c" (self: ^View, enableSetNeedsDisplay: bool) {
msgSend(nil, self, "setEnableSetNeedsDisplay:", enableSetNeedsDisplay)
}
@(objc_type=View, objc_name="enableSetNeedsDisplay")
View_enableSetNeedsDisplay :: proc(self: ^View) -> bool {
View_enableSetNeedsDisplay :: proc "c" (self: ^View) -> bool {
return msgSend(bool, self, "enableSetNeedsDisplay")
}
@(objc_type=View, objc_name="setAutoresizeDrawable")
View_setAutoresizeDrawable :: proc(self: ^View, autoresizeDrawable: bool) {
View_setAutoresizeDrawable :: proc "c" (self: ^View, autoresizeDrawable: bool) {
msgSend(nil, self, "setAutoresizeDrawable:", autoresizeDrawable)
}
@(objc_type=View, objc_name="autoresizeDrawable")
View_autoresizeDrawable :: proc(self: ^View) -> bool {
View_autoresizeDrawable :: proc "c" (self: ^View) -> bool {
return msgSend(bool, self, "autoresizeDrawable")
}
@(objc_type=View, objc_name="setDrawableSize")
View_setDrawableSize :: proc(self: ^View, drawableSize: NS.Size) {
View_setDrawableSize :: proc "c" (self: ^View, drawableSize: NS.Size) {
msgSend(nil, self, "setDrawableSize:", drawableSize)
}
@(objc_type=View, objc_name="drawableSize")
View_drawableSize :: proc(self: ^View) -> NS.Size {
View_drawableSize :: proc "c" (self: ^View) -> NS.Size {
return msgSend(NS.Size, self, "drawableSize")
}
@(objc_type=View, objc_name="preferredDrawableSize")
View_preferredDrawableSize :: proc(self: ^View) -> NS.Size {
View_preferredDrawableSize :: proc "c" (self: ^View) -> NS.Size {
return msgSend(NS.Size, self, "preferredDrawableSize")
}
@(objc_type=View, objc_name="preferredDevice")
View_preferredDevice :: proc(self: ^View) -> ^MTL.Device {
View_preferredDevice :: proc "c" (self: ^View) -> ^MTL.Device {
return msgSend(^MTL.Device, self, "preferredDevice")
}
@(objc_type=View, objc_name="setPaused")
View_setPaused :: proc(self: ^View, isPaused: bool) {
View_setPaused :: proc "c" (self: ^View, isPaused: bool) {
msgSend(nil, self, "setPaused:", isPaused)
}
@(objc_type=View, objc_name="isPaused")
View_isPaused :: proc(self: ^View) -> bool {
View_isPaused :: proc "c" (self: ^View) -> bool {
return msgSend(bool, self, "isPaused")
}
@(objc_type=View, objc_name="setColorSpace")
View_setColorSpace :: proc(self: ^View, colorSpace: ColorSpaceRef) {
View_setColorSpace :: proc "c" (self: ^View, colorSpace: ColorSpaceRef) {
msgSend(nil, self, "setColorSpace:", colorSpace)
}
@(objc_type=View, objc_name="colorSpace")
View_colorSpace :: proc(self: ^View) -> ColorSpaceRef {
View_colorSpace :: proc "c" (self: ^View) -> ColorSpaceRef {
return msgSend(ColorSpaceRef, self, "colorSpace")
}
+17 -17
View File
@@ -11,74 +11,74 @@ msgSend :: intrinsics.objc_send
MetalLayer :: struct{ using _: NS.Layer}
@(objc_type=MetalLayer, objc_name="layer", objc_is_class_method=true)
MetalLayer_layer :: proc() -> ^MetalLayer {
MetalLayer_layer :: proc "c" () -> ^MetalLayer {
return msgSend(^MetalLayer, MetalLayer, "layer")
}
@(objc_type=MetalLayer, objc_name="device")
MetalLayer_device :: proc(self: ^MetalLayer) -> ^MTL.Device {
MetalLayer_device :: proc "c" (self: ^MetalLayer) -> ^MTL.Device {
return msgSend(^MTL.Device, self, "device")
}
@(objc_type=MetalLayer, objc_name="setDevice")
MetalLayer_setDevice :: proc(self: ^MetalLayer, device: ^MTL.Device) {
MetalLayer_setDevice :: proc "c" (self: ^MetalLayer, device: ^MTL.Device) {
msgSend(nil, self, "setDevice:", device)
}
@(objc_type=MetalLayer, objc_name="opaque")
MetalLayer_opaque :: proc(self: ^MetalLayer) -> NS.BOOL {
MetalLayer_opaque :: proc "c" (self: ^MetalLayer) -> NS.BOOL {
return msgSend(NS.BOOL, self, "opaque")
}
@(objc_type=MetalLayer, objc_name="setOpaque")
MetalLayer_setOpaque :: proc(self: ^MetalLayer, opaque: NS.BOOL) {
MetalLayer_setOpaque :: proc "c" (self: ^MetalLayer, opaque: NS.BOOL) {
msgSend(nil, self, "setOpaque:", opaque)
}
@(objc_type=MetalLayer, objc_name="preferredDevice")
MetalLayer_preferredDevice :: proc(self: ^MetalLayer) -> ^MTL.Device {
MetalLayer_preferredDevice :: proc "c" (self: ^MetalLayer) -> ^MTL.Device {
return msgSend(^MTL.Device, self, "preferredDevice")
}
@(objc_type=MetalLayer, objc_name="pixelFormat")
MetalLayer_pixelFormat :: proc(self: ^MetalLayer) -> MTL.PixelFormat {
MetalLayer_pixelFormat :: proc "c" (self: ^MetalLayer) -> MTL.PixelFormat {
return msgSend(MTL.PixelFormat, self, "pixelFormat")
}
@(objc_type=MetalLayer, objc_name="setPixelFormat")
MetalLayer_setPixelFormat :: proc(self: ^MetalLayer, pixelFormat: MTL.PixelFormat) {
MetalLayer_setPixelFormat :: proc "c" (self: ^MetalLayer, pixelFormat: MTL.PixelFormat) {
msgSend(nil, self, "setPixelFormat:", pixelFormat)
}
@(objc_type=MetalLayer, objc_name="framebufferOnly")
MetalLayer_framebufferOnly :: proc(self: ^MetalLayer) -> NS.BOOL {
MetalLayer_framebufferOnly :: proc "c" (self: ^MetalLayer) -> NS.BOOL {
return msgSend(NS.BOOL, self, "framebufferOnly")
}
@(objc_type=MetalLayer, objc_name="setFramebufferOnly")
MetalLayer_setFramebufferOnly :: proc(self: ^MetalLayer, ok: NS.BOOL) {
MetalLayer_setFramebufferOnly :: proc "c" (self: ^MetalLayer, ok: NS.BOOL) {
msgSend(nil, self, "setFramebufferOnly:", ok)
}
@(objc_type=MetalLayer, objc_name="drawableSize")
MetalLayer_drawableSize :: proc(self: ^MetalLayer) -> NS.Size {
MetalLayer_drawableSize :: proc "c" (self: ^MetalLayer) -> NS.Size {
return msgSend(NS.Size, self, "drawableSize")
}
@(objc_type=MetalLayer, objc_name="setDrawableSize")
MetalLayer_setDrawableSize :: proc(self: ^MetalLayer, drawableSize: NS.Size) {
MetalLayer_setDrawableSize :: proc "c" (self: ^MetalLayer, drawableSize: NS.Size) {
msgSend(nil, self, "setDrawableSize:", drawableSize)
}
@(objc_type=MetalLayer, objc_name="frame")
MetalLayer_frame :: proc(self: ^MetalLayer) -> NS.Rect {
MetalLayer_frame :: proc "c" (self: ^MetalLayer) -> NS.Rect {
return msgSend(NS.Rect, self, "frame")
}
@(objc_type=MetalLayer, objc_name="setFrame")
MetalLayer_setFrame :: proc(self: ^MetalLayer, frame: NS.Rect) {
MetalLayer_setFrame :: proc "c" (self: ^MetalLayer, frame: NS.Rect) {
msgSend(nil, self, "setFrame:", frame)
}
@(objc_type=MetalLayer, objc_name="nextDrawable")
MetalLayer_nextDrawable :: proc(self: ^MetalLayer) -> ^MetalDrawable {
MetalLayer_nextDrawable :: proc "c" (self: ^MetalLayer) -> ^MetalDrawable {
return msgSend(^MetalDrawable, self, "nextDrawable")
}
@@ -88,11 +88,11 @@ MetalLayer_nextDrawable :: proc(self: ^MetalLayer) -> ^MetalDrawable {
MetalDrawable :: struct { using _: MTL.Drawable }
@(objc_type=MetalDrawable, objc_name="layer")
MetalDrawable_layer :: proc(self: ^MetalDrawable) -> ^MetalLayer {
MetalDrawable_layer :: proc "c" (self: ^MetalDrawable) -> ^MetalLayer {
return msgSend(^MetalLayer, self, "layer")
}
@(objc_type=MetalDrawable, objc_name="texture")
MetalDrawable_texture :: proc(self: ^MetalDrawable) -> ^MTL.Texture {
MetalDrawable_texture :: proc "c" (self: ^MetalDrawable) -> ^MTL.Texture {
return msgSend(^MTL.Texture, self, "texture")
}