diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp index f4dc9044e7..0e4c384c76 100644 --- a/src/dawn_native/Buffer.cpp +++ b/src/dawn_native/Buffer.cpp @@ -249,11 +249,15 @@ namespace dawn_native { } } - void BufferBase::SetSubData(uint32_t start, uint32_t count, const void* data) { + void BufferBase::SetSubData(uint64_t start, uint64_t count, const void* data) { + if (count > uint64_t(std::numeric_limits::max())) { + GetDevice()->HandleError(InternalErrorType::Validation, "count too big"); + } + Ref queue = AcquireRef(GetDevice()->GetDefaultQueue()); GetDevice()->EmitDeprecationWarning( "Buffer::SetSubData is deprecated, use Queue::WriteBuffer instead"); - queue->WriteBuffer(this, start, data, count); + queue->WriteBuffer(this, start, data, static_cast(count)); } void BufferBase::MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata) { diff --git a/src/dawn_native/Buffer.h b/src/dawn_native/Buffer.h index ef9224a280..c4f1d3297d 100644 --- a/src/dawn_native/Buffer.h +++ b/src/dawn_native/Buffer.h @@ -58,7 +58,7 @@ namespace dawn_native { MaybeError ValidateCanUseOnQueueNow() const; // Dawn API - void SetSubData(uint32_t start, uint32_t count, const void* data); + void SetSubData(uint64_t start, uint64_t count, const void* data); void MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata); void MapWriteAsync(WGPUBufferMapWriteCallback callback, void* userdata); void* GetMappedRange();