[][src]Macro vulkayes_core::render_pass_description

macro_rules! render_pass_description {
    (
		Attachments {
			$unused: ident,
			$(
				$att_name: ident {
					format = $format: expr,
					ops = $ops: expr,
					layouts = $initial_layout: expr => $final_layout: expr
					$(, samples = $samples: expr)?
					$(, may_alias = $may_alias: expr)?
					$(,)?
				}
			)*
		}
		Subpasses {
			$(
				$sub_name: ident {
					$(
						input = [
							$(
								@$input_name: ident $({$input_layout: expr})?
							),+ $(,)?
						]
					)?
					$(
						color = [
							$(
								@$color_name: ident $({$color_layout: expr})?
							),+ $(,)?
						]
						$(
							resolve = [
								$(
									@$resolve_name: ident $({$resolve_layout: expr})?
								),+ $(,)?
							]
						)?
					)?
					$(
						depth_stencil = @$ds_name: ident $({$ds_layout: expr})?
					)?
					$(
						preserve = [
							$(
								@$preserve_name: ident
							),+ $(,)?
						]
					)?
				}
			)+
		}
	) => { ... };
    (
		__INNER_attachment_reference
		$name: ident $($layout: expr)?
	) => { ... };
}

Generates render pass attachment descriptions and subpass descriptions.

The syntax is:


let attachments: [AttachmentDescription; 2];
let holders: (SubpassDescriptionHolder<[AttachmentReference; 1], [AttachmentReference; 1], [u32; 1]>);

let (attachments, holders) = render_pass_description! {
	Attachments {
		// ident for the unused meta-attachment
		UNUSED,

		// name of the attachment, has to be unique across the whole macro to avoid collisions inside the macro
		Foo {
			format = vk::Format::R8_UINT, // any associated constant of vk::Format
			ops = AttachmentOps::Color {
				load: vk::AttachmentLoadOp::CLEAR,
				store: vk::AttachmentStoreOp::DONT_CARE
			},
			layouts = vk::ImageLayout::UNDEFINED => ImageLayoutFinal::COLOR_ATTACHMENT_OPTIMAL, // initial layout (vk::ImageLayout) and final layout (ImageLayoutFinal)
			samples = vk::SampleCountFlags::TYPE_2, // optional, any associated constant of vk::SampleCountFlags
			may_alias = true // optional, controls the vk::AttachmentDescriptionFlags::MAY_ALIAS flag
		}

		Bar {
			format = vk::Format::D16_UNORM_S8_UINT,
			ops = AttachmentOps::DepthStencil {
				depth_load: vk::AttachmentLoadOp::CLEAR,
				depth_store: vk::AttachmentStoreOp::DONT_CARE,
				stencil_load: vk::AttachmentLoadOp::LOAD,
				stencil_store: vk::AttachmentStoreOp::STORE
			},
			layouts = vk::ImageLayout::UNDEFINED => ImageLayoutFinal::DEPTH_STENCIL_ATTACHMENT_OPTIMAL
		}

		// etc.
	}
	Subpasses {
		// name of the subpass, has to be unique across the whole macro to avoid collisions inside the macro
		First {
			// optional, specifies input attachments
			input = [
				@Foo // uses attachment named Foo with layout COLOR_ATTACHMENT_OPTIMAL (final_layout)
			]

			// optional, specifies color attachments
			color = [
				@Foo{ImageLayoutAttachment::GENERAL} // uses with layout GENERAL
			]

			// optional, can only be specified if color attachments are also specified,
			// specifies resolve attachments, size has to match color attachments
			resolve = [
				@UNUSED // unused resolve attachment
			]

			// optional, specifies depth stencil attachment with layout DEPTH_STENCIL_ATTACHMENT_OPTIMAL
			depth_stencil = @Bar{ImageLayoutAttachment::DEPTH_STENCIL_ATTACHMENT_OPTIMAL}

			// optional, specifies attachments to preserve
			preserve = [
				@Foo // Foo is not valid here, this is only for demonstration
			]
		}

		// etc.
	}
};