go-webgpu icon indicating copy to clipboard operation
go-webgpu copied to clipboard

is darwin or ios possible ?

Open gedw99 opened this issue 2 years ago • 14 comments

I always hit "undefined: getSurfaceDescriptor" issue. See below.

``´

➜ gio-windowing git:(main) ✗ go build . go: downloading github.com/rajveermalviya/gio v0.0.0-20220407081512-669757591f4c go: downloading golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d go: downloading gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2 go: downloading gioui.org/shader v1.0.6 go: downloading golang.org/x/exp/shiny v0.0.0-20220328175248-053ad81199eb go: downloading github.com/benoitkugler/textlayout v0.0.10 go: downloading golang.org/x/exp v0.0.0-20220328175248-053ad81199eb go: downloading github.com/go-text/typesetting v0.0.0-20220112121102-58fe93c84506 go: downloading github.com/gioui/uax v0.2.1-0.20220325163150-e3d987515a12

github.com/rajveermalviya/go-webgpu/examples/gio-windowing

./main.go:70:34: undefined: getSurfaceDescriptor

➜ gio-windowing git:(main) ✗ cd .. ➜ examples git:(main) ✗ cd triangle ➜ triangle git:(main) ✗ go build . go: downloading github.com/go-gl/glfw/v3.3/glfw v0.0.0-20220320163800-277f93cfa958

github.com/rajveermalviya/go-webgpu/examples/triangle

./main.go:52:32: undefined: getSurfaceDescriptor

➜ triangle git:(main) ✗ cd .. ➜ examples git:(main) ✗ cd gio-windowing ➜ gio-windowing git:(main) ✗ gogio -arch arm64,arm,amd64 -target android .

gedw99 avatar Apr 27 '22 15:04 gedw99

https://github.com/rajveermalviya/go-webgpu/blob/main/.github/workflows/ci.yml#L25 prevents CI testing darwin ?

gedw99 avatar Apr 27 '22 15:04 gedw99

I always hit "undefined: getSurfaceDescriptor" issue. See below.

yeah triangle & gio-windowing examples currently don't implement getSurfaceDescriptor for darwin (like for linux), though it can be easily implemented via SurfaceDescriptorFromMetalLayer, contributions welcome :).

though other examples (compute & capture) should be working.

prevents CI testing darwin ?

github actions runner doesn't have gpu & macos doesn't ship cpu based metal api implementation, so yeah

rajveermalviya avatar Apr 27 '22 15:04 rajveermalviya

Hey @rajveermalviya

Yeah i saw the _linux.go version. and started to make _darwin version, but I could not work it out even with https://pkg.go.dev/github.com/rajveermalviya/go-webgpu/wgpu#SurfaceDescriptorFromMetalLayer. Sorry but i mostly do basic http stuff in golang.

DO you think you can write that code ?

I can test it at least locally here on my intel mac.

gedw99 avatar Apr 27 '22 16:04 gedw99

though other examples (compute & capture) should be working.

Yes they did for me thanks.

gedw99 avatar Apr 27 '22 16:04 gedw99

this might work for CI for Darwin and IOS, so i asked here: https://github.com/nektos/act/discussions/1143

gedw99 avatar Apr 28 '22 10:04 gedw99

I can test it at least locally here on my intel mac.

I have created a PR #115 which adds support for glfw based triangle example. Would appreciate if you can test it.

rajveermalviya avatar Apr 28 '22 12:04 rajveermalviya

it works

➜  rajveermalviya git clone [email protected]:rajveermalviya/go-webgpu.git -b darwin-examples 
Cloning into 'go-webgpu'...
remote: Enumerating objects: 1513, done.
remote: Counting objects: 100% (139/139), done.
remote: Compressing objects: 100% (76/76), done.
remote: Total 1513 (delta 70), reused 118 (delta 60), pack-reused 1374
Receiving objects: 100% (1513/1513), 914.69 MiB | 7.06 MiB/s, done.
Resolving deltas: 100% (817/817), done.
Updating files: 100% (70/70), done.
➜  rajveermalviya ls
go-webgpu
➜  rajveermalviya cd go-webgpu 
➜  go-webgpu git:(darwin-examples) cd examples 
➜  examples git:(darwin-examples) cd triangle 
➜  triangle git:(darwin-examples) go build .
➜  triangle git:(darwin-examples) ✗ ./triangle 
[go-webgpu] [Warn] Surface does not support present mode: Mailbox, falling back to FIFO
[go-webgpu] [Warn] Surface does not support present mode: Mailbox, falling back to FIFO
[go-webgpu] [Warn] Surface does not support present mode: Mailbox, falling back to FIFO
[go-webgpu] [Warn] Surface does not support present mode: Mailbox, falling back to FIFO
Screenshot 2022-04-28 at 14 30 53

gedw99 avatar Apr 28 '22 12:04 gedw99

i can compile and run gio ios also if need be. If you get the gio window example working then it should work on ios i think. worth trying..

gedw99 avatar Apr 28 '22 12:04 gedw99

it works

thanks for testing :tada:

i can compile and run gio ios also if need be

it will first require ios builds of wgpu-native static libraries. will surely try too add them

rajveermalviya avatar Apr 28 '22 19:04 rajveermalviya

cool. I can't believe you were able to code the darwin triangle without a MacOS to try it on. Impressive dude !!

gedw99 avatar Apr 29 '22 11:04 gedw99

mostly thanks to zig cc's magic. setting correct env for gopls & it provides linting in vscode. it only goes as far as being able to build for macos on linux. still need a mac to run/test the binary.

rajveermalviya avatar Apr 29 '22 12:04 rajveermalviya

thanks - i am def going to check out that link when i have a second... I heard of zig, but never had a reason to look into it deeper.

Still amazing either way.

gedw99 avatar Apr 29 '22 12:04 gedw99

hey @rajveermalviya

I just noticed there is an IOS lib now.

gedw99 avatar Jun 07 '22 17:06 gedw99

Hey @rajveermalviya If you need MAC Testing again just let me know.

gedw99 avatar Mar 20 '23 12:03 gedw99