From 0f0c29fac93a3544c29ac3e1849081894fe1bd17 Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Thu, 18 Jul 2019 22:15:10 -0700 Subject: [PATCH] hacked in the sampled != 0 thing, not sure why my non sampled image was coming in as 2. Also vulkano seems to treat storage image and whatever other image the same, so just copied the match --- src/reflection.rs | 6 ++++-- src/srvk.rs | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/reflection.rs b/src/reflection.rs index efe4e28..7222bac 100644 --- a/src/reflection.rs +++ b/src/reflection.rs @@ -29,6 +29,7 @@ pub fn create_entry(shaders: &CompiledShaders) -> Result { let vertex_layout = create_layouts(&shaders.vertex)?; let fragment_interfaces = create_interfaces(&shaders.fragment)?; let fragment_layout = create_layouts(&shaders.fragment)?; + let frag_input = FragInput { inputs: fragment_interfaces.inputs, }; @@ -110,8 +111,9 @@ fn create_interfaces(data: &[u32]) -> Result { } fn create_layouts(data: &[u32]) -> Result { - sr::ShaderModule::load_u32_data(data) - .map(|m| { + let mut ret = sr::ShaderModule::load_u32_data(data); + + ret.map(|m| { let descs: Result<_, Error> = m .enumerate_descriptor_sets(None) .map_err(|e| Error::LoadingData(e.to_string())) diff --git a/src/srvk.rs b/src/srvk.rs index e907abd..015ee80 100644 --- a/src/srvk.rs +++ b/src/srvk.rs @@ -32,7 +32,8 @@ impl TryFrom for SpirvTy { SpirvTy::try_from(d.image)?.inner(), )), SR::SampledImage => Ok(VK::Image(SpirvTy::try_from(d.image)?.inner())), - SR::StorageImage => Err(ConvertError::Unimplemented(format!("{:?}", d.descriptor_type))), + //SR::StorageImage => Err(ConvertError::Unimplemented(format!("{:?}", d.descriptor_type))), + SR::StorageImage => Ok(VK::Image(SpirvTy::try_from(d.image)?.inner())), SR::UniformTexelBuffer => Ok(VK::TexelBuffer { storage: false, format: None, @@ -66,7 +67,7 @@ impl TryFrom for SpirvTy { } }; let t = DescriptorImageDesc { - sampled: d.sampled != 0, + sampled: d.sampled == 1, dimensions: SpirvTy::try_from(d.dim)?.inner(), // TODO figure out how to do format correctly //format: Some(SpirvTy::from(d.image_format).inner()),