summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/SupportedLimits.cpp
blob: ea37dec206639713bb356a3f1af4567edf3ee1f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "SupportedLimits.h"
#include "Adapter.h"
#include "mozilla/dom/WebGPUBinding.h"
#include "mozilla/webgpu/ffi/wgpu.h"

namespace mozilla::webgpu {

GPU_IMPL_CYCLE_COLLECTION(SupportedLimits, mParent)
GPU_IMPL_JS_WRAP(SupportedLimits)

SupportedLimits::SupportedLimits(Adapter* const aParent,
                                 UniquePtr<ffi::WGPULimits>&& aLimits)
    : ChildOf(aParent), mLimits(std::move(aLimits)) {}

SupportedLimits::~SupportedLimits() = default;

uint32_t SupportedLimits::MaxTextureDimension1D() const {
  return mLimits->max_texture_dimension_1d;
}
uint32_t SupportedLimits::MaxTextureDimension2D() const {
  return mLimits->max_texture_dimension_2d;
}
uint32_t SupportedLimits::MaxTextureDimension3D() const {
  return mLimits->max_texture_dimension_3d;
}
uint32_t SupportedLimits::MaxTextureArrayLayers() const {
  return mLimits->max_texture_array_layers;
}
uint32_t SupportedLimits::MaxBindGroups() const {
  return mLimits->max_bind_groups;
}
uint32_t SupportedLimits::MaxDynamicUniformBuffersPerPipelineLayout() const {
  return mLimits->max_dynamic_uniform_buffers_per_pipeline_layout;
}
uint32_t SupportedLimits::MaxDynamicStorageBuffersPerPipelineLayout() const {
  return mLimits->max_dynamic_storage_buffers_per_pipeline_layout;
}
uint32_t SupportedLimits::MaxSampledTexturesPerShaderStage() const {
  return mLimits->max_sampled_textures_per_shader_stage;
}
uint32_t SupportedLimits::MaxSamplersPerShaderStage() const {
  return mLimits->max_samplers_per_shader_stage;
}
uint32_t SupportedLimits::MaxStorageBuffersPerShaderStage() const {
  return mLimits->max_storage_buffers_per_shader_stage;
}
uint32_t SupportedLimits::MaxStorageTexturesPerShaderStage() const {
  return mLimits->max_storage_textures_per_shader_stage;
}
uint32_t SupportedLimits::MaxUniformBuffersPerShaderStage() const {
  return mLimits->max_uniform_buffers_per_shader_stage;
}
uint32_t SupportedLimits::MaxUniformBufferBindingSize() const {
  return mLimits->max_uniform_buffer_binding_size;
}
uint32_t SupportedLimits::MaxStorageBufferBindingSize() const {
  return mLimits->max_storage_buffer_binding_size;
}
uint32_t SupportedLimits::MinUniformBufferOffsetAlignment() const {
  return mLimits->min_uniform_buffer_offset_alignment;
}
uint32_t SupportedLimits::MinStorageBufferOffsetAlignment() const {
  return mLimits->min_storage_buffer_offset_alignment;
}
uint32_t SupportedLimits::MaxVertexBuffers() const {
  return mLimits->max_vertex_buffers;
}
uint32_t SupportedLimits::MaxVertexAttributes() const {
  return mLimits->max_vertex_attributes;
}
uint32_t SupportedLimits::MaxVertexBufferArrayStride() const {
  return mLimits->max_vertex_buffer_array_stride;
}
uint32_t SupportedLimits::MaxInterStageShaderComponents() const {
  return mLimits->max_inter_stage_shader_components;
}
uint32_t SupportedLimits::MaxComputeWorkgroupStorageSize() const {
  return mLimits->max_compute_workgroup_storage_size;
}
uint32_t SupportedLimits::MaxComputeInvocationsPerWorkgroup() const {
  return mLimits->max_compute_invocations_per_workgroup;
}
uint32_t SupportedLimits::MaxComputeWorkgroupSizeX() const {
  return mLimits->max_compute_workgroup_size_x;
}
uint32_t SupportedLimits::MaxComputeWorkgroupSizeY() const {
  return mLimits->max_compute_workgroup_size_y;
}
uint32_t SupportedLimits::MaxComputeWorkgroupSizeZ() const {
  return mLimits->max_compute_workgroup_size_z;
}
uint32_t SupportedLimits::MaxComputeWorkgroupsPerDimension() const {
  return mLimits->max_compute_workgroups_per_dimension;
}

}  // namespace mozilla::webgpu