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 #include "src/dawn_node/binding/GPUSupportedLimits.h" 16 17 namespace wgpu { namespace binding { 18 19 //////////////////////////////////////////////////////////////////////////////// 20 // wgpu::bindings::GPUSupportedLimits 21 //////////////////////////////////////////////////////////////////////////////// 22 GPUSupportedLimits(wgpu::SupportedLimits limits)23 GPUSupportedLimits::GPUSupportedLimits(wgpu::SupportedLimits limits) 24 : limits_(std::move(limits)) { 25 } 26 getMaxTextureDimension1D(Napi::Env)27 uint32_t GPUSupportedLimits::getMaxTextureDimension1D(Napi::Env) { 28 return limits_.limits.maxTextureDimension1D; 29 } 30 getMaxTextureDimension2D(Napi::Env)31 uint32_t GPUSupportedLimits::getMaxTextureDimension2D(Napi::Env) { 32 return limits_.limits.maxTextureDimension2D; 33 } 34 getMaxTextureDimension3D(Napi::Env)35 uint32_t GPUSupportedLimits::getMaxTextureDimension3D(Napi::Env) { 36 return limits_.limits.maxTextureDimension3D; 37 } 38 getMaxTextureArrayLayers(Napi::Env)39 uint32_t GPUSupportedLimits::getMaxTextureArrayLayers(Napi::Env) { 40 return limits_.limits.maxTextureArrayLayers; 41 } 42 getMaxBindGroups(Napi::Env)43 uint32_t GPUSupportedLimits::getMaxBindGroups(Napi::Env) { 44 return limits_.limits.maxBindGroups; 45 } 46 getMaxDynamicUniformBuffersPerPipelineLayout(Napi::Env)47 uint32_t GPUSupportedLimits::getMaxDynamicUniformBuffersPerPipelineLayout(Napi::Env) { 48 return limits_.limits.maxDynamicUniformBuffersPerPipelineLayout; 49 } 50 getMaxDynamicStorageBuffersPerPipelineLayout(Napi::Env)51 uint32_t GPUSupportedLimits::getMaxDynamicStorageBuffersPerPipelineLayout(Napi::Env) { 52 return limits_.limits.maxDynamicStorageBuffersPerPipelineLayout; 53 } 54 getMaxSampledTexturesPerShaderStage(Napi::Env)55 uint32_t GPUSupportedLimits::getMaxSampledTexturesPerShaderStage(Napi::Env) { 56 return limits_.limits.maxSampledTexturesPerShaderStage; 57 } 58 getMaxSamplersPerShaderStage(Napi::Env)59 uint32_t GPUSupportedLimits::getMaxSamplersPerShaderStage(Napi::Env) { 60 return limits_.limits.maxSamplersPerShaderStage; 61 } 62 getMaxStorageBuffersPerShaderStage(Napi::Env)63 uint32_t GPUSupportedLimits::getMaxStorageBuffersPerShaderStage(Napi::Env) { 64 return limits_.limits.maxStorageBuffersPerShaderStage; 65 } 66 getMaxStorageTexturesPerShaderStage(Napi::Env)67 uint32_t GPUSupportedLimits::getMaxStorageTexturesPerShaderStage(Napi::Env) { 68 return limits_.limits.maxStorageTexturesPerShaderStage; 69 } 70 getMaxUniformBuffersPerShaderStage(Napi::Env)71 uint32_t GPUSupportedLimits::getMaxUniformBuffersPerShaderStage(Napi::Env) { 72 return limits_.limits.maxUniformBuffersPerShaderStage; 73 } 74 getMaxUniformBufferBindingSize(Napi::Env)75 uint64_t GPUSupportedLimits::getMaxUniformBufferBindingSize(Napi::Env) { 76 return limits_.limits.maxUniformBufferBindingSize; 77 } 78 getMaxStorageBufferBindingSize(Napi::Env)79 uint64_t GPUSupportedLimits::getMaxStorageBufferBindingSize(Napi::Env) { 80 return limits_.limits.maxStorageBufferBindingSize; 81 } 82 getMinUniformBufferOffsetAlignment(Napi::Env)83 uint32_t GPUSupportedLimits::getMinUniformBufferOffsetAlignment(Napi::Env) { 84 return limits_.limits.minUniformBufferOffsetAlignment; 85 } 86 getMinStorageBufferOffsetAlignment(Napi::Env)87 uint32_t GPUSupportedLimits::getMinStorageBufferOffsetAlignment(Napi::Env) { 88 return limits_.limits.minStorageBufferOffsetAlignment; 89 } 90 getMaxVertexBuffers(Napi::Env)91 uint32_t GPUSupportedLimits::getMaxVertexBuffers(Napi::Env) { 92 return limits_.limits.maxVertexBuffers; 93 } 94 getMaxVertexAttributes(Napi::Env)95 uint32_t GPUSupportedLimits::getMaxVertexAttributes(Napi::Env) { 96 return limits_.limits.maxVertexAttributes; 97 } 98 getMaxVertexBufferArrayStride(Napi::Env)99 uint32_t GPUSupportedLimits::getMaxVertexBufferArrayStride(Napi::Env) { 100 return limits_.limits.maxVertexBufferArrayStride; 101 } 102 getMaxInterStageShaderComponents(Napi::Env)103 uint32_t GPUSupportedLimits::getMaxInterStageShaderComponents(Napi::Env) { 104 return limits_.limits.maxInterStageShaderComponents; 105 } 106 getMaxComputeWorkgroupStorageSize(Napi::Env)107 uint32_t GPUSupportedLimits::getMaxComputeWorkgroupStorageSize(Napi::Env) { 108 return limits_.limits.maxComputeWorkgroupStorageSize; 109 } 110 getMaxComputeInvocationsPerWorkgroup(Napi::Env)111 uint32_t GPUSupportedLimits::getMaxComputeInvocationsPerWorkgroup(Napi::Env) { 112 return limits_.limits.maxComputeInvocationsPerWorkgroup; 113 } 114 getMaxComputeWorkgroupSizeX(Napi::Env)115 uint32_t GPUSupportedLimits::getMaxComputeWorkgroupSizeX(Napi::Env) { 116 return limits_.limits.maxComputeWorkgroupSizeX; 117 } 118 getMaxComputeWorkgroupSizeY(Napi::Env)119 uint32_t GPUSupportedLimits::getMaxComputeWorkgroupSizeY(Napi::Env) { 120 return limits_.limits.maxComputeWorkgroupSizeY; 121 } 122 getMaxComputeWorkgroupSizeZ(Napi::Env)123 uint32_t GPUSupportedLimits::getMaxComputeWorkgroupSizeZ(Napi::Env) { 124 return limits_.limits.maxComputeWorkgroupSizeZ; 125 } 126 getMaxComputeWorkgroupsPerDimension(Napi::Env)127 uint32_t GPUSupportedLimits::getMaxComputeWorkgroupsPerDimension(Napi::Env) { 128 return limits_.limits.maxComputeWorkgroupsPerDimension; 129 } 130 131 }} // namespace wgpu::binding 132