alt-romes / alt-romes/ghengin

Removing occurrences of Unsafe.toLinear from ghengin-vulkan

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
85
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Amidts the gigantic refactor that brough linear types and backpack to the engine, some corners were cut (making the underling monad the Linear IO Monad was already a huge endeavour).

The engine is still somewhat broken after that giant refactor (e.g. textures still don't work), and some bad decisions were made (`linear-apecs`, leaking linear types out of the implementation onto the user)

Great things have happened, however. Especially the modularity of it all (because of backpack)
Now there are a couple of independent packages that depend on each other
* `ghengin-core`, where the ideal "core" of the engine, with which anything in the engine can be expressed (albeit less easily) (this is in light of GHC.Core). This module is abstract in the implementation of the renderer using backpack.
* `ghengin-vulkan`, is the renderer implementation using vulkan
* `ghengin`, which depends on `ghengin-core` and *instances* it with `ghengin-vulkan` (that's the beauty of backpack)
* some others like `ghengin-core-indep` which are depended on both by `ghengin-core` and `ghengin-vulkan` (since having ghengin-vulkan depend on ghengin-core doesn't yet work)

Currently,
* `ghengin-core` is unsafe-free! we don't use `Unsafe.toLinear` anywhere
* `ghengin-core-indep` exposes some safe functions which use unsafe.toLinear under the hood -- those are part of our trusted base
* `ghengin-vulkan` still uses Unsafe.toLinear extensively where it shouldn't -- it was required for me to see the refactor to the end, but I think there are bugs lurking (especially wrt reference-counted things, the wrong handling of which causes big problems)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.