Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/device/metal/compat.h
| Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
| #define ccl_gpu_ballot(predicate) ((uint64_t)((simd_vote::vote_t)simd_ballot(predicate))) | #define ccl_gpu_ballot(predicate) ((uint64_t)((simd_vote::vote_t)simd_ballot(predicate))) | ||||
| #define ccl_gpu_popc(x) popcount(x) | #define ccl_gpu_popc(x) popcount(x) | ||||
| // clang-format off | // clang-format off | ||||
| /* kernel.h adapters */ | /* kernel.h adapters */ | ||||
| #define ccl_gpu_kernel(...) | #define ccl_gpu_kernel(block_num_threads, thread_num_registers) | ||||
| #define ccl_gpu_kernel_threads(block_num_threads) | |||||
| /* convert a comma-separated list into a semicolon-separated list (so that we can generate a struct based on kernel entrypoint parameters) */ | /* convert a comma-separated list into a semicolon-separated list (so that we can generate a struct based on kernel entrypoint parameters) */ | ||||
| #define FN0() | #define FN0() | ||||
| #define FN1(p1) p1; | #define FN1(p1) p1; | ||||
| #define FN2(p1, p2) p1; p2; | #define FN2(p1, p2) p1; p2; | ||||
| #define FN3(p1, p2, p3) p1; p2; p3; | #define FN3(p1, p2, p3) p1; p2; p3; | ||||
| #define FN4(p1, p2, p3, p4) p1; p2; p3; p4; | #define FN4(p1, p2, p3, p4) p1; p2; p3; p4; | ||||
| #define FN5(p1, p2, p3, p4, p5) p1; p2; p3; p4; p5; | #define FN5(p1, p2, p3, p4, p5) p1; p2; p3; p4; p5; | ||||
| ▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
| /* define a function object where "func" is the lambda body, and additional parameters are used to specify captured state */ | /* define a function object where "func" is the lambda body, and additional parameters are used to specify captured state */ | ||||
| #define ccl_gpu_kernel_lambda(func, ...) \ | #define ccl_gpu_kernel_lambda(func, ...) \ | ||||
| struct KernelLambda \ | struct KernelLambda \ | ||||
| { \ | { \ | ||||
| KernelLambda(ccl_private MetalKernelContext &_context) : context(_context) {} \ | KernelLambda(ccl_private MetalKernelContext &_context) : context(_context) {} \ | ||||
| ccl_private MetalKernelContext &context; \ | ccl_private MetalKernelContext &context; \ | ||||
| __VA_ARGS__; \ | __VA_ARGS__; \ | ||||
| int operator()(const int state) const { return (func); } \ | int operator()(const int state) const { return (func); } \ | ||||
| }ccl_gpu_kernel_lambda_pass(context); ccl_gpu_kernel_lambda_pass | } ccl_gpu_kernel_lambda_pass(context) | ||||
| // clang-format on | // clang-format on | ||||
| /* make_type definitions with Metal style element initializers */ | /* make_type definitions with Metal style element initializers */ | ||||
| #ifdef make_float2 | #ifdef make_float2 | ||||
| # undef make_float2 | # undef make_float2 | ||||
| #endif | #endif | ||||
| #ifdef make_float3 | #ifdef make_float3 | ||||
| ▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
| constant constexpr array<sampler, SamplerCount> metal_samplers = { | constant constexpr array<sampler, SamplerCount> metal_samplers = { | ||||
| sampler(address::repeat, filter::nearest), | sampler(address::repeat, filter::nearest), | ||||
| sampler(address::clamp_to_edge, filter::nearest), | sampler(address::clamp_to_edge, filter::nearest), | ||||
| sampler(address::clamp_to_zero, filter::nearest), | sampler(address::clamp_to_zero, filter::nearest), | ||||
| sampler(address::repeat, filter::linear), | sampler(address::repeat, filter::linear), | ||||
| sampler(address::clamp_to_edge, filter::linear), | sampler(address::clamp_to_edge, filter::linear), | ||||
| sampler(address::clamp_to_zero, filter::linear), | sampler(address::clamp_to_zero, filter::linear), | ||||
| }; | }; | ||||
| No newline at end of file | |||||