From fa7b36c5ebc5e5b4331d20c13795ebbdd1d69ffa Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 13 Sep 2023 19:06:03 -0400 Subject: Update TODO list. --- TODO.org | 126 +++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 79 insertions(+), 47 deletions(-) (limited to 'TODO.org') diff --git a/TODO.org b/TODO.org index 4dca8f8..c117a8a 100644 --- a/TODO.org +++ b/TODO.org @@ -1,4 +1,48 @@ * Tasks +** TODO [#A] Rewrite renderer +It is finally time to make Chickadee at least theoretically capable of +using a graphics API other than OpenGL. OpenGL is showing its age and +all newer graphics APIs use a stateless render queue approach that is +much better than OpenGL's awful global state. MacOS doesn't support +anything past OpenGL 3 and there's already been a number of +compatibility issues for Chickadee. WebGPU is quickly becoming a +thing and with Guile Hoot on the horizon it should be possible to ship +Chickadee games in the browser that use modern graphics APIs, but the +work to make that happen needs to start now. So, the goal is to move +all OpenGL code to an OpenGL backend, add support for multiple +backends, and expose a WebGPU-like interface since the team who made +it have already done the hard work of abstracting over Vulkan, Metal, +and Direct3D. When we can target the web via Hoot, our graphics +backend will be a thin wrapper over the WebGPU JS API, more or less. +And of course on native targets we will now have the option of using +whatever graphics API makes the most sense. + +Some big subtasks here: +- [ ] Decouple OpenGL state management from dynamic render context +- [ ] Refactor all OpenGL calls into a single module +- [ ] Add generic WebGPU-like graphics API +- [ ] Implement that API for OpenGL backend +- [ ] Update all graphics modules to use new API + +One big caveat is that our shading language will still be GLSL at the +end of this, which prevents us from being truly generic. The Seagull +shading language project will take care of that so we can compile to +whichever shader language our backend uses. + +See this for how Trial does graphics pipelines: +https://reader.tymoon.eu/article/363 +** TODO [#A] Move game logic to its own thread +The main thread should be reserved for running the game loop, +processing the input queue, and processing the render queue. +** TODO [#A] Switch from OpenAL to SDL2 audio +I've decided that OpenAL is too high level to be a library that +Chickadee should rely upon, since part of the goal of Chickadee is to +implement as much as possible in Scheme and only resort to C if +absolutely necessary. OpenAL will also make it more difficult to ship +games on the web using Web Audio when Hoot is ready (no I am not going +to compile OpenAL with emscripten.) Instead, we can use SDL2's +cross-platform audio API and implement all the audio mixing directly +in Scheme in a dedicated audio thread. ** TODO [#A] Improve error messages in sprite-batch-add! =sprite-batch-add!= throws an error if it is called before =sprite-batch-clear!= maps the GPU memory, but the error message @@ -6,21 +50,30 @@ doesn't mean anything to users. Also, make sure the docs explain why you need to clear first. Consider renaming =sprite-batch-clear!= to =sprite-batch-begin!= while you're at it. Explain the difference between capacity and size. -** TODO [#A] Remove allocations in hot code paths +** TODO [#A] Bug: Bundled games don't close properly? +The window goes black but doesn't close. Closing the window again +actually closes it. +** TODO [#B] Remove allocations in hot code paths - [ ] hash-for-each causes closure allocation in at least the shader, text, and audio modules - [ ] call-with-error-handling in (chickadee game-loop) allocates closures and is called twice per loop iteration. -** TODO [#A] Bug: Vertical line rendering not working +** TODO [#B] Bug: Vertical line rendering not working Vertical lines are invisible. Not great! -** TODO [#A] Scheme -> GLSL compiler -Like CL's varjo but for Guile. Start with a simple sexp -> GLSL -serializer. +** TODO [#B] The Seagull Shading Language +Like CL's varjo but for Scheme! The goal here is to stop exposing +GLSL to users. For one thing, GLSL sucks to write when you're a +Lisper. If you want to embed a shader in a Scheme module, it has to +be in a gross multi-line string literal. It also tightly couples +Chickadee to OpenGL, but ideally we want to be graphics API agnostic. +By using a Schemey shader language we get something that composes well +with regular Scheme code while also opening up the possibility of +targetting modern graphics APIs in the future. Goals: - Scheme-like syntax - Embeddable within Scheme source files -- Compiles to GLSL during regular Guile compilation +- Compiles to GLSL (for now) - Clean interface for passing data from Scheme to shaders - Implicit returns in tail position (no 'return' keyword) - Everything is an expression @@ -28,8 +81,7 @@ Goals: - Understands built-in shader stage variables - See: https://www.khronos.org/opengl/wiki/Built-in_Variable_(GLSL) - Macros -- Nested functions if they are hoistable (no free variables aka not - closures) +- Nested functions if they don't form closures - Shader libraries for reusing and composing code #+BEGIN_SRC scheme @@ -43,45 +95,37 @@ Goals: (define (sprite-fragment (vec2 ))) #+END_SRC - -** TODO [#A] Ditch the readline dependency +** TODO [#B] Uniform buffers +Need some way to support these while falling back to the current, slow +way that is compatible with OpenGL 2.1. +** TODO [#B] Ditch the readline dependency Figure out how to get back to using Guile's built-in REPL for =chickadee play= so the custom can go away. Readline is hard to make work in an async manner. -** TODO [#B] Bundled games don't close properly? -The window goes black but doesn't close. Closing the window again -actually closes it. -** TODO [#B] REPL meta-command for rendering to an image file -=,render-image= or something. Use a throwaway framebuffer to render -arbitrary stuff to a texture and then save it as a PNG. ** TODO [#B] Bug: Framebuffer stencil issues Render a vector path to a framebuffer and you'll notice that the first filled path doesn't show up. Why is this?? ** TODO [#B] Framebuffer multisampling Requires creating multisampled texture. -** TODO [#B] Multiple threads -SDL2 operates on the main thread, so that will control the game loop -and rendering. OpenAL is already using its own thread for audio. So, -what's needed is another thread for managing game state and some -number of generic worker threads to offload things like loading data -from the file system. Of course, this complicates things -significantly, so the API will have to be carefully designed to do all -the thread synchronization right so the user doesn't have to think -about it. Should I add a dependency on guile-fibers?? -** TODO [#B] Texture fills for vector paths -** TODO [#B] Even-odd rule fills for vector paths -Right now only the non-zero rule is supported. -** TODO [#B] Add shear transformations to vector paths -** TODO [#B] Dashed lines for stroked vector paths -** TODO [#B] Mitered corners for stroked vector paths -** TODO [#B] Text rendering for vector paths ** TODO [#B] Add screenshots to manual -** TODO [#B] Improve particle system +** TODO [#C] Add shear transformations to vector paths +** TODO [#C] Dashed lines for stroked vector paths +** TODO [#C] Mitered corners for stroked vector paths +** TODO [#C] Even-odd rule fills for vector paths +Right now only the non-zero rule is supported. +** TODO [#C] Reverse winding order for vector paths +** TODO [#C] Text rendering for vector paths +** TODO [#C] Texture fills for vector paths +** TODO [#C] Improve particle system Allow more settings to be modified. Add angular velocity. Auto-expand to hold all particles rather than setting a hard cap upfront. -** TODO [#B] Support loading fonts from system font cache +** TODO [#C] Support loading fonts from system font cache +** TODO [#C] REPL meta-command for rendering to an image file +=,render-image= or something. Use a throwaway framebuffer to render +arbitrary stuff to a texture and then save it as a PNG. + ** TODO [#C] Rename array-list-size to array-list-length ** TODO [#C] Bug: Bounding boxes for stroked paths are too small Not sure how to fix right now but the bounding boxes are too small @@ -89,25 +133,13 @@ because they only account for the points within a path, not the thickness of the line, the length of the miters in a polyline, or the end caps. ** TODO [#C] Shader cache in ~/.cache/chickadee? -** TODO [#C] Switch from OpenAL to custom Scheme mixer -I've decided that OpenAL is too high level to be a library that -Chickadee should rely upon, since part of the goal of Chickadee is to -implement as much as possible in Scheme and only resort to C if -absolutely necessary. Instead, we can use SDL2's cross-platform audio -API and implement all the audio mixing directly in Scheme. ** TODO [#C] Binary bundles for MacOS -** TODO [#C] GPU pipeline data structure -Like this: https://reader.tymoon.eu/article/363 ** TODO [#C] 2D physics simulation Add bindings for the chipmunk library or implement a rigid body simulator in Scheme. ** TODO [#C] Multiplayer networking Take a look at Xelf's UDP networking code and https://gafferongames.com/categories/building-a-game-network-protocol/ -** TODO [#C] Render command queue processing -To replace existing immediate mode rendering -** TODO [#C] Uniform buffers -Need some way to support these while falling back to the current, slow -way that is compatible with OpenGL 2.1. + ** TODO [#C] Signed distance field font rendering ** TODO [#C] Physically-based ambient lighting The PBR shader currently does image based ambient lighting in a very -- cgit v1.2.3