dawn.node: Remove unnecessary check that TypedArrays are in bounds

This should be done by V8 on the creation of TypedArray anyways.

Bug: None
Change-Id: Ia0eacfe3a0434acf81b7d0d6473db9aa97c78c09
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122121
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Corentin Wallez 2023-03-17 10:39:33 +00:00 committed by Dawn LUCI CQ
parent 50206a2aa2
commit d6b601790f
1 changed files with 2 additions and 7 deletions

View File

@ -153,20 +153,15 @@ bool Converter::Convert(wgpu::ImageCopyBuffer& out, const interop::GPUImageCopyB
bool Converter::Convert(BufferSource& out, interop::BufferSource in) {
out = {};
if (auto* view = std::get_if<interop::ArrayBufferView>(&in)) {
return std::visit(
std::visit(
[&](auto&& v) {
auto arr = v.ArrayBuffer();
if (v.ByteOffset() + v.ByteLength() > arr.ByteLength()) {
Napi::Error::New(env, "offset + length exceeds underlying buffer size")
.ThrowAsJavaScriptException();
return false;
}
out.data = static_cast<uint8_t*>(arr.Data()) + v.ByteOffset();
out.size = v.ByteLength();
out.bytesPerElement = v.ElementSize();
return true;
},
*view);
return true;
}
if (auto* arr = std::get_if<interop::ArrayBuffer>(&in)) {
out.data = arr->Data();