mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-21 22:34:43 +00:00
Fix warnings
This commit is contained in:
parent
d241551d47
commit
a023aaa078
@ -17,9 +17,6 @@ extern crate vulkano_win;
|
||||
|
||||
use vulkano_win::VkSurfaceBuild;
|
||||
|
||||
use std::ffi::OsStr;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::time::Duration;
|
||||
|
||||
fn main() {
|
||||
|
@ -17,9 +17,6 @@ extern crate vulkano_win;
|
||||
|
||||
use vulkano_win::VkSurfaceBuild;
|
||||
|
||||
use std::ffi::OsStr;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
|
@ -56,9 +56,6 @@ use vulkano::swapchain::SurfaceTransform;
|
||||
use vulkano::swapchain::Swapchain;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::ffi::OsStr;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::time::Duration;
|
||||
|
||||
fn main() {
|
||||
|
@ -18,7 +18,6 @@ pub fn write_descriptor_sets(doc: &parse::Spirv) -> String {
|
||||
// Finding all the descriptors.
|
||||
let mut descriptors = Vec::new();
|
||||
struct Descriptor {
|
||||
name: String,
|
||||
set: u32,
|
||||
binding: u32,
|
||||
desc_ty: String,
|
||||
@ -53,7 +52,6 @@ pub fn write_descriptor_sets(doc: &parse::Spirv) -> String {
|
||||
let (desc_ty, readonly) = descriptor_infos(doc, pointed_ty, false).expect(&format!("Couldn't find relevant type for uniform `{}` (type {}, maybe unimplemented)", name, pointed_ty));
|
||||
|
||||
descriptors.push(Descriptor {
|
||||
name: name,
|
||||
desc_ty: desc_ty,
|
||||
set: descriptor_set,
|
||||
binding: binding,
|
||||
@ -72,7 +70,7 @@ pub fn write_descriptor_sets(doc: &parse::Spirv) -> String {
|
||||
// Iterate once per set.
|
||||
for &set in sets_list.iter() {
|
||||
let descr = descriptors.iter().enumerate().filter(|&(_, d)| d.set == set)
|
||||
.map(|(entry, d)| {
|
||||
.map(|(_, d)| {
|
||||
format!("DescriptorDesc {{
|
||||
binding: {binding},
|
||||
ty: {desc_ty},
|
||||
@ -168,7 +166,7 @@ fn descriptor_infos(doc: &parse::Spirv, pointed_ty: u32, force_combined_image_sa
|
||||
decorations");
|
||||
|
||||
// Determine whether there's a NonWritable decoration.
|
||||
let non_writable = false; // TODO: tricky because the decoration is on struct members
|
||||
//let non_writable = false; // TODO: tricky because the decoration is on struct members
|
||||
|
||||
let desc = format!("DescriptorDescTy::Buffer(DescriptorBufferDesc {{
|
||||
dynamic: Some(false),
|
||||
@ -178,9 +176,8 @@ fn descriptor_infos(doc: &parse::Spirv, pointed_ty: u32, force_combined_image_sa
|
||||
Some((desc, true))
|
||||
},
|
||||
|
||||
&parse::Instruction::TypeImage { result_id, sampled_type_id, ref dim, arrayed, ms,
|
||||
sampled, ref format, ref access, .. }
|
||||
if result_id == pointed_ty =>
|
||||
&parse::Instruction::TypeImage { result_id, ref dim, arrayed, ms, sampled,
|
||||
ref format, .. } if result_id == pointed_ty =>
|
||||
{
|
||||
let sampled = sampled.expect("Vulkan requires that variables of type OpTypeImage \
|
||||
have a Sampled operand of 1 or 2");
|
||||
|
@ -13,12 +13,11 @@ use parse;
|
||||
use is_builtin;
|
||||
use name_from_id;
|
||||
use location_decoration;
|
||||
use type_from_id;
|
||||
use format_from_id;
|
||||
|
||||
pub fn write_entry_point(doc: &parse::Spirv, instruction: &parse::Instruction) -> (String, String) {
|
||||
let (execution, ep_name, interface) = match instruction {
|
||||
&parse::Instruction::EntryPoint { ref execution, id, ref name, ref interface } => {
|
||||
&parse::Instruction::EntryPoint { ref execution, ref name, ref interface, .. } => {
|
||||
(execution, name, interface)
|
||||
},
|
||||
_ => unreachable!()
|
||||
|
@ -7,6 +7,9 @@
|
||||
// notice may not be copied, modified, or distributed except
|
||||
// according to those terms.
|
||||
|
||||
#![allow(dead_code)]
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
use parse::ParseError;
|
||||
|
||||
macro_rules! enumeration {
|
||||
|
@ -279,86 +279,6 @@ fn format_from_id(doc: &parse::Spirv, searched: u32, ignore_first_array: bool) -
|
||||
panic!("Type #{} not found or invalid", searched)
|
||||
}
|
||||
|
||||
// TODO: remove when no longer necessary
|
||||
// TODO: struct definitions don't use this function, so irrelevant elements should be removed
|
||||
fn type_from_id(doc: &parse::Spirv, searched: u32) -> String {
|
||||
for instruction in doc.instructions.iter() {
|
||||
match instruction {
|
||||
&parse::Instruction::TypeVoid { result_id } if result_id == searched => {
|
||||
return "()".to_owned()
|
||||
},
|
||||
&parse::Instruction::TypeBool { result_id } if result_id == searched => {
|
||||
return "bool".to_owned()
|
||||
},
|
||||
&parse::Instruction::TypeInt { result_id, width, signedness } if result_id == searched => {
|
||||
return match (width, signedness) {
|
||||
(8, true) => "i8",
|
||||
(8, false) => "u8",
|
||||
(16, true) => "i16",
|
||||
(16, false) => "u16",
|
||||
(32, true) => "i32",
|
||||
(32, false) => "u32",
|
||||
(64, true) => "i64",
|
||||
(64, false) => "u64",
|
||||
_ => panic!()
|
||||
}.to_owned();
|
||||
},
|
||||
&parse::Instruction::TypeFloat { result_id, width } if result_id == searched => {
|
||||
return match width {
|
||||
32 => "f32",
|
||||
64 => "f64",
|
||||
_ => panic!()
|
||||
}.to_owned();
|
||||
},
|
||||
&parse::Instruction::TypeVector { result_id, component_id, count } if result_id == searched => {
|
||||
let t = type_from_id(doc, component_id);
|
||||
return format!("[{}; {}]", t, count);
|
||||
},
|
||||
&parse::Instruction::TypeMatrix { result_id, column_type_id, column_count } if result_id == searched => {
|
||||
// FIXME: row-major or column-major
|
||||
let t = type_from_id(doc, column_type_id);
|
||||
return format!("[{}; {}]", t, column_count);
|
||||
},
|
||||
&parse::Instruction::TypeImage { result_id, sampled_type_id, ref dim, depth, arrayed, ms, sampled, ref format, ref access } if result_id == searched => {
|
||||
return format!("{}{}Texture{:?}{}{:?}",
|
||||
if ms { "Multisample" } else { "" },
|
||||
if depth == Some(true) { "Depth" } else { "" },
|
||||
dim,
|
||||
if arrayed { "Array" } else { "" },
|
||||
format);
|
||||
},
|
||||
&parse::Instruction::TypeSampledImage { result_id, image_type_id } if result_id == searched => {
|
||||
return type_from_id(doc, image_type_id);
|
||||
},
|
||||
&parse::Instruction::TypeArray { result_id, type_id, length_id } if result_id == searched => {
|
||||
let t = type_from_id(doc, type_id);
|
||||
let len = doc.instructions.iter().filter_map(|e| {
|
||||
match e { &parse::Instruction::Constant { result_id, ref data, .. } if result_id == length_id => Some(data.clone()), _ => None }
|
||||
}).next().expect("failed to find array length");
|
||||
let len = len.iter().rev().fold(0u64, |a, &b| (a << 32) | b as u64);
|
||||
return format!("[{}; {}]", t, len); // FIXME:
|
||||
},
|
||||
&parse::Instruction::TypeRuntimeArray { result_id, type_id } if result_id == searched => {
|
||||
let t = type_from_id(doc, type_id);
|
||||
return format!("[{}]", t);
|
||||
},
|
||||
&parse::Instruction::TypeStruct { result_id, ref member_types } if result_id == searched => {
|
||||
let name = name_from_id(doc, result_id);
|
||||
return name;
|
||||
},
|
||||
&parse::Instruction::TypeOpaque { result_id, ref name } if result_id == searched => {
|
||||
return "<opaque>".to_owned();
|
||||
},
|
||||
&parse::Instruction::TypePointer { result_id, type_id, .. } if result_id == searched => {
|
||||
return type_from_id(doc, type_id);
|
||||
},
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
|
||||
panic!("Type #{} not found", searched)
|
||||
}
|
||||
|
||||
fn name_from_id(doc: &parse::Spirv, searched: u32) -> String {
|
||||
doc.instructions.iter().filter_map(|i| {
|
||||
if let &parse::Instruction::Name { target_id, ref name } = i {
|
||||
@ -425,9 +345,7 @@ fn is_builtin(doc: &parse::Spirv, id: u32) -> bool {
|
||||
|
||||
for instruction in &doc.instructions {
|
||||
match *instruction {
|
||||
parse::Instruction::Variable { result_type_id, result_id, ref storage_class, .. }
|
||||
if result_id == id =>
|
||||
{
|
||||
parse::Instruction::Variable { result_type_id, result_id, .. } if result_id == id => {
|
||||
return is_builtin(doc, result_type_id);
|
||||
},
|
||||
parse::Instruction::TypeArray { result_id, type_id, .. } if result_id == id => {
|
||||
|
@ -139,8 +139,7 @@ fn write_struct(doc: &parse::Spirv, struct_id: u32, members: &[u32]) -> String {
|
||||
if let (Some(cur_size), Some(req_size)) = (current_rust_offset, spirv_req_total_size) {
|
||||
let diff = req_size.checked_sub(cur_size as u32).unwrap();
|
||||
if diff >= 1 {
|
||||
let padding_num = next_padding_num; next_padding_num += 1;
|
||||
members_defs.push(format!("pub _dummy{}: [u8; {}]", padding_num, diff));
|
||||
members_defs.push(format!("pub _dummy{}: [u8; {}]", next_padding_num, diff));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,6 +212,7 @@ macro_rules! pipeline_layout {
|
||||
}
|
||||
|
||||
#[allow(unused_assignments)]
|
||||
#[allow(dead_code)]
|
||||
pub fn build_set_layout_raw(device: &Arc<Device>)
|
||||
-> Result<UnsafeDescriptorSetLayout, OomError>
|
||||
{
|
||||
@ -234,6 +235,7 @@ macro_rules! pipeline_layout {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(dead_code)]
|
||||
pub fn build_set_layout(device: &Arc<Device>)
|
||||
-> Arc<UnsafeDescriptorSetLayout>
|
||||
{
|
||||
|
@ -179,6 +179,7 @@ macro_rules! ordered_passes_renderpass {
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(unused_mut)]
|
||||
#![allow(unused_variables)]
|
||||
let mut num = 0;
|
||||
$(let $atch_name = num; num += 1;)*
|
||||
num -= self.1;
|
||||
@ -196,6 +197,7 @@ macro_rules! ordered_passes_renderpass {
|
||||
fn next(&mut self) -> Option<LayoutPassDescription> {
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(unused_mut)]
|
||||
#![allow(unused_variables)]
|
||||
|
||||
let mut attachment_num = 0;
|
||||
$(
|
||||
@ -246,6 +248,7 @@ macro_rules! ordered_passes_renderpass {
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(unused_mut)]
|
||||
#![allow(unused_variables)]
|
||||
let mut num = 0;
|
||||
$($(let $color_atch = num;)* num += 1;)*
|
||||
num -= self.0;
|
||||
@ -301,6 +304,7 @@ macro_rules! ordered_passes_renderpass {
|
||||
fn attachment_layouts(num: usize) -> (Layout, Layout) {
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(unused_mut)]
|
||||
#![allow(unused_variables)]
|
||||
|
||||
let mut attachment_num = 0;
|
||||
$(
|
||||
|
@ -357,6 +357,7 @@ macro_rules! impl_vertex {
|
||||
unsafe impl $crate::pipeline::vertex::Vertex for $out {
|
||||
#[inline(always)]
|
||||
fn member(name: &str) -> Option<$crate::pipeline::vertex::VertexMemberInfo> {
|
||||
#[allow(unused_imports)]
|
||||
use $crate::format::Format;
|
||||
use $crate::pipeline::vertex::VertexMemberInfo;
|
||||
use $crate::pipeline::vertex::VertexMemberTy;
|
||||
|
Loading…
Reference in New Issue
Block a user