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

master
mitchellhansen 5 years ago
parent 2fb20042a4
commit 0f0c29fac9

@ -29,6 +29,7 @@ pub fn create_entry(shaders: &CompiledShaders) -> Result<Entry, Error> {
let vertex_layout = create_layouts(&shaders.vertex)?; let vertex_layout = create_layouts(&shaders.vertex)?;
let fragment_interfaces = create_interfaces(&shaders.fragment)?; let fragment_interfaces = create_interfaces(&shaders.fragment)?;
let fragment_layout = create_layouts(&shaders.fragment)?; let fragment_layout = create_layouts(&shaders.fragment)?;
let frag_input = FragInput { let frag_input = FragInput {
inputs: fragment_interfaces.inputs, inputs: fragment_interfaces.inputs,
}; };
@ -110,8 +111,9 @@ fn create_interfaces(data: &[u32]) -> Result<ShaderInterfaces, Error> {
} }
fn create_layouts(data: &[u32]) -> Result<LayoutData, Error> { fn create_layouts(data: &[u32]) -> Result<LayoutData, Error> {
sr::ShaderModule::load_u32_data(data) let mut ret = sr::ShaderModule::load_u32_data(data);
.map(|m| {
ret.map(|m| {
let descs: Result<_, Error> = m let descs: Result<_, Error> = m
.enumerate_descriptor_sets(None) .enumerate_descriptor_sets(None)
.map_err(|e| Error::LoadingData(e.to_string())) .map_err(|e| Error::LoadingData(e.to_string()))

@ -32,7 +32,8 @@ impl TryFrom<DescriptorDescInfo> for SpirvTy<DescriptorDescTy> {
SpirvTy::try_from(d.image)?.inner(), SpirvTy::try_from(d.image)?.inner(),
)), )),
SR::SampledImage => Ok(VK::Image(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 { SR::UniformTexelBuffer => Ok(VK::TexelBuffer {
storage: false, storage: false,
format: None, format: None,
@ -66,7 +67,7 @@ impl TryFrom<sr::types::ReflectImageTraits> for SpirvTy<DescriptorImageDesc> {
} }
}; };
let t = DescriptorImageDesc { let t = DescriptorImageDesc {
sampled: d.sampled != 0, sampled: d.sampled == 1,
dimensions: SpirvTy::try_from(d.dim)?.inner(), dimensions: SpirvTy::try_from(d.dim)?.inner(),
// TODO figure out how to do format correctly // TODO figure out how to do format correctly
//format: Some(SpirvTy::from(d.image_format).inner()), //format: Some(SpirvTy::from(d.image_format).inner()),

Loading…
Cancel
Save