render: add depth buffer
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 8m13s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 8m13s
This commit is contained in:
parent
77c717f90b
commit
650b61e3ae
4 changed files with 61 additions and 21 deletions
|
@ -17,7 +17,8 @@ use vulkano::{
|
|||
graphics::{
|
||||
GraphicsPipelineCreateInfo,
|
||||
color_blend::{ColorBlendAttachmentState, ColorBlendState},
|
||||
input_assembly::{InputAssemblyState, PrimitiveTopology},
|
||||
depth_stencil::{DepthState, DepthStencilState},
|
||||
input_assembly::InputAssemblyState,
|
||||
multisample::MultisampleState,
|
||||
rasterization::RasterizationState,
|
||||
subpass::PipelineRenderingCreateInfo,
|
||||
|
@ -84,6 +85,7 @@ impl Square {
|
|||
device: &Arc<Device>,
|
||||
memory_allocator: &Arc<StandardMemoryAllocator>,
|
||||
swapchain_format: Format,
|
||||
depth_format: Format,
|
||||
) -> Result<Self, Box<dyn Error>> {
|
||||
let vertex_buffer = Buffer::from_iter(
|
||||
memory_allocator.clone(),
|
||||
|
@ -173,6 +175,7 @@ impl Square {
|
|||
|
||||
let subpass = PipelineRenderingCreateInfo {
|
||||
color_attachment_formats: vec![Some(swapchain_format)],
|
||||
depth_attachment_format: Some(depth_format),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
@ -190,6 +193,10 @@ impl Square {
|
|||
subpass.color_attachment_formats.len() as u32,
|
||||
ColorBlendAttachmentState::default(),
|
||||
)),
|
||||
depth_stencil_state: Some(DepthStencilState {
|
||||
depth: Some(DepthState::simple()),
|
||||
..Default::default()
|
||||
}),
|
||||
dynamic_state: [DynamicState::Viewport].into_iter().collect(),
|
||||
subpass: Some(subpass.into()),
|
||||
..GraphicsPipelineCreateInfo::layout(layout)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue