dawn_node: Add binding .cpp files for trivial types

All UNIMPLEMENTED()s are TODO.

Bug: dawn:1123
Change-Id: Ie51b807d8a2a2ba376416d77de383dd627d04a07
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64908
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Ben Clayton 2021-09-28 13:56:01 +00:00 committed by Dawn LUCI CQ
parent 118d2dd19e
commit ca9bc676aa
12 changed files with 527 additions and 0 deletions

View File

@ -21,25 +21,36 @@ add_library(dawn_node_binding STATIC
"Errors.h" "Errors.h"
"GPU.h" "GPU.h"
"GPUAdapter.h" "GPUAdapter.h"
"GPUBindGroup.cpp"
"GPUBindGroup.h" "GPUBindGroup.h"
"GPUBindGroupLayout.cpp"
"GPUBindGroupLayout.h" "GPUBindGroupLayout.h"
"GPUBuffer.h" "GPUBuffer.h"
"GPUCommandBuffer.cpp"
"GPUCommandBuffer.h" "GPUCommandBuffer.h"
"GPUCommandEncoder.h" "GPUCommandEncoder.h"
"GPUComputePassEncoder.h" "GPUComputePassEncoder.h"
"GPUComputePipeline.cpp"
"GPUComputePipeline.h" "GPUComputePipeline.h"
"GPUDevice.h" "GPUDevice.h"
"GPUPipelineLayout.cpp"
"GPUPipelineLayout.h" "GPUPipelineLayout.h"
"GPUQuerySet.cpp"
"GPUQuerySet.h" "GPUQuerySet.h"
"GPUQueue.h" "GPUQueue.h"
"GPURenderBundle.cpp"
"GPURenderBundle.h" "GPURenderBundle.h"
"GPURenderBundleEncoder.h" "GPURenderBundleEncoder.h"
"GPURenderPassEncoder.h" "GPURenderPassEncoder.h"
"GPURenderPipeline.cpp"
"GPURenderPipeline.h" "GPURenderPipeline.h"
"GPUSampler.cpp"
"GPUSampler.h" "GPUSampler.h"
"GPUShaderModule.h" "GPUShaderModule.h"
"GPUSupportedLimits.cpp"
"GPUSupportedLimits.h" "GPUSupportedLimits.h"
"GPUTexture.h" "GPUTexture.h"
"GPUTextureView.cpp"
"GPUTextureView.h" "GPUTextureView.h"
) )

View File

@ -0,0 +1,35 @@
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/dawn_node/binding/GPUBindGroup.h"
#include "src/dawn_node/utils/Debug.h"
namespace wgpu { namespace binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPUBindGroup
////////////////////////////////////////////////////////////////////////////////
GPUBindGroup::GPUBindGroup(wgpu::BindGroup group) : group_(std::move(group)) {
}
std::optional<std::string> GPUBindGroup::getLabel(Napi::Env) {
UNIMPLEMENTED();
}
void GPUBindGroup::setLabel(Napi::Env, std::optional<std::string> value) {
UNIMPLEMENTED();
}
}} // namespace wgpu::binding

View File

@ -0,0 +1,36 @@
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/dawn_node/binding/GPUBindGroupLayout.h"
#include "src/dawn_node/utils/Debug.h"
namespace wgpu { namespace binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPUBindGroupLayout
////////////////////////////////////////////////////////////////////////////////
GPUBindGroupLayout::GPUBindGroupLayout(wgpu::BindGroupLayout layout)
: layout_(std::move(layout)) {
}
std::optional<std::string> GPUBindGroupLayout::getLabel(Napi::Env) {
UNIMPLEMENTED();
}
void GPUBindGroupLayout::setLabel(Napi::Env, std::optional<std::string> value) {
UNIMPLEMENTED();
}
}} // namespace wgpu::binding

View File

@ -0,0 +1,40 @@
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/dawn_node/binding/GPUCommandBuffer.h"
#include "src/dawn_node/utils/Debug.h"
namespace wgpu { namespace binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPUCommandBuffer
////////////////////////////////////////////////////////////////////////////////
GPUCommandBuffer::GPUCommandBuffer(wgpu::CommandBuffer cmd_buf) : cmd_buf_(std::move(cmd_buf)) {
}
interop::Promise<double> GPUCommandBuffer::getExecutionTime(Napi::Env) {
UNIMPLEMENTED();
};
std::optional<std::string> GPUCommandBuffer::getLabel(Napi::Env) {
UNIMPLEMENTED();
}
void GPUCommandBuffer::setLabel(Napi::Env, std::optional<std::string> value) {
UNIMPLEMENTED();
}
}} // namespace wgpu::binding

View File

@ -0,0 +1,45 @@
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/dawn_node/binding/GPUComputePipeline.h"
#include "src/dawn_node/binding/GPUBindGroupLayout.h"
#include "src/dawn_node/binding/GPUBuffer.h"
#include "src/dawn_node/utils/Debug.h"
namespace wgpu { namespace binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPUComputePipeline
////////////////////////////////////////////////////////////////////////////////
GPUComputePipeline::GPUComputePipeline(wgpu::ComputePipeline pipeline)
: pipeline_(std::move(pipeline)) {
}
interop::Interface<interop::GPUBindGroupLayout> GPUComputePipeline::getBindGroupLayout(
Napi::Env env,
uint32_t index) {
return interop::GPUBindGroupLayout::Create<GPUBindGroupLayout>(
env, pipeline_.GetBindGroupLayout(index));
}
std::optional<std::string> GPUComputePipeline::getLabel(Napi::Env) {
UNIMPLEMENTED();
}
void GPUComputePipeline::setLabel(Napi::Env, std::optional<std::string> value) {
UNIMPLEMENTED();
}
}} // namespace wgpu::binding

View File

@ -0,0 +1,35 @@
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/dawn_node/binding/GPUPipelineLayout.h"
#include "src/dawn_node/utils/Debug.h"
namespace wgpu { namespace binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPUPipelineLayout
////////////////////////////////////////////////////////////////////////////////
GPUPipelineLayout::GPUPipelineLayout(wgpu::PipelineLayout layout) : layout_(std::move(layout)) {
}
std::optional<std::string> GPUPipelineLayout::getLabel(Napi::Env) {
UNIMPLEMENTED();
}
void GPUPipelineLayout::setLabel(Napi::Env, std::optional<std::string> value) {
UNIMPLEMENTED();
}
}} // namespace wgpu::binding

View File

@ -0,0 +1,39 @@
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/dawn_node/binding/GPUQuerySet.h"
#include "src/dawn_node/utils/Debug.h"
namespace wgpu { namespace binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPUQuerySet
////////////////////////////////////////////////////////////////////////////////
GPUQuerySet::GPUQuerySet(wgpu::QuerySet query_set) : query_set_(std::move(query_set)) {
}
void GPUQuerySet::destroy(Napi::Env) {
query_set_.Destroy();
}
std::optional<std::string> GPUQuerySet::getLabel(Napi::Env) {
UNIMPLEMENTED();
}
void GPUQuerySet::setLabel(Napi::Env, std::optional<std::string> value) {
UNIMPLEMENTED();
}
}} // namespace wgpu::binding

View File

@ -0,0 +1,39 @@
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/dawn_node/binding/GPURenderBundle.h"
#include "src/dawn_node/binding/Converter.h"
#include "src/dawn_node/binding/GPUBuffer.h"
#include "src/dawn_node/binding/GPURenderBundle.h"
#include "src/dawn_node/binding/GPURenderPipeline.h"
#include "src/dawn_node/utils/Debug.h"
namespace wgpu { namespace binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPURenderBundle
////////////////////////////////////////////////////////////////////////////////
GPURenderBundle::GPURenderBundle(wgpu::RenderBundle bundle) : bundle_(std::move(bundle)) {
}
std::optional<std::string> GPURenderBundle::getLabel(Napi::Env) {
UNIMPLEMENTED();
}
void GPURenderBundle::setLabel(Napi::Env, std::optional<std::string> value) {
UNIMPLEMENTED();
}
}} // namespace wgpu::binding

View File

@ -0,0 +1,45 @@
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/dawn_node/binding/GPURenderPipeline.h"
#include "src/dawn_node/binding/GPUBindGroupLayout.h"
#include "src/dawn_node/binding/GPUBuffer.h"
#include "src/dawn_node/utils/Debug.h"
namespace wgpu { namespace binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPURenderPipeline
////////////////////////////////////////////////////////////////////////////////
GPURenderPipeline::GPURenderPipeline(wgpu::RenderPipeline pipeline)
: pipeline_(std::move(pipeline)) {
}
interop::Interface<interop::GPUBindGroupLayout> GPURenderPipeline::getBindGroupLayout(
Napi::Env env,
uint32_t index) {
return interop::GPUBindGroupLayout::Create<GPUBindGroupLayout>(
env, pipeline_.GetBindGroupLayout(index));
}
std::optional<std::string> GPURenderPipeline::getLabel(Napi::Env) {
UNIMPLEMENTED();
}
void GPURenderPipeline::setLabel(Napi::Env, std::optional<std::string> value) {
UNIMPLEMENTED();
}
}} // namespace wgpu::binding

View File

@ -0,0 +1,36 @@
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/dawn_node/binding/GPUSampler.h"
#include "src/dawn_node/binding/Converter.h"
#include "src/dawn_node/utils/Debug.h"
namespace wgpu { namespace binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPUSampler
////////////////////////////////////////////////////////////////////////////////
GPUSampler::GPUSampler(wgpu::Sampler sampler) : sampler_(std::move(sampler)) {
}
std::optional<std::string> GPUSampler::getLabel(Napi::Env) {
UNIMPLEMENTED();
}
void GPUSampler::setLabel(Napi::Env, std::optional<std::string> value) {
UNIMPLEMENTED();
}
}} // namespace wgpu::binding

View File

@ -0,0 +1,131 @@
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/dawn_node/binding/GPUSupportedLimits.h"
namespace wgpu { namespace binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPUSupportedLimits
////////////////////////////////////////////////////////////////////////////////
// Values taken from.
// https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_supported_limits.h
// TODO(crbug.com/dawn/1131): Actually use limits reported by the device / adapter.
uint32_t GPUSupportedLimits::getMaxTextureDimension1D(Napi::Env) {
return 8192;
}
uint32_t GPUSupportedLimits::getMaxTextureDimension2D(Napi::Env) {
return 8192;
}
uint32_t GPUSupportedLimits::getMaxTextureDimension3D(Napi::Env) {
return 2048;
}
uint32_t GPUSupportedLimits::getMaxTextureArrayLayers(Napi::Env) {
return 2048;
}
uint32_t GPUSupportedLimits::getMaxBindGroups(Napi::Env) {
return 4;
}
uint32_t GPUSupportedLimits::getMaxDynamicUniformBuffersPerPipelineLayout(Napi::Env) {
return 8;
}
uint32_t GPUSupportedLimits::getMaxDynamicStorageBuffersPerPipelineLayout(Napi::Env) {
return 4;
}
uint32_t GPUSupportedLimits::getMaxSampledTexturesPerShaderStage(Napi::Env) {
return 16;
}
uint32_t GPUSupportedLimits::getMaxSamplersPerShaderStage(Napi::Env) {
return 16;
}
uint32_t GPUSupportedLimits::getMaxStorageBuffersPerShaderStage(Napi::Env) {
return 4;
}
uint32_t GPUSupportedLimits::getMaxStorageTexturesPerShaderStage(Napi::Env) {
return 4;
}
uint32_t GPUSupportedLimits::getMaxUniformBuffersPerShaderStage(Napi::Env) {
return 12;
}
uint64_t GPUSupportedLimits::getMaxUniformBufferBindingSize(Napi::Env) {
return 16384;
}
uint64_t GPUSupportedLimits::getMaxStorageBufferBindingSize(Napi::Env) {
return 134217728;
}
uint32_t GPUSupportedLimits::getMinUniformBufferOffsetAlignment(Napi::Env) {
return 256;
}
uint32_t GPUSupportedLimits::getMinStorageBufferOffsetAlignment(Napi::Env) {
return 256;
}
uint32_t GPUSupportedLimits::getMaxVertexBuffers(Napi::Env) {
return 8;
}
uint32_t GPUSupportedLimits::getMaxVertexAttributes(Napi::Env) {
return 16;
}
uint32_t GPUSupportedLimits::getMaxVertexBufferArrayStride(Napi::Env) {
return 2048;
}
uint32_t GPUSupportedLimits::getMaxInterStageShaderComponents(Napi::Env) {
return 60;
}
uint32_t GPUSupportedLimits::getMaxComputeWorkgroupStorageSize(Napi::Env) {
return 16352;
}
uint32_t GPUSupportedLimits::getMaxComputeInvocationsPerWorkgroup(Napi::Env) {
return 256;
}
uint32_t GPUSupportedLimits::getMaxComputeWorkgroupSizeX(Napi::Env) {
return 256;
}
uint32_t GPUSupportedLimits::getMaxComputeWorkgroupSizeY(Napi::Env) {
return 256;
}
uint32_t GPUSupportedLimits::getMaxComputeWorkgroupSizeZ(Napi::Env) {
return 64;
}
uint32_t GPUSupportedLimits::getMaxComputeWorkgroupsPerDimension(Napi::Env) {
return 65535;
}
}} // namespace wgpu::binding

View File

@ -0,0 +1,35 @@
// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/dawn_node/binding/GPUTextureView.h"
#include "src/dawn_node/utils/Debug.h"
namespace wgpu { namespace binding {
////////////////////////////////////////////////////////////////////////////////
// wgpu::bindings::GPUTextureView
////////////////////////////////////////////////////////////////////////////////
GPUTextureView::GPUTextureView(wgpu::TextureView view) : view_(std::move(view)) {
}
std::optional<std::string> GPUTextureView::getLabel(Napi::Env) {
UNIMPLEMENTED();
}
void GPUTextureView::setLabel(Napi::Env, std::optional<std::string> value) {
UNIMPLEMENTED();
};
}} // namespace wgpu::binding