From 9052283645d9052ac2c9615629669d5f8a508679 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Tue, 18 Jun 2024 15:53:56 -0400 Subject: [PATCH] refactor: `vertex_index_common`: use `size_of_val` instead of magic number --- tests/tests/vertex_indices/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/tests/vertex_indices/mod.rs b/tests/tests/vertex_indices/mod.rs index 31c3701fbd..dcc2ca82f5 100644 --- a/tests/tests/vertex_indices/mod.rs +++ b/tests/tests/vertex_indices/mod.rs @@ -8,7 +8,6 @@ use std::{num::NonZeroU64, ops::Range}; use itertools::Itertools; use strum::IntoEnumIterator; use wgpu::util::{BufferInitDescriptor, DeviceExt, RenderEncoder}; - use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; use wgt::RenderBundleDescriptor; @@ -342,7 +341,7 @@ async fn vertex_index_common(ctx: TestingContext) { 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 { label: None, size: buffer_size,