This patch adds MetalRT support to Cycles kernel code. It is mostly additive in nature or confined to Metal-specific code, however there are a few areas where this interacts with other code: - MetalRT closely follows the Optix implementation, and in some cases (notably handling of transforms) it makes sense to extend Optix special-casing to MetalRT. For these generalisations we now have `__KERNEL_GPU_RAYTRACING__` instead of `__KERNEL_OPTIX__`. - MetalRT doesn't support primitive offsetting (as with `primitiveIndexOffset` in Optix), so we define and populate a new kernel texture, `__object_prim_offset`, containing per-object primitive / curve-segment offsets. This is referenced and applied in MetalRT intersection handlers. - Two new BVH layout enum values have been added: `BVH_LAYOUT_METAL` and `BVH_LAYOUT_MULTI_METAL_EMBREE` for XPU mode). Some host-side enum case handling has been updated where it is trivial to do so. Ref T92212 Reviewed By: brecht Maniphest Tasks: T92212 Differential Revision: https://developer.blender.org/D13353
92 lines
2.5 KiB
C
92 lines
2.5 KiB
C
/*
|
|
* Copyright 2011-2013 Blender Foundation
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef KERNEL_TEX
|
|
# define KERNEL_TEX(type, name)
|
|
#endif
|
|
|
|
/* BVH2, not used for OptiX or Embree. */
|
|
KERNEL_TEX(float4, __bvh_nodes)
|
|
KERNEL_TEX(float4, __bvh_leaf_nodes)
|
|
KERNEL_TEX(uint, __prim_type)
|
|
KERNEL_TEX(uint, __prim_visibility)
|
|
KERNEL_TEX(uint, __prim_index)
|
|
KERNEL_TEX(uint, __prim_object)
|
|
KERNEL_TEX(uint, __object_node)
|
|
KERNEL_TEX(float2, __prim_time)
|
|
|
|
/* objects */
|
|
KERNEL_TEX(KernelObject, __objects)
|
|
KERNEL_TEX(Transform, __object_motion_pass)
|
|
KERNEL_TEX(DecomposedTransform, __object_motion)
|
|
KERNEL_TEX(uint, __object_flag)
|
|
KERNEL_TEX(float, __object_volume_step)
|
|
KERNEL_TEX(uint, __object_prim_offset)
|
|
|
|
/* cameras */
|
|
KERNEL_TEX(DecomposedTransform, __camera_motion)
|
|
|
|
/* triangles */
|
|
KERNEL_TEX(uint, __tri_shader)
|
|
KERNEL_TEX(packed_float3, __tri_vnormal)
|
|
KERNEL_TEX(uint4, __tri_vindex)
|
|
KERNEL_TEX(uint, __tri_patch)
|
|
KERNEL_TEX(float2, __tri_patch_uv)
|
|
KERNEL_TEX(packed_float3, __tri_verts)
|
|
|
|
/* curves */
|
|
KERNEL_TEX(KernelCurve, __curves)
|
|
KERNEL_TEX(float4, __curve_keys)
|
|
KERNEL_TEX(KernelCurveSegment, __curve_segments)
|
|
|
|
/* patches */
|
|
KERNEL_TEX(uint, __patches)
|
|
|
|
/* attributes */
|
|
KERNEL_TEX(uint4, __attributes_map)
|
|
KERNEL_TEX(float, __attributes_float)
|
|
KERNEL_TEX(float2, __attributes_float2)
|
|
KERNEL_TEX(packed_float3, __attributes_float3)
|
|
KERNEL_TEX(float4, __attributes_float4)
|
|
KERNEL_TEX(uchar4, __attributes_uchar4)
|
|
|
|
/* lights */
|
|
KERNEL_TEX(KernelLightDistribution, __light_distribution)
|
|
KERNEL_TEX(KernelLight, __lights)
|
|
KERNEL_TEX(float2, __light_background_marginal_cdf)
|
|
KERNEL_TEX(float2, __light_background_conditional_cdf)
|
|
|
|
/* particles */
|
|
KERNEL_TEX(KernelParticle, __particles)
|
|
|
|
/* shaders */
|
|
KERNEL_TEX(uint4, __svm_nodes)
|
|
KERNEL_TEX(KernelShader, __shaders)
|
|
|
|
/* lookup tables */
|
|
KERNEL_TEX(float, __lookup_table)
|
|
|
|
/* sobol */
|
|
KERNEL_TEX(float, __sample_pattern_lut)
|
|
|
|
/* image textures */
|
|
KERNEL_TEX(TextureInfo, __texture_info)
|
|
|
|
/* ies lights */
|
|
KERNEL_TEX(float, __ies)
|
|
|
|
#undef KERNEL_TEX
|