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:
parent
db9db31cab
commit
30353998c1
|
@ -98,7 +98,7 @@ class ArrayLengthFromUniform final
|
||||||
~Result() override;
|
~Result() override;
|
||||||
|
|
||||||
/// Indices into the UBO that are statically used.
|
/// 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
|
/// @param program the program to inspect
|
||||||
|
|
|
@ -88,6 +88,13 @@ class DataMap {
|
||||||
/// Put()
|
/// Put()
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T const* Get() const {
|
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>());
|
auto it = map_.find(&TypeInfo::Of<T>());
|
||||||
if (it == map_.end()) {
|
if (it == map_.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Loading…
Reference in New Issue