Skip to content

v0.5.0

Pre-release
Pre-release

Choose a tag to compare

@mkeeter mkeeter released this 03 Aug 14:22
· 49 commits to main since this release
5b59722

This is a large release with a bunch of small features, reorganization, and one big new crate (fidget-wgpu, re-exported as fidget::wgpu). The goal of fidget::wgpu is to perform all pixel-processing operations on the GPU, including both rasterization (function evaluation) and shading. Right now, the crate has building blocks for voxel rendering; pixel rendering is coming in a subsequent release. Expect the APIs to change shape as I actually try to use them in an application.

  • Big reorganization of fidget::raster
    • render2d and render3d modules are renamed to pixel and voxel, respectively
    • ImageRenderConfig and VoxelRenderConfig are both renamed to RenderConfig (in different namespaces)
    • Similarly, each namespace contains an Image and RenderSize type definition. voxel::Image replaces GeometryBuffer; pixel::Image is equivalent to fidget::raster::Image<DistancePixel> in the previous code (but see the next point about renaming!)
    • Renamed DistancePixel to RawDistancePixel; added an unpacked enum DistancePixel (instead of using Result<f32, PixelFill> as a weird Either type
    • The tile sizes member of RenderConfig is now optional and will fall back to the evaluator's tile size if not populated
      • This adds a F: RenderHints trait bound for many functions in fidget::raster
  • Add Image::build function to build an image from a Vec<T> and ImageSizeLike, returning an error if the data size is incorrect.
  • Revamping fidget-bytecode
    • Reserve register u8::MAX to represent an inline immediate
    • Remove separate opcodes, e.g. SubRegReg, SubRegImm, and SubImmReg now all generate BytecodeOp::Sub (using the reserved register as needed for immediates).
    • This also removes the enum RegOpDiscriminants from fidget_core
    • reg_count and mem_count are now counts (rather than "highest value")
  • Add PartialEq for GeometryPixel
  • Major refactoring of error types
    • fidget::Error is removed in favor of fine-grained error types
    • The error type for a function now represents all of the errors that it can return (and no others)
    • All errors still implement standard error traits, so application-level code using anyhow (or similar) may not need to change
  • Fix a bug in bulk evaluator argument checks where mismatched slices could be allowed under some circumstances
  • Add VmData::asm to get an immutable reference to the inner RegTape
  • Add RegTape::repack_map and RegTape::repack to repack registers by frequency (making register 0 the most frequently used, etc)
  • Add RegOp::visit_regs and RegOp::visit_regs_mut to visit registers in an operation
  • Add fidget-wgpu crate
    • This is even more experimental than the rest of Fidget!
    • There are two user-facing modules: voxel does voxel rasterization (depth and normal), and effects does raster effects (e.g. shading)
    • More to come (e.g. RGB evaluation and pixel / 2D rasterization)
  • Add VarMap::iter to iterate over (var, index) tuples
  • Simplified Shape, which was doing too much
    • It no longer has its own transform matrix; bring your own to the evaluation functions (with new eval_with_transform flavors)
    • It no longer supports custom axes; it now always uses Var::{X, Y, Z}
    • Other tweaks to shape evaluation functions: eval_v is now eval_with_vars, and there's a separate eval_with_transform (along with eval_with_transform_and_vars). These all return new error types too!
  • Add output_count() to Function trait
  • Add ShapeVars::check and ShapeVars::contains_key to check whether the variable map is sufficient to evaluate a particular shape.
  • Change fidget_raster and fidget_mesh functions to take a BoundShape<F>, which represents a shape and all of its associated variables. A BoundShape may be constructed using TryFrom for shapes with no variables other than X, Y, Z; otherwise, Shape::bind must be used. This removes a potential unwrap() during rendering, because evaluation requires all variables to be present.
  • Rename trait ImageSizeLike to trait RenderSize in fidget_raster; remove width and height from trait RenderConfig and add a RenderConfig: RenderSize bound
  • Improve denoising pass: back-facing normals are now removed from candidates
  • Switched GeometryPixel back to having a u32 for depth; we are planning to move more post-processing to the GPU, so it's helpful to keep pixels lossless for as long as possible.
  • Add From<VoxelSize> for ImageSize (which drops the depth value)
  • Add Image::as_bytes(), which returns the raw byte array (e.g. for saving to a file).
  • Add Image::as_slice(), which returns the raw pixel array as a slice
  • Improve fidget_raster::effects::compute_ssao
    • Fix pixel-center position (which caused a subtle bias)
    • Make noise sampling more random, eliminating cyclic patterns that led to horizontal striations
    • Correctly handle non-square images (fixing a known deficiency)
    • Use rejection sampling when building kernel and noise arrays to uniformly sample on the boundary of a unit sphere / circle (this is probably overkill, but can prevent very subtle biases)
    • Transposed ssao_kernel and ssao_noise matrices so that they can be directly uploaded to the GPU as array<array<f32, 3>> and array<vec2f> buffers respectively
  • Remove Default from fidget_raster::{voxel, pixel}::RenderConfig, because baking in a size is a questionable API choice. Added RenderConfig::from_size as a replacement, which can similarly be used as a base for constructing a semi-custom instance.