Skip to content

Commit

Permalink
Fixup test problems on different backends, and fixup stub of web.rs d…
Browse files Browse the repository at this point in the history
…evice_lose.
  • Loading branch information
bradwerth committed Sep 21, 2023
1 parent e1f3d7c commit 2feef8f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions tests/tests/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,28 @@ fn device_lose_then_more() {
height: 512,
depth_or_array_layers: 1,
};
let texture = ctx.device.create_texture(&wgpu::TextureDescriptor {
let texture_for_view = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
size: texture_extent,
mip_level_count: 2,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rg8Uint,
usage: wgpu::TextureUsages::COPY_SRC | wgpu::TextureUsages::COPY_DST,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
view_formats: &[],
});
let target_view = texture_for_view.create_view(&wgpu::TextureViewDescriptor::default());

let target_view = texture.create_view(&wgpu::TextureViewDescriptor::default());
let texture_for_write = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
size: texture_extent,
mip_level_count: 2,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rg8Uint,
usage: wgpu::TextureUsages::COPY_DST,
view_formats: &[],
});

// Create some buffers.
let buffer_source = ctx.device.create_buffer(&wgpu::BufferDescriptor {
Expand Down Expand Up @@ -176,7 +186,7 @@ fn device_lose_then_more() {
// Texture clear should fail.
fail(&ctx.device, || {
encoder_for_clear.clear_texture(
&texture,
&texture_for_write,
&wgpu::ImageSubresourceRange {
aspect: wgpu::TextureAspect::All,
base_mip_level: 0,
Expand Down Expand Up @@ -224,7 +234,7 @@ fn device_lose_then_more() {
bytes_per_row: Some(4),
rows_per_image: None,
},
}, texture.as_image_copy(), texture_extent);
}, texture_for_write.as_image_copy(), texture_extent);
});
})
}
2 changes: 1 addition & 1 deletion wgpu/src/backend/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ impl crate::context::Context for Context {
// Device is dropped automatically
}

fn device_lose(&self, _device: &Self::DeviceId, device_data: &Self::DeviceData) {
fn device_lose(&self, _device: &Self::DeviceId, _device_data: &Self::DeviceData) {
// TODO: figure out the GPUDevice implementation of this.
}

Expand Down

0 comments on commit 2feef8f

Please sign in to comment.