Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set max_memory_allocation_size via PhysicalDeviceMaintenance3Properties #3567

Merged
merged 6 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ By @teoxoy in [#3534](https://github.com/gfx-rs/wgpu/pull/3534)

- Improve format MSAA capabilities detection. By @jinleili in [#3429](https://github.com/gfx-rs/wgpu/pull/3429)
- Fix surface view formats validation error. By @jinleili in [#3432](https://github.com/gfx-rs/wgpu/pull/3432)
- Set `max_memory_allocation_size` via `PhysicalDeviceMaintenance3Properties`. By @jinleili in [#3567](https://github.com/gfx-rs/wgpu/pull/3567)

### Bug Fixes

Expand Down
12 changes: 11 additions & 1 deletion wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ impl PhysicalDeviceFeatures {
pub struct PhysicalDeviceCapabilities {
supported_extensions: Vec<vk::ExtensionProperties>,
properties: vk::PhysicalDeviceProperties,
maintenance_3: vk::PhysicalDeviceMaintenance3Properties,
jinleili marked this conversation as resolved.
Show resolved Hide resolved
descriptor_indexing: Option<vk::PhysicalDeviceDescriptorIndexingPropertiesEXT>,
driver: Option<vk::PhysicalDeviceDriverPropertiesKHR>,
/// The effective driver api version supported by the physical device.
Expand Down Expand Up @@ -798,6 +799,7 @@ impl super::InstanceShared {
|| capabilities.supports_extension(vk::KhrDriverPropertiesFn::name());

let mut builder = vk::PhysicalDeviceProperties2KHR::builder();
builder = builder.push_next(&mut capabilities.maintenance_3);
teoxoy marked this conversation as resolved.
Show resolved Hide resolved

if supports_descriptor_indexing {
let next = capabilities
Expand Down Expand Up @@ -1338,9 +1340,17 @@ impl super::Adapter {
let mem_allocator = {
let limits = self.phd_capabilities.properties.limits;
let config = gpu_alloc::Config::i_am_prototyping(); //TODO
let max_memory_allocation_size = self
.phd_capabilities
.maintenance_3
.max_memory_allocation_size;
let properties = gpu_alloc::DeviceProperties {
max_memory_allocation_count: limits.max_memory_allocation_count,
max_memory_allocation_size: u64::max_value(), // TODO
max_memory_allocation_size: if max_memory_allocation_size > 0 {
max_memory_allocation_size
} else {
u64::max_value()
},
non_coherent_atom_size: limits.non_coherent_atom_size,
memory_types: memory_types
.iter()
Expand Down