11# include <Metal/Metal.h>
18 METALRT_TABLE_DEFAULT,
20 METALRT_TABLE_SHADOW_ALL,
23 METALRT_TABLE_LOCAL_MBLUR,
24 METALRT_TABLE_LOCAL_SINGLE_HIT,
25 METALRT_TABLE_LOCAL_SINGLE_HIT_MBLUR,
30enum MetalPipelineType {
42 PSO_SPECIALIZED_INTERSECT,
48 PSO_SPECIALIZED_SHADE,
53# define METALRT_FEATURE_MASK \
54 (KERNEL_FEATURE_HAIR | KERNEL_FEATURE_HAIR_THICK | KERNEL_FEATURE_POINTCLOUD)
56const char *kernel_type_as_string(MetalPipelineType pso_type);
59class MetalKernelPipeline {
64 int originating_device_id;
66 id<MTLLibrary> mtlLibrary = nil;
67 MetalPipelineType pso_type;
69 size_t usage_count = 0;
71 KernelData kernel_data_;
75 int threads_per_threadgroup;
79 id<MTLDevice> mtlDevice = nil;
80 id<MTLFunction> function = nil;
81 id<MTLComputePipelineState> pipeline = nil;
82 int num_threads_per_block = 0;
84 bool should_use_binary_archive()
const;
85 id<MTLFunction> make_intersection_function(
const char *function_name);
89 NSArray *table_functions[METALRT_TABLE_NUM] = {nil};
94class MetalDispatchPipeline {
96 ~MetalDispatchPipeline();
99 void free_intersection_function_tables();
102 friend class MetalDeviceQueue;
103 friend struct ShaderCache;
105 int pipeline_id = -1;
107 MetalPipelineType pso_type;
108 id<MTLComputePipelineState> pipeline = nil;
109 int num_threads_per_block = 0;
111 API_AVAILABLE(macos(11.0))
112 id<MTLIntersectionFunctionTable> intersection_func_table[METALRT_TABLE_NUM] = {nil};
116namespace MetalDeviceKernels {
118int num_incomplete_specialization_requests();
119int get_loaded_kernel_count(
const MetalDevice *device, MetalPipelineType pso_type);
120bool should_load_kernels(
const MetalDevice *device, MetalPipelineType pso_type);
121bool load(MetalDevice *device, MetalPipelineType pso_type);
122const MetalKernelPipeline *get_best_pipeline(
const MetalDevice *device,
DeviceKernel kernel);
124bool is_benchmark_warmup();
127void static_deinitialize();
#define CCL_NAMESPACE_END
void load(const VolumeGridData &grid)
static void update(bNodeTree *ntree)