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.
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace wgpu::binding {
|
|||
// automatically freed when the Converter is destructed.
|
||||
class Converter {
|
||||
public:
|
||||
Converter(Napi::Env e) : env(e) {
|
||||
explicit Converter(Napi::Env e) : env(e) {
|
||||
}
|
||||
~Converter();
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace wgpu::binding {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
class Features : public interop::GPUSupportedFeatures {
|
||||
public:
|
||||
Features(WGPUDeviceProperties properties) {
|
||||
explicit Features(WGPUDeviceProperties properties) {
|
||||
if (properties.depth24UnormStencil8) {
|
||||
enabled_.emplace(interop::GPUFeatureName::kDepth24UnormStencil8);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace wgpu::binding {
|
|||
// GPUBindGroup is an implementation of interop::GPUBindGroup that wraps a wgpu::BindGroup.
|
||||
class GPUBindGroup final : public interop::GPUBindGroup {
|
||||
public:
|
||||
GPUBindGroup(wgpu::BindGroup group);
|
||||
explicit GPUBindGroup(wgpu::BindGroup group);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
inline operator const wgpu::BindGroup&() const {
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
|||
// wgpu::BindGroupLayout.
|
||||
class GPUBindGroupLayout final : public interop::GPUBindGroupLayout {
|
||||
public:
|
||||
GPUBindGroupLayout(wgpu::BindGroupLayout layout);
|
||||
explicit GPUBindGroupLayout(wgpu::BindGroupLayout layout);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
inline operator const wgpu::BindGroupLayout&() const {
|
||||
|
|
|
@ -66,7 +66,8 @@ namespace wgpu::binding {
|
|||
AsyncTask task;
|
||||
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;
|
||||
|
||||
uint64_t s = size.has_value() ? size.value().value : (desc_.size - offset);
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
|||
// wgpu::CommandBuffer.
|
||||
class GPUCommandBuffer final : public interop::GPUCommandBuffer {
|
||||
public:
|
||||
GPUCommandBuffer(wgpu::CommandBuffer cmd_buf);
|
||||
explicit GPUCommandBuffer(wgpu::CommandBuffer cmd_buf);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
inline operator const wgpu::CommandBuffer&() const {
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
|||
// wgpu::CommandEncoder.
|
||||
class GPUCommandEncoder final : public interop::GPUCommandEncoder {
|
||||
public:
|
||||
GPUCommandEncoder(wgpu::CommandEncoder enc);
|
||||
explicit GPUCommandEncoder(wgpu::CommandEncoder enc);
|
||||
|
||||
// interop::GPUCommandEncoder interface compliance
|
||||
interop::Interface<interop::GPURenderPassEncoder> beginRenderPass(
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
|||
// wgpu::ComputePassEncoder.
|
||||
class GPUComputePassEncoder final : public interop::GPUComputePassEncoder {
|
||||
public:
|
||||
GPUComputePassEncoder(wgpu::ComputePassEncoder enc);
|
||||
explicit GPUComputePassEncoder(wgpu::ComputePassEncoder enc);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
inline operator const wgpu::ComputePassEncoder&() const {
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
|||
// wgpu::ComputePipeline.
|
||||
class GPUComputePipeline final : public interop::GPUComputePipeline {
|
||||
public:
|
||||
GPUComputePipeline(wgpu::ComputePipeline pipeline);
|
||||
explicit GPUComputePipeline(wgpu::ComputePipeline pipeline);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
inline operator const wgpu::ComputePipeline&() const {
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace wgpu::binding {
|
|||
class OOMError : public interop::GPUOutOfMemoryError {};
|
||||
class ValidationError : public interop::GPUValidationError {
|
||||
public:
|
||||
ValidationError(std::string message) : message_(std::move(message)) {
|
||||
explicit ValidationError(std::string message) : message_(std::move(message)) {
|
||||
}
|
||||
|
||||
std::string getMessage(Napi::Env) override {
|
||||
|
@ -316,7 +316,7 @@ namespace wgpu::binding {
|
|||
Promise promise;
|
||||
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;
|
||||
|
||||
device_.CreateComputePipelineAsync(
|
||||
|
@ -359,7 +359,7 @@ namespace wgpu::binding {
|
|||
Promise promise;
|
||||
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;
|
||||
|
||||
device_.CreateRenderPipelineAsync(
|
||||
|
@ -453,7 +453,7 @@ namespace wgpu::binding {
|
|||
Promise promise;
|
||||
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;
|
||||
|
||||
device_.PopErrorScope(
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
|||
// wgpu::PipelineLayout.
|
||||
class GPUPipelineLayout final : public interop::GPUPipelineLayout {
|
||||
public:
|
||||
GPUPipelineLayout(wgpu::PipelineLayout layout);
|
||||
explicit GPUPipelineLayout(wgpu::PipelineLayout layout);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
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.
|
||||
class GPUQuerySet final : public interop::GPUQuerySet {
|
||||
public:
|
||||
GPUQuerySet(wgpu::QuerySet query_set);
|
||||
explicit GPUQuerySet(wgpu::QuerySet query_set);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
inline operator const wgpu::QuerySet&() const {
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace wgpu::binding {
|
|||
interop::Promise<void> promise;
|
||||
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;
|
||||
|
||||
queue_.OnSubmittedWorkDone(
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
|||
// wgpu::RenderBundle.
|
||||
class GPURenderBundle final : public interop::GPURenderBundle {
|
||||
public:
|
||||
GPURenderBundle(wgpu::RenderBundle bundle);
|
||||
explicit GPURenderBundle(wgpu::RenderBundle bundle);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
inline operator const wgpu::RenderBundle&() const {
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
|||
// wgpu::RenderBundleEncoder.
|
||||
class GPURenderBundleEncoder final : public interop::GPURenderBundleEncoder {
|
||||
public:
|
||||
GPURenderBundleEncoder(wgpu::RenderBundleEncoder enc);
|
||||
explicit GPURenderBundleEncoder(wgpu::RenderBundleEncoder enc);
|
||||
|
||||
// interop::GPURenderBundleEncoder interface compliance
|
||||
interop::Interface<interop::GPURenderBundle> finish(
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
|||
// wgpu::RenderPassEncoder.
|
||||
class GPURenderPassEncoder final : public interop::GPURenderPassEncoder {
|
||||
public:
|
||||
GPURenderPassEncoder(wgpu::RenderPassEncoder enc);
|
||||
explicit GPURenderPassEncoder(wgpu::RenderPassEncoder enc);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
inline operator const wgpu::RenderPassEncoder&() const {
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
|||
// wgpu::RenderPipeline.
|
||||
class GPURenderPipeline final : public interop::GPURenderPipeline {
|
||||
public:
|
||||
GPURenderPipeline(wgpu::RenderPipeline pipeline);
|
||||
explicit GPURenderPipeline(wgpu::RenderPipeline pipeline);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
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.
|
||||
class GPUSampler final : public interop::GPUSampler {
|
||||
public:
|
||||
GPUSampler(wgpu::Sampler sampler);
|
||||
explicit GPUSampler(wgpu::Sampler sampler);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
inline operator const wgpu::Sampler&() const {
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace wgpu::binding {
|
|||
struct GPUCompilationMessage : public interop::GPUCompilationMessage {
|
||||
WGPUCompilationMessage message;
|
||||
|
||||
GPUCompilationMessage(const WGPUCompilationMessage& m) : message(m) {
|
||||
explicit GPUCompilationMessage(const WGPUCompilationMessage& m) : message(m) {
|
||||
}
|
||||
std::string getMessage(Napi::Env) override {
|
||||
return message.message;
|
||||
|
@ -91,7 +91,7 @@ namespace wgpu::binding {
|
|||
Promise promise;
|
||||
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;
|
||||
|
||||
shader_.GetCompilationInfo(
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace wgpu::binding {
|
|||
// GPUSupportedLimits is an implementation of interop::GPUSupportedLimits.
|
||||
class GPUSupportedLimits final : public interop::GPUSupportedLimits {
|
||||
public:
|
||||
GPUSupportedLimits(wgpu::SupportedLimits);
|
||||
explicit GPUSupportedLimits(wgpu::SupportedLimits);
|
||||
|
||||
// interop::GPUSupportedLimits interface compliance
|
||||
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.
|
||||
class GPUTexture final : public interop::GPUTexture {
|
||||
public:
|
||||
GPUTexture(wgpu::Texture texture);
|
||||
explicit GPUTexture(wgpu::Texture texture);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
inline operator const wgpu::Texture&() const {
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace wgpu::binding {
|
|||
// wgpu::TextureView.
|
||||
class GPUTextureView final : public interop::GPUTextureView {
|
||||
public:
|
||||
GPUTextureView(wgpu::TextureView view);
|
||||
explicit GPUTextureView(wgpu::TextureView view);
|
||||
|
||||
// Implicit cast operator to Dawn GPU object
|
||||
inline operator const wgpu::TextureView&() const {
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace wgpu::interop {
|
|||
using IntegerType = T;
|
||||
ClampedInteger() : value(0) {
|
||||
}
|
||||
// NOLINTNEXTLINE(runtime/explicit)
|
||||
ClampedInteger(T value) : value(value) {
|
||||
}
|
||||
operator T() const {
|
||||
|
@ -95,6 +96,7 @@ namespace wgpu::interop {
|
|||
using IntegerType = T;
|
||||
EnforceRangeInteger() : value(0) {
|
||||
}
|
||||
// NOLINTNEXTLINE(runtime/explicit)
|
||||
EnforceRangeInteger(T value) : value(value) {
|
||||
}
|
||||
operator T() const {
|
||||
|
|
Loading…
Reference in New Issue