4468 Commits

Author SHA1 Message Date
Mitchell Hashimoto
f9313801f1 avoid an alloc and buffer copy in the common case on font loading 2022-08-19 15:12:57 -07:00
Mitchell Hashimoto
742dd010eb Texture atlas supports variable color depth, not just greyscale 2022-08-19 14:37:22 -07:00
Mitchell Hashimoto
eeaad799e5 get rid of Z buffer stuff
This optimization will take more work, and we already got a lot of the
way there by optimizing how we send data down to the GPU.
2022-08-19 13:48:34 -07:00
Mitchell Hashimoto
2351f88631 updateCell sets the proper Z value and bumps it 2022-08-19 13:34:07 -07:00
Mitchell Hashimoto
73e43b6e64 Grid supports sending partial cell updates to GPU 2022-08-19 12:54:07 -07:00
Mitchell Hashimoto
4ca45936f7 Only reallocate the GPU buffer if our CPU capacity changes
Previously, every single render was re-allocating a fairly large (~1MB)
buffer on the GPU. The recommended best practice is to allocate once and
then use `glBufferSubData` to update the memory in-place on the GPU.

We now track the last size we sent to the GPU, compare it to our copy on
the CPU, and if it _grows_ then we reallocate the GPU buffer. If it
shrinks we leave the GPU as-is for now. After this, we use the sub-data
routines to update the data in place.
2022-08-19 10:26:23 -07:00
Mitchell Hashimoto
390d95a5af Enable depth buffer, add depth to shader 2022-08-19 10:07:30 -07:00
Mitchell Hashimoto
a36ae221ae rename font/font.zig to font/main.zig 2022-08-19 09:56:01 -07:00
Mitchell Hashimoto
d16c672771 update Zig, fixed new invalid octal error 2022-08-19 08:58:27 -07:00
Mitchell Hashimoto
1aecfc1061 math style 2022-08-18 11:42:32 -07:00
Mitchell Hashimoto
4dd8924427 clean up ortho2d to do less things 2022-08-18 11:37:29 -07:00
Mitchell Hashimoto
e5c583ccf5 get rid of gb_math and create matrices from scratch 2022-08-18 11:33:28 -07:00
Mitchell Hashimoto
b562eec83c erase display complete should scroll to bottom 2022-08-17 17:24:09 -07:00
Mitchell Hashimoto
16f981a48a Typing a character clears selection, scrolls to bottom 2022-08-17 17:23:58 -07:00
Mitchell Hashimoto
7c50ac2be5 skip a test on stage2, with this the main package tests pass! 2022-08-17 17:06:42 -07:00
Mitchell Hashimoto
5c2edf4d2a Fix some stage2 compilation errors 2022-08-17 14:42:23 -07:00
Mitchell Hashimoto
2f36d5f715 pkg/tracy 2022-08-17 14:03:49 -07:00
Mitchell Hashimoto
ea1e972a29 turn tracy into proper package 2022-08-17 14:02:09 -07:00
Mitchell Hashimoto
2457454b07 test wasm of the term package 2022-08-17 13:57:21 -07:00
Mitchell Hashimoto
ead6e5a435 src/terminal can build into a minimal wasm library, I think 2022-08-17 12:25:53 -07:00
Mitchell Hashimoto
f2d65d4524 move freetype into pkg 2022-08-17 11:20:31 -07:00
Mitchell Hashimoto
b2192ea8f7 move libuv into pkg 2022-08-16 17:47:44 -07:00
Mitchell Hashimoto
3b7a6b78a7 fix ttyWrite calculation to avoid truncating data
the math was wrong. The easiest way to see this was attempting to paste
a large chunk of text, it'd just skip certain parts and truncate it.
2022-08-15 09:57:38 -07:00
Mitchell Hashimoto
e3ddffdf36 don't scale up OpenGL projection in Retina, use true values
This gets rid of blurriness.
2022-08-09 10:21:23 -07:00
Mitchell Hashimoto
f94f3cb5a4 enable retina on Mac, set OpenGL to pixel size properly
This makes things look a bit better, but trades pixelation for blurry
(still TODO). This also fixes an issue on Retina where if you resize
it'd make the viewport 1/4 of the size. The issue here is that OpenGL
uses pixels and glfw uses screen coordinates for everything. We adapt
the screen coords to pixels properly here.
2022-08-09 10:06:30 -07:00
Mitchell Hashimoto
ad1cdbcd59 implement erase display scrollback ("clear" command) 2022-08-09 09:22:34 -07:00
Mitchell Hashimoto
fb5afbedd2 add screen .history tag to fetch scrollback region 2022-08-09 09:18:10 -07:00
Mitchell Hashimoto
57cec33303 set a minimum window size
Fixes #4

The currently picked 10x4 is somewhat arbitrary but matches
Terminal.app. We can make this configurable.
2022-08-09 08:59:45 -07:00
Mitchell Hashimoto
38af14ff3a resize alt screen without reflow 2022-08-08 21:14:27 -07:00
Mitchell Hashimoto
f82493cccf when growing cols, adjust viewport and cursor if we shorten 2022-08-08 20:52:36 -07:00
Mitchell Hashimoto
16a5a45293 when growing rows, offset cursor by added rows 2022-08-08 18:14:11 -07:00
Mitchell Hashimoto
d551f1126b when less cols, cursor needs to be in screen space, not viewport 2022-08-08 17:47:16 -07:00
Mitchell Hashimoto
113b5a318b when shrinking rows, clear empty space from the end (see test case) 2022-08-08 17:24:10 -07:00
Mitchell Hashimoto
a2cf116063 fix a crash when reflowing to smaller cols but still buggy 2022-08-08 14:20:52 -07:00
Mitchell Hashimoto
f3d3d255fb handle case where cursor is past where content is on col shrink 2022-08-08 14:08:01 -07:00
Mitchell Hashimoto
9493561159 assertions to save our bacon 2022-08-08 14:03:14 -07:00
Mitchell Hashimoto
e4c8bbd394 reflow cursor when shrinking cols 2022-08-08 14:02:28 -07:00
Mitchell Hashimoto
6fa4cb07c7 more cursor reflow 2022-08-08 13:56:09 -07:00
Mitchell Hashimoto
bfbeceeefa when cols grow, move cursor if it unwraps the line it is on 2022-08-08 13:47:49 -07:00
Mitchell Hashimoto
9ddb19e9b0 replace old resize with new reflow resize 2022-08-08 13:06:01 -07:00
Mitchell Hashimoto
f97b739317 reflow when columns get smaller 2022-08-08 13:04:27 -07:00
Mitchell Hashimoto
8a5dadd995 rowIndex uses tag max so we have max in just one place 2022-08-08 10:38:24 -07:00
Mitchell Hashimoto
57f6986343 rowIterator(.screen) now ignores unused lines, fixes shrinking rows 2022-08-08 10:32:42 -07:00
Mitchell Hashimoto
4ef73efeac resize less rows, but currently not 100% working (see commented tests) 2022-08-08 10:28:11 -07:00
Mitchell Hashimoto
2cf4a265e5 reflow when cols grow 2022-08-08 09:39:55 -07:00
Mitchell Hashimoto
dc351582bc resize increasing column width without reflow 2022-08-07 16:23:23 -07:00
Mitchell Hashimoto
be3a539152 start working on new resize with reflow, can grow rows 2022-08-07 15:52:53 -07:00
Mitchell Hashimoto
039b640f6b Merge branch 'reflow'
This actually doesn't implement reflow but I wanted to merge this
because it has an important refactor and clarity around screen
operations.

It is now clearly defined in the API what portion of the screen you're
accessing (active, viewport, etc.) and the terminal only operates on the
active area (fixing TODO item in diff).

This is all groundwork I found was necessary to even start thinking
about reflow.
2022-08-07 10:47:27 -07:00
Mitchell Hashimoto
2d6d027097 Screen.region to get a region of contiguous memory for a tag 2022-08-07 10:46:35 -07:00
Mitchell Hashimoto
92602dafca rowIterator takes the tag type to iterate over 2022-08-07 10:26:04 -07:00