Skip to content

Lots of pre-release API changes and fixes#318

Merged
kvark merged 2 commits intomainfrom
claude/nvidia-prime-investigation-wUmwH
Mar 21, 2026
Merged

Lots of pre-release API changes and fixes#318
kvark merged 2 commits intomainfrom
claude/nvidia-prime-investigation-wUmwH

Conversation

@kvark
Copy link
Copy Markdown
Owner

@kvark kvark commented Mar 21, 2026

Blade 0.8 API improvements

Summary

  • Unify PlatformError into a single opaque type shared across all backends (Vulkan, Metal, GLES)
  • Add ComputePipelineBase trait with get_workgroup_size() for backend-agnostic compute pipeline usage
  • Various API ergonomics improvements for crate release (error trait impls, Buffer::size(), memory_stats())
  • Update changelog for 0.8 release

Changes

Unified PlatformError — Replaces per-backend error types (enum on Vulkan/EGL, type = () on Metal/Web) with a single opaque PlatformError(String) in lib.rs. Provides loading() and init() constructors that accept any Debug type, and implements Display + Error.

ComputePipelineBase trait — Adds get_workgroup_size() -> [u32; 3] to a trait bound on ShaderDevice::ComputePipeline, making it available in generic code. Uses #[hidden_trait::expose] so concrete backend types retain inherent method access.

API improvements for releaseBuffer::size(), Context::memory_stats(), Error trait impls on NotSupportedError/PlatformError, and ergonomic updates across examples and downstream crates (blade-egui, blade-render, blade-util).

Test plan

  • Compiles with no errors or warnings
  • Run cargo test across workspace
  • Verify examples still work on Vulkan and Metal backends

claude added 2 commits March 21, 2026 18:10
- Change `wait_for` to return `Result<bool, DeviceError>` (#285)
  Distinguishes timeout (Ok(false)) from device lost (Err) across
  all three backends (Vulkan, Metal, GLES).

- Add `memory_stats()` API with VK_EXT_memory_budget support (#61)
  Reports device-local VRAM budget and usage on Vulkan,
  uses MTLDevice properties on Metal, returns defaults on GLES.

- Set VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT on depth+stencil textures (#283)
  Allows creating texture views with different compatible formats
  (e.g. Depth32Float view of Depth32FloatStencil8Uint texture).

- Handle surface acquire errors gracefully (#290)
  Replace panic on unexpected vkAcquireNextImageKHR errors with
  log + empty frame, matching the existing OUT_OF_DATE handling.

- Add debug bounds check to BufferPiece::data() (#260)
  debug_assert that offset doesn't exceed buffer size.

- Add Buffer::size() accessor to all backends
  GLES already had the field; added to Vulkan and Metal.

- Implement Display + Error for NotSupportedError and DeviceError

https://claude.ai/code/session_01W9jSvpnbXEXmoHFuUVFdUN
- Unify PlatformError into a single opaque struct across all backends,
  replacing per-backend enum/type-alias definitions. This makes error
  handling consistent regardless of compilation target.

- Add ComputePipelineBase trait with get_workgroup_size(), exposed via
  hidden_trait on all backends so generic code can query workgroup size.

- Add changelog entries for all 0.8 API changes.

https://claude.ai/code/session_01W9jSvpnbXEXmoHFuUVFdUN
@kvark kvark merged commit c0e8aa0 into main Mar 21, 2026
12 checks passed
@kvark kvark deleted the claude/nvidia-prime-investigation-wUmwH branch March 21, 2026 18:22
@kvark kvark mentioned this pull request Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants