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

Allocator type is quite large #159

Open
i509VCB opened this issue Mar 23, 2023 · 1 comment
Open

Allocator type is quite large #159

i509VCB opened this issue Mar 23, 2023 · 1 comment

Comments

@i509VCB
Copy link

i509VCB commented Mar 23, 2023

The allocator type is quite large. This is due to holding a ash::Device.

Summary of -Z print-type-sizes (cargo +nightly rustc -- -Z print-type-sizes):

print-type-size type: `gpu_allocator::vulkan::Allocator`: 1552 bytes, alignment: 8 bytes
print-type-size     field `.device`: 1488 bytes
print-type-size     field `.buffer_image_granularity`: 8 bytes
print-type-size     field `.memory_types`: 24 bytes
print-type-size     field `.memory_heaps`: 24 bytes
print-type-size     field `.debug_settings`: 6 bytes
print-type-size     end padding: 2 bytes

A possible solution could be to hold an ash::vk::Device handle and then load the function pointers the allocator uses.

@MarijnS95
Copy link
Member

Happy to accommodate and wrap this in an Arc as suggested in ash-rs/ash#731 (comment) - we do that internally in our codebase as well and have a device: device.as_ref().clone() with comment on AllocatorCreateDesc to duplicate the function pointers. Let's settle ash-rs/ash#731 before definitively doing so though.

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

2 participants