diff --git a/librashader-reflect/src/reflect/cross.rs b/librashader-reflect/src/reflect/cross.rs index 0f468e0..322ade0 100644 --- a/librashader-reflect/src/reflect/cross.rs +++ b/librashader-reflect/src/reflect/cross.rs @@ -332,7 +332,7 @@ where expected, received: offset, ty: offset_type, - pass: pass_number + pass: pass_number, }); } if meta.size != typeinfo.size { @@ -367,7 +367,7 @@ where expected, received: offset, ty: offset_type, - pass: pass_number + pass: pass_number, }); } if meta.size != typeinfo.size * typeinfo.columns { @@ -416,7 +416,7 @@ where expected, received: offset, ty: offset_type, - pass: pass_number + pass: pass_number, }); } diff --git a/librashader-runtime-d3d11/src/filter_chain.rs b/librashader-runtime-d3d11/src/filter_chain.rs index 7ff81d5..0978632 100644 --- a/librashader-runtime-d3d11/src/filter_chain.rs +++ b/librashader-runtime-d3d11/src/filter_chain.rs @@ -265,7 +265,9 @@ impl FilterChainD3D11 { disable_cache, )?; - let ubo_cbuffer = if let Some(ubo) = &reflection.ubo && ubo.size != 0 { + let ubo_cbuffer = if let Some(ubo) = &reflection.ubo + && ubo.size != 0 + { let buffer = FilterChainD3D11::create_constant_buffer(device, ubo.size)?; Some(ConstantBufferBinding { binding: ubo.binding, @@ -277,7 +279,9 @@ impl FilterChainD3D11 { None }; - let push_cbuffer = if let Some(push) = &reflection.push_constant && push.size != 0 { + let push_cbuffer = if let Some(push) = &reflection.push_constant + && push.size != 0 + { let buffer = FilterChainD3D11::create_constant_buffer(device, push.size)?; Some(ConstantBufferBinding { binding: if ubo_cbuffer.is_some() { 1 } else { 0 }, diff --git a/librashader-runtime-d3d11/src/util.rs b/librashader-runtime-d3d11/src/util.rs index 56a8d91..fffeb4a 100644 --- a/librashader-runtime-d3d11/src/util.rs +++ b/librashader-runtime-d3d11/src/util.rs @@ -97,7 +97,8 @@ pub fn d3d11_get_closest_format( for supported in format_support_list { unsafe { if let Ok(supported_format) = device.CheckFormatSupport(*supported) - && (supported_format & format_support_mask) == format_support_mask { + && (supported_format & format_support_mask) == format_support_mask + { return *supported; } } diff --git a/librashader-runtime-d3d12/src/filter_chain.rs b/librashader-runtime-d3d12/src/filter_chain.rs index d5d4a00..79ec6da 100644 --- a/librashader-runtime-d3d12/src/filter_chain.rs +++ b/librashader-runtime-d3d12/src/filter_chain.rs @@ -477,33 +477,32 @@ impl FilterChainD3D12 { .into(); // incredibly cursed. - let (reflection, graphics_pipeline) = if !force_hlsl && - let Ok(graphics_pipeline) = - D3D12GraphicsPipeline::new_from_dxil( + let (reflection, graphics_pipeline) = if !force_hlsl + && let Ok(graphics_pipeline) = D3D12GraphicsPipeline::new_from_dxil( device, library, validator, &dxil, root_signature, render_format, - disable_cache + disable_cache, ) { - (dxil_reflection, graphics_pipeline) - } else { - let hlsl_reflection = hlsl.reflect(index, semantics)?; - let hlsl = hlsl.compile(Some(ShaderModel::V6_0))?; + (dxil_reflection, graphics_pipeline) + } else { + let hlsl_reflection = hlsl.reflect(index, semantics)?; + let hlsl = hlsl.compile(Some(ShaderModel::V6_0))?; - let graphics_pipeline = D3D12GraphicsPipeline::new_from_hlsl( - device, - library, - compiler, - &hlsl, - root_signature, - render_format, - disable_cache - )?; - (hlsl_reflection, graphics_pipeline) - }; + let graphics_pipeline = D3D12GraphicsPipeline::new_from_hlsl( + device, + library, + compiler, + &hlsl, + root_signature, + render_format, + disable_cache, + )?; + (hlsl_reflection, graphics_pipeline) + }; // minimum size here has to be 1 byte. let ubo_size = reflection.ubo.as_ref().map_or(1, |ubo| ubo.size as usize); diff --git a/librashader-runtime-gl/src/binding.rs b/librashader-runtime-gl/src/binding.rs index 24d0572..00bcd04 100644 --- a/librashader-runtime-gl/src/binding.rs +++ b/librashader-runtime-gl/src/binding.rs @@ -68,10 +68,14 @@ where && location.bindable() { if location.is_valid(BindingStage::VERTEX) { - unsafe { T::FACTORY(location.vertex, value); } + unsafe { + T::FACTORY(location.vertex, value); + } } if location.is_valid(BindingStage::FRAGMENT) { - unsafe { T::FACTORY(location.fragment, value); } + unsafe { + T::FACTORY(location.fragment, value); + } } Some(()) } else { diff --git a/librashader-runtime-gl/src/filter_chain/mod.rs b/librashader-runtime-gl/src/filter_chain/mod.rs index ad09e74..fce73f0 100644 --- a/librashader-runtime-gl/src/filter_chain/mod.rs +++ b/librashader-runtime-gl/src/filter_chain/mod.rs @@ -27,12 +27,14 @@ impl FilterChainGL { options: Option<&FilterChainOptionsGL>, ) -> Result { let result = catch_unwind(|| { - if let Some(options) = options && options.use_dsa { + if let Some(options) = options + && options.use_dsa + { return Ok(Self { filter: FilterChainDispatch::DirectStateAccess(unsafe { FilterChainImpl::load_from_preset(preset, Some(options))? - }) - }) + }), + }); } Ok(Self { filter: FilterChainDispatch::Compatibility(unsafe { diff --git a/librashader-runtime-vk/src/filter_chain.rs b/librashader-runtime-vk/src/filter_chain.rs index 33f7244..ac77cad 100644 --- a/librashader-runtime-vk/src/filter_chain.rs +++ b/librashader-runtime-vk/src/filter_chain.rs @@ -188,7 +188,8 @@ impl FrameResiduals { } for framebuffer in self.framebuffers.drain(0..) { if let Some(framebuffer) = framebuffer - && framebuffer != vk::Framebuffer::null() { + && framebuffer != vk::Framebuffer::null() + { unsafe { self.device.destroy_framebuffer(framebuffer, None); } @@ -697,8 +698,13 @@ impl FilterChainVulkan { // try to hint the optimizer assert_eq!(last.len(), 1); if let Some(pass) = last.iter_mut().next() { - if let Some(format) = pass.graphics_pipeline.render_pass.as_ref().map(|r| r.format) - && format != viewport.output.format { + if let Some(format) = pass + .graphics_pipeline + .render_pass + .as_ref() + .map(|r| r.format) + && format != viewport.output.format + { // need to recompile pass.graphics_pipeline.recompile(viewport.output.format)?; } diff --git a/librashader-runtime-vk/src/graphics_pipeline.rs b/librashader-runtime-vk/src/graphics_pipeline.rs index 2aa66f4..f72cbe2 100644 --- a/librashader-runtime-vk/src/graphics_pipeline.rs +++ b/librashader-runtime-vk/src/graphics_pipeline.rs @@ -31,7 +31,9 @@ impl PipelineDescriptors { } pub fn add_ubo_binding(&mut self, ubo_meta: Option<&UboReflection>) { - if let Some(ubo_meta) = ubo_meta && !ubo_meta.stage_mask.is_empty() { + if let Some(ubo_meta) = ubo_meta + && !ubo_meta.stage_mask.is_empty() + { let ubo_mask = util::binding_stage_to_vulkan_stage(ubo_meta.stage_mask); self.layout_bindings.push(vk::DescriptorSetLayoutBinding {