Blender V5.3
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
17#define MTL_MAX_IMAGE_SLOTS GPU_MAX_IMAGE
18#define MTL_MAX_SAMPLER_SLOTS 64
19/* Theoretical limit is 128 no target hardware. */
20#define MTL_MAX_TEXTURE_SLOTS (MTL_MAX_SAMPLER_SLOTS + MTL_MAX_IMAGE_SLOTS)
21/* Max limit without using bind-less for samplers. */
22#define MTL_MAX_DEFAULT_SAMPLERS 16
23/* Total maximum buffers which can be bound to an encoder, for use within a shader.
24 * Uniform buffers and storage buffers share the set of available bind buffers.
25 * The total number of buffer bindings must be <= MTL_MAX_BUFFER_BINDINGS
26 * We also require an additional 2 core buffers for:
27 * - Argument buffer for bindless resources (e.g. samplers)
28 * - Default push constant block
29 * Along with up to 6+1 buffers for vertex data, and index data. */
30#define MTL_MAX_BUFFER_BINDINGS 31
31#define MTL_MAX_VERTEX_INPUT_ATTRIBUTES 31
32#define MTL_MAX_UNIFORMS_PER_BLOCK 64
33
34#define MTL_MAX_SET_BYTES_SIZE 4096
35
37
38/* Context-specific limits -- populated in 'MTLBackend::platform_init' */
40
41 /* Variable Limits & feature sets. */
42 int max_color_render_targets = 4; /* Minimum = 4 */
43 int buffer_alignment_for_textures = 256; /* Upper bound = 256 bytes */
44 int minimum_buffer_offset_alignment = 256; /* Upper bound = 256 bytes */
45
46 /* Capabilities */
49 bool supports_cubemaps = true;
57 /* Hardware ray tracing (ray queries). */
59
60 /* GPU Family */
66
67 /* CPU Info */
70};
71
72} // namespace blender::gpu