Skip to content
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

support for ext_conservative_rasterization #2508

Merged
merged 27 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5ff9f92
disabled bad validation code
LukeP0WERS Mar 23, 2024
dfa359a
conservative rasterization
LukeP0WERS Mar 25, 2024
fab76e5
validation for conservative_rasterization
LukeP0WERS Mar 26, 2024
b791056
rebuild
LukeP0WERS Mar 26, 2024
8d2b152
extra_primitive_overestimation_size dynamic state
LukeP0WERS Mar 28, 2024
975f684
safety fixed
LukeP0WERS Mar 28, 2024
344e152
set builder state
LukeP0WERS Mar 28, 2024
8fa497e
Merge branch 'vulkano-rs:master' into conservative_rasterization
LukeP0WERS Mar 28, 2024
dc538a4
formatted
LukeP0WERS Mar 28, 2024
03fed2c
Merge branch 'conservative_rasterization' of https://github.com/Luke2…
LukeP0WERS Mar 28, 2024
d0a5290
unfixed fake bug fix
LukeP0WERS Mar 28, 2024
1999355
actually unfixed fake bug fix
LukeP0WERS Mar 28, 2024
7cf1033
fixed bad formatting
LukeP0WERS Mar 28, 2024
6625533
deleted duplicate todo
LukeP0WERS Mar 28, 2024
a0aec98
command buffer documentation
LukeP0WERS Mar 28, 2024
1ef06a5
formatted
LukeP0WERS Mar 28, 2024
5c98f41
add vuid
LukeP0WERS Mar 29, 2024
5ef2c8b
add vuid
LukeP0WERS Mar 29, 2024
66f6af8
more validation
LukeP0WERS Mar 29, 2024
14017c8
Update vulkano/src/pipeline/graphics/mod.rs
LukeP0WERS Mar 29, 2024
5be5599
Update vulkano/src/pipeline/graphics/mod.rs
LukeP0WERS Mar 29, 2024
845ca4c
Update vulkano/src/pipeline/graphics/mod.rs
LukeP0WERS Mar 29, 2024
6498a6e
Update vulkano/src/pipeline/graphics/mod.rs
LukeP0WERS Mar 29, 2024
8063221
put in block
LukeP0WERS Mar 29, 2024
91671dc
add todo
LukeP0WERS Mar 29, 2024
d6b14e1
fixed clippy
LukeP0WERS Mar 29, 2024
29a6c3e
removed redundant checks
LukeP0WERS Mar 29, 2024
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
35 changes: 17 additions & 18 deletions vulkano/src/command_buffer/auto/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,24 +1284,23 @@ impl CommandBufferBuilderState {
}
DynamicState::ExtraPrimitiveOverestimationSize => {
self.extra_primitive_overestimation_size = None
}
// DynamicState::DepthClipEnable => todo!(),
// DynamicState::SampleLocationsEnable => todo!(),
// DynamicState::ColorBlendAdvanced => todo!(),
// DynamicState::ProvokingVertexMode => todo!(),
// DynamicState::LineRasterizationMode => todo!(),
// DynamicState::LineStippleEnable => todo!(),
// DynamicState::DepthClipNegativeOneToOne => todo!(),
// DynamicState::ViewportWScalingEnable => todo!(),
// DynamicState::ViewportSwizzle => todo!(),
// DynamicState::CoverageToColorEnable => todo!(),
// DynamicState::CoverageToColorLocation => todo!(),
// DynamicState::CoverageModulationMode => todo!(),
// DynamicState::CoverageModulationTableEnable => todo!(),
// DynamicState::CoverageModulationTable => todo!(),
// DynamicState::ShadingRateImageEnable => todo!(),
// DynamicState::RepresentativeFragmentTestEnable => todo!(),
// DynamicState::CoverageReductionMode => todo!(),
} /* DynamicState::DepthClipEnable => todo!(),
* DynamicState::SampleLocationsEnable => todo!(),
* DynamicState::ColorBlendAdvanced => todo!(),
* DynamicState::ProvokingVertexMode => todo!(),
* DynamicState::LineRasterizationMode => todo!(),
* DynamicState::LineStippleEnable => todo!(),
* DynamicState::DepthClipNegativeOneToOne => todo!(),
* DynamicState::ViewportWScalingEnable => todo!(),
* DynamicState::ViewportSwizzle => todo!(),
* DynamicState::CoverageToColorEnable => todo!(),
* DynamicState::CoverageToColorLocation => todo!(),
* DynamicState::CoverageModulationMode => todo!(),
* DynamicState::CoverageModulationTableEnable => todo!(),
* DynamicState::CoverageModulationTable => todo!(),
* DynamicState::ShadingRateImageEnable => todo!(),
* DynamicState::RepresentativeFragmentTestEnable => todo!(),
* DynamicState::CoverageReductionMode => todo!(), */
}
}
}
Expand Down
125 changes: 125 additions & 0 deletions vulkano/src/pipeline/graphics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@

use self::{
color_blend::ColorBlendState,
conservative_rasterization::ConservativeRasterizationMode,
depth_stencil::{DepthState, DepthStencilState},
discard_rectangle::DiscardRectangleState,
input_assembly::{InputAssemblyState, PrimitiveTopology},
Expand Down Expand Up @@ -2572,6 +2573,130 @@ impl GraphicsPipelineCreateInfo {
}
}

if match device
.physical_device()
.properties()
.conservative_point_and_line_rasterization
{
Some(b) => !b,
None => true,
} {
LukeP0WERS marked this conversation as resolved.
Show resolved Hide resolved
if let (None, Some(input_assembly_state), Some(conservative_rasterization_state)) = (
geometry_stage,
input_assembly_state,
conservative_rasterization_state,
) {
if match conservative_rasterization_state.mode {
ConservativeRasterizationMode::Disabled => false,
_ => true,
} && match input_assembly_state.topology {
PrimitiveTopology::PointList => true,
PrimitiveTopology::LineList => true,
PrimitiveTopology::LineStrip => true,
_ => false,
} && (!dynamic_state.contains(&DynamicState::PrimitiveTopology)
LukeP0WERS marked this conversation as resolved.
Show resolved Hide resolved
|| match device
.physical_device()
.properties()
.dynamic_primitive_topology_unrestricted
{
Some(b) => !b,
None => false,
})
{
return Err(Box::new(ValidationError {
problem: "`input_assembly_state.topology` is not compatible with the \
conservative rasterization mode"
.into(),
vuids: &["VUID-VkGraphicsPipelineCreateInfo-conservativePointAndLineRasterization-08892"],
..Default::default()
}));
}
}

if let (Some(geometry_stage), Some(_), Some(conservative_rasterization_state)) = (
geometry_stage,
input_assembly_state,
conservative_rasterization_state,
) {
let spirv = geometry_stage.entry_point.module().spirv();
let entry_point_function = spirv.function(geometry_stage.entry_point.id());

let mut invalid_output = false;

for instruction in entry_point_function.execution_modes() {
if let Instruction::ExecutionMode { mode, .. } = *instruction {
match mode {
ExecutionMode::OutputPoints => {
invalid_output = true;
break;
}
ExecutionMode::OutputLineStrip => {
invalid_output = true;
break;
}
_ => {}
}
}
}
LukeP0WERS marked this conversation as resolved.
Show resolved Hide resolved

if match conservative_rasterization_state.mode {
ConservativeRasterizationMode::Disabled => false,
_ => true,
} && invalid_output
{
return Err(Box::new(ValidationError {
problem: "the output topology of the geometry shader is not compatible with the \
conservative rasterization mode"
.into(),
vuids: &["VUID-VkGraphicsPipelineCreateInfo-conservativePointAndLineRasterization-06760"],
..Default::default()
}));
}
}

if let (Some(mesh_stage), Some(_), Some(conservative_rasterization_state)) = (
mesh_stage,
input_assembly_state,
conservative_rasterization_state,
) {
LukeP0WERS marked this conversation as resolved.
Show resolved Hide resolved
let spirv = mesh_stage.entry_point.module().spirv();
let entry_point_function = spirv.function(mesh_stage.entry_point.id());

let mut invalid_output = false;

for instruction in entry_point_function.execution_modes() {
if let Instruction::ExecutionMode { mode, .. } = *instruction {
match mode {
ExecutionMode::OutputPoints => {
invalid_output = true;
break;
}
ExecutionMode::OutputLineStrip => {
invalid_output = true;
break;
}
_ => {}
}
}
}

if match conservative_rasterization_state.mode {
ConservativeRasterizationMode::Disabled => false,
_ => true,
} && invalid_output
{
return Err(Box::new(ValidationError {
problem: "the output topology of the mesh shader is not compatible with the \
conservative rasterization mode"
.into(),
vuids: &["VUID-VkGraphicsPipelineCreateInfo-conservativePointAndLineRasterization-06761"],
..Default::default()
}));
}
}
}

if let (Some(fragment_stage), Some(color_blend_state), Some(subpass)) =
(fragment_stage, color_blend_state, subpass)
{
Expand Down