Blender V5.3
mtl_shader_generate.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
12#include "gpu_shader_private.hh"
13
14#include "mtl_capabilities.hh"
15
16#include <sstream>
17
36#define MTL_MAX_SSBO 16
37#define MTL_MAX_UBO 12
38#define MTL_SSBO_SLOT_OFFSET 0
39#define MTL_UBO_SLOT_OFFSET MTL_MAX_SSBO
40#define MTL_ACCELERATION_STRUCTURE_SLOT (MTL_UBO_SLOT_OFFSET + MTL_MAX_UBO)
41#define MTL_PUSH_CONSTANT_BUFFER_SLOT (MTL_ACCELERATION_STRUCTURE_SLOT + 1)
42#define MTL_SAMPLER_ARGUMENT_BUFFER_SLOT (MTL_PUSH_CONSTANT_BUFFER_SLOT + 1)
43
59#define MTL_IMAGE_SLOT_OFFSET 0
60#define MTL_SAMPLER_SLOT_OFFSET MTL_MAX_IMAGE_SLOTS
61
62/* Other parts of the backend also use specialization constants. */
63#define MTL_SPECIALIZATION_CONSTANT_OFFSET 30
64
65namespace blender::gpu {
66
67struct PatchedShaderCreateInfo;
68
69uint32_t available_buffer_slots(const shader::ShaderCreateInfo &info);
70
71std::pair<std::string, std::string> generate_entry_point(const shader::ShaderCreateInfo &info,
72 const ShaderStage stage,
73 const StringRefNull entry_point_name);
74
75void patch_create_info_atomic_workaround(std::unique_ptr<PatchedShaderCreateInfo> &patched_info,
76 const shader::ShaderCreateInfo &original_info);
77
78} // namespace blender::gpu
std::pair< std::string, std::string > generate_entry_point(const ShaderCreateInfo &info, const ShaderStage stage, const StringRefNull entry_point_name)
void patch_create_info_atomic_workaround(std::unique_ptr< PatchedShaderCreateInfo > &patched_info, const shader::ShaderCreateInfo &original_info)
uint32_t available_buffer_slots(const ShaderCreateInfo &info)
unsigned int uint32_t
Definition BKE_text.h:81