depth: Fix not resized
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 8m22s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 8m22s
This commit is contained in:
parent
650b61e3ae
commit
6a6b1821a4
5 changed files with 38 additions and 44 deletions
|
@ -12,7 +12,6 @@ use glam::Vec3;
|
|||
use vulkano::format::Format;
|
||||
use vulkano::image::Image;
|
||||
use vulkano::image::ImageCreateInfo;
|
||||
use vulkano::image::ImageLayout;
|
||||
use vulkano::image::ImageUsage;
|
||||
use vulkano::memory::allocator::AllocationCreateInfo;
|
||||
use vulkano::{
|
||||
|
@ -34,7 +33,6 @@ pub struct MainSceneState {
|
|||
camera: Camera3D,
|
||||
texture: Texture,
|
||||
speed: f32,
|
||||
depth_image_view: Arc<ImageView>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -48,27 +46,11 @@ impl Scene for MainScene {
|
|||
}
|
||||
|
||||
fn load(&mut self, scene_context: &SceneContext) -> Result<(), Box<dyn Error>> {
|
||||
let depth_image = Image::new(
|
||||
scene_context.memory_allocator.clone(),
|
||||
ImageCreateInfo {
|
||||
format: Format::D16_UNORM,
|
||||
extent: [
|
||||
scene_context.window_size[0] as u32,
|
||||
scene_context.window_size[1] as u32,
|
||||
1,
|
||||
],
|
||||
usage: ImageUsage::DEPTH_STENCIL_ATTACHMENT,
|
||||
..Default::default()
|
||||
},
|
||||
AllocationCreateInfo::default(),
|
||||
)?;
|
||||
let depth_image_view = ImageView::new_default(depth_image)?;
|
||||
|
||||
let square = Square::new(
|
||||
&scene_context.device,
|
||||
&scene_context.memory_allocator,
|
||||
scene_context.swapchain_format,
|
||||
Format::D16_UNORM,
|
||||
scene_context.swapchain_image_view.format(),
|
||||
scene_context.depth_stencil_image_view.format(),
|
||||
)?;
|
||||
|
||||
let num_instances = 100;
|
||||
|
@ -122,7 +104,6 @@ impl Scene for MainScene {
|
|||
camera,
|
||||
texture,
|
||||
speed: 50.0,
|
||||
depth_image_view,
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -143,7 +124,6 @@ impl Scene for MainScene {
|
|||
|
||||
fn render(
|
||||
&mut self,
|
||||
image_view: &Arc<ImageView>,
|
||||
acquire_future: Box<dyn GpuFuture>,
|
||||
scene_context: &SceneContext,
|
||||
gui: &mut Gui,
|
||||
|
@ -169,13 +149,17 @@ impl Scene for MainScene {
|
|||
load_op: AttachmentLoadOp::Clear,
|
||||
store_op: AttachmentStoreOp::Store,
|
||||
clear_value: Some([0.0, 0.0, 0.0, 1.0].into()),
|
||||
..RenderingAttachmentInfo::image_view(image_view.clone())
|
||||
..RenderingAttachmentInfo::image_view(
|
||||
scene_context.swapchain_image_view.clone(),
|
||||
)
|
||||
})],
|
||||
depth_attachment: Some(RenderingAttachmentInfo {
|
||||
load_op: AttachmentLoadOp::Clear,
|
||||
store_op: AttachmentStoreOp::DontCare,
|
||||
clear_value: Some([1.0].into()),
|
||||
..RenderingAttachmentInfo::image_view(state.depth_image_view.clone())
|
||||
..RenderingAttachmentInfo::image_view(
|
||||
scene_context.depth_stencil_image_view.clone(),
|
||||
)
|
||||
}),
|
||||
..Default::default()
|
||||
})?
|
||||
|
@ -230,7 +214,8 @@ impl Scene for MainScene {
|
|||
});
|
||||
});
|
||||
|
||||
let render_future = gui.draw_on_image(render_future, image_view.clone());
|
||||
let render_future =
|
||||
gui.draw_on_image(render_future, scene_context.swapchain_image_view.clone());
|
||||
|
||||
Ok(render_future)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue