Remove unnecessary create_buffer_init for uniforms

This commit is contained in:
Héctor Ramón Jiménez 2020-08-27 19:28:03 +02:00
parent b689778ed9
commit 3eb63762c7
2 changed files with 12 additions and 16 deletions

View File

@ -78,16 +78,12 @@ impl Pipeline {
],
});
let uniforms = Uniforms {
transform: Transformation::identity().into(),
};
let uniforms_buffer =
device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: None,
contents: uniforms.as_bytes(),
usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST,
});
let uniforms_buffer = device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: mem::size_of::<Uniforms>() as u64,
usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST,
mapped_at_creation: false,
});
let constant_bind_group =
device.create_bind_group(&wgpu::BindGroupDescriptor {

View File

@ -34,12 +34,12 @@ impl Pipeline {
}],
});
let constants_buffer =
device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: None,
contents: Uniforms::default().as_bytes(),
usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST,
});
let constants_buffer = device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: mem::size_of::<Uniforms>() as u64,
usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST,
mapped_at_creation: false,
});
let constants = device.create_bind_group(&wgpu::BindGroupDescriptor {
label: None,