Skip to content

Commit

Permalink
render: fix RenderResourceBinding PartialEq impl
Browse files Browse the repository at this point in the history
  • Loading branch information
multun committed Aug 16, 2020
1 parent dfbdeeb commit e36b26c
Showing 1 changed file with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::{
};
use uuid::Uuid;

#[derive(Clone, Eq, PartialEq, Debug)]
#[derive(Clone, Eq, Debug)]
pub enum RenderResourceBinding {
Buffer {
buffer: BufferId,
Expand Down Expand Up @@ -48,6 +48,34 @@ impl RenderResourceBinding {
}
}

impl PartialEq for RenderResourceBinding {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(
RenderResourceBinding::Buffer {
buffer: self_buffer,
range: self_range,
dynamic_index: _,
},
RenderResourceBinding::Buffer {
buffer: other_buffer,
range: other_range,
dynamic_index: _,
},
) => self_buffer == other_buffer && self_range == other_range,
(
RenderResourceBinding::Texture(self_texture),
RenderResourceBinding::Texture(other_texture),
) => RenderResourceId::from(*self_texture) == RenderResourceId::from(*other_texture),
(
RenderResourceBinding::Sampler(self_sampler),
RenderResourceBinding::Sampler(other_sampler),
) => RenderResourceId::from(*self_sampler) == RenderResourceId::from(*other_sampler),
_ => false,
}
}
}

impl Hash for RenderResourceBinding {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
match self {
Expand Down

0 comments on commit e36b26c

Please sign in to comment.