From 399794e8432c4745b821aa51b1e6b4460fadc0b8 Mon Sep 17 00:00:00 2001 From: dav Date: Sun, 28 Apr 2024 10:48:54 -0700 Subject: [PATCH] Update dependencies --- Cargo.toml | 4 ++-- src/vulkan/buffer.rs | 5 +++-- src/vulkan/image.rs | 1 + src/vulkan/mod.rs | 3 ++- src/vulkan/texture.rs | 2 +- src/vulkan/vkcore.rs | 1 - 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 091184b..4b7471a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,12 +32,12 @@ pollster = "0.3" raw-window-handle = { version = "0.6.0", optional = true } # naga_translation -naga = { version = "0.12", features = ["glsl-in", "spv-in", "wgsl-in", "spv-out", "wgsl-out"], optional = true } +naga = { version = "0.19", features = ["glsl-in", "spv-in", "wgsl-in", "spv-out", "wgsl-out"], optional = true } [target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dependencies] # vulkan ash = { version = "0.37.3", optional = true } -gpu-allocator = { version = "0.21.0", optional = true } +gpu-allocator = { version = "0.25.0", optional = true } [target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies] # vulkan diff --git a/src/vulkan/buffer.rs b/src/vulkan/buffer.rs index c91db1f..386d671 100644 --- a/src/vulkan/buffer.rs +++ b/src/vulkan/buffer.rs @@ -72,7 +72,7 @@ impl VkContext { let each_size = std::mem::size_of::(); let byte_slice = unsafe { - std::slice::from_raw_parts(data.as_ptr() as *const u8, each_size * data.len()) + std::slice::from_raw_parts(data.as_ptr() as *const u8, std::mem::size_of_val(data)) }; let padded_buf = unsafe { pad_raw_slice(byte_slice, min_ubo_alignment, each_size, data.len()) }; @@ -231,7 +231,7 @@ impl VkContext { storage_type: BufferStorageType, additional_buffer_usage: vk::BufferUsageFlags, ) -> GResult<(VkBuffer, Option)> { - let buf_size = std::mem::size_of::() * data.len(); + let buf_size = std::mem::size_of_val(data); let mut staging = VkBuffer::new( &self.core.dev, @@ -300,6 +300,7 @@ impl VkBuffer { requirements, location: mem_usage, linear: true, + allocation_scheme: AllocationScheme::GpuAllocatorManaged }) .unwrap(); diff --git a/src/vulkan/image.rs b/src/vulkan/image.rs index f3225fd..1bb4248 100644 --- a/src/vulkan/image.rs +++ b/src/vulkan/image.rs @@ -52,6 +52,7 @@ impl VkImage { requirements, location: MemoryLocation::GpuOnly, linear: true, + allocation_scheme: AllocationScheme::GpuAllocatorManaged }) .unwrap(); diff --git a/src/vulkan/mod.rs b/src/vulkan/mod.rs index 568a7e9..e1398b8 100644 --- a/src/vulkan/mod.rs +++ b/src/vulkan/mod.rs @@ -2,7 +2,7 @@ use super::context::{self, *}; use super::error::{gpu_api_err, GResult, GpuError}; use ash::{extensions as vk_extensions, vk, Entry, *}; use gpu_allocator::{ - vulkan::{Allocation, AllocationCreateDesc, Allocator, AllocatorCreateDesc}, + vulkan::{Allocation, AllocationCreateDesc, AllocationScheme, Allocator, AllocatorCreateDesc}, MemoryLocation, }; use raw_window_handle::{RawDisplayHandle, RawWindowHandle}; @@ -148,6 +148,7 @@ impl VkContext { debug_settings: Default::default(), // TODO OPT: We should enable this perhaps? buffer_device_address: false, + allocation_sizes: Default::default(), }) .map_err(|e| gpu_api_err!("vulkan gpu_allocator {}", e))?; diff --git a/src/vulkan/texture.rs b/src/vulkan/texture.rs index a941e0f..ce66b92 100644 --- a/src/vulkan/texture.rs +++ b/src/vulkan/texture.rs @@ -246,7 +246,7 @@ impl VkTexture { let mut offset = 0; for data in datas.iter() { self.staging - .map_copy_data(data.as_ptr() as *const u8, data.len(), offset)?; + .map_copy_data(data.as_ptr(), data.len(), offset)?; offset += data.len(); } diff --git a/src/vulkan/vkcore.rs b/src/vulkan/vkcore.rs index 2bfcb59..38e4dbf 100644 --- a/src/vulkan/vkcore.rs +++ b/src/vulkan/vkcore.rs @@ -221,7 +221,6 @@ impl VkCore { // ## Actually Make It let dev_create = vk::DeviceCreateInfo::builder() .enabled_extension_names(&dev_extensions) - .enabled_layer_names(&layers) .enabled_features(&features) .queue_create_infos(&queues_create) .build();