1 // Copyright 2021 The Dawn Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef DAWN_NODE_BINDING_GPUSUPPORTEDLIMITS_H_ 16 #define DAWN_NODE_BINDING_GPUSUPPORTEDLIMITS_H_ 17 18 #include "dawn/webgpu_cpp.h" 19 #include "dawn_native/DawnNative.h" 20 #include "napi.h" 21 #include "src/dawn_node/interop/WebGPU.h" 22 23 namespace wgpu { namespace binding { 24 25 // GPUSupportedLimits is an implementation of interop::GPUSupportedLimits. 26 class GPUSupportedLimits final : public interop::GPUSupportedLimits { 27 public: 28 GPUSupportedLimits(wgpu::SupportedLimits); 29 30 // interop::GPUSupportedLimits interface compliance 31 uint32_t getMaxTextureDimension1D(Napi::Env) override; 32 uint32_t getMaxTextureDimension2D(Napi::Env) override; 33 uint32_t getMaxTextureDimension3D(Napi::Env) override; 34 uint32_t getMaxTextureArrayLayers(Napi::Env) override; 35 uint32_t getMaxBindGroups(Napi::Env) override; 36 uint32_t getMaxDynamicUniformBuffersPerPipelineLayout(Napi::Env) override; 37 uint32_t getMaxDynamicStorageBuffersPerPipelineLayout(Napi::Env) override; 38 uint32_t getMaxSampledTexturesPerShaderStage(Napi::Env) override; 39 uint32_t getMaxSamplersPerShaderStage(Napi::Env) override; 40 uint32_t getMaxStorageBuffersPerShaderStage(Napi::Env) override; 41 uint32_t getMaxStorageTexturesPerShaderStage(Napi::Env) override; 42 uint32_t getMaxUniformBuffersPerShaderStage(Napi::Env) override; 43 uint64_t getMaxUniformBufferBindingSize(Napi::Env) override; 44 uint64_t getMaxStorageBufferBindingSize(Napi::Env) override; 45 uint32_t getMinUniformBufferOffsetAlignment(Napi::Env) override; 46 uint32_t getMinStorageBufferOffsetAlignment(Napi::Env) override; 47 uint32_t getMaxVertexBuffers(Napi::Env) override; 48 uint32_t getMaxVertexAttributes(Napi::Env) override; 49 uint32_t getMaxVertexBufferArrayStride(Napi::Env) override; 50 uint32_t getMaxInterStageShaderComponents(Napi::Env) override; 51 uint32_t getMaxComputeWorkgroupStorageSize(Napi::Env) override; 52 uint32_t getMaxComputeInvocationsPerWorkgroup(Napi::Env) override; 53 uint32_t getMaxComputeWorkgroupSizeX(Napi::Env) override; 54 uint32_t getMaxComputeWorkgroupSizeY(Napi::Env) override; 55 uint32_t getMaxComputeWorkgroupSizeZ(Napi::Env) override; 56 uint32_t getMaxComputeWorkgroupsPerDimension(Napi::Env) override; 57 58 private: 59 wgpu::SupportedLimits limits_; 60 }; 61 62 }} // namespace wgpu::binding 63 64 #endif // DAWN_NODE_BINDING_GPUSUPPORTEDLIMITS_H_ 65