In the Rust ash library, I can create this: let surfaceloader =…
- User
In the Rust ash library, I can create this:
let surface_loader = ash::khr::surface::Instance::new(&vulkan_entry, &vulkan_instance);Is this something I should just create one of, or should I just create it on a as-needed basis?
- Assistant
In Rust, when working with the
ashlibrary for Vulkan, the creation of objects likesurface_loaderdepends on the intended usage and the overhead of creating them.The
surface_loaderin your code is essentially a loader for interacting with the Vulkan surface extension. Given that Vulkan is a low-level API, resource management and performance considerations are important. Here are some guidelines for deciding how to manage this object: - User
Is surface_loader a good name for it?
- Assistant
Naming in code can significantly impact readability and maintainability, so it's great that you're considering whether
surface_loaderis an appropriate name. Here are a few considerations to help you decide:-
Descriptiveness:
- The name should clearly convey the role or functionality of the object. The term
surface_loadersuggests that the object is responsible for "loading" or managing Vulkan surfaces, which is accurate in this context.
- The name should clearly convey the role or functionality of the object. The term
-