Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
gpu_capabilities.hpp
Go to the documentation of this file.
1#pragma once
2
11
12#include <cstdint>
13#include <string_view>
14#include <vector>
15
16namespace pulp::render {
17
43
45const std::vector<GpuFormat>& all_gpu_formats();
46
49
53
56
62 bool float32_filterable = false;
64 bool float32_blendable = false;
66 bool bgra8_unorm_storage = false;
68 bool timestamp_query = false;
70 bool shader_f16 = false;
71};
72
77 bool renderable = false;
79 bool blendable = false;
81 bool multisample = false;
83 bool storage = false;
85 bool filterable = false;
86};
87
90
92enum class GpuAdapterKind : std::uint8_t { unknown, integrated, discrete, cpu };
93
107
111 std::uint32_t max_texture_dimension_1d = 0;
112 std::uint32_t max_texture_dimension_3d = 0;
113 std::uint32_t max_texture_array_layers = 0;
114 std::uint32_t max_bind_groups = 0;
122 std::uint32_t max_vertex_buffers = 0;
123 std::uint32_t max_vertex_attributes = 0;
132 std::vector<GpuFormatSupport> formats;
133
137 std::vector<GpuFormat> renderable_color_formats() const;
139 std::vector<GpuFormat> storage_formats() const;
141 std::vector<std::uint32_t> sample_counts(GpuFormat format) const;
142};
143
146
157enum class GpuRenderTier : std::uint8_t { none, basic, standard, high };
158
159std::string_view gpu_render_tier_name(GpuRenderTier tier);
160
163
164} // namespace pulp::render
What the product grants a device: the quota table indexed by capability tier and live thermal state.
Definition aax_editor.hpp:31
Definition gpu_fwd.hpp:31
std::string_view gpu_format_name(GpuFormat format)
WebGPU spelling of a format ("rgba8unorm"), or "undefined".
bool gpu_format_is_depth(GpuFormat format)
True for depth and depth/stencil formats.
GpuRenderTier
Coarse rendering tier for choosing a visual path.
Definition gpu_capabilities.hpp:157
@ none
Definition gpu_capabilities.hpp:157
@ high
Definition gpu_capabilities.hpp:157
@ standard
Definition gpu_capabilities.hpp:157
@ basic
Definition gpu_capabilities.hpp:157
std::uint32_t gpu_format_bytes_per_pixel(GpuFormat format)
Bytes per texel for color formats, 0 for depth/stencil and undefined (depth texels have no defined CP...
const std::vector< GpuFormat > & all_gpu_formats()
Every format above except undefined, in declaration order.
std::string_view gpu_render_tier_name(GpuRenderTier tier)
GpuRenderTier pick_tier(const GpuDeviceFacts &facts)
Pure: the same facts always give the same tier.
void fill_format_table(GpuDeviceCapabilities &caps)
Fill the format table of caps from caps.facts.features. Pure.
GpuAdapterKind
Adapter class as Dawn reports it.
Definition gpu_capabilities.hpp:92
@ discrete
Definition gpu_capabilities.hpp:92
@ unknown
Definition gpu_capabilities.hpp:92
@ cpu
Definition gpu_capabilities.hpp:92
@ integrated
Definition gpu_capabilities.hpp:92
GpuFormatSupport gpu_format_support(GpuFormat format, const GpuDeviceFeatures &features)
The WebGPU format table for format, adjusted for features. Pure.
GpuFormat
Texture formats the typed GPU API accepts.
Definition gpu_capabilities.hpp:20
@ rg11b10_ufloat
Definition gpu_capabilities.hpp:29
@ bgra8_unorm
Definition gpu_capabilities.hpp:26
@ r8_unorm
Definition gpu_capabilities.hpp:22
@ rg32_float
Definition gpu_capabilities.hpp:34
@ depth32_float
Definition gpu_capabilities.hpp:41
@ rgba32_float
Definition gpu_capabilities.hpp:35
@ r32_uint
Definition gpu_capabilities.hpp:36
@ depth16_unorm
Definition gpu_capabilities.hpp:38
@ rg8_unorm
Definition gpu_capabilities.hpp:23
@ rgba16_float
Definition gpu_capabilities.hpp:32
@ undefined
Definition gpu_capabilities.hpp:21
@ depth24_plus_stencil8
Definition gpu_capabilities.hpp:40
@ bgra8_unorm_srgb
Definition gpu_capabilities.hpp:27
@ r32_float
Definition gpu_capabilities.hpp:33
@ rgb10a2_unorm
Definition gpu_capabilities.hpp:28
@ depth24_plus
Definition gpu_capabilities.hpp:39
@ rgba8_unorm
Definition gpu_capabilities.hpp:24
@ rgba8_unorm_srgb
Definition gpu_capabilities.hpp:25
@ rg16_float
Definition gpu_capabilities.hpp:31
@ r16_float
Definition gpu_capabilities.hpp:30
@ rgba8_uint
Definition gpu_capabilities.hpp:37
Rendering capabilities of the shared device.
Definition gpu_capabilities.hpp:109
std::vector< GpuFormat > storage_formats() const
Formats usable as write-only storage textures.
std::uint32_t max_storage_buffers_per_shader_stage
Definition gpu_capabilities.hpp:119
GpuDeviceFacts facts
Definition gpu_capabilities.hpp:110
std::uint32_t max_bind_groups
Definition gpu_capabilities.hpp:114
std::vector< std::uint32_t > sample_counts(GpuFormat format) const
Sample counts a render target of format may use: {1} or {1, 4}.
std::uint32_t max_compute_workgroups_per_dimension
Definition gpu_capabilities.hpp:128
std::uint32_t min_storage_buffer_offset_alignment
Definition gpu_capabilities.hpp:130
std::uint32_t max_bindings_per_bind_group
Definition gpu_capabilities.hpp:115
std::uint32_t max_texture_dimension_1d
Definition gpu_capabilities.hpp:111
std::uint32_t max_samplers_per_shader_stage
Definition gpu_capabilities.hpp:117
std::uint32_t min_uniform_buffer_offset_alignment
Definition gpu_capabilities.hpp:129
std::uint32_t max_uniform_buffers_per_shader_stage
Definition gpu_capabilities.hpp:118
std::uint32_t max_vertex_buffers
Definition gpu_capabilities.hpp:122
std::uint32_t max_compute_workgroup_size_x
Definition gpu_capabilities.hpp:125
std::vector< GpuFormatSupport > formats
One entry per all_gpu_formats() entry, same order.
Definition gpu_capabilities.hpp:132
std::uint64_t max_storage_buffer_binding_size
Definition gpu_capabilities.hpp:121
std::uint32_t max_compute_workgroup_size_y
Definition gpu_capabilities.hpp:126
std::uint64_t max_uniform_buffer_binding_size
Definition gpu_capabilities.hpp:120
std::uint32_t max_sampled_textures_per_shader_stage
Definition gpu_capabilities.hpp:116
std::vector< GpuFormat > renderable_color_formats() const
Formats usable as color attachments (depth formats excluded).
GpuFormatSupport support(GpuFormat format) const
Support for one format; an all-false record for an unknown format.
std::uint32_t max_vertex_attributes
Definition gpu_capabilities.hpp:123
std::uint32_t max_color_attachment_bytes_per_sample
Definition gpu_capabilities.hpp:124
std::uint32_t max_texture_dimension_3d
Definition gpu_capabilities.hpp:112
std::uint32_t max_compute_workgroup_size_z
Definition gpu_capabilities.hpp:127
std::uint32_t max_texture_array_layers
Definition gpu_capabilities.hpp:113
The facts pick_tier() reads. A test can build one by hand.
Definition gpu_capabilities.hpp:95
std::uint32_t max_texture_dimension_2d
Definition gpu_capabilities.hpp:100
GpuAdapterKind adapter
Definition gpu_capabilities.hpp:99
std::uint32_t max_storage_textures_per_shader_stage
Definition gpu_capabilities.hpp:102
bool available
Definition gpu_capabilities.hpp:96
std::uint32_t max_color_attachments
Definition gpu_capabilities.hpp:101
std::uint64_t max_buffer_size
Definition gpu_capabilities.hpp:104
GpuDeviceFeatures features
Definition gpu_capabilities.hpp:105
bool null_backend
Dawn's Null backend: validates API calls, draws nothing.
Definition gpu_capabilities.hpp:98
std::uint32_t max_compute_invocations_per_workgroup
Definition gpu_capabilities.hpp:103
Optional device features that change what a format can do.
Definition gpu_capabilities.hpp:58
bool rg11b10_ufloat_renderable
rg11b10ufloat-renderable
Definition gpu_capabilities.hpp:60
bool float32_blendable
float32-blendable
Definition gpu_capabilities.hpp:64
bool float32_filterable
float32-filterable
Definition gpu_capabilities.hpp:62
bool shader_f16
shader-f16
Definition gpu_capabilities.hpp:70
bool bgra8_unorm_storage
bgra8unorm-storage
Definition gpu_capabilities.hpp:66
bool timestamp_query
timestamp-query
Definition gpu_capabilities.hpp:68
What one format supports on a device.
Definition gpu_capabilities.hpp:74
GpuFormat format
Definition gpu_capabilities.hpp:75
bool blendable
Blending is allowed when it is a color attachment.
Definition gpu_capabilities.hpp:79
bool renderable
Usable as a render-pass color (or depth) attachment.
Definition gpu_capabilities.hpp:77
bool filterable
Sampled with a filtering sampler.
Definition gpu_capabilities.hpp:85
bool multisample
4x multisampling is allowed. WebGPU guarantees exactly 1 and 4.
Definition gpu_capabilities.hpp:81
bool storage
Usable as a write-only storage texture.
Definition gpu_capabilities.hpp:83