-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add mip map example #86
Conversation
It looks like this PR eliminates most of the remaining validation errors in my renderer! There's one relevant case where it might not be using the correct barrier. I have a set of passes like this: let mut mip = 0;
while width > 1 && height > 1 {
graph
.begin_pass("low_z_prepass_pyramid")
.bind_pipeline([...])
.read_descriptor_as(0, depth_node, info_mip(dwrite_info, mip))
.write_descriptor_as(1, depth_node, info_mip(dwrite_info, mip + 1))
.record_compute(move |compute, _bindings| {
compute.dispatch(width / 8 + 1, height / 8 + 1, 1);
});
width /= 2;
height /= 2;
mip += 1;
}
fn info_mip(info: ImageViewInfo, level: u32) -> ImageViewInfo {
let mut write_info = info;
write_info.base_mip_level = level;
write_info.mip_level_count = Some(1);
write_info
} And it seems that the
|
I did just notice that with this PR I'm getting undefined img in render doc on some attachments and it just renders black on a GTX1060. Still need to track down the cause or make a minimal reproduction. Just wanted to mention. (I tried a few of the basic examples in this repo and it didn't occur, though there were other vulkan validation errors) |
I've re-worked how image barriers are handled. Where previously only one single access type was tracked for a whole image, now individual access types are tracked for every aspect, layer, and mip level. This should fix a bunch of the troubles around mip levels and other image subresource accesses. See There is a new This part: while width > 1 && height > 1 {
graph
.begin_pass("low_z_prepass_pyramid")
.bind_pipeline([...])
.read_descriptor_as() ...can be changed to: let mut pass = graph
.begin_pass("low_z_prepass_pyramid")
.bind_pipeline([...]);
while width > 1 && height > 1 {
pass = pass.read_descriptor_as() There are still a few bugs in the examples (when synchronization validation is enabled) and some todos:
|
There are still some remaining issues with validation of swapchain and msaa resolve attachments, but those are not related to this PR or mip level handling and will be resolved in later changes. Also, there will be greatly improved renderpass dependency handling (performance and correctness) coming soon. |
This PR overhauls buffer and image barriers to get close to the optimal state. Where previously buffer and image resources would use a single
vk_sync::AccessType
to track changes, now all subresources are tracked individually using a pair of high-performance diff algorithms. The new code is unit and fuzz tested.The changes are almost entirely internal to Screen-13 and only visible by noticing the API changes made to the
Buffer::access
andImage::access
functions.Previously these functions took a single access and provided a single access to use when creating barriers.
Now these functions also require the sub-resource range being accessed and provide a list of sub-resource ranges and their previous access type.
This should all be transparent to users of Screen-13 unless they're doing interop with raw Vulkan code.
In the future Screen-13 will also track command buffer submissions and completions so that existing resource access can be cleared back to
AccessType::Nothing
and not require barriers in those cases.