mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2025-02-16 17:12:29 +00:00
Run rustfmt (#843)
This commit is contained in:
parent
d845b15ff1
commit
626863d7c0
@ -1077,13 +1077,14 @@ impl<P> SyncCommandBuffer<P> {
|
||||
|
||||
match (buf.try_gpu_lock(entry.exclusive, queue), prev_err) {
|
||||
(Ok(_), _) => (),
|
||||
(Err(err), AccessCheckError::Unknown) | (_, AccessCheckError::Denied(err)) => {
|
||||
(Err(err), AccessCheckError::Unknown) |
|
||||
(_, AccessCheckError::Denied(err)) => {
|
||||
ret_value = Err(CommandBufferExecError::AccessError {
|
||||
error: err,
|
||||
command_name: cmd.name().into(),
|
||||
command_param: cmd.buffer_name(resource_index),
|
||||
command_offset: command_id,
|
||||
});
|
||||
error: err,
|
||||
command_name: cmd.name().into(),
|
||||
command_param: cmd.buffer_name(resource_index),
|
||||
command_offset: command_id,
|
||||
});
|
||||
break;
|
||||
},
|
||||
};
|
||||
@ -1108,13 +1109,14 @@ impl<P> SyncCommandBuffer<P> {
|
||||
|
||||
match (img.try_gpu_lock(entry.exclusive, entry.initial_layout), prev_err) {
|
||||
(Ok(_), _) => (),
|
||||
(Err(err), AccessCheckError::Unknown) | (_, AccessCheckError::Denied(err)) => {
|
||||
(Err(err), AccessCheckError::Unknown) |
|
||||
(_, AccessCheckError::Denied(err)) => {
|
||||
ret_value = Err(CommandBufferExecError::AccessError {
|
||||
error: err,
|
||||
command_name: cmd.name().into(),
|
||||
command_param: cmd.image_name(resource_index),
|
||||
command_offset: command_id,
|
||||
});
|
||||
error: err,
|
||||
command_name: cmd.name().into(),
|
||||
command_param: cmd.image_name(resource_index),
|
||||
command_offset: command_id,
|
||||
});
|
||||
break;
|
||||
},
|
||||
};
|
||||
|
@ -1759,7 +1759,9 @@ impl<'b, P> SyncCommandBufferBuilderBindDescriptorSets<'b, P> {
|
||||
fn buffer_name(&self, mut num: usize) -> Cow<'static, str> {
|
||||
for (set_num, set) in self.0.iter().enumerate() {
|
||||
if let Some(buf) = set.buffer(num) {
|
||||
return format!("Buffer bound to descriptor {} of set {}", buf.1, set_num)
|
||||
return format!("Buffer bound to descriptor {} of set {}",
|
||||
buf.1,
|
||||
set_num)
|
||||
.into();
|
||||
}
|
||||
num -= set.num_buffers();
|
||||
@ -1778,7 +1780,9 @@ impl<'b, P> SyncCommandBufferBuilderBindDescriptorSets<'b, P> {
|
||||
fn image_name(&self, mut num: usize) -> Cow<'static, str> {
|
||||
for (set_num, set) in self.0.iter().enumerate() {
|
||||
if let Some(img) = set.image(num) {
|
||||
return format!("Image bound to descriptor {} of set {}", img.1, set_num)
|
||||
return format!("Image bound to descriptor {} of set {}",
|
||||
img.1,
|
||||
set_num)
|
||||
.into();
|
||||
}
|
||||
num -= set.num_images();
|
||||
|
@ -1289,8 +1289,7 @@ impl<P> UnsafeCommandBufferBuilder<P> {
|
||||
|
||||
debug_assert!(scissors.iter().all(|s| s.offset.x >= 0 && s.offset.y >= 0));
|
||||
debug_assert!(scissors.iter().all(|s| {
|
||||
s.extent.width < i32::max_value() as u32 &&
|
||||
s.extent.height < i32::max_value() as u32 &&
|
||||
s.extent.width < i32::max_value() as u32 && s.extent.height < i32::max_value() as u32 &&
|
||||
s.offset.x.checked_add(s.extent.width as i32).is_some() &&
|
||||
s.offset.y.checked_add(s.extent.height as i32).is_some()
|
||||
}));
|
||||
|
@ -94,7 +94,7 @@ impl error::Error for CheckDescriptorSetsValidityError {
|
||||
CheckDescriptorSetsValidityError::IncompatibleDescriptor { ref error, .. } => {
|
||||
Some(error)
|
||||
},
|
||||
_ => None
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,16 +81,15 @@ impl DescriptorDesc {
|
||||
// TODO: add example
|
||||
#[inline]
|
||||
pub fn is_superset_of(&self, other: &DescriptorDesc)
|
||||
-> Result<(), DescriptorDescSupersetError>
|
||||
{
|
||||
-> Result<(), DescriptorDescSupersetError> {
|
||||
self.ty.is_superset_of(&other.ty)?;
|
||||
self.stages.is_superset_of(&other.stages)?;
|
||||
|
||||
if self.array_count < other.array_count {
|
||||
return Err(DescriptorDescSupersetError::ArrayTooSmall {
|
||||
len: self.array_count,
|
||||
required: other.array_count,
|
||||
});
|
||||
len: self.array_count,
|
||||
required: other.array_count,
|
||||
});
|
||||
}
|
||||
|
||||
if self.readonly && !other.readonly {
|
||||
@ -238,8 +237,7 @@ impl DescriptorDescTy {
|
||||
// TODO: add example
|
||||
#[inline]
|
||||
pub fn is_superset_of(&self, other: &DescriptorDescTy)
|
||||
-> Result<(), DescriptorDescSupersetError>
|
||||
{
|
||||
-> Result<(), DescriptorDescSupersetError> {
|
||||
match (self, other) {
|
||||
(&DescriptorDescTy::Sampler, &DescriptorDescTy::Sampler) => Ok(()),
|
||||
|
||||
@ -259,16 +257,16 @@ impl DescriptorDescTy {
|
||||
}) => {
|
||||
if me_multisampled != other_multisampled {
|
||||
return Err(DescriptorDescSupersetError::MultisampledMismatch {
|
||||
provided: me_multisampled,
|
||||
expected: other_multisampled,
|
||||
});
|
||||
provided: me_multisampled,
|
||||
expected: other_multisampled,
|
||||
});
|
||||
}
|
||||
|
||||
if me_array_layers != other_array_layers {
|
||||
return Err(DescriptorDescSupersetError::IncompatibleArrayLayers {
|
||||
provided: me_array_layers,
|
||||
required: other_array_layers,
|
||||
});
|
||||
provided: me_array_layers,
|
||||
required: other_array_layers,
|
||||
});
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@ -309,15 +307,15 @@ impl DescriptorDescTy {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(DescriptorDescSupersetError::FormatMismatch {
|
||||
provided: Some(m),
|
||||
expected: o,
|
||||
})
|
||||
provided: Some(m),
|
||||
expected: o,
|
||||
})
|
||||
},
|
||||
(None, None) => Ok(()),
|
||||
(None, Some(a)) => Err(DescriptorDescSupersetError::FormatMismatch {
|
||||
provided: Some(a),
|
||||
expected: a,
|
||||
}),
|
||||
provided: Some(a),
|
||||
expected: a,
|
||||
}),
|
||||
}
|
||||
},
|
||||
|
||||
@ -348,36 +346,37 @@ impl DescriptorImageDesc {
|
||||
/// Checks whether we are a superset of another image.
|
||||
// TODO: add example
|
||||
#[inline]
|
||||
pub fn is_superset_of(&self, other: &DescriptorImageDesc) -> Result<(), DescriptorDescSupersetError> {
|
||||
pub fn is_superset_of(&self, other: &DescriptorImageDesc)
|
||||
-> Result<(), DescriptorDescSupersetError> {
|
||||
if self.dimensions != other.dimensions {
|
||||
return Err(DescriptorDescSupersetError::DimensionsMismatch {
|
||||
provided: self.dimensions,
|
||||
expected: other.dimensions,
|
||||
});
|
||||
provided: self.dimensions,
|
||||
expected: other.dimensions,
|
||||
});
|
||||
}
|
||||
|
||||
if self.multisampled != other.multisampled {
|
||||
return Err(DescriptorDescSupersetError::MultisampledMismatch {
|
||||
provided: self.multisampled,
|
||||
expected: other.multisampled,
|
||||
});
|
||||
provided: self.multisampled,
|
||||
expected: other.multisampled,
|
||||
});
|
||||
}
|
||||
|
||||
match (self.format, other.format) {
|
||||
(Some(a), Some(b)) => if a != b {
|
||||
return Err(DescriptorDescSupersetError::FormatMismatch {
|
||||
provided: Some(a),
|
||||
expected: b,
|
||||
});
|
||||
provided: Some(a),
|
||||
expected: b,
|
||||
});
|
||||
},
|
||||
(Some(_), None) => (),
|
||||
(None, None) => (),
|
||||
(None, Some(a)) => {
|
||||
return Err(DescriptorDescSupersetError::FormatMismatch {
|
||||
provided: None,
|
||||
expected: a,
|
||||
});
|
||||
}
|
||||
provided: None,
|
||||
expected: a,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
match (self.array_layers, other.array_layers) {
|
||||
@ -387,24 +386,32 @@ impl DescriptorImageDesc {
|
||||
match (my_max, other_max) {
|
||||
(Some(m), Some(o)) => if m < o {
|
||||
return Err(DescriptorDescSupersetError::IncompatibleArrayLayers {
|
||||
provided: DescriptorImageDescArray::Arrayed { max_layers: my_max },
|
||||
required: DescriptorImageDescArray::Arrayed { max_layers: other_max },
|
||||
});
|
||||
provided: DescriptorImageDescArray::Arrayed {
|
||||
max_layers: my_max,
|
||||
},
|
||||
required: DescriptorImageDescArray::Arrayed {
|
||||
max_layers: other_max,
|
||||
},
|
||||
});
|
||||
},
|
||||
(Some(_), None) => (),
|
||||
(None, Some(m)) => {
|
||||
return Err(DescriptorDescSupersetError::IncompatibleArrayLayers {
|
||||
provided: DescriptorImageDescArray::Arrayed { max_layers: my_max },
|
||||
required: DescriptorImageDescArray::Arrayed { max_layers: other_max },
|
||||
});
|
||||
provided: DescriptorImageDescArray::Arrayed {
|
||||
max_layers: my_max,
|
||||
},
|
||||
required: DescriptorImageDescArray::Arrayed {
|
||||
max_layers: other_max,
|
||||
},
|
||||
});
|
||||
},
|
||||
(None, None) => (), // TODO: is this correct?
|
||||
};
|
||||
},
|
||||
(a, b) => return Err(DescriptorDescSupersetError::IncompatibleArrayLayers {
|
||||
provided: a,
|
||||
required: b,
|
||||
}),
|
||||
provided: a,
|
||||
required: b,
|
||||
}),
|
||||
};
|
||||
|
||||
Ok(())
|
||||
@ -473,10 +480,7 @@ pub enum DescriptorType {
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum DescriptorDescSupersetError {
|
||||
/// The number of array elements of the descriptor is smaller than expected.
|
||||
ArrayTooSmall {
|
||||
len: u32,
|
||||
required: u32,
|
||||
},
|
||||
ArrayTooSmall { len: u32, required: u32 },
|
||||
|
||||
/// The descriptor type doesn't match the type of the other descriptor.
|
||||
TypeMismatch,
|
||||
@ -497,10 +501,7 @@ pub enum DescriptorDescSupersetError {
|
||||
expected: Format,
|
||||
},
|
||||
|
||||
MultisampledMismatch {
|
||||
provided: bool,
|
||||
expected: bool,
|
||||
},
|
||||
MultisampledMismatch { provided: bool, expected: bool },
|
||||
|
||||
IncompatibleArrayLayers {
|
||||
provided: DescriptorImageDescArray,
|
||||
@ -553,7 +554,7 @@ impl From<ShaderStagesSupersetError> for DescriptorDescSupersetError {
|
||||
match err {
|
||||
ShaderStagesSupersetError::NotSuperset => {
|
||||
DescriptorDescSupersetError::ShaderStagesNotSuperset
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -640,8 +641,8 @@ impl ShaderStages {
|
||||
if (self.vertex || !other.vertex) &&
|
||||
(self.tessellation_control || !other.tessellation_control) &&
|
||||
(self.tessellation_evaluation || !other.tessellation_evaluation) &&
|
||||
(self.geometry || !other.geometry) && (self.fragment || !other.fragment) &&
|
||||
(self.compute || !other.compute)
|
||||
(self.geometry || !other.geometry) &&
|
||||
(self.fragment || !other.fragment) && (self.compute || !other.compute)
|
||||
{
|
||||
Ok(())
|
||||
} else {
|
||||
|
@ -47,7 +47,7 @@ use sampler::Sampler;
|
||||
/// # let graphics_pipeline: Arc<GraphicsPipelineAbstract> = return;
|
||||
/// // use vulkano::pipeline::GraphicsPipelineAbstract;
|
||||
/// // let graphics_pipeline: Arc<GraphicsPipelineAbstract> = ...;
|
||||
///
|
||||
///
|
||||
/// let pool = FixedSizeDescriptorSetsPool::new(graphics_pipeline.clone(), 0);
|
||||
/// ```
|
||||
///
|
||||
|
@ -25,41 +25,41 @@ pub struct RuntimePipelineDesc {
|
||||
|
||||
impl RuntimePipelineDesc {
|
||||
/// Builds a new `RuntimePipelineDesc` from the descriptors and push constants descriptions.
|
||||
pub fn new<TSetsIter, TPushConstsIter, TDescriptorsIter>
|
||||
(desc: TSetsIter, push_constants: TPushConstsIter)
|
||||
-> Result<RuntimePipelineDesc, RuntimePipelineDescError>
|
||||
pub fn new<TSetsIter, TPushConstsIter, TDescriptorsIter>(
|
||||
desc: TSetsIter, push_constants: TPushConstsIter)
|
||||
-> Result<RuntimePipelineDesc, RuntimePipelineDescError>
|
||||
where TSetsIter: IntoIterator<Item = TDescriptorsIter>,
|
||||
TDescriptorsIter: IntoIterator<Item = Option<DescriptorDesc>>,
|
||||
TPushConstsIter: IntoIterator<Item = PipelineLayoutDescPcRange>
|
||||
{
|
||||
let descriptors = desc.into_iter().map(|s| s.into_iter().collect()).collect();
|
||||
let push_constants: SmallVec<[PipelineLayoutDescPcRange; 6]> =
|
||||
push_constants.into_iter().collect();
|
||||
push_constants.into_iter().collect();
|
||||
|
||||
for (a_id, a) in push_constants.iter().enumerate() {
|
||||
for b in push_constants.iter().skip(a_id + 1) {
|
||||
if a.offset <= b.offset && a.offset + a.size > b.offset {
|
||||
return Err(RuntimePipelineDescError::PushConstantsConflict {
|
||||
first_offset: a.offset,
|
||||
first_size: a.size,
|
||||
second_offset: b.offset,
|
||||
});
|
||||
first_offset: a.offset,
|
||||
first_size: a.size,
|
||||
second_offset: b.offset,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if b.offset <= a.offset && b.offset + b.size > a.offset {
|
||||
return Err(RuntimePipelineDescError::PushConstantsConflict {
|
||||
first_offset: b.offset,
|
||||
first_size: b.size,
|
||||
second_offset: a.offset,
|
||||
});
|
||||
first_offset: b.offset,
|
||||
first_size: b.size,
|
||||
second_offset: a.offset,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(RuntimePipelineDesc {
|
||||
descriptors,
|
||||
push_constants,
|
||||
})
|
||||
descriptors,
|
||||
push_constants,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,7 +76,9 @@ unsafe impl PipelineLayoutDesc for RuntimePipelineDesc {
|
||||
|
||||
#[inline]
|
||||
fn descriptor(&self, set: usize, binding: usize) -> Option<DescriptorDesc> {
|
||||
self.descriptors.get(set).and_then(|s| s.get(binding).cloned().unwrap_or(None))
|
||||
self.descriptors
|
||||
.get(set)
|
||||
.and_then(|s| s.get(binding).cloned().unwrap_or(None))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -121,12 +123,12 @@ impl fmt::Display for RuntimePipelineDescError {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::iter;
|
||||
use descriptor::descriptor::DescriptorDesc;
|
||||
use descriptor::descriptor::ShaderStages;
|
||||
use descriptor::pipeline_layout::PipelineLayoutDescPcRange;
|
||||
use descriptor::pipeline_layout::RuntimePipelineDesc;
|
||||
use descriptor::pipeline_layout::RuntimePipelineDescError;
|
||||
use std::iter;
|
||||
|
||||
#[test]
|
||||
fn pc_conflict() {
|
||||
@ -135,7 +137,7 @@ mod tests {
|
||||
size: 8,
|
||||
stages: ShaderStages::all(),
|
||||
};
|
||||
|
||||
|
||||
let range2 = PipelineLayoutDescPcRange {
|
||||
offset: 4,
|
||||
size: 8,
|
||||
@ -146,9 +148,12 @@ mod tests {
|
||||
(iter::empty(), iter::once(range1).chain(iter::once(range2)));
|
||||
|
||||
match r {
|
||||
Err(RuntimePipelineDescError::PushConstantsConflict { first_offset: 0, first_size: 8,
|
||||
second_offset: 4 }) => (),
|
||||
_ => panic!() // test failed
|
||||
Err(RuntimePipelineDescError::PushConstantsConflict {
|
||||
first_offset: 0,
|
||||
first_size: 8,
|
||||
second_offset: 4,
|
||||
}) => (),
|
||||
_ => panic!(), // test failed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -195,10 +195,10 @@ unsafe impl<T: ?Sized, U: ?Sized> PipelineLayoutSuperset<U> for T
|
||||
(Some(mine), Some(other)) => {
|
||||
if let Err(err) = mine.is_superset_of(&other) {
|
||||
return Err(PipelineLayoutNotSupersetError::IncompatibleDescriptors {
|
||||
error: err,
|
||||
set_num: set_num as u32,
|
||||
descriptor: desc_num as u32,
|
||||
});
|
||||
error: err,
|
||||
set_num: set_num as u32,
|
||||
descriptor: desc_num as u32,
|
||||
});
|
||||
}
|
||||
},
|
||||
(None, Some(_)) =>
|
||||
@ -260,7 +260,7 @@ impl error::Error for PipelineLayoutNotSupersetError {
|
||||
PipelineLayoutNotSupersetError::IncompatibleDescriptors { ref error, .. } => {
|
||||
Some(error)
|
||||
},
|
||||
_ => None
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -457,22 +457,20 @@ unsafe impl<F, A> ImageAccess for AttachmentImage<F, A>
|
||||
if expected_layout != self.attachment_layout && expected_layout != ImageLayout::Undefined {
|
||||
if self.initialized.load(Ordering::SeqCst) {
|
||||
return Err(AccessError::UnexpectedImageLayout {
|
||||
requested: expected_layout,
|
||||
allowed: self.attachment_layout,
|
||||
});
|
||||
requested: expected_layout,
|
||||
allowed: self.attachment_layout,
|
||||
});
|
||||
} else {
|
||||
return Err(AccessError::UnexpectedImageLayout {
|
||||
requested: expected_layout,
|
||||
allowed: ImageLayout::Undefined,
|
||||
});
|
||||
requested: expected_layout,
|
||||
allowed: ImageLayout::Undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if expected_layout != ImageLayout::Undefined {
|
||||
if !self.initialized.load(Ordering::SeqCst) {
|
||||
return Err(AccessError::ImageNotInitialized {
|
||||
requested: expected_layout,
|
||||
});
|
||||
return Err(AccessError::ImageNotInitialized { requested: expected_layout });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,13 +309,12 @@ unsafe impl<F, A> ImageAccess for ImmutableImage<F, A>
|
||||
|
||||
#[inline]
|
||||
fn try_gpu_lock(&self, exclusive_access: bool, expected_layout: ImageLayout)
|
||||
-> Result<(), AccessError>
|
||||
{
|
||||
-> Result<(), AccessError> {
|
||||
if expected_layout != self.layout && expected_layout != ImageLayout::Undefined {
|
||||
return Err(AccessError::UnexpectedImageLayout {
|
||||
requested: expected_layout,
|
||||
allowed: self.layout,
|
||||
});
|
||||
requested: expected_layout,
|
||||
allowed: self.layout,
|
||||
});
|
||||
}
|
||||
|
||||
if exclusive_access {
|
||||
@ -429,9 +428,9 @@ unsafe impl<F, A> ImageAccess for ImmutableImageInitialization<F, A>
|
||||
fn try_gpu_lock(&self, _: bool, expected_layout: ImageLayout) -> Result<(), AccessError> {
|
||||
if expected_layout != ImageLayout::Undefined {
|
||||
return Err(AccessError::UnexpectedImageLayout {
|
||||
requested: expected_layout,
|
||||
allowed: ImageLayout::Undefined,
|
||||
});
|
||||
requested: expected_layout,
|
||||
allowed: ImageLayout::Undefined,
|
||||
});
|
||||
}
|
||||
|
||||
if self.image.initialized.load(Ordering::Relaxed) {
|
||||
|
@ -217,9 +217,9 @@ unsafe impl<F, A> ImageAccess for StorageImage<F, A>
|
||||
// TODO: handle initial layout transition
|
||||
if expected_layout != ImageLayout::General && expected_layout != ImageLayout::Undefined {
|
||||
return Err(AccessError::UnexpectedImageLayout {
|
||||
requested: expected_layout,
|
||||
allowed: ImageLayout::General,
|
||||
});
|
||||
requested: expected_layout,
|
||||
allowed: ImageLayout::General,
|
||||
});
|
||||
}
|
||||
|
||||
let val = self.gpu_lock.compare_and_swap(0, 1, Ordering::SeqCst);
|
||||
|
@ -264,8 +264,7 @@ unsafe impl<T> ImageAccess for T
|
||||
|
||||
#[inline]
|
||||
fn try_gpu_lock(&self, exclusive_access: bool, expected_layout: ImageLayout)
|
||||
-> Result<(), AccessError>
|
||||
{
|
||||
-> Result<(), AccessError> {
|
||||
(**self).try_gpu_lock(exclusive_access, expected_layout)
|
||||
}
|
||||
|
||||
@ -327,8 +326,7 @@ unsafe impl<I> ImageAccess for ImageAccessFromUndefinedLayout<I>
|
||||
|
||||
#[inline]
|
||||
fn try_gpu_lock(&self, exclusive_access: bool, expected_layout: ImageLayout)
|
||||
-> Result<(), AccessError>
|
||||
{
|
||||
-> Result<(), AccessError> {
|
||||
self.image.try_gpu_lock(exclusive_access, expected_layout)
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ impl
|
||||
raster: Default::default(),
|
||||
multisample: vk::PipelineMultisampleStateCreateInfo {
|
||||
sType: vk::STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,
|
||||
.. mem::zeroed()
|
||||
..mem::zeroed()
|
||||
},
|
||||
fragment_shader: None,
|
||||
depth_stencil: DepthStencil::disabled(),
|
||||
@ -802,10 +802,14 @@ impl<Vdef, Vs, Vss, Tcs, Tcss, Tes, Tess, Gs, Gss, Fs, Fss, Rp>
|
||||
lineWidth: self.raster.line_width.unwrap_or(1.0),
|
||||
};
|
||||
|
||||
self.multisample.rasterizationSamples = self.render_pass.as_ref().unwrap().num_samples().unwrap_or(1);
|
||||
self.multisample.rasterizationSamples = self.render_pass
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.num_samples()
|
||||
.unwrap_or(1);
|
||||
if self.multisample.sampleShadingEnable != vk::FALSE {
|
||||
debug_assert!(self.multisample.minSampleShading >= 0.0 &&
|
||||
self.multisample.minSampleShading <= 1.0);
|
||||
self.multisample.minSampleShading <= 1.0);
|
||||
if !device.enabled_features().sample_rate_shading {
|
||||
return Err(GraphicsPipelineCreationError::SampleRateShadingFeatureNotEnabled);
|
||||
}
|
||||
|
@ -74,7 +74,8 @@ impl ShaderModule {
|
||||
/// - The SPIR-V code may require some features that are not enabled. This isn't checked by
|
||||
/// this function either.
|
||||
///
|
||||
pub unsafe fn from_words(device: Arc<Device>, spirv: &[u32]) -> Result<Arc<ShaderModule>, OomError> {
|
||||
pub unsafe fn from_words(device: Arc<Device>, spirv: &[u32])
|
||||
-> Result<Arc<ShaderModule>, OomError> {
|
||||
Self::from_ptr(device, spirv.as_ptr(), spirv.len() * mem::size_of::<u32>())
|
||||
}
|
||||
|
||||
@ -86,7 +87,8 @@ impl ShaderModule {
|
||||
/// - The SPIR-V code may require some features that are not enabled. This isn't checked by
|
||||
/// this function either.
|
||||
///
|
||||
unsafe fn from_ptr(device: Arc<Device>, spirv: *const u32, spirv_len: usize) -> Result<Arc<ShaderModule>, OomError> {
|
||||
unsafe fn from_ptr(device: Arc<Device>, spirv: *const u32, spirv_len: usize)
|
||||
-> Result<Arc<ShaderModule>, OomError> {
|
||||
let module = {
|
||||
let infos = vk::ShaderModuleCreateInfo {
|
||||
sType: vk::STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
|
||||
|
@ -9,12 +9,12 @@
|
||||
|
||||
use std::iter;
|
||||
|
||||
use buffer::BufferAccess;
|
||||
use pipeline::vertex::AttributeInfo;
|
||||
use pipeline::vertex::IncompatibleVertexDefinitionError;
|
||||
use pipeline::vertex::InputRate;
|
||||
use pipeline::vertex::VertexDefinition;
|
||||
use pipeline::vertex::VertexSource;
|
||||
use buffer::BufferAccess;
|
||||
|
||||
/// Implementation of `VertexDefinition` for drawing with no buffers at all.
|
||||
///
|
||||
@ -32,13 +32,15 @@ pub struct BufferlessVertices {
|
||||
}
|
||||
|
||||
unsafe impl VertexSource<BufferlessVertices> for BufferlessDefinition {
|
||||
fn decode(&self, n: BufferlessVertices) -> (Vec<Box<BufferAccess + Sync + Send + 'static>>, usize, usize) {
|
||||
fn decode(&self, n: BufferlessVertices)
|
||||
-> (Vec<Box<BufferAccess + Sync + Send + 'static>>, usize, usize) {
|
||||
(Vec::new(), n.vertices, n.instances)
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<T> VertexSource<Vec<T>> for BufferlessDefinition {
|
||||
fn decode<'l>(&self, _: Vec<T>) -> (Vec<Box<BufferAccess + Sync + Send + 'static>>, usize, usize) {
|
||||
fn decode<'l>(&self, _: Vec<T>)
|
||||
-> (Vec<Box<BufferAccess + Sync + Send + 'static>>, usize, usize) {
|
||||
panic!("bufferless drawing should not be supplied with buffers")
|
||||
}
|
||||
}
|
||||
@ -46,7 +48,9 @@ unsafe impl<T> VertexSource<Vec<T>> for BufferlessDefinition {
|
||||
unsafe impl<I> VertexDefinition<I> for BufferlessDefinition {
|
||||
type BuffersIter = iter::Empty<(u32, usize, InputRate)>;
|
||||
type AttribsIter = iter::Empty<(u32, u32, AttributeInfo)>;
|
||||
fn definition(&self, _: &I) -> Result<(Self::BuffersIter, Self::AttribsIter), IncompatibleVertexDefinitionError> {
|
||||
fn definition(
|
||||
&self, _: &I)
|
||||
-> Result<(Self::BuffersIter, Self::AttribsIter), IncompatibleVertexDefinitionError> {
|
||||
Ok((iter::empty(), iter::empty()))
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,8 @@
|
||||
//! # }
|
||||
//! ```
|
||||
|
||||
pub use self::bufferless::BufferlessDefinition;
|
||||
pub use self::bufferless::BufferlessVertices;
|
||||
pub use self::definition::AttributeInfo;
|
||||
pub use self::definition::IncompatibleVertexDefinitionError;
|
||||
pub use self::definition::InputRate;
|
||||
@ -75,8 +77,6 @@ pub use self::two::TwoBuffersDefinition;
|
||||
pub use self::vertex::Vertex;
|
||||
pub use self::vertex::VertexMemberInfo;
|
||||
pub use self::vertex::VertexMemberTy;
|
||||
pub use self::bufferless::BufferlessDefinition;
|
||||
pub use self::bufferless::BufferlessVertices;
|
||||
|
||||
mod definition;
|
||||
mod impl_vertex;
|
||||
|
Loading…
Reference in New Issue
Block a user