Skip to content

Update triangle example to use the task graph#2794

Draft
CptPotato wants to merge 1 commit into
vulkano-rs:masterfrom
CptPotato:triangle-task-graph
Draft

Update triangle example to use the task graph#2794
CptPotato wants to merge 1 commit into
vulkano-rs:masterfrom
CptPotato:triangle-task-graph

Conversation

@CptPotato
Copy link
Copy Markdown
Contributor

Updates the triangle example to use the task graph.

The changes follow the deferred example. Colors were adjusted, as discussed on Discord.

@CptPotato
Copy link
Copy Markdown
Contributor Author

I kept the previous comments where applicable, but haven't added any new ones. So this still needs another pass in terms of documentation.

But other than comments, this one is ready for review.

@CptPotato CptPotato force-pushed the triangle-task-graph branch from 9fe1c6d to 5374642 Compare May 7, 2026 22:10
Comment thread examples/triangle/main.rs
struct TriangleTask {
pipeline: Option<Arc<GraphicsPipeline>>,
vertex_buffer_id: Id<Buffer>,
swapchain_id: Id<Swapchain>,
Copy link
Copy Markdown
Contributor Author

@CptPotato CptPotato May 7, 2026

Choose a reason for hiding this comment

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

I first tried to use target: Id<Image> here instead of directly referring to the swapchain. This seemed cleaner, since the triangle task technically doesn't need to know that the target is a swapchain.

But didn't get it to work after some trial and error. Not sure if this is possible atm.

Copy link
Copy Markdown
Contributor

@marc0246 marc0246 May 7, 2026

Choose a reason for hiding this comment

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

<Id<Swapchain>>::current_image_id just casts the type parameter if you look at the implementation. This is but one of the reasons that the type parameter doesn't make sense.

@marc0246
Copy link
Copy Markdown
Contributor

marc0246 commented May 7, 2026

Do you think rgb(251, 113, 133) looks the best for the trongle? 🤔

@marc0246
Copy link
Copy Markdown
Contributor

marc0246 commented May 7, 2026

First thing that jumps out is that the TriangleTask struct and its impls should come after all the App and RenderContext structs and impls. We always order free-standing functions as well as structs and their impls from outermost to innermost. I suggest you fix this ASAP because it matters a lot for when you write the comments.

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.

2 participants