Fix the examples

This commit is contained in:
Pierre Krieger 2016-04-30 12:52:47 +02:00
parent 3cd617fd85
commit 148e7e3e3f
5 changed files with 47 additions and 8 deletions

View File

@ -25,7 +25,7 @@ script:
# chance to reach travis' memory limit
- cargo test -j 1 --manifest-path vulkano-win/Cargo.toml
- cargo test --no-run -j 1 -v --manifest-path vulkano/Cargo.toml
#- cargo build -j 1 --manifest-path examples/Cargo.toml
- cargo build -j 1 --manifest-path examples/Cargo.toml
after_success:
- |

View File

@ -9,7 +9,7 @@ vulkano = { path = "../vulkano" }
vulkano-win = { path = "../vulkano-win" }
cgmath = "0.7.0"
image = "0.6.1"
winit = { git = "https://github.com/tomaka/winit" }
winit = "0.5.0"
[build-dependencies]
vk-sys = { path = "../vk-sys" }

View File

@ -76,7 +76,7 @@ fn main() {
let vertex_buffer = vulkano::buffer::cpu_access::CpuAccessibleBuffer::<[Vertex]>
::array(&device, 4, &vulkano::buffer::Usage::all(),
::array(&device, 4, &vulkano::buffer::BufferUsage::all(),
Some(queue.family())).expect("failed to create buffer");
struct Vertex { position: [f32; 2] }
@ -131,7 +131,7 @@ fn main() {
// TODO: staging buffer instead
let pixel_buffer = vulkano::buffer::cpu_access::CpuAccessibleBuffer::<[[u8; 4]]>
::array(&device, image_data.len(), &vulkano::buffer::Usage::all(),
::array(&device, image_data.len(), &vulkano::buffer::BufferUsage::all(),
Some(queue.family())).expect("failed to create buffer");
{

View File

@ -81,7 +81,7 @@ fn main() {
let vertex_buffer = vulkano::buffer::cpu_access::CpuAccessibleBuffer
::array(&device, examples::VERTICES.len(),
&vulkano::buffer::Usage::all(), Some(queue.family()))
&vulkano::buffer::BufferUsage::all(), Some(queue.family()))
.expect("failed to create buffer");
{
@ -93,7 +93,7 @@ fn main() {
let normals_buffer = vulkano::buffer::cpu_access::CpuAccessibleBuffer
::array(&device, examples::NORMALS.len(),
&vulkano::buffer::Usage::all(), Some(queue.family()))
&vulkano::buffer::BufferUsage::all(), Some(queue.family()))
.expect("failed to create buffer");
{
@ -105,7 +105,7 @@ fn main() {
let index_buffer = vulkano::buffer::cpu_access::CpuAccessibleBuffer
::array(&device, examples::INDICES.len(),
&vulkano::buffer::Usage::all(), Some(queue.family()))
&vulkano::buffer::BufferUsage::all(), Some(queue.family()))
.expect("failed to create buffer");
{
@ -122,7 +122,7 @@ fn main() {
let scale = cgmath::Matrix4::from_scale(0.01);
let uniform_buffer = vulkano::buffer::cpu_access::CpuAccessibleBuffer::<vs::ty::Data>
::new(&device, &vulkano::buffer::Usage::all(), Some(queue.family()))
::new(&device, &vulkano::buffer::BufferUsage::all(), Some(queue.family()))
.expect("failed to create buffer");
{
let mut mapping = uniform_buffer.write(Duration::new(0, 0)).unwrap();

View File

@ -427,6 +427,45 @@ unsafe impl VertexMember for f64 {
}
}
unsafe impl<T> VertexMember for (T,)
where T: VertexMember
{
#[inline]
fn format() -> (VertexMemberTy, usize) {
<T as VertexMember>::format()
}
}
unsafe impl<T> VertexMember for (T, T)
where T: VertexMember
{
#[inline]
fn format() -> (VertexMemberTy, usize) {
let (ty, sz) = <T as VertexMember>::format();
(ty, sz * 2)
}
}
unsafe impl<T> VertexMember for (T, T, T)
where T: VertexMember
{
#[inline]
fn format() -> (VertexMemberTy, usize) {
let (ty, sz) = <T as VertexMember>::format();
(ty, sz * 3)
}
}
unsafe impl<T> VertexMember for (T, T, T, T)
where T: VertexMember
{
#[inline]
fn format() -> (VertexMemberTy, usize) {
let (ty, sz) = <T as VertexMember>::format();
(ty, sz * 4)
}
}
macro_rules! impl_vm_array {
($sz:expr) => (
unsafe impl<T> VertexMember for [T; $sz]