tint: Fix copy instead of move of ArrayLengthFromUniform::used_size_indices

In our backends, we std::move this unordered_set into the Results
struct, but because we'd get a const reference to a const object,
std::move would cast this to a const r-value, which binds to const ref,
and thus would end up copying instead of moving. This change just
ensures that we get a non-const ref to a non-const unordered_set where
we do the move.

Bug: tint:1495
Change-Id: I8d1cfe66b8343bae4146fc85fc86d72bac41a1a1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86202
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano 2022-04-08 21:23:58 +00:00 committed by Dawn LUCI CQ
parent db9db31cab
commit 30353998c1
2 changed files with 8 additions and 1 deletions

View File

@ -98,7 +98,7 @@ class ArrayLengthFromUniform final
~Result() override;
/// Indices into the UBO that are statically used.
const std::unordered_set<uint32_t> used_size_indices;
std::unordered_set<uint32_t> used_size_indices;
};
/// @param program the program to inspect

View File

@ -88,6 +88,13 @@ class DataMap {
/// Put()
template <typename T>
T const* Get() const {
return const_cast<DataMap*>(this)->Get<T>();
}
/// @returns a pointer to the Data placed into the DataMap with a call to
/// Put()
template <typename T>
T* Get() {
auto it = map_.find(&TypeInfo::Of<T>());
if (it == map_.end()) {
return nullptr;