mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
use self
This commit is contained in:
parent
645c121dda
commit
db1870e7fc
@ -154,7 +154,7 @@ impl<B: hal::Backend> CommandAllocator<B> {
|
||||
pending: Vec::new(),
|
||||
},
|
||||
);
|
||||
Ok(CommandAllocator {
|
||||
Ok(Self {
|
||||
queue_family,
|
||||
internal_thread_id,
|
||||
inner: Mutex::new(Inner { pools }),
|
||||
|
||||
@ -93,7 +93,7 @@ impl RenderBundleEncoder {
|
||||
base: Option<BasePass<RenderCommand>>,
|
||||
) -> Result<Self, CreateRenderBundleError> {
|
||||
span!(_guard, INFO, "RenderBundleEncoder::new");
|
||||
Ok(RenderBundleEncoder {
|
||||
Ok(Self {
|
||||
base: base.unwrap_or_else(BasePass::new),
|
||||
parent_id,
|
||||
context: RenderPassContext {
|
||||
@ -330,7 +330,7 @@ struct IndexState {
|
||||
|
||||
impl IndexState {
|
||||
fn new() -> Self {
|
||||
IndexState {
|
||||
Self {
|
||||
buffer: None,
|
||||
format: wgt::IndexFormat::default(),
|
||||
range: 0..0,
|
||||
@ -385,7 +385,7 @@ struct VertexState {
|
||||
|
||||
impl VertexState {
|
||||
fn new() -> Self {
|
||||
VertexState {
|
||||
Self {
|
||||
buffer: None,
|
||||
range: 0..0,
|
||||
stride: 0,
|
||||
@ -424,7 +424,7 @@ struct BindState {
|
||||
|
||||
impl BindState {
|
||||
fn new() -> Self {
|
||||
BindState {
|
||||
Self {
|
||||
bind_group: None,
|
||||
dynamic_offsets: 0..0,
|
||||
is_dirty: false,
|
||||
|
||||
@ -70,7 +70,7 @@ pub struct ComputePass {
|
||||
|
||||
impl ComputePass {
|
||||
pub fn new(parent_id: id::CommandEncoderId) -> Self {
|
||||
ComputePass {
|
||||
Self {
|
||||
base: BasePass::new(),
|
||||
parent_id,
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ pub struct BasePass<C> {
|
||||
|
||||
impl<C: Clone> BasePass<C> {
|
||||
fn new() -> Self {
|
||||
BasePass {
|
||||
Self {
|
||||
commands: Vec::new(),
|
||||
dynamic_offsets: Vec::new(),
|
||||
string_data: Vec::new(),
|
||||
@ -138,7 +138,7 @@ impl<C: Clone> BasePass<C> {
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
fn from_ref(base: BasePassRef<C>) -> Self {
|
||||
BasePass {
|
||||
Self {
|
||||
commands: base.commands.to_vec(),
|
||||
dynamic_offsets: base.dynamic_offsets.to_vec(),
|
||||
string_data: base.string_data.to_vec(),
|
||||
|
||||
@ -152,7 +152,7 @@ pub struct RenderPass {
|
||||
|
||||
impl RenderPass {
|
||||
pub fn new(parent_id: id::CommandEncoderId, desc: RenderPassDescriptor) -> Self {
|
||||
RenderPass {
|
||||
Self {
|
||||
base: BasePass::new(),
|
||||
parent_id,
|
||||
color_targets: desc.color_attachments.iter().cloned().collect(),
|
||||
|
||||
@ -100,7 +100,7 @@ struct NonReferencedResources<B: hal::Backend> {
|
||||
|
||||
impl<B: hal::Backend> NonReferencedResources<B> {
|
||||
fn new() -> Self {
|
||||
NonReferencedResources {
|
||||
Self {
|
||||
buffers: Vec::new(),
|
||||
images: Vec::new(),
|
||||
image_views: Vec::new(),
|
||||
@ -225,7 +225,7 @@ pub(crate) struct LifetimeTracker<B: hal::Backend> {
|
||||
|
||||
impl<B: hal::Backend> LifetimeTracker<B> {
|
||||
pub fn new() -> Self {
|
||||
LifetimeTracker {
|
||||
Self {
|
||||
mapped: Vec::new(),
|
||||
future_suspected_buffers: Vec::new(),
|
||||
future_suspected_textures: Vec::new(),
|
||||
|
||||
@ -272,7 +272,7 @@ impl<B: GfxBackend> Device<B> {
|
||||
None => (),
|
||||
}
|
||||
|
||||
Ok(Device {
|
||||
Ok(Self {
|
||||
raw,
|
||||
adapter_id,
|
||||
cmd_allocator,
|
||||
@ -923,8 +923,8 @@ pub enum DeviceError {
|
||||
impl From<hal::device::OomOrDeviceLost> for DeviceError {
|
||||
fn from(err: hal::device::OomOrDeviceLost) -> Self {
|
||||
match err {
|
||||
hal::device::OomOrDeviceLost::OutOfMemory(_) => DeviceError::OutOfMemory,
|
||||
hal::device::OomOrDeviceLost::DeviceLost(_) => DeviceError::Lost,
|
||||
hal::device::OomOrDeviceLost::OutOfMemory(_) => Self::OutOfMemory,
|
||||
hal::device::OomOrDeviceLost::DeviceLost(_) => Self::Lost,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -934,14 +934,14 @@ impl DeviceError {
|
||||
match err {
|
||||
gfx_memory::HeapsError::AllocationError(hal::device::AllocationError::OutOfMemory(
|
||||
_,
|
||||
)) => DeviceError::OutOfMemory,
|
||||
)) => Self::OutOfMemory,
|
||||
_ => panic!("Unable to allocate memory: {:?}", err),
|
||||
}
|
||||
}
|
||||
|
||||
fn from_bind(err: hal::device::BindError) -> Self {
|
||||
match err {
|
||||
hal::device::BindError::OutOfMemory(_) => DeviceError::OutOfMemory,
|
||||
hal::device::BindError::OutOfMemory(_) => Self::OutOfMemory,
|
||||
_ => panic!("failed to bind memory: {}", err),
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ pub(crate) struct PendingWrites<B: hal::Backend> {
|
||||
|
||||
impl<B: hal::Backend> PendingWrites<B> {
|
||||
pub fn new() -> Self {
|
||||
PendingWrites {
|
||||
Self {
|
||||
command_buffer: None,
|
||||
temp_buffers: Vec::new(),
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ impl Trace {
|
||||
tracing::info!("Tracing into '{:?}'", path);
|
||||
let mut file = std::fs::File::create(path.join(FILE_NAME))?;
|
||||
file.write_all(b"[\n")?;
|
||||
Ok(Trace {
|
||||
Ok(Self {
|
||||
path: path.to_path_buf(),
|
||||
file,
|
||||
config: ron::ser::PrettyConfig::default(),
|
||||
|
||||
@ -36,7 +36,7 @@ pub struct IdentityManager {
|
||||
|
||||
impl Default for IdentityManager {
|
||||
fn default() -> Self {
|
||||
IdentityManager {
|
||||
Self {
|
||||
free: Default::default(),
|
||||
epochs: Default::default(),
|
||||
}
|
||||
@ -45,7 +45,7 @@ impl Default for IdentityManager {
|
||||
|
||||
impl IdentityManager {
|
||||
pub fn from_index(min_index: u32) -> Self {
|
||||
IdentityManager {
|
||||
Self {
|
||||
free: (0..min_index).collect(),
|
||||
epochs: vec![1; min_index as usize],
|
||||
}
|
||||
@ -292,7 +292,7 @@ impl<'a, T> Token<'a, T> {
|
||||
assert_ne!(old, 0, "Root token was dropped");
|
||||
active.set(old + 1);
|
||||
});
|
||||
Token { level: PhantomData }
|
||||
Self { level: PhantomData }
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ impl Token<'static, Root> {
|
||||
assert_eq!(0, active.replace(1), "Root token is already active");
|
||||
});
|
||||
|
||||
Token { level: PhantomData }
|
||||
Self { level: PhantomData }
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,7 +381,7 @@ pub struct Registry<T, I: TypedId, F: IdentityHandlerFactory<I>> {
|
||||
|
||||
impl<T, I: TypedId, F: IdentityHandlerFactory<I>> Registry<T, I, F> {
|
||||
fn new(backend: Backend, factory: &F, kind: &'static str) -> Self {
|
||||
Registry {
|
||||
Self {
|
||||
identity: factory.spawn(0),
|
||||
data: RwLock::new(Storage {
|
||||
map: Vec::new(),
|
||||
@ -393,7 +393,7 @@ impl<T, I: TypedId, F: IdentityHandlerFactory<I>> Registry<T, I, F> {
|
||||
}
|
||||
|
||||
fn without_backend(factory: &F, kind: &'static str) -> Self {
|
||||
Registry {
|
||||
Self {
|
||||
identity: factory.spawn(1),
|
||||
data: RwLock::new(Storage {
|
||||
map: Vec::new(),
|
||||
@ -508,7 +508,7 @@ pub struct Hub<B: hal::Backend, F: GlobalIdentityHandlerFactory> {
|
||||
|
||||
impl<B: GfxBackend, F: GlobalIdentityHandlerFactory> Hub<B, F> {
|
||||
fn new(factory: &F) -> Self {
|
||||
Hub {
|
||||
Self {
|
||||
adapters: Registry::new(B::VARIANT, factory, "Adapter"),
|
||||
devices: Registry::new(B::VARIANT, factory, "Device"),
|
||||
swap_chains: Registry::new(B::VARIANT, factory, "SwapChain"),
|
||||
@ -668,7 +668,7 @@ pub struct Hubs<F: GlobalIdentityHandlerFactory> {
|
||||
|
||||
impl<F: GlobalIdentityHandlerFactory> Hubs<F> {
|
||||
fn new(factory: &F) -> Self {
|
||||
Hubs {
|
||||
Self {
|
||||
#[cfg(vulkan)]
|
||||
vulkan: Hub::new(factory),
|
||||
#[cfg(metal)]
|
||||
@ -691,7 +691,7 @@ pub struct Global<G: GlobalIdentityHandlerFactory> {
|
||||
impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
pub fn new(name: &str, factory: G, backends: wgt::BackendBit) -> Self {
|
||||
span!(_guard, INFO, "Global::new");
|
||||
Global {
|
||||
Self {
|
||||
instance: Instance::new(name, 1, backends),
|
||||
surfaces: Registry::without_backend(&factory, "Surface"),
|
||||
hubs: Hubs::new(&factory),
|
||||
|
||||
@ -39,7 +39,7 @@ enum SerialId {
|
||||
impl<T> From<Id<T>> for SerialId {
|
||||
fn from(id: Id<T>) -> Self {
|
||||
let (index, epoch, backend) = id.unzip();
|
||||
SerialId::Id(index, epoch, backend)
|
||||
Self::Id(index, epoch, backend)
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "replay")]
|
||||
|
||||
@ -50,7 +50,7 @@ impl Instance {
|
||||
None
|
||||
}
|
||||
};
|
||||
Instance {
|
||||
Self {
|
||||
#[cfg(vulkan)]
|
||||
vulkan: map((Backend::Vulkan, gfx_backend_vulkan::Instance::create)),
|
||||
#[cfg(metal)]
|
||||
@ -200,7 +200,7 @@ impl<B: hal::Backend> Adapter<B> {
|
||||
.max(MIN_PUSH_CONSTANT_SIZE), // As an extension, the default is always 0, so define a separate minimum.
|
||||
};
|
||||
|
||||
Adapter {
|
||||
Self {
|
||||
raw,
|
||||
features,
|
||||
limits,
|
||||
@ -235,7 +235,7 @@ impl AdapterInfo {
|
||||
device_type,
|
||||
} = adapter_info;
|
||||
|
||||
AdapterInfo {
|
||||
Self {
|
||||
name,
|
||||
vendor,
|
||||
device,
|
||||
@ -302,8 +302,8 @@ pub enum AdapterInputs<'a, I> {
|
||||
impl<I: Clone> AdapterInputs<'_, I> {
|
||||
fn find(&self, b: Backend) -> Option<I> {
|
||||
match *self {
|
||||
AdapterInputs::IdSet(ids, ref fun) => ids.iter().find(|id| fun(id) == b).cloned(),
|
||||
AdapterInputs::Mask(bits, ref fun) => {
|
||||
Self::IdSet(ids, ref fun) => ids.iter().find(|id| fun(id) == b).cloned(),
|
||||
Self::Mask(bits, ref fun) => {
|
||||
if bits.contains(b.into()) {
|
||||
Some(fun(b))
|
||||
} else {
|
||||
|
||||
@ -96,7 +96,7 @@ impl Clone for RefCount {
|
||||
fn clone(&self) -> Self {
|
||||
let old_size = unsafe { self.0.as_ref() }.fetch_add(1, Ordering::AcqRel);
|
||||
assert!(old_size < Self::MAX);
|
||||
RefCount(self.0)
|
||||
Self(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ impl MultiRefCount {
|
||||
fn new() -> Self {
|
||||
let bx = Box::new(AtomicUsize::new(1));
|
||||
let ptr = Box::into_raw(bx);
|
||||
MultiRefCount(unsafe { ptr::NonNull::new_unchecked(ptr) })
|
||||
Self(unsafe { ptr::NonNull::new_unchecked(ptr) })
|
||||
}
|
||||
|
||||
fn inc(&self) {
|
||||
@ -169,7 +169,7 @@ struct LifeGuard {
|
||||
impl LifeGuard {
|
||||
fn new() -> Self {
|
||||
let bx = Box::new(AtomicUsize::new(1));
|
||||
LifeGuard {
|
||||
Self {
|
||||
ref_count: ptr::NonNull::new(Box::into_raw(bx)).map(RefCount),
|
||||
submission_index: AtomicUsize::new(0),
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ impl PendingTransition<BufferState> {
|
||||
|
||||
impl Default for BufferState {
|
||||
fn default() -> Self {
|
||||
BufferState {
|
||||
Self {
|
||||
first: None,
|
||||
last: BufferUse::empty(),
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ pub struct Unit<U> {
|
||||
impl<U: Copy> Unit<U> {
|
||||
/// Create a new unit from a given usage.
|
||||
fn new(usage: U) -> Self {
|
||||
Unit {
|
||||
Self {
|
||||
first: None,
|
||||
last: usage,
|
||||
}
|
||||
@ -199,7 +199,7 @@ impl<S: ResourceState + fmt::Debug> fmt::Debug for ResourceTracker<S> {
|
||||
impl<S: ResourceState> ResourceTracker<S> {
|
||||
/// Create a new empty tracker.
|
||||
pub fn new(backend: wgt::Backend) -> Self {
|
||||
ResourceTracker {
|
||||
Self {
|
||||
map: FastHashMap::default(),
|
||||
temp: Vec::new(),
|
||||
backend,
|
||||
@ -514,7 +514,7 @@ pub(crate) struct TrackerSet {
|
||||
impl TrackerSet {
|
||||
/// Create an empty set.
|
||||
pub fn new(backend: wgt::Backend) -> Self {
|
||||
TrackerSet {
|
||||
Self {
|
||||
buffers: ResourceTracker::new(backend),
|
||||
textures: ResourceTracker::new(backend),
|
||||
views: ResourceTracker::new(backend),
|
||||
|
||||
@ -18,13 +18,13 @@ pub struct RangedStates<I, T> {
|
||||
|
||||
impl<I: Copy + PartialOrd, T: Copy + PartialEq> RangedStates<I, T> {
|
||||
pub fn empty() -> Self {
|
||||
RangedStates {
|
||||
Self {
|
||||
ranges: SmallVec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_range(range: Range<I>, value: T) -> Self {
|
||||
RangedStates {
|
||||
Self {
|
||||
ranges: iter::once((range, value)).collect(),
|
||||
}
|
||||
}
|
||||
@ -32,7 +32,7 @@ impl<I: Copy + PartialOrd, T: Copy + PartialEq> RangedStates<I, T> {
|
||||
/// Construct a new instance from a slice of ranges.
|
||||
#[cfg(test)]
|
||||
pub fn from_slice(values: &[(Range<I>, T)]) -> Self {
|
||||
RangedStates {
|
||||
Self {
|
||||
ranges: values.iter().cloned().collect(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ impl PendingTransition<TextureState> {
|
||||
|
||||
impl TextureState {
|
||||
pub fn new(mip_level_count: hal::image::Level, array_layer_count: hal::image::Layer) -> Self {
|
||||
TextureState {
|
||||
Self {
|
||||
mips: iter::repeat_with(|| {
|
||||
PlaneStates::from_range(0..array_layer_count, Unit::new(TextureUse::UNINITIALIZED))
|
||||
})
|
||||
|
||||
@ -66,8 +66,8 @@ pub enum PowerPreference {
|
||||
}
|
||||
|
||||
impl Default for PowerPreference {
|
||||
fn default() -> PowerPreference {
|
||||
PowerPreference::Default
|
||||
fn default() -> Self {
|
||||
Self::Default
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ bitflags::bitflags! {
|
||||
|
||||
impl From<Backend> for BackendBit {
|
||||
fn from(backend: Backend) -> Self {
|
||||
BackendBit::from_bits(1 << backend as u32).unwrap()
|
||||
Self::from_bits(1 << backend as u32).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ pub struct Limits {
|
||||
|
||||
impl Default for Limits {
|
||||
fn default() -> Self {
|
||||
Limits {
|
||||
Self {
|
||||
max_bind_groups: 4,
|
||||
max_dynamic_uniform_buffers_per_pipeline_layout: 8,
|
||||
max_dynamic_storage_buffers_per_pipeline_layout: 4,
|
||||
@ -476,7 +476,7 @@ pub enum BlendOperation {
|
||||
|
||||
impl Default for BlendOperation {
|
||||
fn default() -> Self {
|
||||
BlendOperation::Add
|
||||
Self::Add
|
||||
}
|
||||
}
|
||||
|
||||
@ -513,7 +513,7 @@ impl BlendDescriptor {
|
||||
|
||||
impl Default for BlendDescriptor {
|
||||
fn default() -> Self {
|
||||
BlendDescriptor::REPLACE
|
||||
Self::REPLACE
|
||||
}
|
||||
}
|
||||
|
||||
@ -536,7 +536,7 @@ pub struct ColorStateDescriptor {
|
||||
|
||||
impl From<TextureFormat> for ColorStateDescriptor {
|
||||
fn from(format: TextureFormat) -> Self {
|
||||
ColorStateDescriptor {
|
||||
Self {
|
||||
format,
|
||||
alpha_blend: BlendDescriptor::REPLACE,
|
||||
color_blend: BlendDescriptor::REPLACE,
|
||||
@ -589,7 +589,7 @@ pub enum FrontFace {
|
||||
|
||||
impl Default for FrontFace {
|
||||
fn default() -> Self {
|
||||
FrontFace::Ccw
|
||||
Self::Ccw
|
||||
}
|
||||
}
|
||||
|
||||
@ -609,7 +609,7 @@ pub enum CullMode {
|
||||
|
||||
impl Default for CullMode {
|
||||
fn default() -> Self {
|
||||
CullMode::None
|
||||
Self::None
|
||||
}
|
||||
}
|
||||
|
||||
@ -629,7 +629,7 @@ pub enum PolygonMode {
|
||||
|
||||
impl Default for PolygonMode {
|
||||
fn default() -> Self {
|
||||
PolygonMode::Fill
|
||||
Self::Fill
|
||||
}
|
||||
}
|
||||
|
||||
@ -874,7 +874,7 @@ bitflags::bitflags! {
|
||||
|
||||
impl Default for ColorWrite {
|
||||
fn default() -> Self {
|
||||
ColorWrite::ALL
|
||||
Self::ALL
|
||||
}
|
||||
}
|
||||
|
||||
@ -946,7 +946,7 @@ pub enum IndexFormat {
|
||||
|
||||
impl Default for IndexFormat {
|
||||
fn default() -> Self {
|
||||
IndexFormat::Uint32
|
||||
Self::Uint32
|
||||
}
|
||||
}
|
||||
|
||||
@ -976,7 +976,7 @@ pub enum StencilOperation {
|
||||
|
||||
impl Default for StencilOperation {
|
||||
fn default() -> Self {
|
||||
StencilOperation::Keep
|
||||
Self::Keep
|
||||
}
|
||||
}
|
||||
|
||||
@ -1009,7 +1009,7 @@ impl StencilStateFaceDescriptor {
|
||||
|
||||
impl Default for StencilStateFaceDescriptor {
|
||||
fn default() -> Self {
|
||||
StencilStateFaceDescriptor::IGNORE
|
||||
Self::IGNORE
|
||||
}
|
||||
}
|
||||
|
||||
@ -1040,7 +1040,7 @@ pub enum CompareFunction {
|
||||
impl CompareFunction {
|
||||
pub fn needs_ref_value(self) -> bool {
|
||||
match self {
|
||||
CompareFunction::Never | CompareFunction::Always => false,
|
||||
Self::Never | Self::Always => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
@ -1145,32 +1145,29 @@ pub enum VertexFormat {
|
||||
impl VertexFormat {
|
||||
pub fn size(&self) -> u64 {
|
||||
match self {
|
||||
VertexFormat::Uchar2
|
||||
| VertexFormat::Char2
|
||||
| VertexFormat::Uchar2Norm
|
||||
| VertexFormat::Char2Norm => 2,
|
||||
VertexFormat::Uchar4
|
||||
| VertexFormat::Char4
|
||||
| VertexFormat::Uchar4Norm
|
||||
| VertexFormat::Char4Norm
|
||||
| VertexFormat::Ushort2
|
||||
| VertexFormat::Short2
|
||||
| VertexFormat::Ushort2Norm
|
||||
| VertexFormat::Short2Norm
|
||||
| VertexFormat::Half2
|
||||
| VertexFormat::Float
|
||||
| VertexFormat::Uint
|
||||
| VertexFormat::Int => 4,
|
||||
VertexFormat::Ushort4
|
||||
| VertexFormat::Short4
|
||||
| VertexFormat::Ushort4Norm
|
||||
| VertexFormat::Short4Norm
|
||||
| VertexFormat::Half4
|
||||
| VertexFormat::Float2
|
||||
| VertexFormat::Uint2
|
||||
| VertexFormat::Int2 => 8,
|
||||
VertexFormat::Float3 | VertexFormat::Uint3 | VertexFormat::Int3 => 12,
|
||||
VertexFormat::Float4 | VertexFormat::Uint4 | VertexFormat::Int4 => 16,
|
||||
Self::Uchar2 | Self::Char2 | Self::Uchar2Norm | Self::Char2Norm => 2,
|
||||
Self::Uchar4
|
||||
| Self::Char4
|
||||
| Self::Uchar4Norm
|
||||
| Self::Char4Norm
|
||||
| Self::Ushort2
|
||||
| Self::Short2
|
||||
| Self::Ushort2Norm
|
||||
| Self::Short2Norm
|
||||
| Self::Half2
|
||||
| Self::Float
|
||||
| Self::Uint
|
||||
| Self::Int => 4,
|
||||
Self::Ushort4
|
||||
| Self::Short4
|
||||
| Self::Ushort4Norm
|
||||
| Self::Short4Norm
|
||||
| Self::Half4
|
||||
| Self::Float2
|
||||
| Self::Uint2
|
||||
| Self::Int2 => 8,
|
||||
Self::Float3 | Self::Uint3 | Self::Int3 => 12,
|
||||
Self::Float4 | Self::Uint4 | Self::Int4 => 16,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1357,37 +1354,37 @@ pub struct Color {
|
||||
}
|
||||
|
||||
impl Color {
|
||||
pub const TRANSPARENT: Self = Color {
|
||||
pub const TRANSPARENT: Self = Self {
|
||||
r: 0.0,
|
||||
g: 0.0,
|
||||
b: 0.0,
|
||||
a: 0.0,
|
||||
};
|
||||
pub const BLACK: Self = Color {
|
||||
pub const BLACK: Self = Self {
|
||||
r: 0.0,
|
||||
g: 0.0,
|
||||
b: 0.0,
|
||||
a: 1.0,
|
||||
};
|
||||
pub const WHITE: Self = Color {
|
||||
pub const WHITE: Self = Self {
|
||||
r: 1.0,
|
||||
g: 1.0,
|
||||
b: 1.0,
|
||||
a: 1.0,
|
||||
};
|
||||
pub const RED: Self = Color {
|
||||
pub const RED: Self = Self {
|
||||
r: 1.0,
|
||||
g: 0.0,
|
||||
b: 0.0,
|
||||
a: 1.0,
|
||||
};
|
||||
pub const GREEN: Self = Color {
|
||||
pub const GREEN: Self = Self {
|
||||
r: 0.0,
|
||||
g: 1.0,
|
||||
b: 0.0,
|
||||
a: 1.0,
|
||||
};
|
||||
pub const BLUE: Self = Color {
|
||||
pub const BLUE: Self = Self {
|
||||
r: 0.0,
|
||||
g: 0.0,
|
||||
b: 1.0,
|
||||
@ -1421,12 +1418,12 @@ pub struct Origin3d {
|
||||
}
|
||||
|
||||
impl Origin3d {
|
||||
pub const ZERO: Self = Origin3d { x: 0, y: 0, z: 0 };
|
||||
pub const ZERO: Self = Self { x: 0, y: 0, z: 0 };
|
||||
}
|
||||
|
||||
impl Default for Origin3d {
|
||||
fn default() -> Self {
|
||||
Origin3d::ZERO
|
||||
Self::ZERO
|
||||
}
|
||||
}
|
||||
|
||||
@ -1443,7 +1440,7 @@ pub struct Extent3d {
|
||||
|
||||
impl Default for Extent3d {
|
||||
fn default() -> Self {
|
||||
Extent3d {
|
||||
Self {
|
||||
width: 1,
|
||||
height: 1,
|
||||
depth: 1,
|
||||
@ -1504,7 +1501,7 @@ pub enum TextureAspect {
|
||||
|
||||
impl Default for TextureAspect {
|
||||
fn default() -> Self {
|
||||
TextureAspect::All
|
||||
Self::All
|
||||
}
|
||||
}
|
||||
|
||||
@ -1539,7 +1536,7 @@ pub enum AddressMode {
|
||||
|
||||
impl Default for AddressMode {
|
||||
fn default() -> Self {
|
||||
AddressMode::ClampToEdge
|
||||
Self::ClampToEdge
|
||||
}
|
||||
}
|
||||
|
||||
@ -1561,7 +1558,7 @@ pub enum FilterMode {
|
||||
|
||||
impl Default for FilterMode {
|
||||
fn default() -> Self {
|
||||
FilterMode::Nearest
|
||||
Self::Nearest
|
||||
}
|
||||
}
|
||||
|
||||
@ -1832,8 +1829,7 @@ pub enum BindingType {
|
||||
impl BindingType {
|
||||
pub fn has_dynamic_offset(&self) -> bool {
|
||||
match *self {
|
||||
BindingType::UniformBuffer { dynamic, .. }
|
||||
| BindingType::StorageBuffer { dynamic, .. } => dynamic,
|
||||
Self::UniformBuffer { dynamic, .. } | Self::StorageBuffer { dynamic, .. } => dynamic,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user