Skip to content

Commit b203056

Browse files
committed
cli(wgpu): update wgpu api
1 parent 592f22d commit b203056

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

librashader-cli/src/render/wgpu.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ use std::io::{Cursor, Write};
88
use std::ops::DerefMut;
99
use std::path::Path;
1010
use std::sync::Arc;
11-
use wgpu::{Adapter, Device, Instance, Queue, Texture};
11+
use wgpu::{Adapter, Device, Instance, Queue, TexelCopyBufferInfo, Texture};
1212
use wgpu_types::{
13-
BufferAddress, BufferDescriptor, BufferUsages, CommandEncoderDescriptor, ImageCopyBuffer,
14-
ImageDataLayout, Maintain, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages,
13+
BufferAddress, BufferDescriptor, BufferUsages, CommandEncoderDescriptor, Maintain,
14+
TexelCopyBufferLayout, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages,
1515
};
1616

1717
use librashader::presets::ShaderPreset;
@@ -70,8 +70,8 @@ impl RenderTest for Wgpu {
7070
) -> anyhow::Result<image::RgbaImage> {
7171
let mut chain = FilterChain::load_from_preset(
7272
preset,
73-
Arc::clone(&self.device),
74-
Arc::clone(&self.queue),
73+
&self.device,
74+
&self.queue,
7575
Some(&FilterChainOptions {
7676
force_no_mipmaps: false,
7777
enable_cache: true,
@@ -126,20 +126,14 @@ impl RenderTest for Wgpu {
126126
});
127127

128128
for frame in 0..=frame_count {
129-
chain.frame(
130-
Arc::clone(&self.texture),
131-
&viewport,
132-
&mut cmd,
133-
frame,
134-
options.as_ref(),
135-
)?;
129+
chain.frame(&self.texture, &viewport, &mut cmd, frame, options.as_ref())?;
136130
}
137131

138132
cmd.copy_texture_to_buffer(
139133
output_tex.as_image_copy(),
140-
ImageCopyBuffer {
134+
TexelCopyBufferInfo {
141135
buffer: &output_buf,
142-
layout: ImageDataLayout {
136+
layout: TexelCopyBufferLayout {
143137
offset: 0,
144138
bytes_per_row: Some(buffer_dimensions.padded_bytes_per_row as u32),
145139
rows_per_image: None,
@@ -247,14 +241,14 @@ impl Wgpu {
247241
});
248242

249243
queue.write_texture(
250-
wgpu::ImageCopyTexture {
244+
wgpu::TexelCopyTextureInfo {
251245
texture: &texture,
252246
mip_level: 0,
253247
origin: wgpu::Origin3d::ZERO,
254248
aspect: wgpu::TextureAspect::All,
255249
},
256250
&image.bytes,
257-
wgpu::ImageDataLayout {
251+
wgpu::TexelCopyBufferLayout {
258252
offset: 0,
259253
bytes_per_row: Some(4 * image.size.width),
260254
rows_per_image: None,

0 commit comments

Comments
 (0)