|
Blender V5.3
|
#include "gpu_shader_create_info.hh"#include "gpu_shader_private.hh"#include "mtl_capabilities.hh"#include <sstream>Go to the source code of this file.
Namespaces | |
| namespace | blender |
| BMesh Iterators. | |
| namespace | blender::gpu |
Macros | |
| #define | MTL_MAX_SSBO 16 |
| #define | MTL_MAX_UBO 12 |
| #define | MTL_SSBO_SLOT_OFFSET 0 |
| #define | MTL_UBO_SLOT_OFFSET MTL_MAX_SSBO |
| #define | MTL_ACCELERATION_STRUCTURE_SLOT (MTL_UBO_SLOT_OFFSET + MTL_MAX_UBO) |
| #define | MTL_PUSH_CONSTANT_BUFFER_SLOT (MTL_ACCELERATION_STRUCTURE_SLOT + 1) |
| #define | MTL_SAMPLER_ARGUMENT_BUFFER_SLOT (MTL_PUSH_CONSTANT_BUFFER_SLOT + 1) |
| #define | MTL_IMAGE_SLOT_OFFSET 0 |
| #define | MTL_SAMPLER_SLOT_OFFSET MTL_MAX_IMAGE_SLOTS |
| #define | MTL_SPECIALIZATION_CONSTANT_OFFSET 30 |
Functions | |
| uint32_t | blender::gpu::available_buffer_slots (const ShaderCreateInfo &info) |
| std::pair< std::string, std::string > | blender::gpu::generate_entry_point (const ShaderCreateInfo &info, const ShaderStage stage, const StringRefNull entry_point_name) |
| void | blender::gpu::patch_create_info_atomic_workaround (std::unique_ptr< PatchedShaderCreateInfo > &patched_info, const shader::ShaderCreateInfo &original_info) |
| #define MTL_ACCELERATION_STRUCTURE_SLOT (MTL_UBO_SLOT_OFFSET + MTL_MAX_UBO) |
Definition at line 40 of file mtl_shader_generate.hh.
Referenced by blender::gpu::available_buffer_slots(), blender::gpu::ensure_buffer_bindings(), blender::gpu::generate_resource(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().
| #define MTL_IMAGE_SLOT_OFFSET 0 |
Whether they are used for arbitrary load/store or sampling, all textures share a binding space per stage (up to 128 slots on our target devices). However, we keep the same combined texture+sampler semantic as GLSL. The sampler binding space is much more limited (16 on target hardware) which limits the maximum texture we can bind for sampling. We lift this limit by using an Argument Buffer to store the samplers. So we reserve the first 16 slots to images and the remaining ones for sampler textures.
+--------------------------—+-----—+---------—+ | Type | Count | Slot Range | +--------------------------—+-----—+---------—+ | Image Textures | 8 | 0..7 | | Sampler Textures | 64 | 8..71 | +--------------------------—+-----—+---------—+
Definition at line 59 of file mtl_shader_generate.hh.
Referenced by blender::gpu::ensure_texture_bindings(), and blender::gpu::generate_resource().
| #define MTL_MAX_SSBO 16 |
In Metal UBO, SSBO and Push Constants all share the same binding space with a maximum of 31 bindings per stage. To avoid bind location clash, we associate different ranges to different usage. Given that vertex and index buffers are not present in the shader code, we try to pack them in the remaining unused slots. This is done inside the PSO description building (inside the Batch API).
+--------------------------—+-----—+---------—+ | Type | Count | Slot Range | +--------------------------—+-----—+---------—+ | Vertex Buffers | 16 | 0..30 | | Storage Buffers | 16 | 0..15 | | Uniform Buffers | 12 | 16..27 | | Acceleration Structure | 1 | 28..28 | | Push Constant Buffer | 1 | 29..29 | | Sampler Argument Buffer | 1 | 30..30 | +--------------------------—+-----—+---------—+
Definition at line 36 of file mtl_shader_generate.hh.
| #define MTL_MAX_UBO 12 |
Definition at line 37 of file mtl_shader_generate.hh.
| #define MTL_PUSH_CONSTANT_BUFFER_SLOT (MTL_ACCELERATION_STRUCTURE_SLOT + 1) |
Definition at line 41 of file mtl_shader_generate.hh.
Referenced by blender::gpu::available_buffer_slots(), blender::gpu::ensure_push_constant(), and blender::gpu::generate_uniforms().
| #define MTL_SAMPLER_ARGUMENT_BUFFER_SLOT (MTL_PUSH_CONSTANT_BUFFER_SLOT + 1) |
Definition at line 42 of file mtl_shader_generate.hh.
Referenced by blender::gpu::available_buffer_slots(), blender::gpu::bind_sampler_argument_buffer(), blender::gpu::MTLShaderInterface::ensure_argument_encoder(), and blender::gpu::generate_sampler_argument_buffer().
| #define MTL_SAMPLER_SLOT_OFFSET MTL_MAX_IMAGE_SLOTS |
Definition at line 60 of file mtl_shader_generate.hh.
Referenced by blender::gpu::ensure_texture_bindings(), blender::gpu::generate_resource(), and blender::gpu::generate_texture().
| #define MTL_SPECIALIZATION_CONSTANT_OFFSET 30 |
Definition at line 63 of file mtl_shader_generate.hh.
Referenced by blender::gpu::generate_resources(), and blender::gpu::populate_specialization_constant_values().
| #define MTL_SSBO_SLOT_OFFSET 0 |
Definition at line 38 of file mtl_shader_generate.hh.
Referenced by blender::gpu::available_buffer_slots(), blender::gpu::ensure_buffer_bindings(), blender::gpu::generate_resource(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().
| #define MTL_UBO_SLOT_OFFSET MTL_MAX_SSBO |
Definition at line 39 of file mtl_shader_generate.hh.
Referenced by blender::gpu::available_buffer_slots(), blender::gpu::ensure_buffer_bindings(), blender::gpu::generate_resource(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().