mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 23:04:07 +00:00
use self
This commit is contained in:
parent
62f26367cd
commit
efd52e02af
@ -20,7 +20,7 @@ mod compat {
|
|||||||
}
|
}
|
||||||
impl<T> Default for Entry<T> {
|
impl<T> Default for Entry<T> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Entry {
|
Self {
|
||||||
assigned: None,
|
assigned: None,
|
||||||
expected: None,
|
expected: None,
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ mod compat {
|
|||||||
|
|
||||||
impl<T: Copy + PartialEq> Manager<T> {
|
impl<T: Copy + PartialEq> Manager<T> {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Manager {
|
Self {
|
||||||
entries: Default::default(),
|
entries: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ pub(super) struct Binder {
|
|||||||
|
|
||||||
impl Binder {
|
impl Binder {
|
||||||
pub(super) fn new() -> Self {
|
pub(super) fn new() -> Self {
|
||||||
Binder {
|
Self {
|
||||||
pipeline_layout_id: None,
|
pipeline_layout_id: None,
|
||||||
manager: compat::Manager::new(),
|
manager: compat::Manager::new(),
|
||||||
payloads: Default::default(),
|
payloads: Default::default(),
|
||||||
|
@ -222,8 +222,8 @@ enum OptionalState {
|
|||||||
|
|
||||||
impl OptionalState {
|
impl OptionalState {
|
||||||
fn require(&mut self, require: bool) {
|
fn require(&mut self, require: bool) {
|
||||||
if require && *self == OptionalState::Unused {
|
if require && *self == Self::Unused {
|
||||||
*self = OptionalState::Required;
|
*self = Self::Required;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ struct VertexBufferState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl VertexBufferState {
|
impl VertexBufferState {
|
||||||
const EMPTY: Self = VertexBufferState {
|
const EMPTY: Self = Self {
|
||||||
total_size: 0,
|
total_size: 0,
|
||||||
stride: 0,
|
stride: 0,
|
||||||
rate: VertexStepMode::Vertex,
|
rate: VertexStepMode::Vertex,
|
||||||
|
@ -84,7 +84,7 @@ impl RenderPassContext {
|
|||||||
// Assumed the renderpass only contains one subpass
|
// Assumed the renderpass only contains one subpass
|
||||||
pub(crate) fn check_compatible(
|
pub(crate) fn check_compatible(
|
||||||
&self,
|
&self,
|
||||||
other: &RenderPassContext,
|
other: &Self,
|
||||||
) -> Result<(), RenderPassCompatibilityError> {
|
) -> Result<(), RenderPassCompatibilityError> {
|
||||||
if self.attachments.colors != other.attachments.colors {
|
if self.attachments.colors != other.attachments.colors {
|
||||||
return Err(RenderPassCompatibilityError::IncompatibleColorAttachment(
|
return Err(RenderPassCompatibilityError::IncompatibleColorAttachment(
|
||||||
@ -119,7 +119,7 @@ pub struct UserClosures {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl UserClosures {
|
impl UserClosures {
|
||||||
fn extend(&mut self, other: UserClosures) {
|
fn extend(&mut self, other: Self) {
|
||||||
self.mappings.extend(other.mappings);
|
self.mappings.extend(other.mappings);
|
||||||
self.submissions.extend(other.submissions);
|
self.submissions.extend(other.submissions);
|
||||||
}
|
}
|
||||||
|
@ -170,9 +170,9 @@ pub(crate) enum TextureInner<A: hal::Api> {
|
|||||||
impl<A: hal::Api> TextureInner<A> {
|
impl<A: hal::Api> TextureInner<A> {
|
||||||
pub fn as_raw(&self) -> Option<&A::Texture> {
|
pub fn as_raw(&self) -> Option<&A::Texture> {
|
||||||
match *self {
|
match *self {
|
||||||
TextureInner::Native { raw: Some(ref tex) } => Some(tex),
|
Self::Native { raw: Some(ref tex) } => Some(tex),
|
||||||
TextureInner::Native { raw: None } => None,
|
Self::Native { raw: None } => None,
|
||||||
TextureInner::Surface {
|
Self::Surface {
|
||||||
ref raw,
|
ref raw,
|
||||||
parent_id: _,
|
parent_id: _,
|
||||||
} => Some(std::borrow::Borrow::borrow(raw)),
|
} => Some(std::borrow::Borrow::borrow(raw)),
|
||||||
|
@ -923,7 +923,7 @@ impl Interface {
|
|||||||
entry_points.insert((entry_point.stage, entry_point.name.clone()), ep);
|
entry_points.insert((entry_point.stage, entry_point.name.clone()), ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
Interface {
|
Self {
|
||||||
features,
|
features,
|
||||||
resources,
|
resources,
|
||||||
entry_points,
|
entry_points,
|
||||||
|
@ -545,7 +545,7 @@ struct MapContext {
|
|||||||
|
|
||||||
impl MapContext {
|
impl MapContext {
|
||||||
fn new(total_size: BufferAddress) -> Self {
|
fn new(total_size: BufferAddress) -> Self {
|
||||||
MapContext {
|
Self {
|
||||||
total_size,
|
total_size,
|
||||||
initial_range: 0..0,
|
initial_range: 0..0,
|
||||||
sub_ranges: Vec::new(),
|
sub_ranges: Vec::new(),
|
||||||
@ -1383,7 +1383,7 @@ impl Instance {
|
|||||||
/// - `backends` - Controls from which [backends][Backends] wgpu will choose
|
/// - `backends` - Controls from which [backends][Backends] wgpu will choose
|
||||||
/// during instantiation.
|
/// during instantiation.
|
||||||
pub fn new(backends: Backends) -> Self {
|
pub fn new(backends: Backends) -> Self {
|
||||||
Instance {
|
Self {
|
||||||
context: Arc::new(C::init(backends)),
|
context: Arc::new(C::init(backends)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1399,7 +1399,7 @@ impl Instance {
|
|||||||
/// Refer to the creation of wgpu-hal Instance for every backend.
|
/// Refer to the creation of wgpu-hal Instance for every backend.
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
pub unsafe fn from_hal<A: wgc::hub::HalApi>(hal_instance: A::Instance) -> Self {
|
pub unsafe fn from_hal<A: wgc::hub::HalApi>(hal_instance: A::Instance) -> Self {
|
||||||
Instance {
|
Self {
|
||||||
context: Arc::new(C::from_hal_instance::<A>(hal_instance)),
|
context: Arc::new(C::from_hal_instance::<A>(hal_instance)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user