Blender V5.0
mtl_capabilities.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11namespace blender::gpu {
12
13/*** Derived from: https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf ***/
15
16#define MTL_MAX_TEXTURE_SLOTS 128
17#define MTL_MAX_SAMPLER_SLOTS MTL_MAX_TEXTURE_SLOTS
18/* Max limit without using bind-less for samplers. */
19#define MTL_MAX_DEFAULT_SAMPLERS 16
20/* Total maximum buffers which can be bound to an encoder, for use within a shader.
21 * Uniform buffers and storage buffers share the set of available bind buffers.
22 * The total number of buffer bindings must be <= MTL_MAX_BUFFER_BINDINGS
23 * We also require an additional 2 core buffers for:
24 * - Argument buffer for bindless resources (e.g. samplers)
25 * - Default push constant block
26 * Along with up to 6+1 buffers for vertex data, and index data. */
27#define MTL_MAX_BUFFER_BINDINGS 31
28#define MTL_MAX_VERTEX_INPUT_ATTRIBUTES 31
29#define MTL_MAX_UNIFORMS_PER_BLOCK 64
30
32
33/* Context-specific limits -- populated in 'MTLBackend::platform_init' */
35
36 /* Variable Limits & feature sets. */
37 int max_color_render_targets = 4; /* Minimum = 4 */
38 int buffer_alignment_for_textures = 256; /* Upper bound = 256 bytes */
39 int minimum_buffer_offset_alignment = 256; /* Upper bound = 256 bytes */
40
41 /* Capabilities */
44 bool supports_cubemaps = true;
52
53 /* GPU Family */
59
60 /* CPU Info */
63};
64
65} // namespace blender::gpu