Convert node bindings over to use explicit.
This CL adds explicit annotations to the single argument constructors in the node binding code. Bug: dawn:1339 Change-Id: I428c8e485bc3d6230c3cf7d61c2146d5ec977abf Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86644 Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
f0469eb65a
commit
d58820a330
|
@ -57,7 +57,8 @@ namespace wgpu::binding {
|
||||||
|
|
||||||
// Constructor.
|
// Constructor.
|
||||||
// Calls AsyncRunner::Begin()
|
// Calls AsyncRunner::Begin()
|
||||||
inline AsyncTask(std::shared_ptr<AsyncRunner> runner) : runner_(std::move(runner)) {
|
explicit inline AsyncTask(std::shared_ptr<AsyncRunner> runner)
|
||||||
|
: runner_(std::move(runner)) {
|
||||||
runner_->Begin();
|
runner_->Begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace wgpu::binding {
|
||||||
// automatically freed when the Converter is destructed.
|
// automatically freed when the Converter is destructed.
|
||||||
class Converter {
|
class Converter {
|
||||||
public:
|
public:
|
||||||
Converter(Napi::Env e) : env(e) {
|
explicit Converter(Napi::Env e) : env(e) {
|
||||||
}
|
}
|
||||||
~Converter();
|
~Converter();
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace wgpu::binding {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
class Features : public interop::GPUSupportedFeatures {
|
class Features : public interop::GPUSupportedFeatures {
|
||||||
public:
|
public:
|
||||||
Features(WGPUDeviceProperties properties) {
|
explicit Features(WGPUDeviceProperties properties) {
|
||||||
if (properties.depth24UnormStencil8) {
|
if (properties.depth24UnormStencil8) {
|
||||||
enabled_.emplace(interop::GPUFeatureName::kDepth24UnormStencil8);
|
enabled_.emplace(interop::GPUFeatureName::kDepth24UnormStencil8);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace wgpu::binding {
|
||||||
// GPUBindGroup is an implementation of interop::GPUBindGroup that wraps a wgpu::BindGroup.
|
// GPUBindGroup is an implementation of interop::GPUBindGroup that wraps a wgpu::BindGroup.
|
||||||
class GPUBindGroup final : public interop::GPUBindGroup {
|
class GPUBindGroup final : public interop::GPUBindGroup {
|
||||||
public:
|
public:
|
||||||
GPUBindGroup(wgpu::BindGroup group);
|
explicit GPUBindGroup(wgpu::BindGroup group);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::BindGroup&() const {
|
inline operator const wgpu::BindGroup&() const {
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
||||||
// wgpu::BindGroupLayout.
|
// wgpu::BindGroupLayout.
|
||||||
class GPUBindGroupLayout final : public interop::GPUBindGroupLayout {
|
class GPUBindGroupLayout final : public interop::GPUBindGroupLayout {
|
||||||
public:
|
public:
|
||||||
GPUBindGroupLayout(wgpu::BindGroupLayout layout);
|
explicit GPUBindGroupLayout(wgpu::BindGroupLayout layout);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::BindGroupLayout&() const {
|
inline operator const wgpu::BindGroupLayout&() const {
|
||||||
|
|
|
@ -66,7 +66,8 @@ namespace wgpu::binding {
|
||||||
AsyncTask task;
|
AsyncTask task;
|
||||||
State& state;
|
State& state;
|
||||||
};
|
};
|
||||||
auto ctx = new Context{env, interop::Promise<void>(env, PROMISE_INFO), async_, state_};
|
auto ctx =
|
||||||
|
new Context{env, interop::Promise<void>(env, PROMISE_INFO), AsyncTask(async_), state_};
|
||||||
auto promise = ctx->promise;
|
auto promise = ctx->promise;
|
||||||
|
|
||||||
uint64_t s = size.has_value() ? size.value().value : (desc_.size - offset);
|
uint64_t s = size.has_value() ? size.value().value : (desc_.size - offset);
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
||||||
// wgpu::CommandBuffer.
|
// wgpu::CommandBuffer.
|
||||||
class GPUCommandBuffer final : public interop::GPUCommandBuffer {
|
class GPUCommandBuffer final : public interop::GPUCommandBuffer {
|
||||||
public:
|
public:
|
||||||
GPUCommandBuffer(wgpu::CommandBuffer cmd_buf);
|
explicit GPUCommandBuffer(wgpu::CommandBuffer cmd_buf);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::CommandBuffer&() const {
|
inline operator const wgpu::CommandBuffer&() const {
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
||||||
// wgpu::CommandEncoder.
|
// wgpu::CommandEncoder.
|
||||||
class GPUCommandEncoder final : public interop::GPUCommandEncoder {
|
class GPUCommandEncoder final : public interop::GPUCommandEncoder {
|
||||||
public:
|
public:
|
||||||
GPUCommandEncoder(wgpu::CommandEncoder enc);
|
explicit GPUCommandEncoder(wgpu::CommandEncoder enc);
|
||||||
|
|
||||||
// interop::GPUCommandEncoder interface compliance
|
// interop::GPUCommandEncoder interface compliance
|
||||||
interop::Interface<interop::GPURenderPassEncoder> beginRenderPass(
|
interop::Interface<interop::GPURenderPassEncoder> beginRenderPass(
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
||||||
// wgpu::ComputePassEncoder.
|
// wgpu::ComputePassEncoder.
|
||||||
class GPUComputePassEncoder final : public interop::GPUComputePassEncoder {
|
class GPUComputePassEncoder final : public interop::GPUComputePassEncoder {
|
||||||
public:
|
public:
|
||||||
GPUComputePassEncoder(wgpu::ComputePassEncoder enc);
|
explicit GPUComputePassEncoder(wgpu::ComputePassEncoder enc);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::ComputePassEncoder&() const {
|
inline operator const wgpu::ComputePassEncoder&() const {
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
||||||
// wgpu::ComputePipeline.
|
// wgpu::ComputePipeline.
|
||||||
class GPUComputePipeline final : public interop::GPUComputePipeline {
|
class GPUComputePipeline final : public interop::GPUComputePipeline {
|
||||||
public:
|
public:
|
||||||
GPUComputePipeline(wgpu::ComputePipeline pipeline);
|
explicit GPUComputePipeline(wgpu::ComputePipeline pipeline);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::ComputePipeline&() const {
|
inline operator const wgpu::ComputePipeline&() const {
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace wgpu::binding {
|
||||||
class OOMError : public interop::GPUOutOfMemoryError {};
|
class OOMError : public interop::GPUOutOfMemoryError {};
|
||||||
class ValidationError : public interop::GPUValidationError {
|
class ValidationError : public interop::GPUValidationError {
|
||||||
public:
|
public:
|
||||||
ValidationError(std::string message) : message_(std::move(message)) {
|
explicit ValidationError(std::string message) : message_(std::move(message)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getMessage(Napi::Env) override {
|
std::string getMessage(Napi::Env) override {
|
||||||
|
@ -316,7 +316,7 @@ namespace wgpu::binding {
|
||||||
Promise promise;
|
Promise promise;
|
||||||
AsyncTask task;
|
AsyncTask task;
|
||||||
};
|
};
|
||||||
auto ctx = new Context{env, Promise(env, PROMISE_INFO), async_};
|
auto ctx = new Context{env, Promise(env, PROMISE_INFO), AsyncTask(async_)};
|
||||||
auto promise = ctx->promise;
|
auto promise = ctx->promise;
|
||||||
|
|
||||||
device_.CreateComputePipelineAsync(
|
device_.CreateComputePipelineAsync(
|
||||||
|
@ -359,7 +359,7 @@ namespace wgpu::binding {
|
||||||
Promise promise;
|
Promise promise;
|
||||||
AsyncTask task;
|
AsyncTask task;
|
||||||
};
|
};
|
||||||
auto ctx = new Context{env, Promise(env, PROMISE_INFO), async_};
|
auto ctx = new Context{env, Promise(env, PROMISE_INFO), AsyncTask(async_)};
|
||||||
auto promise = ctx->promise;
|
auto promise = ctx->promise;
|
||||||
|
|
||||||
device_.CreateRenderPipelineAsync(
|
device_.CreateRenderPipelineAsync(
|
||||||
|
@ -453,7 +453,7 @@ namespace wgpu::binding {
|
||||||
Promise promise;
|
Promise promise;
|
||||||
AsyncTask task;
|
AsyncTask task;
|
||||||
};
|
};
|
||||||
auto* ctx = new Context{env, Promise(env, PROMISE_INFO), async_};
|
auto* ctx = new Context{env, Promise(env, PROMISE_INFO), AsyncTask(async_)};
|
||||||
auto promise = ctx->promise;
|
auto promise = ctx->promise;
|
||||||
|
|
||||||
device_.PopErrorScope(
|
device_.PopErrorScope(
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
||||||
// wgpu::PipelineLayout.
|
// wgpu::PipelineLayout.
|
||||||
class GPUPipelineLayout final : public interop::GPUPipelineLayout {
|
class GPUPipelineLayout final : public interop::GPUPipelineLayout {
|
||||||
public:
|
public:
|
||||||
GPUPipelineLayout(wgpu::PipelineLayout layout);
|
explicit GPUPipelineLayout(wgpu::PipelineLayout layout);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::PipelineLayout&() const {
|
inline operator const wgpu::PipelineLayout&() const {
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace wgpu::binding {
|
||||||
// GPUQuerySet is an implementation of interop::GPUQuerySet that wraps a wgpu::QuerySet.
|
// GPUQuerySet is an implementation of interop::GPUQuerySet that wraps a wgpu::QuerySet.
|
||||||
class GPUQuerySet final : public interop::GPUQuerySet {
|
class GPUQuerySet final : public interop::GPUQuerySet {
|
||||||
public:
|
public:
|
||||||
GPUQuerySet(wgpu::QuerySet query_set);
|
explicit GPUQuerySet(wgpu::QuerySet query_set);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::QuerySet&() const {
|
inline operator const wgpu::QuerySet&() const {
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace wgpu::binding {
|
||||||
interop::Promise<void> promise;
|
interop::Promise<void> promise;
|
||||||
AsyncTask task;
|
AsyncTask task;
|
||||||
};
|
};
|
||||||
auto ctx = new Context{env, interop::Promise<void>(env, PROMISE_INFO), async_};
|
auto ctx = new Context{env, interop::Promise<void>(env, PROMISE_INFO), AsyncTask(async_)};
|
||||||
auto promise = ctx->promise;
|
auto promise = ctx->promise;
|
||||||
|
|
||||||
queue_.OnSubmittedWorkDone(
|
queue_.OnSubmittedWorkDone(
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
||||||
// wgpu::RenderBundle.
|
// wgpu::RenderBundle.
|
||||||
class GPURenderBundle final : public interop::GPURenderBundle {
|
class GPURenderBundle final : public interop::GPURenderBundle {
|
||||||
public:
|
public:
|
||||||
GPURenderBundle(wgpu::RenderBundle bundle);
|
explicit GPURenderBundle(wgpu::RenderBundle bundle);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::RenderBundle&() const {
|
inline operator const wgpu::RenderBundle&() const {
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
||||||
// wgpu::RenderBundleEncoder.
|
// wgpu::RenderBundleEncoder.
|
||||||
class GPURenderBundleEncoder final : public interop::GPURenderBundleEncoder {
|
class GPURenderBundleEncoder final : public interop::GPURenderBundleEncoder {
|
||||||
public:
|
public:
|
||||||
GPURenderBundleEncoder(wgpu::RenderBundleEncoder enc);
|
explicit GPURenderBundleEncoder(wgpu::RenderBundleEncoder enc);
|
||||||
|
|
||||||
// interop::GPURenderBundleEncoder interface compliance
|
// interop::GPURenderBundleEncoder interface compliance
|
||||||
interop::Interface<interop::GPURenderBundle> finish(
|
interop::Interface<interop::GPURenderBundle> finish(
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
||||||
// wgpu::RenderPassEncoder.
|
// wgpu::RenderPassEncoder.
|
||||||
class GPURenderPassEncoder final : public interop::GPURenderPassEncoder {
|
class GPURenderPassEncoder final : public interop::GPURenderPassEncoder {
|
||||||
public:
|
public:
|
||||||
GPURenderPassEncoder(wgpu::RenderPassEncoder enc);
|
explicit GPURenderPassEncoder(wgpu::RenderPassEncoder enc);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::RenderPassEncoder&() const {
|
inline operator const wgpu::RenderPassEncoder&() const {
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
||||||
// wgpu::RenderPipeline.
|
// wgpu::RenderPipeline.
|
||||||
class GPURenderPipeline final : public interop::GPURenderPipeline {
|
class GPURenderPipeline final : public interop::GPURenderPipeline {
|
||||||
public:
|
public:
|
||||||
GPURenderPipeline(wgpu::RenderPipeline pipeline);
|
explicit GPURenderPipeline(wgpu::RenderPipeline pipeline);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::RenderPipeline&() const {
|
inline operator const wgpu::RenderPipeline&() const {
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace wgpu::binding {
|
||||||
// GPUSampler is an implementation of interop::GPUSampler that wraps a wgpu::Sampler.
|
// GPUSampler is an implementation of interop::GPUSampler that wraps a wgpu::Sampler.
|
||||||
class GPUSampler final : public interop::GPUSampler {
|
class GPUSampler final : public interop::GPUSampler {
|
||||||
public:
|
public:
|
||||||
GPUSampler(wgpu::Sampler sampler);
|
explicit GPUSampler(wgpu::Sampler sampler);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::Sampler&() const {
|
inline operator const wgpu::Sampler&() const {
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace wgpu::binding {
|
||||||
struct GPUCompilationMessage : public interop::GPUCompilationMessage {
|
struct GPUCompilationMessage : public interop::GPUCompilationMessage {
|
||||||
WGPUCompilationMessage message;
|
WGPUCompilationMessage message;
|
||||||
|
|
||||||
GPUCompilationMessage(const WGPUCompilationMessage& m) : message(m) {
|
explicit GPUCompilationMessage(const WGPUCompilationMessage& m) : message(m) {
|
||||||
}
|
}
|
||||||
std::string getMessage(Napi::Env) override {
|
std::string getMessage(Napi::Env) override {
|
||||||
return message.message;
|
return message.message;
|
||||||
|
@ -91,7 +91,7 @@ namespace wgpu::binding {
|
||||||
Promise promise;
|
Promise promise;
|
||||||
AsyncTask task;
|
AsyncTask task;
|
||||||
};
|
};
|
||||||
auto ctx = new Context{env, Promise(env, PROMISE_INFO), async_};
|
auto ctx = new Context{env, Promise(env, PROMISE_INFO), AsyncTask(async_)};
|
||||||
auto promise = ctx->promise;
|
auto promise = ctx->promise;
|
||||||
|
|
||||||
shader_.GetCompilationInfo(
|
shader_.GetCompilationInfo(
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace wgpu::binding {
|
||||||
// GPUSupportedLimits is an implementation of interop::GPUSupportedLimits.
|
// GPUSupportedLimits is an implementation of interop::GPUSupportedLimits.
|
||||||
class GPUSupportedLimits final : public interop::GPUSupportedLimits {
|
class GPUSupportedLimits final : public interop::GPUSupportedLimits {
|
||||||
public:
|
public:
|
||||||
GPUSupportedLimits(wgpu::SupportedLimits);
|
explicit GPUSupportedLimits(wgpu::SupportedLimits);
|
||||||
|
|
||||||
// interop::GPUSupportedLimits interface compliance
|
// interop::GPUSupportedLimits interface compliance
|
||||||
uint32_t getMaxTextureDimension1D(Napi::Env) override;
|
uint32_t getMaxTextureDimension1D(Napi::Env) override;
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace wgpu::binding {
|
||||||
// GPUTexture is an implementation of interop::GPUTexture that wraps a wgpu::Texture.
|
// GPUTexture is an implementation of interop::GPUTexture that wraps a wgpu::Texture.
|
||||||
class GPUTexture final : public interop::GPUTexture {
|
class GPUTexture final : public interop::GPUTexture {
|
||||||
public:
|
public:
|
||||||
GPUTexture(wgpu::Texture texture);
|
explicit GPUTexture(wgpu::Texture texture);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::Texture&() const {
|
inline operator const wgpu::Texture&() const {
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
||||||
// wgpu::TextureView.
|
// wgpu::TextureView.
|
||||||
class GPUTextureView final : public interop::GPUTextureView {
|
class GPUTextureView final : public interop::GPUTextureView {
|
||||||
public:
|
public:
|
||||||
GPUTextureView(wgpu::TextureView view);
|
explicit GPUTextureView(wgpu::TextureView view);
|
||||||
|
|
||||||
// Implicit cast operator to Dawn GPU object
|
// Implicit cast operator to Dawn GPU object
|
||||||
inline operator const wgpu::TextureView&() const {
|
inline operator const wgpu::TextureView&() const {
|
||||||
|
|
|
@ -78,6 +78,7 @@ namespace wgpu::interop {
|
||||||
using IntegerType = T;
|
using IntegerType = T;
|
||||||
ClampedInteger() : value(0) {
|
ClampedInteger() : value(0) {
|
||||||
}
|
}
|
||||||
|
// NOLINTNEXTLINE(runtime/explicit)
|
||||||
ClampedInteger(T value) : value(value) {
|
ClampedInteger(T value) : value(value) {
|
||||||
}
|
}
|
||||||
operator T() const {
|
operator T() const {
|
||||||
|
@ -95,6 +96,7 @@ namespace wgpu::interop {
|
||||||
using IntegerType = T;
|
using IntegerType = T;
|
||||||
EnforceRangeInteger() : value(0) {
|
EnforceRangeInteger() : value(0) {
|
||||||
}
|
}
|
||||||
|
// NOLINTNEXTLINE(runtime/explicit)
|
||||||
EnforceRangeInteger(T value) : value(value) {
|
EnforceRangeInteger(T value) : value(value) {
|
||||||
}
|
}
|
||||||
operator T() const {
|
operator T() const {
|
||||||
|
|
Loading…
Reference in New Issue