Use the binding mask for BGL hashing and comparison

This commit is contained in:
Corentin Wallez 2018-05-09 14:08:17 -04:00 committed by Corentin Wallez
parent f77e3cc648
commit 87ec361cc2
1 changed files with 6 additions and 12 deletions

View File

@ -15,6 +15,7 @@
#include "backend/BindGroupLayout.h"
#include "backend/Device.h"
#include "common/BitSetIterator.h"
#include "common/HashUtils.h"
#include <functional>
@ -25,10 +26,8 @@ namespace backend {
size_t HashBindingInfo(const BindGroupLayoutBase::LayoutBindingInfo& info) {
size_t hash = Hash(info.mask);
for (size_t binding = 0; binding < kMaxBindingsPerGroup; ++binding) {
if (info.mask[binding]) {
HashCombine(&hash, info.visibilities[binding], info.types[binding]);
}
for (uint32_t binding : IterateBitSet(info.mask)) {
HashCombine(&hash, info.visibilities[binding], info.types[binding]);
}
return hash;
@ -40,14 +39,9 @@ namespace backend {
return false;
}
for (size_t binding = 0; binding < kMaxBindingsPerGroup; ++binding) {
if (a.mask[binding]) {
if (a.visibilities[binding] != b.visibilities[binding]) {
return false;
}
if (a.types[binding] != b.types[binding]) {
return false;
}
for (uint32_t binding : IterateBitSet(a.mask)) {
if ((a.visibilities[binding] != b.visibilities[binding]) || (a.types[binding] != b.types[binding])) {
return false;
}
}