Add shortcut function for the triangle_list IA

This commit is contained in:
Pierre Krieger 2016-02-27 22:22:31 +01:00
parent 705de7671d
commit 4f19f00469
3 changed files with 13 additions and 10 deletions

View File

@ -175,11 +175,7 @@ fn main() {
let pipeline = {
let ia = vulkano::pipeline::input_assembly::InputAssembly {
topology: vulkano::pipeline::input_assembly::PrimitiveTopology::TriangleList,
primitive_restart_enable: false,
};
let ia = vulkano::pipeline::input_assembly::InputAssembly::triangle_list();
let raster = Default::default();
let ms = vulkano::pipeline::multisample::Multisample::disabled();
let blend = vulkano::pipeline::blend::Blend {

View File

@ -163,11 +163,7 @@ fn main() {
}.unwrap();
let pipeline = {
let ia = vulkano::pipeline::input_assembly::InputAssembly {
topology: vulkano::pipeline::input_assembly::PrimitiveTopology::TriangleList,
primitive_restart_enable: false,
};
let ia = vulkano::pipeline::input_assembly::InputAssembly::triangle_list();
let raster = Default::default();
let ms = vulkano::pipeline::multisample::Multisample::disabled();
let blend = vulkano::pipeline::blend::Blend {

View File

@ -19,6 +19,17 @@ pub struct InputAssembly {
pub primitive_restart_enable: bool,
}
impl InputAssembly {
/// Builds an `InputAssembly` struct with the `TriangleList` topology.
#[inline]
pub fn triangle_list() -> InputAssembly {
InputAssembly {
topology: PrimitiveTopology::TriangleList,
primitive_restart_enable: false,
}
}
}
/// Describes how vertices must be grouped together to form primitives.
///
/// Note that some topologies don't support primitive restart.