mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
refactor: fully qual. size_of
usage (#6401)
This commit is contained in:
parent
91447aefc9
commit
2b15a2b24b
@ -1,6 +1,6 @@
|
|||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
use nanorand::{Rng, WyRand};
|
use nanorand::{Rng, WyRand};
|
||||||
use std::{borrow::Cow, mem};
|
use std::{borrow::Cow, mem::size_of};
|
||||||
use wgpu::util::DeviceExt;
|
use wgpu::util::DeviceExt;
|
||||||
use winit::{
|
use winit::{
|
||||||
event::{ElementState, KeyEvent},
|
event::{ElementState, KeyEvent},
|
||||||
@ -164,7 +164,7 @@ impl crate::framework::Example for Example {
|
|||||||
ty: wgpu::BindingType::Buffer {
|
ty: wgpu::BindingType::Buffer {
|
||||||
ty: wgpu::BufferBindingType::Uniform,
|
ty: wgpu::BufferBindingType::Uniform,
|
||||||
has_dynamic_offset: false,
|
has_dynamic_offset: false,
|
||||||
min_binding_size: wgpu::BufferSize::new(mem::size_of::<Globals>() as _),
|
min_binding_size: wgpu::BufferSize::new(size_of::<Globals>() as _),
|
||||||
},
|
},
|
||||||
count: None,
|
count: None,
|
||||||
},
|
},
|
||||||
@ -195,7 +195,7 @@ impl crate::framework::Example for Example {
|
|||||||
ty: wgpu::BindingType::Buffer {
|
ty: wgpu::BindingType::Buffer {
|
||||||
ty: wgpu::BufferBindingType::Uniform,
|
ty: wgpu::BufferBindingType::Uniform,
|
||||||
has_dynamic_offset: true,
|
has_dynamic_offset: true,
|
||||||
min_binding_size: wgpu::BufferSize::new(mem::size_of::<Bunny>() as _),
|
min_binding_size: wgpu::BufferSize::new(size_of::<Bunny>() as _),
|
||||||
},
|
},
|
||||||
count: None,
|
count: None,
|
||||||
}],
|
}],
|
||||||
@ -337,7 +337,7 @@ impl crate::framework::Example for Example {
|
|||||||
resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
|
resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
|
||||||
buffer: &local_buffer,
|
buffer: &local_buffer,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
size: wgpu::BufferSize::new(mem::size_of::<Bunny>() as _),
|
size: wgpu::BufferSize::new(size_of::<Bunny>() as _),
|
||||||
}),
|
}),
|
||||||
}],
|
}],
|
||||||
label: None,
|
label: None,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
use std::mem;
|
use std::mem::size_of;
|
||||||
use wgpu::util::DeviceExt;
|
use wgpu::util::DeviceExt;
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
@ -70,7 +70,7 @@ impl<const SRGB: bool> crate::framework::Example for Example<SRGB> {
|
|||||||
_queue: &wgpu::Queue,
|
_queue: &wgpu::Queue,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
// Create the vertex and index buffers
|
// Create the vertex and index buffers
|
||||||
let vertex_size = mem::size_of::<Vertex>();
|
let vertex_size = size_of::<Vertex>();
|
||||||
let (vertex_data, index_data) = create_vertices();
|
let (vertex_data, index_data) = create_vertices();
|
||||||
|
|
||||||
let vertex_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
let vertex_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||||
|
Loading…
Reference in New Issue
Block a user