RenderPassBeginInfo

Struct RenderPassBeginInfo 

Source
pub struct RenderPassBeginInfo {
    pub render_pass: Arc<RenderPass>,
    pub framebuffer: Arc<Framebuffer>,
    pub render_area_offset: [u32; 2],
    pub render_area_extent: [u32; 2],
    pub clear_values: Vec<Option<ClearValue>>,
    pub _ne: NonExhaustive,
}
Expand description

Parameters to begin a new render pass.

Fields§

§render_pass: Arc<RenderPass>

The render pass to begin.

If this is not the render pass that framebuffer was created with, it must be compatible with that render pass.

The default value is the render pass of framebuffer.

§framebuffer: Arc<Framebuffer>

The framebuffer to use for rendering.

There is no default value.

§render_area_offset: [u32; 2]

The offset from the top left corner of the framebuffer that will be rendered to.

The default value is [0, 0].

§render_area_extent: [u32; 2]

The size of the area that will be rendered to.

render_area_offset + render_area_extent must not be greater than [framebuffer.extent()].

The default value is [framebuffer.extent()].

§clear_values: Vec<Option<ClearValue>>

Provides, for each attachment in render_pass that has a load operation of AttachmentLoadOp::Clear, the clear values that should be used for the attachments in the framebuffer. There must be exactly [framebuffer.attachments().len()] elements provided, and each one must match the attachment format.

To skip over an attachment whose load operation is something else, provide None.

The default value is empty, which must be overridden if the framebuffer has attachments.

§_ne: NonExhaustive

Implementations§

Source§

impl RenderPassBeginInfo

Source

pub fn framebuffer(framebuffer: Arc<Framebuffer>) -> RenderPassBeginInfo

Examples found in repository?
examples/scene_example.rs (line 199)
165pub fn get_cmd_bufs(
166    vk: Arc<Vk>, 
167    renderer: &Renderer,
168    imgui_renderer: &mut ImGui,
169    presenter: &Presenter,
170    pipeline: Arc<GraphicsPipeline>,
171) -> Vec<CommandBufferType> {
172    let mut cmd_bufs: Vec<CommandBufferType> = vec![];
173
174    let ubo = VkBuffer::uniform(vk.allocators.clone(), vs::Camera {
175        view: renderer.camera.get_view(),
176        proj: renderer.camera.get_proj(),
177    });
178
179    let camera_desc_set = descriptor_set(
180        vk.clone(), 
181        0, 
182        pipeline.clone(), 
183        [WriteDescriptorSet::buffer(0, ubo.content.clone())]
184    ).0;
185
186    let render_passes = imgui_renderer.get_renderpasses(
187        presenter.images.clone(),
188        vk.clone()
189    );
190
191    let mut i = 0;
192    for framebuffer in &presenter.framebuffers.clone() {
193        let mut builder = VkBuilder::new_multiple(vk.clone());
194
195        builder.0
196            .begin_render_pass(
197                RenderPassBeginInfo {
198                    clear_values: vec![Some([0.1, 0.2, 0.3, 1.0].into()), Some(1.0.into())],
199                    ..RenderPassBeginInfo::framebuffer(framebuffer.clone())
200                },
201                SubpassBeginInfo {
202                    contents: SubpassContents::Inline,
203                    ..Default::default()
204                },
205            )
206            .unwrap()
207            .bind_pipeline_graphics(pipeline.clone())
208            .unwrap()
209            .bind_descriptor_sets(
210                vulkano::pipeline::PipelineBindPoint::Graphics, 
211                pipeline.layout().clone(), 
212                0, 
213                camera_desc_set.clone(),
214            )
215            .unwrap();
216
217        for mesh in &renderer.meshes {
218            mesh.build_commands(vk.clone(), &mut builder.0, pipeline.clone());
219        }
220
221        builder.0.end_render_pass(Default::default()).unwrap();
222
223        let render_pass = &render_passes[i];
224        builder.0.begin_render_pass(
225            RenderPassBeginInfo {
226                clear_values: vec![None],
227                render_pass: render_pass.rp.clone(),
228                ..RenderPassBeginInfo::framebuffer(render_pass.framebuffer.clone())
229            },
230            SubpassBeginInfo {
231                contents: SubpassContents::SecondaryCommandBuffers,
232                ..Default::default()
233            },
234        ).expect(&format!("failed to start imgui render pass on framebuffer {:?}", framebuffer));
235
236        builder.0.execute_commands(render_pass.cmd_buf.clone()).unwrap();
237        
238        builder.0.end_render_pass(Default::default()).unwrap();
239        
240        
241        cmd_bufs.push(
242            builder.command_buffer()
243        );
244
245        i += 1;
246    }
247
248    cmd_bufs
249}

Trait Implementations§

Source§

impl Clone for RenderPassBeginInfo

Source§

fn clone(&self) -> RenderPassBeginInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RenderPassBeginInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.