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

Streamline swapchain classes #973

Closed
wants to merge 1 commit into from

Conversation

jherico
Copy link
Contributor

@jherico jherico commented Mar 10, 2024

Description

Fixes #972

Updates to Swapchain & HPPSwapchain

  • Eliminate the surface_formats and preset_modes which are only ever used during the swapchain creation in the constructor
  • Eliminate the image_usage_flags member in favor of the SwapchainProperties/HPPSwapchainProperties image_usage member
  • Redefine all constructors in terms of a private constructor that accepts a ``SwapchainProperties/HPPSwapchainProperties` parameter
  • Convert SwapchainProperties::image_usage from VkImageUsageFlags to std::set<VkImageUsageFlagBits>
    • I'd have preferred to leave it and use VkImageUsageFlags everywhere in the C bindings code, but then all the overloaded constructors and downstream members can't distinguish between VkImageUsageFlags and uint32_t. This isn't a problem in the C++ bindings because vk::ImageUsageFlags isn't the same fundamental type as uint32_t.

Other files

  • Updated HPPApiVulkanSample and HPPRenderContext swapchain utility functions to use vk::ImageUsageFlags instead of std::set<vk::ImageUsageFlagBits>
  • Updated HPPRenderContext and RenderContext to remove the unused swapchain_properties member.

General Checklist:

Please ensure the following points are checked:

  • My code follows the coding style
  • I have reviewed file licenses
  • I have commented any added functions (in line with Doxygen)
  • I have commented any code that could be hard to understand
  • My changes do not add any new compiler warnings
  • My changes do not add any new validation layer errors or warnings
  • I have used existing framework/helper functions where possible
  • My changes do not add any regressions
  • I have tested every sample to ensure everything runs correctly
  • This PR describes the scope and expected impact of the changes I am making

Note: The Samples CI runs a number of checks including:

  • I have updated the header Copyright to reflect the current year (CI build will fail if Copyright is out of date)
  • My changes build on Windows, Linux, macOS and Android. Otherwise I have documented any exceptions

@jherico jherico marked this pull request as ready for review March 10, 2024 23:20
gary-sweet
gary-sweet previously approved these changes Mar 11, 2024
Copy link
Collaborator

@JoseEmilio-ARM JoseEmilio-ARM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in #963, please let that be merged before this one, thanks!

@jherico jherico marked this pull request as draft March 11, 2024 22:21
@jherico jherico marked this pull request as ready for review March 11, 2024 22:21
vk::ImageUsageFlags supported_image_usage,
vk::FormatFeatureFlags supported_features)
template <typename BitType>
std::set<BitType> flags_in(const vk::Flags<BitType> &flags)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some more descriptive name than flags_in? Like to_set, or split or so?
And why do you sort the flags into a std::set, not a std::vector?


HPPSwapchain::HPPSwapchain(HPPDevice &device,
vk::SurfaceKHR surface,
const HPPSwapchainProperties &inittial_properties) :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: inittial_properties

@marty-johnson59
Copy link
Contributor

Hi @jherico, any thoughts on resolving the comments above? How can we best move this one forward? Thanks

@marty-johnson59
Copy link
Contributor

Closing this PR as it looks like the issues addressed here have already been fixed. Please re-open if there's more to do. Thanks!

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

Successfully merging this pull request may close these issues.

choose_surface_format called twice
5 participants