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

Make dynamic state future-proof and more Vulkan-y #2348

Merged
merged 8 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
19 changes: 12 additions & 7 deletions examples/src/bin/async-update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ use vulkano::{
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
pipeline::{
graphics::{
color_blend::ColorBlendState,
color_blend::{ColorBlendAttachmentState, ColorBlendState},
input_assembly::{InputAssemblyState, PrimitiveTopology},
multisample::MultisampleState,
rasterization::RasterizationState,
Expand All @@ -80,7 +80,7 @@ use vulkano::{
GraphicsPipelineCreateInfo,
},
layout::PipelineDescriptorSetLayoutCreateInfo,
GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
DynamicState, GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
PipelineShaderStageCreateInfo,
},
render_pass::{Framebuffer, FramebufferCreateInfo, RenderPass, Subpass},
Expand Down Expand Up @@ -456,13 +456,18 @@ fn main() {
GraphicsPipelineCreateInfo {
stages: stages.into_iter().collect(),
vertex_input_state: Some(vertex_input_state),
input_assembly_state: Some(
InputAssemblyState::new().topology(PrimitiveTopology::TriangleStrip),
),
viewport_state: Some(ViewportState::viewport_dynamic_scissor_irrelevant()),
input_assembly_state: Some(InputAssemblyState {
topology: PrimitiveTopology::TriangleStrip,
..Default::default()
}),
viewport_state: Some(ViewportState::default()),
rasterization_state: Some(RasterizationState::default()),
multisample_state: Some(MultisampleState::default()),
color_blend_state: Some(ColorBlendState::new(subpass.num_color_attachments())),
color_blend_state: Some(ColorBlendState::default_with(
subpass.num_color_attachments(),
ColorBlendAttachmentState::default(),
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
},
Expand Down
12 changes: 8 additions & 4 deletions examples/src/bin/buffer-allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use vulkano::{
memory::allocator::{MemoryTypeFilter, StandardMemoryAllocator},
pipeline::{
graphics::{
color_blend::ColorBlendState,
color_blend::{ColorBlendAttachmentState, ColorBlendState},
input_assembly::InputAssemblyState,
multisample::MultisampleState,
rasterization::RasterizationState,
Expand All @@ -40,7 +40,7 @@ use vulkano::{
GraphicsPipelineCreateInfo,
},
layout::PipelineDescriptorSetLayoutCreateInfo,
GraphicsPipeline, PipelineLayout, PipelineShaderStageCreateInfo,
DynamicState, GraphicsPipeline, PipelineLayout, PipelineShaderStageCreateInfo,
},
render_pass::{Framebuffer, FramebufferCreateInfo, RenderPass, Subpass},
swapchain::{
Expand Down Expand Up @@ -253,10 +253,14 @@ fn main() {
stages: stages.into_iter().collect(),
vertex_input_state: Some(vertex_input_state),
input_assembly_state: Some(InputAssemblyState::default()),
viewport_state: Some(ViewportState::viewport_dynamic_scissor_irrelevant()),
viewport_state: Some(ViewportState::default()),
rasterization_state: Some(RasterizationState::default()),
multisample_state: Some(MultisampleState::default()),
color_blend_state: Some(ColorBlendState::new(subpass.num_color_attachments())),
color_blend_state: Some(ColorBlendState::default_with(
subpass.num_color_attachments(),
ColorBlendAttachmentState::default(),
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
},
Expand Down
23 changes: 14 additions & 9 deletions examples/src/bin/deferred/frame/ambient_lighting_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ use vulkano::{
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
pipeline::{
graphics::{
color_blend::{AttachmentBlend, BlendFactor, BlendOp, ColorBlendState},
color_blend::{
AttachmentBlend, BlendFactor, BlendOp, ColorBlendAttachmentState, ColorBlendState,
},
input_assembly::InputAssemblyState,
multisample::MultisampleState,
rasterization::RasterizationState,
Expand All @@ -31,7 +33,7 @@ use vulkano::{
GraphicsPipelineCreateInfo,
},
layout::PipelineDescriptorSetLayoutCreateInfo,
GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
DynamicState, GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
PipelineShaderStageCreateInfo,
},
render_pass::Subpass,
Expand Down Expand Up @@ -118,21 +120,24 @@ impl AmbientLightingSystem {
stages: stages.into_iter().collect(),
vertex_input_state: Some(vertex_input_state),
input_assembly_state: Some(InputAssemblyState::default()),
viewport_state: Some(ViewportState::viewport_dynamic_scissor_irrelevant()),
viewport_state: Some(ViewportState::default()),
rasterization_state: Some(RasterizationState::default()),
multisample_state: Some(MultisampleState::default()),
color_blend_state: Some(
ColorBlendState::new(subpass.num_color_attachments()).blend(
AttachmentBlend {
color_blend_state: Some(ColorBlendState::default_with(
subpass.num_color_attachments(),
ColorBlendAttachmentState {
blend: Some(AttachmentBlend {
color_blend_op: BlendOp::Add,
src_color_blend_factor: BlendFactor::One,
dst_color_blend_factor: BlendFactor::One,
alpha_blend_op: BlendOp::Max,
src_alpha_blend_factor: BlendFactor::One,
dst_alpha_blend_factor: BlendFactor::One,
},
),
),
}),
..Default::default()
},
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.clone().into()),
..GraphicsPipelineCreateInfo::layout(layout)
},
Expand Down
23 changes: 14 additions & 9 deletions examples/src/bin/deferred/frame/directional_lighting_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ use vulkano::{
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
pipeline::{
graphics::{
color_blend::{AttachmentBlend, BlendFactor, BlendOp, ColorBlendState},
color_blend::{
AttachmentBlend, BlendFactor, BlendOp, ColorBlendAttachmentState, ColorBlendState,
},
input_assembly::InputAssemblyState,
multisample::MultisampleState,
rasterization::RasterizationState,
Expand All @@ -32,7 +34,7 @@ use vulkano::{
GraphicsPipelineCreateInfo,
},
layout::PipelineDescriptorSetLayoutCreateInfo,
GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
DynamicState, GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
PipelineShaderStageCreateInfo,
},
render_pass::Subpass,
Expand Down Expand Up @@ -119,21 +121,24 @@ impl DirectionalLightingSystem {
stages: stages.into_iter().collect(),
vertex_input_state: Some(vertex_input_state),
input_assembly_state: Some(InputAssemblyState::default()),
viewport_state: Some(ViewportState::viewport_dynamic_scissor_irrelevant()),
viewport_state: Some(ViewportState::default()),
rasterization_state: Some(RasterizationState::default()),
multisample_state: Some(MultisampleState::default()),
color_blend_state: Some(
ColorBlendState::new(subpass.num_color_attachments()).blend(
AttachmentBlend {
color_blend_state: Some(ColorBlendState::default_with(
subpass.num_color_attachments(),
ColorBlendAttachmentState {
blend: Some(AttachmentBlend {
color_blend_op: BlendOp::Add,
src_color_blend_factor: BlendFactor::One,
dst_color_blend_factor: BlendFactor::One,
alpha_blend_op: BlendOp::Max,
src_alpha_blend_factor: BlendFactor::One,
dst_alpha_blend_factor: BlendFactor::One,
},
),
),
}),
..Default::default()
},
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.clone().into()),
..GraphicsPipelineCreateInfo::layout(layout)
},
Expand Down
23 changes: 14 additions & 9 deletions examples/src/bin/deferred/frame/point_lighting_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ use vulkano::{
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
pipeline::{
graphics::{
color_blend::{AttachmentBlend, BlendFactor, BlendOp, ColorBlendState},
color_blend::{
AttachmentBlend, BlendFactor, BlendOp, ColorBlendAttachmentState, ColorBlendState,
},
input_assembly::InputAssemblyState,
multisample::MultisampleState,
rasterization::RasterizationState,
Expand All @@ -32,7 +34,7 @@ use vulkano::{
GraphicsPipelineCreateInfo,
},
layout::PipelineDescriptorSetLayoutCreateInfo,
GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
DynamicState, GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
PipelineShaderStageCreateInfo,
},
render_pass::Subpass,
Expand Down Expand Up @@ -118,21 +120,24 @@ impl PointLightingSystem {
stages: stages.into_iter().collect(),
vertex_input_state: Some(vertex_input_state),
input_assembly_state: Some(InputAssemblyState::default()),
viewport_state: Some(ViewportState::viewport_dynamic_scissor_irrelevant()),
viewport_state: Some(ViewportState::default()),
rasterization_state: Some(RasterizationState::default()),
multisample_state: Some(MultisampleState::default()),
color_blend_state: Some(
ColorBlendState::new(subpass.num_color_attachments()).blend(
AttachmentBlend {
color_blend_state: Some(ColorBlendState::default_with(
subpass.num_color_attachments(),
ColorBlendAttachmentState {
blend: Some(AttachmentBlend {
color_blend_op: BlendOp::Add,
src_color_blend_factor: BlendFactor::One,
dst_color_blend_factor: BlendFactor::One,
alpha_blend_op: BlendOp::Max,
src_alpha_blend_factor: BlendFactor::One,
dst_alpha_blend_factor: BlendFactor::One,
},
),
),
}),
..Default::default()
},
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.clone().into()),
..GraphicsPipelineCreateInfo::layout(layout)
},
Expand Down
19 changes: 13 additions & 6 deletions examples/src/bin/deferred/triangle_draw_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use vulkano::{
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
pipeline::{
graphics::{
color_blend::ColorBlendState,
depth_stencil::DepthStencilState,
color_blend::{ColorBlendAttachmentState, ColorBlendState},
depth_stencil::{DepthState, DepthStencilState},
input_assembly::InputAssemblyState,
multisample::MultisampleState,
rasterization::RasterizationState,
Expand All @@ -28,7 +28,7 @@ use vulkano::{
GraphicsPipelineCreateInfo,
},
layout::PipelineDescriptorSetLayoutCreateInfo,
GraphicsPipeline, PipelineLayout, PipelineShaderStageCreateInfo,
DynamicState, GraphicsPipeline, PipelineLayout, PipelineShaderStageCreateInfo,
},
render_pass::Subpass,
};
Expand Down Expand Up @@ -107,11 +107,18 @@ impl TriangleDrawSystem {
stages: stages.into_iter().collect(),
vertex_input_state: Some(vertex_input_state),
input_assembly_state: Some(InputAssemblyState::default()),
viewport_state: Some(ViewportState::viewport_dynamic_scissor_irrelevant()),
viewport_state: Some(ViewportState::default()),
rasterization_state: Some(RasterizationState::default()),
depth_stencil_state: Some(DepthStencilState::simple_depth_test()),
depth_stencil_state: Some(DepthStencilState {
depth: Some(DepthState::simple()),
..Default::default()
}),
multisample_state: Some(MultisampleState::default()),
color_blend_state: Some(ColorBlendState::new(subpass.num_color_attachments())),
color_blend_state: Some(ColorBlendState::default_with(
subpass.num_color_attachments(),
ColorBlendAttachmentState::default(),
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.clone().into()),
..GraphicsPipelineCreateInfo::layout(layout)
},
Expand Down
24 changes: 15 additions & 9 deletions examples/src/bin/gl-interop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mod linux {
},
pipeline::{
graphics::{
color_blend::ColorBlendState,
color_blend::{AttachmentBlend, ColorBlendAttachmentState, ColorBlendState},
input_assembly::{InputAssemblyState, PrimitiveTopology},
multisample::MultisampleState,
rasterization::RasterizationState,
Expand All @@ -57,7 +57,7 @@ mod linux {
GraphicsPipelineCreateInfo,
},
layout::PipelineDescriptorSetLayoutCreateInfo,
GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
DynamicState, GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
PipelineShaderStageCreateInfo,
},
render_pass::{Framebuffer, FramebufferCreateInfo, RenderPass, Subpass},
Expand Down Expand Up @@ -688,15 +688,21 @@ mod linux {
GraphicsPipelineCreateInfo {
stages: stages.into_iter().collect(),
vertex_input_state: Some(vertex_input_state),
input_assembly_state: Some(
InputAssemblyState::new().topology(PrimitiveTopology::TriangleStrip),
),
viewport_state: Some(ViewportState::viewport_dynamic_scissor_irrelevant()),
input_assembly_state: Some(InputAssemblyState {
topology: PrimitiveTopology::TriangleStrip,
..Default::default()
}),
viewport_state: Some(ViewportState::default()),
rasterization_state: Some(RasterizationState::default()),
multisample_state: Some(MultisampleState::default()),
color_blend_state: Some(
ColorBlendState::new(subpass.num_color_attachments()).blend_alpha(),
),
color_blend_state: Some(ColorBlendState::default_with(
subpass.num_color_attachments(),
ColorBlendAttachmentState {
blend: Some(AttachmentBlend::alpha()),
..Default::default()
},
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
},
Expand Down
24 changes: 15 additions & 9 deletions examples/src/bin/image-self-copy-blit/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use vulkano::{
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
pipeline::{
graphics::{
color_blend::ColorBlendState,
color_blend::{AttachmentBlend, ColorBlendAttachmentState, ColorBlendState},
input_assembly::{InputAssemblyState, PrimitiveTopology},
multisample::MultisampleState,
rasterization::RasterizationState,
Expand All @@ -41,7 +41,7 @@ use vulkano::{
GraphicsPipelineCreateInfo,
},
layout::PipelineDescriptorSetLayoutCreateInfo,
GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
DynamicState, GraphicsPipeline, Pipeline, PipelineBindPoint, PipelineLayout,
PipelineShaderStageCreateInfo,
},
render_pass::{Framebuffer, FramebufferCreateInfo, RenderPass, Subpass},
Expand Down Expand Up @@ -363,15 +363,21 @@ fn main() {
GraphicsPipelineCreateInfo {
stages: stages.into_iter().collect(),
vertex_input_state: Some(vertex_input_state),
input_assembly_state: Some(
InputAssemblyState::new().topology(PrimitiveTopology::TriangleStrip),
),
viewport_state: Some(ViewportState::viewport_dynamic_scissor_irrelevant()),
input_assembly_state: Some(InputAssemblyState {
topology: PrimitiveTopology::TriangleStrip,
..Default::default()
}),
viewport_state: Some(ViewportState::default()),
rasterization_state: Some(RasterizationState::default()),
multisample_state: Some(MultisampleState::default()),
color_blend_state: Some(
ColorBlendState::new(subpass.num_color_attachments()).blend_alpha(),
),
color_blend_state: Some(ColorBlendState::default_with(
subpass.num_color_attachments(),
ColorBlendAttachmentState {
blend: Some(AttachmentBlend::alpha()),
..Default::default()
},
)),
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
subpass: Some(subpass.into()),
..GraphicsPipelineCreateInfo::layout(layout)
},
Expand Down
Loading