Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Jones <michael_p_jones@apple.com>2021-10-14 15:53:40 +0300
committerMichael Jones <michael_p_jones@apple.com>2021-10-14 18:14:43 +0300
commita0f269f682dab848afc80cd322d04a0c4a815cae (patch)
tree0978b1888273fbaa2d14550bde484c5247fa89ff /intern/cycles/kernel/kernel_differential.h
parent47caeb8c26686e24ea7e694f94fabee44f3d2dca (diff)
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
Diffstat (limited to 'intern/cycles/kernel/kernel_differential.h')
-rw-r--r--intern/cycles/kernel/kernel_differential.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/intern/cycles/kernel/kernel_differential.h b/intern/cycles/kernel/kernel_differential.h
index db4e110bd10..17187083019 100644
--- a/intern/cycles/kernel/kernel_differential.h
+++ b/intern/cycles/kernel/kernel_differential.h
@@ -20,7 +20,7 @@ CCL_NAMESPACE_BEGIN
/* See "Tracing Ray Differentials", Homan Igehy, 1999. */
-ccl_device void differential_transfer(ccl_addr_space differential3 *surface_dP,
+ccl_device void differential_transfer(ccl_private differential3 *surface_dP,
const differential3 ray_dP,
float3 ray_D,
const differential3 ray_dD,
@@ -38,7 +38,7 @@ ccl_device void differential_transfer(ccl_addr_space differential3 *surface_dP,
surface_dP->dy = tmpy - dot(tmpy, surface_Ng) * tmp;
}
-ccl_device void differential_incoming(ccl_addr_space differential3 *dI, const differential3 dD)
+ccl_device void differential_incoming(ccl_private differential3 *dI, const differential3 dD)
{
/* compute dIdx/dy at a shading point, we just need to negate the
* differential of the ray direction */
@@ -47,8 +47,8 @@ ccl_device void differential_incoming(ccl_addr_space differential3 *dI, const di
dI->dy = -dD.dy;
}
-ccl_device void differential_dudv(ccl_addr_space differential *du,
- ccl_addr_space differential *dv,
+ccl_device void differential_dudv(ccl_private differential *du,
+ ccl_private differential *dv,
float3 dPdu,
float3 dPdv,
differential3 dP,
@@ -132,7 +132,7 @@ ccl_device_forceinline float differential_make_compact(const differential3 D)
return 0.5f * (len(D.dx) + len(D.dy));
}
-ccl_device_forceinline void differential_transfer_compact(ccl_addr_space differential3 *surface_dP,
+ccl_device_forceinline void differential_transfer_compact(ccl_private differential3 *surface_dP,
const float ray_dP,
const float3 /* ray_D */,
const float ray_dD,
@@ -149,7 +149,7 @@ ccl_device_forceinline void differential_transfer_compact(ccl_addr_space differe
surface_dP->dy = dy * scale;
}
-ccl_device_forceinline void differential_incoming_compact(ccl_addr_space differential3 *dI,
+ccl_device_forceinline void differential_incoming_compact(ccl_private differential3 *dI,
const float3 D,
const float dD)
{