Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update render pass checks for new VUID #2055

Merged
merged 2 commits into from
Oct 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/src/bin/msaa-renderpass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,7 @@ fn main() {
depth_range: 0.0..1.0,
};

let command_buffer_allocator =
StandardCommandBufferAllocator::new(device.clone(), Default::default());
let command_buffer_allocator = StandardCommandBufferAllocator::new(device, Default::default());

let buf = CpuAccessibleBuffer::from_iter(
&memory_allocator,
Expand Down
133 changes: 18 additions & 115 deletions vulkano/src/render_pass/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -920,127 +920,30 @@ impl RenderPass {
}

if src_subpass == dst_subpass {
let src_stages_non_framebuffer = PipelineStages {
early_fragment_tests: false,
fragment_shader: false,
late_fragment_tests: false,
color_attachment_output: false,
..src_stages
};
let dst_stages_non_framebuffer = PipelineStages {
early_fragment_tests: false,
fragment_shader: false,
late_fragment_tests: false,
color_attachment_output: false,
..dst_stages
let framebuffer_stages = PipelineStages {
early_fragment_tests: true,
fragment_shader: true,
late_fragment_tests: true,
color_attachment_output: true,
..PipelineStages::empty()
};

if !src_stages_non_framebuffer.is_empty()
|| !dst_stages_non_framebuffer.is_empty()
// VUID-VkSubpassDependency2-srcSubpass-06810
if src_stages.intersects(&framebuffer_stages)
&& !(dst_stages - framebuffer_stages).is_empty()
{
let src_latest_stage = if src_stages.all_graphics {
13
} else {
let PipelineStages {
draw_indirect,
//index_input,
//vertex_attribute_input,
vertex_shader,
tessellation_control_shader,
tessellation_evaluation_shader,
geometry_shader,
//transform_feedback,
//fragment_shading_rate_attachment,
early_fragment_tests,
fragment_shader,
late_fragment_tests,
color_attachment_output,
..
} = src_stages;

#[allow(clippy::identity_op)]
[
draw_indirect as u8 * 1,
// index_input as u8 * 2,
// vertex_attribute_input as u8 * 3,
vertex_shader as u8 * 4,
tessellation_control_shader as u8 * 5,
tessellation_evaluation_shader as u8 * 6,
geometry_shader as u8 * 7,
// transform_feedback as u8 * 8,
// fragment_shading_rate_attachment as u8 * 9,
early_fragment_tests as u8 * 10,
fragment_shader as u8 * 11,
late_fragment_tests as u8 * 12,
color_attachment_output as u8 * 13,
]
.into_iter()
.max()
.unwrap()
};

let dst_earliest_stage = if dst_stages.all_graphics {
1
} else {
let PipelineStages {
draw_indirect,
//index_input,
//vertex_attribute_input,
vertex_shader,
tessellation_control_shader,
tessellation_evaluation_shader,
geometry_shader,
//transform_feedback,
//fragment_shading_rate_attachment,
early_fragment_tests,
fragment_shader,
late_fragment_tests,
color_attachment_output,
..
} = dst_stages;

#[allow(clippy::identity_op)]
[
draw_indirect as u8 * 1,
// index_input as u8 * 2,
// vertex_attribute_input as u8 * 3,
vertex_shader as u8 * 4,
tessellation_control_shader as u8 * 5,
tessellation_evaluation_shader as u8 * 6,
geometry_shader as u8 * 7,
// transform_feedback as u8 * 8,
// fragment_shading_rate_attachment as u8 * 9,
early_fragment_tests as u8 * 10,
fragment_shader as u8 * 11,
late_fragment_tests as u8 * 12,
color_attachment_output as u8 * 13,
]
.into_iter()
.min()
.unwrap()
};

// VUID-VkSubpassDependency2-srcSubpass-03087
if src_latest_stage > dst_earliest_stage {
return Err(
RenderPassCreationError::DependencySelfDependencySourceStageAfterDestinationStage {
dependency: dependency_num,
},
);
}
return Err(
RenderPassCreationError::DependencySelfDependencySourceStageAfterDestinationStage {
dependency: dependency_num,
},
);
}

let src_has_framebuffer_stage = src_stages.fragment_shader
|| src_stages.early_fragment_tests
|| src_stages.late_fragment_tests
|| src_stages.color_attachment_output;
let dst_has_framebuffer_stage = dst_stages.fragment_shader
|| dst_stages.early_fragment_tests
|| dst_stages.late_fragment_tests
|| dst_stages.color_attachment_output;

// VUID-VkSubpassDependency2-srcSubpass-02245
if src_has_framebuffer_stage && dst_has_framebuffer_stage && !by_region {
if src_stages.intersects(&framebuffer_stages)
&& dst_stages.intersects(&framebuffer_stages)
&& !by_region
{
return Err(
RenderPassCreationError::DependencySelfDependencyFramebufferStagesWithoutByRegion {
dependency: dependency_num,
Expand Down