Skip to content

Refactor: STL Ranges and Views for RenderPass Attachments #48

@SpinnerX

Description

@SpinnerX

Description

This issue is for refactoring the VkRenderPass logic for object creation. Current implementation manually assigns and indexes VkRenderPass structures. Moving towards a more robust, extensible, and modernized approach.

Using STL ranges and views in replacement for manual for-loops and STL vector indexing with std::views::transform and std::views::filter.

Pseudo-Example

Brief example of an idea to getting the STL ranges and views working with filtering between renderpass attachments (color/depth).

// getting getting our attachments
auto attachments = p_attachments
    | std::views::transform([](const auto& attachment) {
        return VkAttachmentDescription{
            // specify that attachment here in the parameters
    };
}); | std::ranges::to<std::vector>(); // represent as std::vector


// filtering between color/depth attachments
auto color_attachments = attachments
    | std::views::enumerate
    | std::views::filter([](const auto& pair) { return !has_depth(std::get<1>(pair).layout); })
    | std::views::transform([](const auto& pair){
        auto[idx, spec] = pair;
        return VkAttachmentReference{
        // specify parameters for attachment reference
    };
}) | std::ranges::to<std::vector>();

What does task completion look like?

  • API modernization consuming span<const attachment> for setting up renderpass attachments
  • Ranges used for mapping structures for filtering between color and depth attachments.
  • Using ranges::transform and views::filter to filter between renderpass specifics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✨improvementImproving existing designs.📐designTasks that involve the core systems. Highly involve in API design.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions