mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-16 04:11:25 +00:00
dawn/node: Avoid empty vector index
If a device lists no features, don't zero-index an empty std::vector. Change-Id: I10d632f0c5d5a162abec180797ad11adee67fc6b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116863 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Auto-Submit: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
47a81fc126
commit
58d1e89426
@ -181,7 +181,9 @@ GPUDevice::~GPUDevice() {
|
||||
interop::Interface<interop::GPUSupportedFeatures> GPUDevice::getFeatures(Napi::Env env) {
|
||||
size_t count = device_.EnumerateFeatures(nullptr);
|
||||
std::vector<wgpu::FeatureName> features(count);
|
||||
device_.EnumerateFeatures(&features[0]);
|
||||
if (count > 0) {
|
||||
device_.EnumerateFeatures(features.data());
|
||||
}
|
||||
return interop::GPUSupportedFeatures::Create<GPUSupportedFeatures>(env, env,
|
||||
std::move(features));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user