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:
parent
50206a2aa2
commit
d6b601790f
|
@ -153,20 +153,15 @@ bool Converter::Convert(wgpu::ImageCopyBuffer& out, const interop::GPUImageCopyB
|
||||||
bool Converter::Convert(BufferSource& out, interop::BufferSource in) {
|
bool Converter::Convert(BufferSource& out, interop::BufferSource in) {
|
||||||
out = {};
|
out = {};
|
||||||
if (auto* view = std::get_if<interop::ArrayBufferView>(&in)) {
|
if (auto* view = std::get_if<interop::ArrayBufferView>(&in)) {
|
||||||
return std::visit(
|
std::visit(
|
||||||
[&](auto&& v) {
|
[&](auto&& v) {
|
||||||
auto arr = v.ArrayBuffer();
|
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.data = static_cast<uint8_t*>(arr.Data()) + v.ByteOffset();
|
||||||
out.size = v.ByteLength();
|
out.size = v.ByteLength();
|
||||||
out.bytesPerElement = v.ElementSize();
|
out.bytesPerElement = v.ElementSize();
|
||||||
return true;
|
|
||||||
},
|
},
|
||||||
*view);
|
*view);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
if (auto* arr = std::get_if<interop::ArrayBuffer>(&in)) {
|
if (auto* arr = std::get_if<interop::ArrayBuffer>(&in)) {
|
||||||
out.data = arr->Data();
|
out.data = arr->Data();
|
||||||
|
|
Loading…
Reference in New Issue