diff options
Diffstat (limited to 'adapters/fparkan-render-vulkan/src/ffi')
| -rw-r--r-- | adapters/fparkan-render-vulkan/src/ffi/resources.rs | 2 | ||||
| -rw-r--r-- | adapters/fparkan-render-vulkan/src/ffi/smoke.rs | 2 | ||||
| -rw-r--r-- | adapters/fparkan-render-vulkan/src/ffi/smoke_types.rs | 12 |
3 files changed, 8 insertions, 8 deletions
diff --git a/adapters/fparkan-render-vulkan/src/ffi/resources.rs b/adapters/fparkan-render-vulkan/src/ffi/resources.rs index b7e84bd..1d38503 100644 --- a/adapters/fparkan-render-vulkan/src/ffi/resources.rs +++ b/adapters/fparkan-render-vulkan/src/ffi/resources.rs @@ -236,7 +236,7 @@ pub(super) fn create_static_mesh_index_buffer( device: &VulkanLogicalDeviceProbe, mesh: &VulkanStaticMesh, ) -> Result<VulkanAllocatedBuffer, VulkanSmokeRendererError> { - let mut bytes = Vec::with_capacity(mesh.indices.len() * std::mem::size_of::<u16>()); + let mut bytes = Vec::with_capacity(mesh.indices.len() * std::mem::size_of::<u32>()); for &index in &mesh.indices { bytes.extend_from_slice(&index.to_ne_bytes()); } diff --git a/adapters/fparkan-render-vulkan/src/ffi/smoke.rs b/adapters/fparkan-render-vulkan/src/ffi/smoke.rs index 63066b4..f7c72b6 100644 --- a/adapters/fparkan-render-vulkan/src/ffi/smoke.rs +++ b/adapters/fparkan-render-vulkan/src/ffi/smoke.rs @@ -701,7 +701,7 @@ impl VulkanSmokeRenderer { command_buffer, self.index_buffer_ref()?.buffer, 0, - vk::IndexType::UINT16, + vk::IndexType::UINT32, ); let clip_from_world = matrix_bytes(self.camera.clip_from_world); device.device().cmd_push_constants( diff --git a/adapters/fparkan-render-vulkan/src/ffi/smoke_types.rs b/adapters/fparkan-render-vulkan/src/ffi/smoke_types.rs index 47cab7d..2ca517b 100644 --- a/adapters/fparkan-render-vulkan/src/ffi/smoke_types.rs +++ b/adapters/fparkan-render-vulkan/src/ffi/smoke_types.rs @@ -126,7 +126,7 @@ pub struct VulkanStaticMesh { /// Vertex data in pipeline order. pub vertices: Vec<VulkanStaticVertex>, /// Triangle-list indices into [`Self::vertices`]. - pub indices: Vec<u16>, + pub indices: Vec<u32>, /// Source-preserving triangle draw ranges in [`Self::indices`]. pub draw_ranges: Vec<VulkanStaticDrawRange>, } @@ -296,11 +296,11 @@ impl VulkanStaticMesh { if usize::try_from(expected_first).ok() != Some(self.indices.len()) { return Err("static mesh draw ranges must cover all indices"); } - if self - .indices - .iter() - .any(|&index| usize::from(index) >= self.vertices.len()) - { + if self.indices.iter().any(|&index| { + usize::try_from(index) + .ok() + .is_none_or(|index| index >= self.vertices.len()) + }) { return Err("static mesh index exceeds vertex count"); } Ok(()) |
