Cleanup unused code

This commit is contained in:
maik klein 2016-12-26 00:39:00 +01:00
parent 87ee2af220
commit 4fd228fcb3
2 changed files with 8 additions and 23 deletions

View file

@ -1,22 +1,15 @@
#![allow(dead_code)]
#[macro_use] #[macro_use]
extern crate ash; extern crate ash;
extern crate winit;
extern crate examples; extern crate examples;
use ash::vk; use ash::vk;
use std::default::Default; use std::default::Default;
use ash::entry::Entry;
use ash::instance::Instance;
use ash::extensions::{Swapchain, XlibSurface, Surface, DebugReport};
use ash::device::Device;
use std::ptr; use std::ptr;
use std::ffi::{CStr, CString}; use std::ffi::CString;
use std::mem; use std::mem;
use std::path::Path; use std::path::Path;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use winit::os::unix::WindowExt;
use examples::*; use examples::*;
#[derive(Clone, Debug, Copy)] #[derive(Clone, Debug, Copy)]
@ -28,17 +21,6 @@ struct Vertex {
fn main() { fn main() {
unsafe { unsafe {
let base = ExampleBase::new(1920, 1080); let base = ExampleBase::new(1920, 1080);
let fence_create_info = vk::FenceCreateInfo {
s_type: vk::StructureType::FenceCreateInfo,
p_next: ptr::null(),
flags: vk::FenceCreateFlags::empty(),
};
let command_buffer_begin_info = vk::CommandBufferBeginInfo {
s_type: vk::StructureType::CommandBufferBeginInfo,
p_next: ptr::null(),
p_inheritance_info: ptr::null(),
flags: vk::COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
};
let renderpass_attachments = let renderpass_attachments =
[vk::AttachmentDescription { [vk::AttachmentDescription {
format: base.surface_format.format, format: base.surface_format.format,
@ -484,7 +466,7 @@ fn main() {
// device.cmd_draw(draw_command_buffer, 3, 1, 0, 0); // device.cmd_draw(draw_command_buffer, 3, 1, 0, 0);
device.cmd_end_render_pass(draw_command_buffer); device.cmd_end_render_pass(draw_command_buffer);
}); });
let mut present_info_err = unsafe { mem::uninitialized() }; let mut present_info_err = mem::uninitialized();
let present_info = vk::PresentInfoKHR { let present_info = vk::PresentInfoKHR {
s_type: vk::StructureType::PresentInfoKhr, s_type: vk::StructureType::PresentInfoKhr,
p_next: ptr::null(), p_next: ptr::null(),

View file

@ -22,12 +22,15 @@ use std::ops::Drop;
#[macro_export] #[macro_export]
macro_rules! offset_of{ macro_rules! offset_of{
($base: path, $field: ident) => { ($base: path, $field: ident) => {
{
#[allow(unused_unsafe)]
unsafe{ unsafe{
let b: $base = mem::uninitialized(); let b: $base = mem::uninitialized();
(&b.$field as *const _ as isize) - (&b as *const _ as isize) (&b.$field as *const _ as isize) - (&b as *const _ as isize)
} }
} }
} }
}
pub fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(device: &Device, pub fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>(device: &Device,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,