]> git.nega.tv - josh/narcissus/log
josh/narcissus
2 years agoImplement some more maths basics
Joshua Simmons [Sun, 16 Oct 2022 21:41:28 +0000 (23:41 +0200)]
Implement some more maths basics

2 years agoFix errors in `sin/cos/tan` exhaustive checking
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.

2 years agoImprove `mod_inverse_u32` testing
Joshua Simmons [Sat, 15 Oct 2022 21:35:14 +0000 (23:35 +0200)]
Improve `mod_inverse_u32` testing

2 years agoFix some edge case handling in `sin_cos_pi`
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.

2 years agoAdd some new maths functions
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`.

2 years agoImprove pool implementation
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.

2 years agoAlways panic when failing to drop a `ManualArc`
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.

2 years agoFix log2 off-by-one error
Joshua Simmons [Thu, 6 Oct 2022 21:52:46 +0000 (23:52 +0200)]
Fix log2 off-by-one error

2 years agoRemove useless commented code
Joshua Simmons [Thu, 6 Oct 2022 21:28:20 +0000 (23:28 +0200)]
Remove useless commented code

2 years agoReplace magic value in pool with random mixer
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.

2 years agoAdd multiplicative inverse and log2 functions
Joshua Simmons [Thu, 6 Oct 2022 19:45:24 +0000 (21:45 +0200)]
Add multiplicative inverse and log2 functions

2 years agoFix remaining clippy lints
Joshua Simmons [Sun, 2 Oct 2022 13:09:07 +0000 (15:09 +0200)]
Fix remaining clippy lints

2 years agoFix warning caused by ManualArc API change
Joshua Simmons [Sun, 2 Oct 2022 11:29:41 +0000 (13:29 +0200)]
Fix warning caused by ManualArc API change

2 years agoImprove API of `ManualArc`
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.

2 years agoRemove some unused functions
Joshua Simmons [Sun, 2 Oct 2022 11:24:46 +0000 (13:24 +0200)]
Remove some unused functions

2 years agoSimplify main and add some 🦈 stuff
Joshua Simmons [Sun, 25 Sep 2022 19:26:08 +0000 (21:26 +0200)]
Simplify main and add some ðŸ¦ˆ stuff

2 years agoSwitch back to O0 for debug mode
Joshua Simmons [Sun, 25 Sep 2022 19:25:35 +0000 (21:25 +0200)]
Switch back to O0 for debug mode

2 years agoAdd `Debug` implementation for `Window`
Joshua Simmons [Sun, 25 Sep 2022 19:24:52 +0000 (21:24 +0200)]
Add `Debug` implementation for `Window`

2 years agoUpdate apt cache before installing deps
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.

2 years agoImprove perf of obj parser
Joshua Simmons [Sun, 25 Sep 2022 15:10:09 +0000 (17:10 +0200)]
Improve perf of obj parser

2 years agoFix some clippy lints and doc errors
Joshua Simmons [Sun, 25 Sep 2022 12:13:41 +0000 (14:13 +0200)]
Fix some clippy lints and doc errors

2 years agoFix some clippy lints
Joshua Simmons [Sun, 25 Sep 2022 12:13:10 +0000 (14:13 +0200)]
Fix some clippy lints

2 years agoFix doc-tests for `array_windows`
Joshua Simmons [Sun, 25 Sep 2022 12:05:42 +0000 (14:05 +0200)]
Fix doc-tests for `array_windows`

2 years agoAdd a basic obj file parser
Joshua Simmons [Sun, 25 Sep 2022 11:54:06 +0000 (13:54 +0200)]
Add a basic obj file parser

2 years agoAdd `slice::array_windows` from std library
Joshua Simmons [Sun, 25 Sep 2022 11:53:10 +0000 (13:53 +0200)]
Add `slice::array_windows` from std library

2 years agoAdd blåhaj
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)

2 years agoAdd basic safe wrapper for stb_image
Joshua Simmons [Sat, 17 Sep 2022 10:04:27 +0000 (12:04 +0200)]
Add basic safe wrapper for stb_image

2 years agoUpdate `Cargo.lock` after removing libc dependency
Joshua Simmons [Sat, 17 Sep 2022 10:02:36 +0000 (12:02 +0200)]
Update `Cargo.lock` after removing libc dependency

2 years agoReplace libc crate with a budget version
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.

2 years agoFix some clippy lints for pool
Joshua Simmons [Mon, 12 Sep 2022 20:35:47 +0000 (22:35 +0200)]
Fix some clippy lints for pool

2 years agoAdd llvm to the github actions dependencies
Joshua Simmons [Sun, 11 Sep 2022 21:04:50 +0000 (23:04 +0200)]
Add llvm to the github actions dependencies

2 years agoAdd clang 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

2 years agoAdd stb_image binding
Joshua Simmons [Sun, 11 Sep 2022 20:57:03 +0000 (22:57 +0200)]
Add stb_image binding

2 years agoMove binding libraries to ffi directory
Joshua Simmons [Sun, 11 Sep 2022 18:19:04 +0000 (20:19 +0200)]
Move binding libraries to ffi directory

2 years agoAdd Mat4 `look_at`, `ortho` and `perspective` fn's
Joshua Simmons [Sun, 11 Sep 2022 14:04:19 +0000 (16:04 +0200)]
Add Mat4 `look_at`, `ortho` and `perspective` fn's

2 years agoAdd point -> vector conversion functions
Joshua Simmons [Sun, 11 Sep 2022 14:02:52 +0000 (16:02 +0200)]
Add point -> vector conversion functions

2 years agoAdd `normalized` function to vectors
Joshua Simmons [Sun, 11 Sep 2022 14:01:51 +0000 (16:01 +0200)]
Add `normalized` function to vectors

2 years agoImprove `min`, `max` on ARM, and fix documentation
Joshua Simmons [Sat, 10 Sep 2022 10:16:48 +0000 (12:16 +0200)]
Improve `min`, `max` on ARM, and fix documentation

Use regular `f32::min` and `f32::max` for non-x86 platforms. Allows arm
to generate `fminnm`.
Improve documentation of platform specific behavior of `min` and `max`.
Add note about `sqrt` operation to `_sq` functions.

2 years agoFill out `Mat2` and `Mat3` some more
Joshua Simmons [Thu, 8 Sep 2022 20:46:38 +0000 (22:46 +0200)]
Fill out `Mat2` and `Mat3` some more

2 years agoImprove documentation for maths library
Joshua Simmons [Thu, 8 Sep 2022 19:13:44 +0000 (21:13 +0200)]
Improve documentation for maths library

2 years agoFix braces causing a rustdoc error
Joshua Simmons [Thu, 8 Sep 2022 19:12:03 +0000 (21:12 +0200)]
Fix braces causing a rustdoc error

2 years agoSwitch thread token to `std::array::from_fn`
Joshua Simmons [Thu, 8 Sep 2022 16:55:24 +0000 (18:55 +0200)]
Switch thread token to `std::array::from_fn`

2 years agoAdd `min`, `max` and `clamp` functions
Joshua Simmons [Thu, 8 Sep 2022 06:51:34 +0000 (08:51 +0200)]
Add `min`, `max` and `clamp` functions

2 years agoFix some clippy lints
Joshua Simmons [Wed, 7 Sep 2022 21:54:57 +0000 (23:54 +0200)]
Fix some clippy lints

2 years agoImplement `from_axis_angle` for `Mat4`
Joshua Simmons [Wed, 7 Sep 2022 20:58:21 +0000 (22:58 +0200)]
Implement `from_axis_angle` for `Mat4`

2 years agoAdd missing axis vectors for `Vec3`
Joshua Simmons [Wed, 7 Sep 2022 20:57:17 +0000 (22:57 +0200)]
Add missing axis vectors for `Vec3`

2 years agoAdd extra vector operators
Joshua Simmons [Wed, 7 Sep 2022 20:55:41 +0000 (22:55 +0200)]
Add extra vector operators

Add Add/Sub/Mul/Div by scalar
Add Neg

2 years agoAdd unit types for degrees and radians
Joshua Simmons [Wed, 7 Sep 2022 20:53:40 +0000 (22:53 +0200)]
Add unit types for degrees and radians

2 years agoRework maths library
Joshua Simmons [Tue, 6 Sep 2022 21:43:38 +0000 (23:43 +0200)]
Rework maths library

Split into multiple files.
Add `Affine2` and `Affine3` transformation types.
Add `Point2` and `Point3` types.
Use macro instead of repeating basic `Point` and `Vec` implementation.
Change `Mat4 * Point` to use homogeneous coordinates where `w=1`.
Change `Mat4 * Vec` to use homogeneous coordinates where `w=0`.

2 years agoAdd `from_translation` to `Mat4` and tidy tests
Joshua Simmons [Tue, 6 Sep 2022 07:18:41 +0000 (09:18 +0200)]
Add `from_translation` to `Mat4` and tidy tests

2 years agoAdd `ONE` associated consts to vector types
Joshua Simmons [Tue, 6 Sep 2022 07:17:41 +0000 (09:17 +0200)]
Add `ONE` associated consts to vector types

2 years agoAdd SDL2 dependency to github workflow
Joshua Simmons [Mon, 5 Sep 2022 21:39:59 +0000 (23:39 +0200)]
Add SDL2 dependency to github workflow

2 years agoAvoid hardcoding the path to the mold linker
Joshua Simmons [Mon, 5 Sep 2022 21:35:59 +0000 (23:35 +0200)]
Avoid hardcoding the path to the mold linker

2 years agoAdd mold to github workflow
Josh Simmons [Mon, 5 Sep 2022 21:32:42 +0000 (23:32 +0200)]
Add mold to github workflow

2 years agoCreate rust workflow
Josh Simmons [Mon, 5 Sep 2022 21:28:07 +0000 (23:28 +0200)]
Create rust workflow

2 years agoSplit maths library into multiple modules
Joshua Simmons [Mon, 5 Sep 2022 21:24:49 +0000 (23:24 +0200)]
Split maths library into multiple modules

2 years agoRename `virtual_vec` inner types
Joshua Simmons [Mon, 5 Sep 2022 06:40:33 +0000 (08:40 +0200)]
Rename `virtual_vec` inner types

Remove `virtual` from the inner module names to avoid repetition.
Rename `RawVirtualVec` to `VirtualRawVec` so it's more consistent.

2 years agoUpdate build script profile defaults
Joshua Simmons [Sun, 4 Sep 2022 21:05:10 +0000 (23:05 +0200)]
Update build script profile defaults

Add optimizations to debug build.
Add LTO to release build.

2 years agoAdd maths dependency to narcissus
Joshua Simmons [Sun, 4 Sep 2022 21:03:50 +0000 (23:03 +0200)]
Add maths dependency to narcissus

2 years agoStart implementing basic maths functions
Joshua Simmons [Sun, 4 Sep 2022 21:01:33 +0000 (23:01 +0200)]
Start implementing basic maths functions

2 years agoReplace `make_array` with `std::array::from_fn`
Joshua Simmons [Sun, 4 Sep 2022 11:06:33 +0000 (13:06 +0200)]
Replace `make_array` with `std::array::from_fn`

2 years ago[narc-gpu] Remove unnecessary unsafe block
Joshua Simmons [Tue, 30 Aug 2022 05:25:30 +0000 (07:25 +0200)]
[narc-gpu] Remove unnecessary unsafe block

2 years ago[vulkan-sys] Add implicit unsafe to vk_check macro
Joshua Simmons [Tue, 30 Aug 2022 05:23:39 +0000 (07:23 +0200)]
[vulkan-sys] Add implicit unsafe to vk_check macro

Unifies it with the narcissus-gpu version.

2 years agoUse &CStr for `get_instance_proc_address`
Joshua Simmons [Mon, 29 Aug 2022 06:38:07 +0000 (08:38 +0200)]
Use &CStr for `get_instance_proc_address`

2 years agoCreate LICENCE
Josh Simmons [Sun, 28 Aug 2022 10:05:16 +0000 (12:05 +0200)]
Create LICENCE

2 years agoInitial Commit
Joshua Simmons [Sat, 22 Jan 2022 20:36:05 +0000 (21:36 +0100)]
Initial Commit