Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/obvgab/kinzoku
Cross platform graphics in Swift using WGSL. An implementation of wgpu-native
https://github.com/obvgab/kinzoku
Last synced: 12 days ago
JSON representation
Cross platform graphics in Swift using WGSL. An implementation of wgpu-native
- Host: GitHub
- URL: https://github.com/obvgab/kinzoku
- Owner: obvgab
- Created: 2022-12-26T19:24:11.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-07T15:05:35.000Z (about 1 year ago)
- Last Synced: 2024-10-02T00:34:25.413Z (about 1 month ago)
- Language: C
- Homepage:
- Size: 13.2 MB
- Stars: 13
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kinzoku
Implementation of wgpu-native in Swift.
Library binaries are provided for
- macOS
- arm64
- x86_64 (testing)
- manylinux
- arm64 (testing)
- x86_64 (testing)General Notes
- Create getters and setters for all KZ classes that make interfacing with them akin to C--just provide middleman
- ~~All the 'self.pointers' tuples can probably be compressed to just an [UnsafeMutablePointer], but readibility is key right now~~
- WGPUChainedStructs should be removed eventually
- Appears basically everwhere with "nextInChain" and what not
- Maybe implement a .intoChainedStruct() for all classes, or allow all classes in the init()?
- (1) ~~Consider making any structs/classes that are just 'public var c: WGPUClass' into typealiases~~
- ~~Typealiases can have extensions for other functions. Any non-pointer holding classes can be converted easily~~
- ~~Extensions also may allow for getters/setters, so interfacing swift-like would be better~~
- ~~Removes the issue of invoking .c constantly, we can just use ?~~
- ~~Maybe make instance hold all pointers in [UnsafeMutablePointer], deallocate all at once (in Instance, for example--see the first comment)~~
- ~~Less memory efficient, cleaner code~~
- ~~Depending on how things are sized, it might actually be more memory efficient, as double-up'd objects wouldn't be an issue~~- Compress class files into more abstract files
- (2) ~~Set enums to have primitive WGPUTypes, that way no conversion is necessary (removes all the calls to constructors and .rawValues)~~- Make functions with callbacks (presumably async) into actual swift async functions
- (3) ~~Eventually exclude the header files, because we basically define it ourselves in this file~~
- ~~Would also remove all dependencies from the project, which is nice. WgpuHeaders would be irrelevent~~
- ~~Callbacks can become regular closures probably~~
- The wgpu.h free functions are interesting. We unfortunately have to use strdup() constantly, so I wonder if it cleans those types for structs
- ~~Maybe change the definition of `manualPointer()` so it uses `Unmanaged.passUnretained()`. That way Swift's ARC handles memory as normal and we don't have to figure out deinit constantly~~
- Changed definition. manualPointer has been split to have a copying method and a dangling method1. [Not possible due to all C types being derivatives of OpaquePointer]
2. [Not possible, WGPUTypes cannot be the basis of enums, raw values are required (but inits might be possible)]
3. [Not possible, C structs are not the same as Swift structs, we can't redefine those: we need at least one .h for structs]