vgpu/mock1 symbolView source ↗

Symbols in this topic

createMockAdapter

createMockAdapter(options?) returns a pure-JavaScript VGPUAdapter. Its devices allocate in-memory buffers backed by Uint8Array, making core testable without Dawn or native GPU libraries.

options.features declares the optional features the mock adapter supports (its equivalent of GPUAdapter.features); it defaults to none. requestDevice rejects a requiredFeatures entry outside that set with VGPU-FEATURE-UNSUPPORTED, and — faithful to WebGPU — the created device's features holds exactly the requested features, not the adapter's full set. This lets tests exercise feature-gated code paths (e.g. "depth-clip-control") both with and without the feature granted.