Blender Git Commit Log

Git Commits -> Revision a0f269f

Revision a0f269f by Michael Jones (master)
October 14, 2021, 15:14 (GMT)
Cycles: Kernel address space changes for MSL

This is the first of a sequence of changes to support compiling Cycles kernels as MSL (Metal Shading Language) in preparation for a Metal GPU device implementation.

MSL requires that all pointer types be declared with explicit address space attributes (device, thread, etc...). There is already precedent for this with Cycles' address space macros (ccl_global, ccl_private, etc...), therefore the first step of MSL-enablement is to apply these consistently. Line-for-line this represents the largest change required to enable MSL. Applying this change first will simplify future patches as well as offering the emergent benefit of enhanced descriptiveness.

The vast majority of deltas in this patch fall into one of two cases:

- Ensuring ccl_private is specified for thread-local pointer types
- Ensuring ccl_global is specified for device-wide pointer types

Additionally, the ccl_addr_space qualifier can be removed. Prior to Cycles X, ccl_addr_space was used as a context-dependent address space qualifier, but now it is either redundant (e.g. in struct typedefs), or can be replaced by ccl_global in the case of pointer types. Associated function variants (e.g. lcg_step_float_addrspace) are also redundant.

In cases where address space qualifiers are chained with "const", this patch places the address space qualifier first. The rationale for this is that the choice of address space is likely to have the greater impact on runtime performance and overall architecture.

The final part of this patch is the addition of a metal/compat.h header. This is partially complete and will be extended in future patches, paving the way for the full Metal implementation.

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D12864

Commit Details:

Full Hash: a0f269f682dab848afc80cd322d04a0c4a815cae
Parent Commit: 47caeb8
Lines Changed: +2146, -1648

1 Added Path:

/intern/cycles/kernel/device/metal/compat.h (+126, -0) (View)

147 Modified Paths:

/intern/cycles/kernel/bvh/bvh.h (+18, -18) (Diff)
/intern/cycles/kernel/bvh/bvh_local.h (+8, -8) (Diff)
/intern/cycles/kernel/bvh/bvh_nodes.h (+5, -5) (Diff)
/intern/cycles/kernel/bvh/bvh_shadow_all.h (+9, -9) (Diff)
/intern/cycles/kernel/bvh/bvh_traversal.h (+6, -6) (Diff)
/intern/cycles/kernel/bvh/bvh_util.h (+13, -10) (Diff)
/intern/cycles/kernel/bvh/bvh_volume.h (+6, -6) (Diff)
/intern/cycles/kernel/bvh/bvh_volume_all.h (+4, -4) (Diff)
/intern/cycles/kernel/closure/alloc.h (+11, -6) (Diff)
/intern/cycles/kernel/closure/bsdf.h (+19, -17) (Diff)
/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h (+24, -19) (Diff)
/intern/cycles/kernel/closure/bsdf_ashikhmin_velvet.h (+14, -14) (Diff)
/intern/cycles/kernel/closure/bsdf_diffuse.h (+27, -27) (Diff)
/intern/cycles/kernel/closure/bsdf_diffuse_ramp.h (+13, -13) (Diff)
/intern/cycles/kernel/closure/bsdf_hair.h (+27, -27) (Diff)
/intern/cycles/kernel/closure/bsdf_hair_principled.h (+31, -27) (Diff)
/intern/cycles/kernel/closure/bsdf_microfacet.h (+59, -55) (Diff)
/intern/cycles/kernel/closure/bsdf_microfacet_multi.h (+58, -49) (Diff)
/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h (+11, -11) (Diff)
/intern/cycles/kernel/closure/bsdf_oren_nayar.h (+16, -16) (Diff)
/intern/cycles/kernel/closure/bsdf_phong_ramp.h (+15, -15) (Diff)
/intern/cycles/kernel/closure/bsdf_principled_diffuse.h (+23, -18) (Diff)
/intern/cycles/kernel/closure/bsdf_principled_sheen.h (+16, -15) (Diff)
/intern/cycles/kernel/closure/bsdf_reflection.h (+12, -12) (Diff)
/intern/cycles/kernel/closure/bsdf_refraction.h (+12, -12) (Diff)
/intern/cycles/kernel/closure/bsdf_toon.h (+27, -27) (Diff)
/intern/cycles/kernel/closure/bsdf_transparent.h (+15, -13) (Diff)
/intern/cycles/kernel/closure/bsdf_util.h (+7, -7) (Diff)
/intern/cycles/kernel/closure/bssrdf.h (+24, -11) (Diff)
/intern/cycles/kernel/closure/emissive.h (+7, -4) (Diff)
/intern/cycles/kernel/closure/volume.h (+25, -22) (Diff)
/intern/cycles/kernel/device/cpu/compat.h (+0, -2) (Diff)
/intern/cycles/kernel/device/cuda/compat.h (+0, -1) (Diff)
/intern/cycles/kernel/device/hip/compat.h (+0, -1) (Diff)
/intern/cycles/kernel/device/optix/compat.h (+0, -1) (Diff)
/intern/cycles/kernel/geom/geom_attribute.h (+9, -7) (Diff)
/intern/cycles/kernel/geom/geom_curve.h (+28, -25) (Diff)
/intern/cycles/kernel/geom/geom_curve_intersect.h (+16, -16) (Diff)
/intern/cycles/kernel/geom/geom_motion_curve.h (+12, -7) (Diff)
/intern/cycles/kernel/geom/geom_motion_triangle.h (+12, -7) (Diff)
/intern/cycles/kernel/geom/geom_motion_triangle_intersect.h (+10, -10) (Diff)
/intern/cycles/kernel/geom/geom_motion_triangle_shader.h (+2, -2) (Diff)
/intern/cycles/kernel/geom/geom_object.h (+98, -87) (Diff)
/intern/cycles/kernel/geom/geom_patch.h (+38, -30) (Diff)
/intern/cycles/kernel/geom/geom_primitive.h (+34, -28) (Diff)
/intern/cycles/kernel/geom/geom_shader_data.h (+16, -15) (Diff)
/intern/cycles/kernel/geom/geom_subd_triangle.h (+25, -23) (Diff)
/intern/cycles/kernel/geom/geom_triangle.h (+34, -29) (Diff)
/intern/cycles/kernel/geom/geom_triangle_intersect.h (+10, -10) (Diff)
/intern/cycles/kernel/geom/geom_volume.h (+4, -4) (Diff)
/intern/cycles/kernel/integrator/integrator_init_from_bake.h (+1, -1) (Diff)
/intern/cycles/kernel/integrator/integrator_init_from_camera.h (+3, -3) (Diff)
/intern/cycles/kernel/integrator/integrator_intersect_closest.h (+1, -1) (Diff)
/intern/cycles/kernel/integrator/integrator_intersect_shadow.h (+2, -2) (Diff)
/intern/cycles/kernel/integrator/integrator_intersect_volume_stack.h (+2, -2) (Diff)
/intern/cycles/kernel/integrator/integrator_shade_background.h (+2, -2) (Diff)
/intern/cycles/kernel/integrator/integrator_shade_light.h (+1, -1) (Diff)
/intern/cycles/kernel/integrator/integrator_shade_shadow.h (+4, -3) (Diff)
/intern/cycles/kernel/integrator/integrator_shade_surface.h (+20, -19) (Diff)
/intern/cycles/kernel/integrator/integrator_shade_volume.h (+57, -51) (Diff)
/intern/cycles/kernel/integrator/integrator_state.h (+7, -6) (Diff)
/intern/cycles/kernel/integrator/integrator_state_util.h (+12, -13) (Diff)
/intern/cycles/kernel/integrator/integrator_subsurface.h (+8, -5) (Diff)
/intern/cycles/kernel/integrator/integrator_subsurface_disk.h (+2, -2) (Diff)
/intern/cycles/kernel/integrator/integrator_subsurface_random_walk.h (+11, -8) (Diff)
/intern/cycles/kernel/integrator/integrator_volume_stack.h (+4, -3) (Diff)
/intern/cycles/kernel/kernel_accumulate.h (+12, -8) (Diff)
/intern/cycles/kernel/kernel_adaptive_sampling.h (+3, -3) (Diff)
/intern/cycles/kernel/kernel_bake.h (+2, -2) (Diff)
/intern/cycles/kernel/kernel_camera.h (+16, -14) (Diff)
/intern/cycles/kernel/kernel_color.h (+2, -2) (Diff)
/intern/cycles/kernel/kernel_differential.h (+6, -6) (Diff)
/intern/cycles/kernel/kernel_emission.h (+30, -26) (Diff)
/intern/cycles/kernel/kernel_film.h (+60, -57) (Diff)
/intern/cycles/kernel/kernel_id_passes.h (+1, -1) (Diff)
/intern/cycles/kernel/kernel_jitter.h (+10, -3) (Diff)
/intern/cycles/kernel/kernel_light.h (+37, -35) (Diff)
/intern/cycles/kernel/kernel_light_background.h (+25, -16) (Diff)
/intern/cycles/kernel/kernel_light_common.h (+8, -5) (Diff)
/intern/cycles/kernel/kernel_lookup_table.h (+5, -2) (Diff)
/intern/cycles/kernel/kernel_montecarlo.h (+13, -6) (Diff)
/intern/cycles/kernel/kernel_passes.h (+11, -7) (Diff)
/intern/cycles/kernel/kernel_path_state.h (+22, -17) (Diff)
/intern/cycles/kernel/kernel_projection.h (+2, -2) (Diff)
/intern/cycles/kernel/kernel_random.h (+9, -12) (Diff)
/intern/cycles/kernel/kernel_shader.h (+118, -98) (Diff)
/intern/cycles/kernel/kernel_types.h (+9, -8) (Diff)
/intern/cycles/kernel/svm/svm.h (+23, -16) (Diff)
/intern/cycles/kernel/svm/svm_ao.h (+5, -2) (Diff)
/intern/cycles/kernel/svm/svm_aov.h (+4, -4) (Diff)
/intern/cycles/kernel/svm/svm_attribute.h (+13, -13) (Diff)
/intern/cycles/kernel/svm/svm_bevel.h (+9, -3) (Diff)
/intern/cycles/kernel/svm/svm_blackbody.h (+3, -3) (Diff)
/intern/cycles/kernel/svm/svm_brick.h (+5, -2) (Diff)
/intern/cycles/kernel/svm/svm_brightness.h (+1, -1) (Diff)
/intern/cycles/kernel/svm/svm_bump.h (+6, -6) (Diff)
/intern/cycles/kernel/svm/svm_camera.h (+3, -3) (Diff)
/intern/cycles/kernel/svm/svm_checker.h (+3, -3) (Diff)
/intern/cycles/kernel/svm/svm_clamp.h (+3, -3) (Diff)
/intern/cycles/kernel/svm/svm_closure.h (+102, -62) (Diff)
/intern/cycles/kernel/svm/svm_convert.h (+6, -2) (Diff)
/intern/cycles/kernel/svm/svm_displace.h (+14, -11) (Diff)
/intern/cycles/kernel/svm/svm_fresnel.h (+8, -3) (Diff)
/intern/cycles/kernel/svm/svm_gamma.h (+5, -2) (Diff)
/intern/cycles/kernel/svm/svm_geometry.h (+30, -12) (Diff)
/intern/cycles/kernel/svm/svm_gradient.h (+3, -1) (Diff)
/intern/cycles/kernel/svm/svm_hsv.h (+3, -3) (Diff)
/intern/cycles/kernel/svm/svm_ies.h (+5, -5) (Diff)
/intern/cycles/kernel/svm/svm_image.h (+13, -9) (Diff)
/intern/cycles/kernel/svm/svm_invert.h (+5, -2) (Diff)
/intern/cycles/kernel/svm/svm_light_path.h (+5, -3) (Diff)
/intern/cycles/kernel/svm/svm_magic.h (+5, -2) (Diff)
/intern/cycles/kernel/svm/svm_mapping.h (+9, -9) (Diff)
/intern/cycles/kernel/svm/svm_map_range.h (+3, -3) (Diff)
/intern/cycles/kernel/svm/svm_math.h (+6, -6) (Diff)
/intern/cycles/kernel/svm/svm_math_util.h (+2, -2) (Diff)
/intern/cycles/kernel/svm/svm_mix.h (+3, -3) (Diff)
/intern/cycles/kernel/svm/svm_musgrave.h (+3, -3) (Diff)
/intern/cycles/kernel/svm/svm_noisetex.h (+11, -11) (Diff)
/intern/cycles/kernel/svm/svm_normal.h (+3, -3) (Diff)
/intern/cycles/kernel/svm/svm_ramp.h (+18, -9) (Diff)
/intern/cycles/kernel/svm/svm_sepcomb_hsv.h (+6, -6) (Diff)
/intern/cycles/kernel/svm/svm_sepcomb_vector.h (+10, -4) (Diff)
/intern/cycles/kernel/svm/svm_sky.h (+17, -14) (Diff)
/intern/cycles/kernel/svm/svm_tex_coord.h (+24, -12) (Diff)
/intern/cycles/kernel/svm/svm_value.h (+10, -4) (Diff)
/intern/cycles/kernel/svm/svm_vector_rotate.h (+2, -2) (Diff)
/intern/cycles/kernel/svm/svm_vector_transform.h (+3, -3) (Diff)
/intern/cycles/kernel/svm/svm_vertex_color.h (+9, -9) (Diff)
/intern/cycles/kernel/svm/svm_voronoi.h (+61, -47) (Diff)
/intern/cycles/kernel/svm/svm_voxel.h (+5, -2) (Diff)
/intern/cycles/kernel/svm/svm_wave.h (+5, -2) (Diff)
/intern/cycles/kernel/svm/svm_wavelength.h (+5, -2) (Diff)
/intern/cycles/kernel/svm/svm_white_noise.h (+3, -3) (Diff)
/intern/cycles/kernel/svm/svm_wireframe.h (+8, -5) (Diff)
/intern/cycles/util/util_color.h (+1, -1) (Diff)
/intern/cycles/util/util_half.h (+2, -2) (Diff)
/intern/cycles/util/util_math.h (+7, -3) (Diff)
/intern/cycles/util/util_math_fast.h (+1, -1) (Diff)
/intern/cycles/util/util_math_float2.h (+1, -1) (Diff)
/intern/cycles/util/util_math_float3.h (+2, -2) (Diff)
/intern/cycles/util/util_math_float4.h (+1, -1) (Diff)
/intern/cycles/util/util_math_intersect.h (+11, -11) (Diff)
/intern/cycles/util/util_math_matrix.h (+20, -14) (Diff)
/intern/cycles/util/util_projection.h (+3, -2) (Diff)
/intern/cycles/util/util_rect.h (+4, -1) (Diff)
/intern/cycles/util/util_transform.h (+11, -9) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021