Skip to content

v0.5.1

Pre-release
Pre-release

Choose a tag to compare

@mkeeter mkeeter released this 27 Sep 18:52
· 7 commits to main since this release
174d3db

The most significant change in this version is unlocking all-GPU rendering: we can start with a shape on the CPU, then perform a full rendering pipeline (including shading and post-processing) entirely on the GPU. The APIs were codesigned along with Halfspace, with a goal of moving its heavy work to the GPU for native-equivalent performance on the web.

As such, this release includes many changes to fidget::wgpu, which I break out into a separate section below. It also includes a bunch of other changes!

  • In fidget::raster, reorganize RenderConfig to separate out the render settings (transform, size, etc) from evaluation settings (thread count, cancellation, etc); the latter are now in a new EvalConfig.
  • Add z to fidget::raster::pixel::RenderConfig to set the Z evaluation level
  • Move PartialEq implementation from Tree to TreeOp; switch to OrderedFloat semantics so that pointer comparisons are valid. Previously, the Eq implementation on Tree was invalid (due to non-reflexive NaN comparisons), but it's now fixed.
  • Add a Hash implementation to Tree and TreeOp, again using OrderedFloat semantics. This allows trees to be stored in hashmaps; thanks to @virtualritz for the suggestion!
  • Move more VM functions onto Grad and Interval (out of the VM implementation); add a FloatExt trait which adds them to f32 as well.
  • Fix a JIT bug in the gradient evaluator on Windows, where we assumed that input &[Grad] slices were aligned to 16 bytes. This caused a Access Violation error code when running the JITted function (0xC0000005).
  • Add fast path for interval trigonometry functions when lower == upper
  • Add new rand and mix opcodes, which can be used for deterministic pseudo-random number generation. There are also examples of single-octave and multi-octave Perlin noise in the repository showing how these can be used.
  • Switch to using f32 everywhere. Fidget's evaluators always used f32 internally, but other components (e.g. constants in a Context) were f64. Using f32 everywhere makes this more consistent, and lets us remove a bunch of annoying workarounds (e.g epsilons scattered throughout the evaluator test suite).
    • As a side effect, the evaluator test suite now confirms that evaluators agree exactly with the canonical operator definition. This required removing the JIT implementation for modulo, which was not exactly in agreement with the non-JIT implementation.

fidget::wgpu changes

This section may not be all-inclusive; sorry! I did warn you that fidget::wgpu was "even more experimental than the rest of Fidget"!.

  • fidget::wgpu now uses the RenderConfig type from fidget::raster instead of its own, slightly-different RenderConfig. This was, in fact, the motivation for the reorganization!
    • Render size in fidget::wgpu::voxel is now set by the RenderConfig, instead of by the Buffers object. This means that buffers are generated without a size, and resized when passed to render functions. Functions which do resizing have a new possible error variant if the render size is too large for WGPU buffers.
    • Removed size from many buffer construction functions in fidget::wgpu::voxel, since they're resized when used in evaluation.
    • Add fidget::wgpu::buf::DepthImageBuffer, which is a flexible image buffer taking a VoxelSize (so that it preserves depth).
  • Add fidget::wgpu::pixel module for 2D rasterization on the GPU. This is sometimes slower than the CPU evaluator for very complex expressions, but is blazingly fast for simpler expressions. Plus, it allows for an all-GPU evaluation architecture when embedding Fidget into other applications.
    • The fidget::wgpu::pixel::effects module is also new; it includes merging and color evaluation for 2D images.
  • Move fidget_wgpu::effects to fidget_wgpu::voxel::effects
  • Add evaluation of per-pixel colors to fidget_wgpu::voxel::effects; see fidget_wgpu::voxel::effects::Context::submit_color as the main entry point.
    • Move ShapeColorBuffers construction to top-level Gpu object
  • VarMap now implements Debug
  • VarMap::has_free_vars checks whether there are non-XYZ vars in the map
  • RawDistancePixel now implements zerocopy::IntoBytes
  • Restored RawDistancePixel::distance to get a distance value; it's now a simple Option<f32> (not the previous weird Result<f32, PixelFill>).
  • submit* functions in WebGPU voxel rendering no longer take an optional out parameter; callers should instead use Gpu::copy and Gpu::map (along with Gpu::read_buffer_for to generate the host-readable buffer)
  • More reorganization of fidget::wgpu buffer APIs
  • Remove timestamps from fidget::wgpu pixel and voxel rendering; they will come back in a new form at some point in the future
  • Make RenderShape not store GPU objects, so it can be constructed independently through RenderShape::new (and shared between threads).
  • Similarly, make ShapeColorBuffers not store GPU objects, so it can be constructed independently through ShapeColorBuffers::new (and shared between threads).
  • Rename the workspace buffer objects from Buffers to Workspace (e.g. fidget::wgpu::voxel::Buffers) to more clearly reflect their usage.
  • Bump to wgpu 30.0.1