diff --git a/src/dawn_native/null/DeviceNull.cpp b/src/dawn_native/null/DeviceNull.cpp index adc44f0974..fd91585faf 100644 --- a/src/dawn_native/null/DeviceNull.cpp +++ b/src/dawn_native/null/DeviceNull.cpp @@ -209,8 +209,8 @@ namespace dawn_native { namespace null { return {}; } - MaybeError Device::IncrementMemoryUsage(size_t bytes) { - static_assert(kMaxMemoryUsage <= std::numeric_limits::max() / 2, ""); + MaybeError Device::IncrementMemoryUsage(uint64_t bytes) { + static_assert(kMaxMemoryUsage <= std::numeric_limits::max(), ""); if (bytes > kMaxMemoryUsage || mMemoryUsage + bytes > kMaxMemoryUsage) { return DAWN_OUT_OF_MEMORY_ERROR("Out of memory."); } @@ -218,7 +218,7 @@ namespace dawn_native { namespace null { return {}; } - void Device::DecrementMemoryUsage(size_t bytes) { + void Device::DecrementMemoryUsage(uint64_t bytes) { ASSERT(mMemoryUsage >= bytes); mMemoryUsage -= bytes; } diff --git a/src/dawn_native/null/DeviceNull.h b/src/dawn_native/null/DeviceNull.h index f6f361185c..56cb6a82dc 100644 --- a/src/dawn_native/null/DeviceNull.h +++ b/src/dawn_native/null/DeviceNull.h @@ -106,8 +106,8 @@ namespace dawn_native { namespace null { uint64_t destinationOffset, uint64_t size) override; - MaybeError IncrementMemoryUsage(size_t bytes); - void DecrementMemoryUsage(size_t bytes); + MaybeError IncrementMemoryUsage(uint64_t bytes); + void DecrementMemoryUsage(uint64_t bytes); private: using DeviceBase::DeviceBase; @@ -147,7 +147,7 @@ namespace dawn_native { namespace null { std::vector> mPendingOperations; - static constexpr size_t kMaxMemoryUsage = 256 * 1024 * 1024; + static constexpr uint64_t kMaxMemoryUsage = 256 * 1024 * 1024; size_t mMemoryUsage = 0; };