-
Notifications
You must be signed in to change notification settings - Fork 21
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
Upgrade ash to 0.38 and egui to 0.27.2 #10
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of these calls aren't contributing to safety: refer to the Ash README on the latest published version.
examples/example/main.rs
Outdated
let wait_dst_stage_mask = [vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT]; | ||
self.device.queue_submit( | ||
self.graphics_queue, | ||
&[vk::SubmitInfo::builder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from_ref?
examples/example/main.rs
Outdated
.image_indices(&[image_index as u32]) | ||
.wait_semaphores(&[self.render_finished_semaphores[self.current_frame]]), | ||
.swapchains(std::slice::from_ref(&self.swapchain)) | ||
.image_indices(&image_indices) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fwiw the temporary allocation here is fine, as long as you don't call .build.
examples/user_texture/main.rs
Outdated
let wait_dst_stage_mask = [vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT]; | ||
self.device.queue_submit( | ||
self.graphics_queue, | ||
&[vk::SubmitInfo::builder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again from_ref might help to remove .build(). Constructing slices inside the same expression is fine.
src/integration.rs
Outdated
} | ||
.expect("Failed to create descriptor pool."); | ||
let descriptor_pool = { | ||
let pool_sizes = [vk::DescriptorPoolSize::builder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No wins in factoring this out either.
src/integration.rs
Outdated
let subpasses = [vk::SubpassDescription::builder() | ||
.pipeline_bind_point(vk::PipelineBindPoint::GRAPHICS) | ||
.color_attachments(&color_attachment_refs) | ||
.build()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the lifetime of &color_attachments_refs
gets lost.
First of all, thanks for the PR! Sorry, but the PR seems to contain things that don't necessarily contribute to safety, as @MarijnS95 points out. |
For what it is worth some older Ash docs recommended (iirc) the As such there are a few ways to go at this PR and these changes; but for the time being I'd recommend either tackling everything or only fix the actual lifetime issues (and not introduce any new ones!). When |
The |
Thank you for your work on ash 0.38, @MarijnS95! Here are some notes on this PR:
I have some questions if that is okay with you, @MarijnS95:
|
I ran the current version on the main branch and can confirm that the sync issues were present before this PR. |
Without diving in this codebase, this might be a common problem where the first format from swapchain' capabilities is used. If this is BGR instead of RGB, the render target bind point might not be updated and hence swizzle the wrong colors on write (though the validation layer should complain here).
I'd recommend to |
.dependencies(&[vk::SubpassDependency::default() | ||
.src_subpass(vk::SUBPASS_EXTERNAL) | ||
.dst_subpass(0) | ||
.src_access_mask(vk::AccessFlags::COLOR_ATTACHMENT_WRITE) | ||
.dst_access_mask(vk::AccessFlags::COLOR_ATTACHMENT_WRITE) | ||
.src_stage_mask(vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT) | ||
.dst_stage_mask(vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT) | ||
.build()]), | ||
.dst_stage_mask(vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT)]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fyi for POD structs without references (pointers to objects or arrays), especially when you fill all fields like this, are cleaner to write with plain Rust field syntax (than the builder pattern). Same for vk::AttachmentDescription
above, vk::ImageSubresourceRange
and probably a few others.
Fix #9