Compat: support textureBindingViewDimension in dawn.node
Change-Id: Idc5531e72f4b6a18b3dcbc0bd599b751505f400f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/159301
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Gregg Tavares <gman@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/dawn/node/binding/GPUDevice.cpp b/src/dawn/node/binding/GPUDevice.cpp
index aad9bf4..b75e92a 100644
--- a/src/dawn/node/binding/GPUDevice.cpp
+++ b/src/dawn/node/binding/GPUDevice.cpp
@@ -252,6 +252,17 @@
!conv(desc.viewFormats, desc.viewFormatCount, descriptor.viewFormats)) {
return {};
}
+
+ wgpu::TextureBindingViewDimensionDescriptor texture_binding_view_dimension_desc{};
+ wgpu::TextureViewDimension texture_binding_view_dimension;
+ if (descriptor.textureBindingViewDimension.has_value() &&
+ conv(texture_binding_view_dimension, descriptor.textureBindingViewDimension)) {
+ texture_binding_view_dimension_desc.textureBindingViewDimension =
+ texture_binding_view_dimension;
+ desc.nextInChain =
+ reinterpret_cast<wgpu::ChainedStruct*>(&texture_binding_view_dimension_desc);
+ }
+
return interop::GPUTexture::Create<GPUTexture>(env, device_, desc,
device_.CreateTexture(&desc));
}
diff --git a/src/dawn/node/interop/DawnExtensions.idl b/src/dawn/node/interop/DawnExtensions.idl
index 9b65802..3bb71bd 100644
--- a/src/dawn/node/interop/DawnExtensions.idl
+++ b/src/dawn/node/interop/DawnExtensions.idl
@@ -44,3 +44,7 @@
interface GPUCommandEncoder {
undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex);
};
+
+dictionary GPUTextureDescriptor {
+ GPUTextureViewDimension? textureBindingViewDimension;
+};