mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-27 01:05:03 +00:00
Remove custom framebuffer clear values and stuff
This commit is contained in:
parent
4defc0f4b5
commit
1afbdde27f
@ -88,39 +88,6 @@ macro_rules! ordered_passes_renderpass {
|
||||
)*
|
||||
}
|
||||
|
||||
impl CustomRenderPassDesc {
|
||||
#[inline]
|
||||
pub fn start_attachments(&self) -> atch::AttachmentsStart {
|
||||
atch::AttachmentsStart
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn start_clear_values(&self) -> cv::ClearValuesStart {
|
||||
cv::ClearValuesStart
|
||||
}
|
||||
}
|
||||
|
||||
pub mod atch {
|
||||
use $crate::framebuffer::AttachmentsList;
|
||||
use $crate::framebuffer::FramebufferCreationError;
|
||||
use $crate::framebuffer::RenderPassDesc;
|
||||
use $crate::framebuffer::RenderPassDescAttachmentsList;
|
||||
use $crate::framebuffer::ensure_image_view_compatible;
|
||||
use $crate::image::traits::ImageViewAccess;
|
||||
use super::CustomRenderPassDesc;
|
||||
pub struct AttachmentsStart;
|
||||
ordered_passes_renderpass!{[] __impl_attachments__ [] [] [$($atch_name),*] [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]}
|
||||
}
|
||||
|
||||
pub mod cv {
|
||||
use std::iter;
|
||||
use $crate::format::ClearValue;
|
||||
use $crate::framebuffer::RenderPassDescClearValues;
|
||||
use super::CustomRenderPassDesc;
|
||||
pub struct ClearValuesStart;
|
||||
ordered_passes_renderpass!{[] __impl_clear_values__ [] [] [$($atch_name: $load),*] [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl RenderPassDesc for CustomRenderPassDesc {
|
||||
#[inline]
|
||||
@ -378,185 +345,4 @@ macro_rules! ordered_passes_renderpass {
|
||||
)*
|
||||
}.build_render_pass($device)
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
([] __impl_attachments__ [] [] [] [$($params:ident),*]) => {
|
||||
unsafe impl RenderPassDescAttachmentsList<AttachmentsStart> for CustomRenderPassDesc {
|
||||
type List = ();
|
||||
|
||||
fn check_attachments_list(&self, attachments: AttachmentsStart) -> Result<(), FramebufferCreationError> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
([] __impl_attachments__ [] [] [$next:ident $(, $rest:ident)*] [$first_param:ident, $($rest_params:ident),*]) => {
|
||||
pub struct $next<$first_param> {
|
||||
current: $first_param,
|
||||
}
|
||||
|
||||
impl AttachmentsStart {
|
||||
pub fn $next<$first_param>(self, next: $first_param) -> $next<$first_param> {
|
||||
$next {
|
||||
current: next,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<$first_param> $next<$first_param> where $first_param: ImageViewAccess {
|
||||
fn check_attachments_list(self, rp: &CustomRenderPassDesc, n: usize) -> Result<($first_param,), FramebufferCreationError> {
|
||||
debug_assert_eq!(n, 0);
|
||||
match ensure_image_view_compatible(rp, 0, &self.current) {
|
||||
Ok(()) => Ok((self.current,)),
|
||||
Err(err) => Err(FramebufferCreationError::IncompatibleAttachment {
|
||||
attachment_num: 0,
|
||||
error: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ordered_passes_renderpass!{[] __impl_attachments__ [$next] [$first_param] [$($rest),*] [$($rest_params),*]}
|
||||
};
|
||||
|
||||
([] __impl_attachments__ [$prev:ident] [$($prev_params:ident),*] [] [$($params:ident),*]) => {
|
||||
unsafe impl<$($prev_params),*> RenderPassDescAttachmentsList<$prev<$($prev_params),*>> for CustomRenderPassDesc
|
||||
where $($prev_params: ImageViewAccess + Send + Sync + 'static),*
|
||||
{
|
||||
fn check_attachments_list(&self, attachments: $prev<$($prev_params,)*>) -> Result<Box<AttachmentsList + Send + Sync>, FramebufferCreationError> {
|
||||
Ok(Box::new(try!(attachments.check_attachments_list(self, self.num_attachments() - 1))))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
([] __impl_attachments__ [$prev:ident] [$($prev_params:ident),*] [$next:ident $(, $rest:ident)*] [$first_param:ident, $($rest_params:ident),*]) => {
|
||||
pub struct $next<$($prev_params,)* $first_param> {
|
||||
prev: $prev<$($prev_params),*>,
|
||||
current: $first_param,
|
||||
}
|
||||
|
||||
impl<$($prev_params),*> $prev<$($prev_params),*> {
|
||||
pub fn $next<$first_param>(self, next: $first_param) -> $next<$($prev_params,)* $first_param> {
|
||||
$next {
|
||||
prev: self,
|
||||
current: next,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<$($prev_params,)* $first_param> $next<$($prev_params,)* $first_param>
|
||||
where $($prev_params: ImageViewAccess,)*
|
||||
$first_param: ImageViewAccess
|
||||
{
|
||||
fn check_attachments_list(self, rp: &CustomRenderPassDesc, n: usize) -> Result<($($prev_params,)* $first_param), FramebufferCreationError> {
|
||||
let ($($prev_params,)*) = try!(self.prev.check_attachments_list(rp, n - 1));
|
||||
|
||||
match ensure_image_view_compatible(rp, n, &self.current) {
|
||||
Ok(()) => Ok(($($prev_params,)* self.current)),
|
||||
Err(err) => Err(FramebufferCreationError::IncompatibleAttachment {
|
||||
attachment_num: n,
|
||||
error: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ordered_passes_renderpass!{[] __impl_attachments__ [$next] [$($prev_params,)* $first_param] [$($rest),*] [$($rest_params),*]}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
([] __impl_clear_values__ [] [] [] [$($params:ident),*]) => {
|
||||
unsafe impl RenderPassDescClearValues<ClearValuesStart> for CustomRenderPassDesc {
|
||||
#[inline]
|
||||
fn convert_clear_values(&self, values: ClearValuesStart) -> Box<Iterator<Item = ClearValue>> {
|
||||
Box::new(iter::empty())
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
([] __impl_clear_values__ [] [] [$next:ident: Clear $(, $rest:ident: $rest_load:ident)*] [$first_param:ident, $($rest_params:ident),*]) => {
|
||||
pub struct $next<$first_param> {
|
||||
current: $first_param,
|
||||
}
|
||||
|
||||
impl ClearValuesStart {
|
||||
pub fn $next<$first_param>(self, next: $first_param) -> $next<$first_param> {
|
||||
$next {
|
||||
current: next,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<$first_param> $next<$first_param>
|
||||
where $first_param: Into<ClearValue>
|
||||
{
|
||||
#[inline]
|
||||
fn convert_clear_values(self) -> iter::Once<ClearValue> {
|
||||
// FIXME: check format
|
||||
iter::once(self.current.into())
|
||||
}
|
||||
}
|
||||
|
||||
ordered_passes_renderpass!{[] __impl_clear_values__ [$next] [$first_param] [$($rest: $rest_load),*] [$($rest_params),*]}
|
||||
};
|
||||
|
||||
([] __impl_clear_values__ [] [] [$next:ident: $other:ident $(, $rest:ident: $rest_load:ident)*] [$first_param:ident, $($rest_params:ident),*]) => {
|
||||
ordered_passes_renderpass!{[] __impl_clear_values__ [] [] [$($rest: $rest_load),*] [$first_param, $($rest_params),*]}
|
||||
};
|
||||
|
||||
([] __impl_clear_values__ [$prev:ident] [$($prev_params:ident),*] [] [$($params:ident),*]) => {
|
||||
unsafe impl<$($prev_params),*> RenderPassDescClearValues<$prev<$($prev_params),*>> for CustomRenderPassDesc
|
||||
where $($prev_params: Into<ClearValue>),*
|
||||
{
|
||||
#[inline]
|
||||
fn convert_clear_values(&self, values: $prev<$($prev_params,)*>) -> Box<Iterator<Item = ClearValue>> {
|
||||
Box::new(values.convert_clear_values())
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
([] __impl_clear_values__ [$prev:ident] [$($prev_params:ident),*] [$next:ident: Clear $(, $rest:ident: $rest_load:ident)*] [$first_param:ident, $($rest_params:ident),*]) => {
|
||||
pub struct $next<$($prev_params,)* $first_param> {
|
||||
prev: $prev<$($prev_params,)*>,
|
||||
current: $first_param,
|
||||
}
|
||||
|
||||
impl<$($prev_params,)*> $prev<$($prev_params,)*> {
|
||||
pub fn $next<$first_param>(self, next: $first_param) -> $next<$($prev_params,)* $first_param> {
|
||||
$next {
|
||||
prev: self,
|
||||
current: next,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<$($prev_params,)* $first_param> $next<$($prev_params,)* $first_param>
|
||||
where $first_param: Into<ClearValue>
|
||||
$(, $prev_params: Into<ClearValue>)*
|
||||
{
|
||||
#[inline]
|
||||
fn convert_clear_values(self) -> Box<Iterator<Item = ClearValue>> {
|
||||
// TODO: subopptimal iterator
|
||||
let prev = self.prev.convert_clear_values();
|
||||
// FIXME: check format
|
||||
Box::new(prev.chain(iter::once(self.current.into())))
|
||||
}
|
||||
}
|
||||
|
||||
ordered_passes_renderpass!{[] __impl_clear_values__ [$next] [$($prev_params,)* $first_param] [$($rest: $rest_load),*] [$($rest_params),*]}
|
||||
};
|
||||
|
||||
([] __impl_clear_values__ [$prev:ident] [$($prev_params:ident),*] [$next:ident: $other:ident $(, $rest:ident: $rest_load:ident)*] [$first_param:ident, $($rest_params:ident),*]) => {
|
||||
ordered_passes_renderpass!{[] __impl_clear_values__ [$prev] [$($prev_params,)*] [$($rest: $rest_load),*] [$first_param, $($rest_params),*]}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user