]>
git.nega.tv - josh/narcissus/log
Joshua Simmons [Mon, 14 Nov 2022 20:52:28 +0000 (21:52 +0100)]
Simplify `Mat3::mul`
Joshua Simmons [Mon, 14 Nov 2022 20:31:50 +0000 (21:31 +0100)]
Increase the shark factor
Joshua Simmons [Mon, 14 Nov 2022 20:31:16 +0000 (21:31 +0100)]
Sprinkle some inlines and unrolling for debug perf
Joshua Simmons [Sun, 13 Nov 2022 22:51:52 +0000 (23:51 +0100)]
Add shorthand functions for vector and point new
Joshua Simmons [Sun, 13 Nov 2022 22:35:41 +0000 (23:35 +0100)]
Add test for cross product :)
Joshua Simmons [Sun, 13 Nov 2022 22:29:24 +0000 (23:29 +0100)]
Fix matrix handling now cross-product works
Joshua Simmons [Sun, 13 Nov 2022 21:50:35 +0000 (22:50 +0100)]
Simplify use of shader build script
Joshua Simmons [Sun, 13 Nov 2022 21:49:41 +0000 (22:49 +0100)]
Add note about rotation direction
Joshua Simmons [Sun, 13 Nov 2022 21:07:36 +0000 (22:07 +0100)]
Fix typo in cross-product implementation
Joshua Simmons [Sun, 13 Nov 2022 16:20:15 +0000 (17:20 +0100)]
Multiple Shark Zone
Joshua Simmons [Sun, 13 Nov 2022 13:13:56 +0000 (14:13 +0100)]
Rename `FrameToken` -> `Frame`
Joshua Simmons [Sun, 13 Nov 2022 13:03:39 +0000 (14:03 +0100)]
Tidy up the way we handle cmd buffers
Use the arena allocator to bump allocate them from the frame structure,
and return a wrapper struct holding a pointer to the concrete type.
Simplify a few signatures now we have a direct pointer to the cmd
buffer.
Joshua Simmons [Sun, 13 Nov 2022 11:04:52 +0000 (12:04 +0100)]
Add basic input events
Joshua Simmons [Sat, 12 Nov 2022 23:22:56 +0000 (00:22 +0100)]
Add const for magical swapchain destruction delay
Joshua Simmons [Sat, 12 Nov 2022 23:08:09 +0000 (00:08 +0100)]
Bundle all per-thread frame objects
Joshua Simmons [Sat, 12 Nov 2022 22:46:18 +0000 (23:46 +0100)]
Tidy up vulkan stuff
Joshua Simmons [Sat, 12 Nov 2022 20:46:24 +0000 (21:46 +0100)]
blåhaj bring up 🦈🦈🦈
Joshua Simmons [Fri, 11 Nov 2022 23:50:53 +0000 (00:50 +0100)]
Tidy some lints and documentation
Joshua Simmons [Fri, 11 Nov 2022 23:02:58 +0000 (00:02 +0100)]
Fix `Arc` incorrectly initializing itself as `Rc`
Joshua Simmons [Fri, 11 Nov 2022 22:24:48 +0000 (23:24 +0100)]
Fix memory safety issue in `HybridArena`
Calling `reset()` on an initialized, then moved `HybridArena` wouldn't
correctly update the page head pointer, causing reset to be called on
somebody else's bit of stack memory.
Joshua Simmons [Fri, 11 Nov 2022 22:23:36 +0000 (23:23 +0100)]
Remove broken attribute from `static_assert` macro
Joshua Simmons [Fri, 11 Nov 2022 21:53:38 +0000 (22:53 +0100)]
Add fallback for `round_ties_to_even` SSE4.1 path
Joshua Simmons [Fri, 11 Nov 2022 20:20:14 +0000 (21:20 +0100)]
Remove comparison with the empty page
By marking the empty page as a "stack" page, we can avoid needing to
compare with the empty page when allocating from a hybrid array.
Joshua Simmons [Wed, 9 Nov 2022 21:10:26 +0000 (22:10 +0100)]
Add bounded random function to `Pcg64`
Remove `Pcg32` because I don't think we're likely to need that for
anything.
Joshua Simmons [Wed, 9 Nov 2022 21:00:15 +0000 (22:00 +0100)]
Add `mul_full_width_{u8,u16,u32,u64}` functions
Joshua Simmons [Wed, 9 Nov 2022 20:56:28 +0000 (21:56 +0100)]
Fix clippy lints in stb_image build script
Joshua Simmons [Tue, 8 Nov 2022 22:25:55 +0000 (23:25 +0100)]
Add basic random numbers
Josh Simmons [Sun, 6 Nov 2022 10:45:09 +0000 (11:45 +0100)]
[meta] Update rust in github actions
Joshua Simmons [Sun, 6 Nov 2022 10:08:20 +0000 (11:08 +0100)]
Use `HybridArena` instead of heap allocation
Joshua Simmons [Sun, 6 Nov 2022 10:06:32 +0000 (11:06 +0100)]
Use `let..else` when handling slice lengths
Allow `VulkanSlice2` to be created from mutable references.
Joshua Simmons [Sat, 5 Nov 2022 12:53:12 +0000 (13:53 +0100)]
Use Rust's ThreadId instead of gettid
It's a little bit nasty due to needing to wrap it in Option, however it
avoids making the gettid syscall every time we do a lock / unlock
operation. Small performance improvement in debug mode.
Joshua Simmons [Sat, 5 Nov 2022 12:51:29 +0000 (13:51 +0100)]
Keep frame pointers by default
Joshua Simmons [Sat, 5 Nov 2022 10:22:39 +0000 (11:22 +0100)]
Handle each vulkan pool type separately
Joshua Simmons [Sat, 5 Nov 2022 10:00:23 +0000 (11:00 +0100)]
Improve lifetimes command buffer tokens
Not binding to the lifetime of the thread token meant you could create
multiple mut references to the same command buffer with
`command_buffer_mut`.
Relax requirements for mut references on the command buffer tokens in
the API as they're not required.
Josh Simmons [Fri, 4 Nov 2022 20:59:59 +0000 (21:59 +0100)]
Fix reduction using the wrong rounding mode (#1)
Previously we were using `f32::round` in the reduction step, however
that isn't correct. We really need IEEE-754 tiesToEven semantics for the
rounding step, so manually implement that.
Joshua Simmons [Fri, 4 Nov 2022 18:12:12 +0000 (19:12 +0100)]
Allocate uniform buffer in host visible memory
Joshua Simmons [Thu, 3 Nov 2022 21:52:35 +0000 (22:52 +0100)]
Add descriptor APIs and move the triangle
Joshua Simmons [Thu, 3 Nov 2022 21:51:42 +0000 (22:51 +0100)]
Fix clippy lints
Joshua Simmons [Thu, 3 Nov 2022 21:56:47 +0000 (22:56 +0100)]
Fix clippy dead code warning
Joshua Simmons [Thu, 3 Nov 2022 21:18:31 +0000 (22:18 +0100)]
Expand arena functionality
Add `alloc_slice_fill_with`
Add `alloc_slice_fill_copy`
Add `alloc_slice_fill_clone`
Add `alloc_slice_fill_iter`
Joshua Simmons [Thu, 3 Nov 2022 21:17:30 +0000 (22:17 +0100)]
Allow creating vulkan slices from mut slices
Joshua Simmons [Thu, 3 Nov 2022 21:14:54 +0000 (22:14 +0100)]
Target modern CPU by default
Joshua Simmons [Thu, 3 Nov 2022 21:14:17 +0000 (22:14 +0100)]
Fix base `Mat4 * Vec4` function name
Joshua Simmons [Wed, 2 Nov 2022 21:16:50 +0000 (22:16 +0100)]
Add `Arena` and `HybridArena`
Add two variants on a simple bump allocator. Based loosly on the bumpalo
crate.
Provides two types, `Arena` which always allocates from the heap and
`HybridArena` which will first use a stack allocated page, then fall
back to allocating from the heap as well.
Joshua Simmons [Wed, 2 Nov 2022 21:15:47 +0000 (22:15 +0100)]
Add vk descriptor management functions
Joshua Simmons [Sat, 29 Oct 2022 15:47:44 +0000 (17:47 +0200)]
Use fully qualified path to mold binary
Load it into the /usr/ instead of /usr/local on github actions so the
path is the same as when installed as a regular package.
Joshua Simmons [Sat, 29 Oct 2022 15:32:52 +0000 (17:32 +0200)]
Re-add clang as linker
Joshua Simmons [Sat, 29 Oct 2022 15:29:33 +0000 (17:29 +0200)]
Update github actions VM to Ubuntu 22.04
Joshua Simmons [Sat, 29 Oct 2022 15:03:14 +0000 (17:03 +0200)]
Don't need to force clang linker anymore
Joshua Simmons [Sat, 29 Oct 2022 14:14:54 +0000 (16:14 +0200)]
Add `BindGroupLayout`
Joshua Simmons [Sat, 29 Oct 2022 14:12:39 +0000 (16:12 +0200)]
Rename `request_command_buffer` to `create_...`
The distinction between requesting and creating seems a bit tenuious and
probably just confusing. Might re-visit this later once the API is more
complete.
Joshua Simmons [Sat, 29 Oct 2022 14:09:54 +0000 (16:09 +0200)]
Fix comment running past the line width limit
Joshua Simmons [Sat, 29 Oct 2022 14:09:14 +0000 (16:09 +0200)]
Add `is_aligned_to` and `is_aligned` functions
Joshua Simmons [Sat, 29 Oct 2022 14:08:07 +0000 (16:08 +0200)]
Fix incorrect pad values for vulkan slices
Add tests for every vulkan slice used to ensure they're all correct.
Joshua Simmons [Sat, 29 Oct 2022 14:07:34 +0000 (16:07 +0200)]
Add missing default implementations
Joshua Simmons [Sat, 29 Oct 2022 14:02:49 +0000 (16:02 +0200)]
Remove unnecessary comment
Joshua Simmons [Fri, 28 Oct 2022 21:20:09 +0000 (23:20 +0200)]
Fill in affine2, affine3, and quat functions
Josh Simmons [Sun, 23 Oct 2022 09:07:16 +0000 (11:07 +0200)]
Try updating Rust before build
Joshua Simmons [Sat, 22 Oct 2022 14:25:44 +0000 (16:25 +0200)]
Improve error rate on sin_pi
Similarly to our tan implementation, use a 48 bit leading coefficient.
Reduces the percentage of faithfully rounded results from 17.4% to 1.3%.
Joshua Simmons [Fri, 21 Oct 2022 21:05:21 +0000 (23:05 +0200)]
Be more defensive when doing range reduction
f32 as u32 saturates in rust, using to_int_unchecked wasn't currently
saturating on x86, but it's conceivable that it might. Go the long way
around by converting first to i32 and then to u32 in order to avoid the
possibility.
Joshua Simmons [Mon, 17 Oct 2022 06:47:12 +0000 (08:47 +0200)]
Fix clippy lints
Joshua Simmons [Sun, 16 Oct 2022 21:43:29 +0000 (23:43 +0200)]
Re-word some documentation for manual_arc
Joshua Simmons [Sun, 16 Oct 2022 21:42:46 +0000 (23:42 +0200)]
Fix warnings in affine2 and affine3
Joshua Simmons [Sun, 16 Oct 2022 21:41:28 +0000 (23:41 +0200)]
Implement some more maths basics
Joshua Simmons [Sun, 16 Oct 2022 15:34:01 +0000 (17:34 +0200)]
Fix errors in `sin/cos/tan` exhaustive checking
Add fractional ulps error calculation.
Fix where the multiplication by pi happens in checking code.
Replace rug with small hand-rolled mpfr wrapper.
Joshua Simmons [Sat, 15 Oct 2022 21:35:14 +0000 (23:35 +0200)]
Improve `mod_inverse_u32` testing
Joshua Simmons [Sat, 15 Oct 2022 21:34:23 +0000 (23:34 +0200)]
Fix some edge case handling in `sin_cos_pi`
Update tests as well.
Joshua Simmons [Sat, 15 Oct 2022 13:32:22 +0000 (15:32 +0200)]
Add some new maths functions
Add `{sin,cos,tan}_pi_f32` functions.
Add `next_after_f32`.
Add `HalfTurns` unit type.
Switch `Mat4` to use turns and `sin_cos_pi_f32`.
Joshua Simmons [Sat, 8 Oct 2022 11:03:44 +0000 (13:03 +0200)]
Improve pool implementation
Move virtual memory failures into the `virtual_reserve` and
`virtual_commit` signatures so we can give better assert messages on
failure.
Handle growth more accurately, allowing us to use the entire table
capacity before asserting.
Reserve a bit in the generation counter to keep track of whether a slot
is full by incrementing the counter on both allocation and deallocation.
This means exported handles can only ever have an odd generation
counter.
Assert when given a handle that has an invalid generation counter
(where the counter implies it would be pointing to an empty slot).
Both above changes together means it's no longer possible to create a
reference to an uninitialized slot, even when manually messing with the
handle or mixing handles between different pools.
Joshua Simmons [Sat, 8 Oct 2022 11:00:54 +0000 (13:00 +0200)]
Always panic when failing to drop a `ManualArc`
Hopefully the optimiser can nuke the branch most of the time.
Joshua Simmons [Thu, 6 Oct 2022 21:52:46 +0000 (23:52 +0200)]
Fix log2 off-by-one error
Joshua Simmons [Thu, 6 Oct 2022 21:28:20 +0000 (23:28 +0200)]
Remove useless commented code
Joshua Simmons [Thu, 6 Oct 2022 20:59:29 +0000 (22:59 +0200)]
Replace magic value in pool with random mixer
Instead of using a 4 bit magic number, and consequently restricting the
size of the pool, instead mix handles with a per-pool random integer
based on the pool's base memory address.
The associated tests will perhaps be a bit flaky, so disable them by
default.
Joshua Simmons [Thu, 6 Oct 2022 19:45:24 +0000 (21:45 +0200)]
Add multiplicative inverse and log2 functions
Joshua Simmons [Sun, 2 Oct 2022 13:09:07 +0000 (15:09 +0200)]
Fix remaining clippy lints
Joshua Simmons [Sun, 2 Oct 2022 11:29:41 +0000 (13:29 +0200)]
Fix warning caused by ManualArc API change
Joshua Simmons [Sun, 2 Oct 2022 11:26:06 +0000 (13:26 +0200)]
Improve API of `ManualArc`
Consume the ManualArc when calling `release` to avoid needing to handle
double-free. Avoids unsafety in user code (was only protected by a debug
assert before)
Add some very basic documentation.
Joshua Simmons [Sun, 2 Oct 2022 11:24:46 +0000 (13:24 +0200)]
Remove some unused functions
Joshua Simmons [Sun, 25 Sep 2022 19:26:08 +0000 (21:26 +0200)]
Simplify main and add some 🦈 stuff
Joshua Simmons [Sun, 25 Sep 2022 19:25:35 +0000 (21:25 +0200)]
Switch back to O0 for debug mode
Joshua Simmons [Sun, 25 Sep 2022 19:24:52 +0000 (21:24 +0200)]
Add `Debug` implementation for `Window`
Josh Simmons [Sun, 25 Sep 2022 16:00:13 +0000 (18:00 +0200)]
Update apt cache before installing deps
apt-get install will randomly fail if you don't update the cache beforehand.
Joshua Simmons [Sun, 25 Sep 2022 15:10:09 +0000 (17:10 +0200)]
Improve perf of obj parser
Joshua Simmons [Sun, 25 Sep 2022 12:13:41 +0000 (14:13 +0200)]
Fix some clippy lints and doc errors
Joshua Simmons [Sun, 25 Sep 2022 12:13:10 +0000 (14:13 +0200)]
Fix some clippy lints
Joshua Simmons [Sun, 25 Sep 2022 12:05:42 +0000 (14:05 +0200)]
Fix doc-tests for `array_windows`
Joshua Simmons [Sun, 25 Sep 2022 11:54:06 +0000 (13:54 +0200)]
Add a basic obj file parser
Joshua Simmons [Sun, 25 Sep 2022 11:53:10 +0000 (13:53 +0200)]
Add `slice::array_windows` from std library
Joshua Simmons [Sat, 17 Sep 2022 10:07:39 +0000 (12:07 +0200)]
Add blåhaj
Created by [twitter.com/IsabelleDotJpeg](https://twitter.com/IsabelleDotJpeg)
Joshua Simmons [Sat, 17 Sep 2022 10:04:27 +0000 (12:04 +0200)]
Add basic safe wrapper for stb_image
Joshua Simmons [Sat, 17 Sep 2022 10:02:36 +0000 (12:02 +0200)]
Update `Cargo.lock` after removing libc dependency
Joshua Simmons [Mon, 12 Sep 2022 20:39:15 +0000 (22:39 +0200)]
Replace libc crate with a budget version
Try to improve compile times by copy-pasting the handful of libc
definitions that we actually need. This is going to be a bit broken for
non-x86_64 platforms for now.
Joshua Simmons [Mon, 12 Sep 2022 20:35:47 +0000 (22:35 +0200)]
Fix some clippy lints for pool
Joshua Simmons [Sun, 11 Sep 2022 21:04:50 +0000 (23:04 +0200)]
Add llvm to the github actions dependencies
Joshua Simmons [Sun, 11 Sep 2022 21:02:22 +0000 (23:02 +0200)]
Add clang to the github actions dependencies
Joshua Simmons [Sun, 11 Sep 2022 20:57:03 +0000 (22:57 +0200)]
Add stb_image binding
Joshua Simmons [Sun, 11 Sep 2022 18:19:04 +0000 (20:19 +0200)]
Move binding libraries to ffi directory
Joshua Simmons [Sun, 11 Sep 2022 14:04:19 +0000 (16:04 +0200)]
Add Mat4 `look_at`, `ortho` and `perspective` fn's
Joshua Simmons [Sun, 11 Sep 2022 14:02:52 +0000 (16:02 +0200)]
Add point -> vector conversion functions
Joshua Simmons [Sun, 11 Sep 2022 14:01:51 +0000 (16:01 +0200)]
Add `normalized` function to vectors