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

Error in Default for AllocatorCreateInfo #42

Closed
pmathia0 opened this issue Nov 26, 2020 · 4 comments
Closed

Error in Default for AllocatorCreateInfo #42

pmathia0 opened this issue Nov 26, 2020 · 4 comments

Comments

@pmathia0
Copy link

rust 1.46.0 works fine

 let allocator_info = vk_mem::AllocatorCreateInfo {
            physical_device: base._gpu.unwrap(),
            device: device.clone(),
            instance: base.instance.clone(),
            frame_in_use_count: 2u32,
            ..Default::default()
};

latest rust 1.48.0 fails: attempted to zero-initialize type ash::Device, which is invalid
specifying all fields in allocator_info and avoiding default solves the problem, so I suppose somethings wrong in default implementation
vk_mem 0.2.2
ash 0.31.0
Windows 10

@aloucks
Copy link
Contributor

aloucks commented Nov 28, 2020

It's fixed in #39 but there has not yet been a new release.

@gwihlidal
Copy link
Owner

Thanks - I've been incredibly busy lately and I'd like to push a new release with all of this, but master doesn't seem to be building right now. If someone could fix it I could push a release, or it'll need to wait until I can find some time to look into it.

@hoj-senna
Copy link

Many thanks for the fix, and for vk-mem-rs in the first place.

but master doesn't seem to be building right now.

I was able to avoid this building problem by changing '#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1' to '#define VMA_DYNAMIC_VULKAN_FUNCTIONS 0' in line 4021 of vk_mem_alloc.h. — That file is part of VulkanMemoryAllocator, not of vk-mem-rs; and I don't know what/how much this change would break. (I just wanted to mention it in case this helps.)

@matthewjberger
Copy link
Contributor

matthewjberger commented Jan 27, 2021

@hoj-senna We can achieve that by adding

build.define("VMA_DYNAMIC_VULKAN_FUNCTIONS", "0");

to the build.rs in this repo.

FWIW I cloned this repo in my renderer project and linked against it with a relative path. The build succeeded but there were linker errors at runtime. Adding the line above prevented the linker errors and my project was running correctly after that.

From the VMA docs it looks like that setting does this:

Third, VMA tries to fetch remaining pointers that are still null by calling vkGetInstanceProcAddr and vkGetDeviceProcAddr on its own. If you want to disable this feature, set configuration macro: #define VMA_DYNAMIC_VULKAN_FUNCTIONS 0.

I can open a quick pr to add this line to the build.rs, as it got my renderer working again after updating my rust version.

Good catch!

gwihlidal added a commit that referenced this issue Feb 14, 2021
Define VMA_DYNAMIC_VULKAN_FUNCTIONS as 0. Closes #42.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants