mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-20 10:53:34 +00:00
refactor: resolve clippy::bool_to_int_with_if
This commit is contained in:
parent
a377ae2b7f
commit
98eb19c854
@ -1,5 +1,8 @@
|
||||
use std::iter;
|
||||
use winapi::um::{d3d12, d3dcommon};
|
||||
use winapi::{
|
||||
shared::minwindef::BOOL,
|
||||
um::{d3d12, d3dcommon},
|
||||
};
|
||||
|
||||
pub fn map_buffer_usage_to_resource_flags(usage: crate::BufferUses) -> d3d12::D3D12_RESOURCE_FLAGS {
|
||||
let mut flags = 0;
|
||||
@ -329,14 +332,14 @@ fn map_stencil_face(face: &wgt::StencilFaceState) -> d3d12::D3D12_DEPTH_STENCILO
|
||||
|
||||
pub fn map_depth_stencil(ds: &wgt::DepthStencilState) -> d3d12::D3D12_DEPTH_STENCIL_DESC {
|
||||
d3d12::D3D12_DEPTH_STENCIL_DESC {
|
||||
DepthEnable: if ds.is_depth_enabled() { 1 } else { 0 },
|
||||
DepthEnable: BOOL::from(ds.is_depth_enabled()),
|
||||
DepthWriteMask: if ds.depth_write_enabled {
|
||||
d3d12::D3D12_DEPTH_WRITE_MASK_ALL
|
||||
} else {
|
||||
d3d12::D3D12_DEPTH_WRITE_MASK_ZERO
|
||||
},
|
||||
DepthFunc: map_comparison(ds.depth_compare),
|
||||
StencilEnable: if ds.stencil.is_enabled() { 1 } else { 0 },
|
||||
StencilEnable: BOOL::from(ds.stencil.is_enabled()),
|
||||
StencilReadMask: ds.stencil.read_mask as u8,
|
||||
StencilWriteMask: ds.stencil.write_mask as u8,
|
||||
FrontFace: map_stencil_face(&ds.stencil.front),
|
||||
|
@ -7,7 +7,7 @@ use super::{conv, descriptor, view};
|
||||
use parking_lot::Mutex;
|
||||
use std::{ffi, mem, num::NonZeroU32, ptr, slice, sync::Arc};
|
||||
use winapi::{
|
||||
shared::{dxgiformat, dxgitype, winerror},
|
||||
shared::{dxgiformat, dxgitype, minwindef::BOOL, winerror},
|
||||
um::{d3d12, d3dcompiler, synchapi, winbase},
|
||||
Interface,
|
||||
};
|
||||
@ -1358,8 +1358,8 @@ impl crate::Device<super::Api> for super::Device {
|
||||
DepthBias: bias.constant,
|
||||
DepthBiasClamp: bias.clamp,
|
||||
SlopeScaledDepthBias: bias.slope_scale,
|
||||
DepthClipEnable: if desc.primitive.unclipped_depth { 0 } else { 1 },
|
||||
MultisampleEnable: if desc.multisample.count > 1 { 1 } else { 0 },
|
||||
DepthClipEnable: BOOL::from(!desc.primitive.unclipped_depth),
|
||||
MultisampleEnable: BOOL::from(desc.multisample.count > 1),
|
||||
ForcedSampleCount: 0,
|
||||
AntialiasedLineEnable: 0,
|
||||
ConservativeRaster: if desc.primitive.conservative {
|
||||
@ -1388,11 +1388,7 @@ impl crate::Device<super::Api> for super::Device {
|
||||
RasterizedStream: 0,
|
||||
},
|
||||
BlendState: d3d12::D3D12_BLEND_DESC {
|
||||
AlphaToCoverageEnable: if desc.multisample.alpha_to_coverage_enabled {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
},
|
||||
AlphaToCoverageEnable: BOOL::from(desc.multisample.alpha_to_coverage_enabled),
|
||||
IndependentBlendEnable: 1,
|
||||
RenderTarget: conv::map_render_targets(desc.color_targets),
|
||||
},
|
||||
|
@ -702,11 +702,7 @@ impl crate::Instance<super::Api> for Instance {
|
||||
EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE as egl::Attrib,
|
||||
EGL_PLATFORM_X11_KHR as egl::Attrib,
|
||||
EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED as egl::Attrib,
|
||||
if desc.flags.contains(crate::InstanceFlags::VALIDATION) {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
},
|
||||
usize::from(desc.flags.contains(crate::InstanceFlags::VALIDATION)),
|
||||
egl::ATTRIB_NONE,
|
||||
];
|
||||
let display = egl
|
||||
|
Loading…
Reference in New Issue
Block a user