964 Commits

Author SHA1 Message Date
Mitchell Hashimoto
f09ba38c6f remove stage1 hack 2022-11-01 13:25:20 -07:00
Mitchell Hashimoto
3d5ea05565 update zig 2022-10-31 21:34:36 -07:00
Mitchell Hashimoto
9e3bbc1598 macos: send logs to unified logging 2022-10-31 15:16:29 -07:00
Mitchell Hashimoto
7608d7921f pkg/macos: OS Log support 2022-10-31 14:47:10 -07:00
Mitchell Hashimoto
e0933ed62e Update README.md 2022-10-31 14:05:53 -07:00
Mitchell Hashimoto
9d736985b3 Mac bundle, icons 2022-10-31 14:04:41 -07:00
Mitchell Hashimoto
a9df393580 fix mouse scroll direction 2022-10-31 12:09:34 -07:00
Mitchell Hashimoto
a14871e38a Metal Renderer
This implements a pure Metal renderer for macOS targets. 

Performance:
  - Average frame time: 0.7ms (Metal) vs. 1.5ms (OpenGL)
  - Average fps while `cat`-ing a 1GB file (vsync disabled): 100 (Metal) vs. 70 (OpenGL)
    * Note: while the frame time is 2x faster in Metal, the FPS is not 2x for what I assume to be lock contention on terminal state.

Why?
  - OpenGL has been deprecated on macOS since 2018. 
  - All OpenGL has to go through a Metal translation layer anyways, which has a non-zero cost. 
  - There is a bug on Mac where rendering OpenGL on a separate thread from the windowing thread can cause crashes, so most OpenGL software just don't multi-thread render on Mac. 
  - Metal is more explicit about resource management compared to OpenGL, so we gain performance.
  - Metal is much more multi-thread friendly, so our multi-threaded renderer works great! (with resizes!)
2022-10-31 10:48:53 -07:00
Mitchell Hashimoto
8dd68ea5fe metal: reallocate textures if they grow 2022-10-31 10:42:27 -07:00
Mitchell Hashimoto
9e628635c2 metal: hollow rect cursor works 2022-10-31 10:33:31 -07:00
Mitchell Hashimoto
20adaa7b66 metal: disable v-sync 2022-10-31 10:25:49 -07:00
Mitchell Hashimoto
1d1f161b03 metal: fix double wide cell width 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
901ff199c8 log the renderer on startup 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
ddc0d60ea2 metal: set contentsScale and handle screen scale factor for retina 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
c1b70cb788 metal: devmode 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
666833f12f metal: color textures 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
ee45d363a9 metal: cursor and underline 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
4b5174d2c6 metal: blending 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
178418834c metal: glyphs show up (poorly) 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
0058906035 metal: handle HiDPI scaling 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
fb49595904 metal: pass colors in 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
a7c1f63ad8 metal: populate the greyscale texture, prep ubershader 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
89610f9b8d metal: setup vertex data 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
6b7ed3fefb metal: use content scale when resizing 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
ea0265f021 projection matrix, render cell 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
a17a7426a3 draw a square, handle resize 2022-10-31 09:44:37 -07:00
Mitchell Hashimoto
4d4c1790cb draw a triangle 2022-10-31 09:44:36 -07:00
Mitchell Hashimoto
fc7e457098 add first pass metal shader 2022-10-31 09:44:36 -07:00
Mitchell Hashimoto
90a284e176 boilerplate for rendering 2022-10-31 09:44:36 -07:00
Mitchell Hashimoto
873afd042b don't test stage1 2022-10-31 09:44:36 -07:00
Mitchell Hashimoto
090bab6798 metal: setup the render loop, draw the background color 2022-10-31 09:44:36 -07:00
Mitchell Hashimoto
07271a6cfd Initial metal abstraction (noop) 2022-10-31 09:44:36 -07:00
Mitchell Hashimoto
19f003d7d0 mac: load emoji font last so it is not preferred for text 2022-10-31 09:44:19 -07:00
Mitchell Hashimoto
7557b7b831 update zig 2022-10-30 22:27:08 -07:00
Mitchell Hashimoto
6203893d45 update README about release builds 2022-10-30 22:22:39 -07:00
Mitchell Hashimoto
f89b5d12f6 fixed bugs 2022-10-29 09:48:57 -07:00
Mitchell Hashimoto
6d0b8a24d9 pkg/objc: shortcut for set/get property 2022-10-28 14:38:50 -07:00
Mitchell Hashimoto
1e5c17dffa Comment to show native access 2022-10-28 10:02:32 -07:00
Mitchell Hashimoto
71042b6f1b pkg/objc: more methods 2022-10-28 09:36:56 -07:00
Mitchell Hashimoto
b4a83d98c4 window no longer makes any OpenGL calls 2022-10-28 09:24:40 -07:00
Mitchell Hashimoto
209cad609c update zig 2022-10-27 17:06:54 -07:00
Mitchell Hashimoto
7d3eb2579a Objective-C Runtime (Low-level ObjC interfacing)
This adds a new homemade package `pkg/objc` that wraps the Objective-C runtime so that Zig can interface with ObjC. This doesn't have 100% API coverage but all the hard problems (mainly `objc_msgSend`) are done. We can merge this now, start working on ObjC stuff, and expand APIs as we need them.

The `objc` package is of course only available to Mac builds.
2022-10-25 21:32:56 -07:00
Mitchell Hashimoto
59cb774cdd pkg/objc: properties 2022-10-25 21:25:07 -07:00
Mitchell Hashimoto
aaaae38fa1 pkg/objc: more message send stuff 2022-10-25 20:55:41 -07:00
Mitchell Hashimoto
f587b222e7 don't need fstage1 2022-10-25 20:55:34 -07:00
Mitchell Hashimoto
7d48e564b5 pkg/objc: message send 2022-10-25 20:30:42 -07:00
Mitchell Hashimoto
10ee05b435 pkg/objc: selectors 2022-10-25 16:33:45 -07:00
Mitchell Hashimoto
dd8fde52d9 pkg/objc starting 2022-10-25 16:21:11 -07:00
Mitchell Hashimoto
e7ffb823af propertly deinit the GPA so we can detect leaks in debug 2022-10-25 15:49:21 -07:00
Mitchell Hashimoto
d8cdd5d8fe Fix the primary leak with config 2022-10-25 15:48:13 -07:00