mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
refactor: vertex_index_common
: use size_of_val
instead of magic number
This commit is contained in:
parent
764b15a556
commit
5c29ad548b
@ -8,7 +8,6 @@ use std::{num::NonZeroU64, ops::Range};
|
|||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use strum::IntoEnumIterator;
|
use strum::IntoEnumIterator;
|
||||||
use wgpu::util::{BufferInitDescriptor, DeviceExt, RenderEncoder};
|
use wgpu::util::{BufferInitDescriptor, DeviceExt, RenderEncoder};
|
||||||
|
|
||||||
use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext};
|
use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext};
|
||||||
use wgt::RenderBundleDescriptor;
|
use wgt::RenderBundleDescriptor;
|
||||||
|
|
||||||
@ -379,7 +378,7 @@ async fn vertex_index_common(ctx: TestingContext) {
|
|||||||
|
|
||||||
let expected = test.expectation(&ctx);
|
let expected = test.expectation(&ctx);
|
||||||
|
|
||||||
let buffer_size = 4 * expected.len() as u64;
|
let buffer_size = (std::mem::size_of_val(&expected[0]) * expected.len()) as u64;
|
||||||
let cpu_buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor {
|
let cpu_buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor {
|
||||||
label: None,
|
label: None,
|
||||||
size: buffer_size,
|
size: buffer_size,
|
||||||
|
Loading…
Reference in New Issue
Block a user