render: fix bind group PartialEq impl

This commit is contained in:
Victor "multun" Collod 2020-08-16 02:52:00 -07:00
parent c38420f1e9
commit dfbdeeb27f

View File

@ -4,7 +4,7 @@ use std::{
hash::{Hash, Hasher},
};
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, Eq)]
pub struct BindGroupDescriptor {
pub index: u32,
pub bindings: Vec<BindingDescriptor>,
@ -35,9 +35,17 @@ impl BindGroupDescriptor {
impl Hash for BindGroupDescriptor {
fn hash<H: Hasher>(&self, state: &mut H) {
// TODO: remove index from hash state (or at least id). index is not considered a part of a bind group on the gpu.
// bind groups are bound to indices in pipelines
// TODO: remove index from hash state (or at least id), and update the PartialEq implem.
// index is not considered a part of a bind group on the gpu.
// bind groups are bound to indices in pipelines.
self.index.hash(state);
self.bindings.hash(state);
}
}
impl PartialEq for BindGroupDescriptor {
fn eq(&self, other: &Self) -> bool {
// This MUST be kept in sync with the hash implementation above
self.index == other.index && self.bindings == other.bindings
}
}