aboutsummaryrefslogtreecommitdiff
path: root/flowy/src/motion/enc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'flowy/src/motion/enc.rs')
-rw-r--r--flowy/src/motion/enc.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/flowy/src/motion/enc.rs b/flowy/src/motion/enc.rs
index aa45d7b..76a2c7f 100644
--- a/flowy/src/motion/enc.rs
+++ b/flowy/src/motion/enc.rs
@@ -1,12 +1,11 @@
-use std::mem::size_of;
-
use super::{CommonBuffers, Params, RoundParams};
use bytemuck::{Pod, Zeroable};
+use std::mem::size_of;
use wgpu::{
include_wgsl, BindGroup, BindGroupDescriptor, BindGroupEntry, BindGroupLayoutDescriptor,
BindGroupLayoutEntry, BindingType, Buffer, BufferDescriptor, BufferUsages, CommandEncoder,
ComputePipeline, ComputePipelineDescriptor, Device, PipelineLayoutDescriptor, Queue,
- ShaderStages, TextureFormat, TextureSampleType, TextureViewDimension,
+ ShaderStages, TextureSampleType, TextureViewDimension,
};
pub struct MotionEncoder {
@@ -101,7 +100,7 @@ impl MotionEncoder {
BindGroupEntry {
binding: 2,
resource: wgpu::BindingResource::TextureView(
- &bufs.textures[1 - i].create_view(&Default::default()),
+ &bufs.textures[i].create_view(&Default::default()),
),
},
BindGroupEntry {
@@ -136,7 +135,7 @@ impl MotionEncoder {
}
}
- pub fn write_uniforms(&self, queue: Queue) {
+ pub fn write_uniforms(&self, queue: &Queue) {
queue.write_buffer(
&self.uniform_buffer,
0,
@@ -151,6 +150,6 @@ impl MotionEncoder {
});
cpass.set_pipeline(&self.pipeline);
cpass.set_bind_group(0, &self.bind_groups[rp.swap], &[]);
- cpass.dispatch_workgroups(params.extent.width, params.extent.height, 1);
+ cpass.dispatch_workgroups(params.blocks_x as u32, params.blocks_y as u32, 1);
}
}