fmt: cargo fmt

This commit is contained in:
chyyran 2024-02-03 02:04:39 -05:00 committed by Ronny Chan
parent 60fac06332
commit 80325fda9e
8 changed files with 52 additions and 34 deletions

View file

@ -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,
});
}

View file

@ -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 },

View file

@ -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;
}
}

View file

@ -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);

View file

@ -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 {

View file

@ -27,12 +27,14 @@ impl FilterChainGL {
options: Option<&FilterChainOptionsGL>,
) -> Result<Self> {
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 {

View file

@ -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)?;
}

View file

@ -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 {