No-op backend, for application logic + validation testing #5236
Labels
area: api
Issues related to API surface
area: tests
Improvements or issues with our test suite
type: enhancement
New feature or request
Is your feature request related to a problem? Please describe.
I'd like to be able to write
#[test]
s for code that manages one or morewgpu
objects, without needing to make the test conditional on the presence of a GPU or software render driver.Describe the solution you'd like
I'd like a way to create a
Device
andQueue
that always succeeds, and the resulting device would always allow creating objects such asTexture
s (subject to wgpu validation checks), but where all operations that would read the results of computations (i.e. mapping buffers for read) always fail since they have no real implementation. Perhaps this would look like a special backend bit to pass towgpu::Instance::new()
.Tests written using this mechanism would be able to test that the application code succeeds on all CPU-side matters while ignoring the GPU state, and also that it does not trigger any
wgpu
validation errors.Describe alternatives you've considered
An alternative approach to this problem would be a software renderer backend that's an optional dependency of
wgpu
(rather than being an OS driver that might be absent), but while that would be nifty, it's more than we need here.In individual cases, the application code could be modified to allow skipping all
wgpu
operations, but that would often be awkward and require providing alternative data storage used only for testing (e.g. forTexture::size()
).#2291 "Add a Dummy backend" is similar, but if I understand correctly, is asking only for a way to compile applications with no backends (presumably
Instance::request_adapter()
would always fail). This feature would subsume that feature.The text was updated successfully, but these errors were encountered: