diff options
author | Brecht Van Lommel <brecht> | 2021-10-17 17:10:10 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-18 20:02:10 +0300 |
commit | 1df3b51988852fa8ee6b530a64aa23346db9acd4 (patch) | |
tree | dd79dba4c8ff8bb8474cc399e9d1b308d845e0cb /intern/cycles/kernel/bvh | |
parent | 44c3bb729be42d6d67eaf8918d7cbcb2ff0b315d (diff) |
Cycles: replace integrator state argument macros
* Rename struct KernelGlobals to struct KernelGlobalsCPU
* Add KernelGlobals, IntegratorState and ConstIntegratorState typedefs
that every device can define in its own way.
* Remove INTEGRATOR_STATE_ARGS and INTEGRATOR_STATE_PASS macros and
replace with these new typedefs.
* Add explicit state argument to INTEGRATOR_STATE and similar macros
In preparation for decoupling main and shadow paths.
Differential Revision: https://developer.blender.org/D12888
Diffstat (limited to 'intern/cycles/kernel/bvh')
-rw-r--r-- | intern/cycles/kernel/bvh/bvh.h | 10 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_embree.h | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_local.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_nodes.h | 10 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_shadow_all.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_traversal.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_util.h | 20 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_volume.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_volume_all.h | 4 |
9 files changed, 34 insertions, 34 deletions
diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index a501cbe7a4b..bdbd574bf0f 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -154,7 +154,7 @@ ccl_device_inline bool scene_intersect_valid(ccl_private const Ray *ray) return isfinite_safe(ray->P.x) && isfinite_safe(ray->D.x) && len_squared(ray->D) != 0.0f; } -ccl_device_intersect bool scene_intersect(ccl_global const KernelGlobals *kg, +ccl_device_intersect bool scene_intersect(KernelGlobals kg, ccl_private const Ray *ray, const uint visibility, ccl_private Intersection *isect) @@ -248,7 +248,7 @@ ccl_device_intersect bool scene_intersect(ccl_global const KernelGlobals *kg, } #ifdef __BVH_LOCAL__ -ccl_device_intersect bool scene_intersect_local(ccl_global const KernelGlobals *kg, +ccl_device_intersect bool scene_intersect_local(KernelGlobals kg, ccl_private const Ray *ray, ccl_private LocalIntersection *local_isect, int local_object, @@ -360,7 +360,7 @@ ccl_device_intersect bool scene_intersect_local(ccl_global const KernelGlobals * #endif #ifdef __SHADOW_RECORD_ALL__ -ccl_device_intersect bool scene_intersect_shadow_all(ccl_global const KernelGlobals *kg, +ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals kg, ccl_private const Ray *ray, ccl_private Intersection *isect, uint visibility, @@ -448,7 +448,7 @@ ccl_device_intersect bool scene_intersect_shadow_all(ccl_global const KernelGlob #endif /* __SHADOW_RECORD_ALL__ */ #ifdef __VOLUME__ -ccl_device_intersect bool scene_intersect_volume(ccl_global const KernelGlobals *kg, +ccl_device_intersect bool scene_intersect_volume(KernelGlobals kg, ccl_private const Ray *ray, ccl_private Intersection *isect, const uint visibility) @@ -510,7 +510,7 @@ ccl_device_intersect bool scene_intersect_volume(ccl_global const KernelGlobals #endif /* __VOLUME__ */ #ifdef __VOLUME_RECORD_ALL__ -ccl_device_intersect uint scene_intersect_volume_all(ccl_global const KernelGlobals *kg, +ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals kg, ccl_private const Ray *ray, ccl_private Intersection *isect, const uint max_hits, diff --git a/intern/cycles/kernel/bvh/bvh_embree.h b/intern/cycles/kernel/bvh/bvh_embree.h index d3db6295ea5..7fa0cfdc510 100644 --- a/intern/cycles/kernel/bvh/bvh_embree.h +++ b/intern/cycles/kernel/bvh/bvh_embree.h @@ -35,7 +35,7 @@ struct CCLIntersectContext { RAY_VOLUME_ALL = 4, } RayType; - const KernelGlobals *kg; + KernelGlobals kg; RayType type; /* for shadow rays */ @@ -50,7 +50,7 @@ struct CCLIntersectContext { int local_object_id; uint *lcg_state; - CCLIntersectContext(const KernelGlobals *kg_, RayType type_) + CCLIntersectContext(KernelGlobals kg_, RayType type_) { kg = kg_; type = type_; @@ -101,7 +101,7 @@ ccl_device_inline void kernel_embree_setup_rayhit(const Ray &ray, rayhit.hit.primID = RTC_INVALID_GEOMETRY_ID; } -ccl_device_inline void kernel_embree_convert_hit(const KernelGlobals *kg, +ccl_device_inline void kernel_embree_convert_hit(KernelGlobals kg, const RTCRay *ray, const RTCHit *hit, Intersection *isect) @@ -137,7 +137,7 @@ ccl_device_inline void kernel_embree_convert_hit(const KernelGlobals *kg, } ccl_device_inline void kernel_embree_convert_sss_hit( - const KernelGlobals *kg, const RTCRay *ray, const RTCHit *hit, Intersection *isect, int object) + KernelGlobals kg, const RTCRay *ray, const RTCHit *hit, Intersection *isect, int object) { isect->u = 1.0f - hit->v - hit->u; isect->v = hit->u; diff --git a/intern/cycles/kernel/bvh/bvh_local.h b/intern/cycles/kernel/bvh/bvh_local.h index 78ad4a34da9..79cde69699e 100644 --- a/intern/cycles/kernel/bvh/bvh_local.h +++ b/intern/cycles/kernel/bvh/bvh_local.h @@ -36,7 +36,7 @@ ccl_device #else ccl_device_inline #endif - bool BVH_FUNCTION_FULL_NAME(BVH)(ccl_global const KernelGlobals *kg, + bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals kg, ccl_private const Ray *ray, ccl_private LocalIntersection *local_isect, int local_object, @@ -196,7 +196,7 @@ ccl_device_inline return false; } -ccl_device_inline bool BVH_FUNCTION_NAME(ccl_global const KernelGlobals *kg, +ccl_device_inline bool BVH_FUNCTION_NAME(KernelGlobals kg, ccl_private const Ray *ray, ccl_private LocalIntersection *local_isect, int local_object, diff --git a/intern/cycles/kernel/bvh/bvh_nodes.h b/intern/cycles/kernel/bvh/bvh_nodes.h index 49b37f39671..71122085f69 100644 --- a/intern/cycles/kernel/bvh/bvh_nodes.h +++ b/intern/cycles/kernel/bvh/bvh_nodes.h @@ -16,7 +16,7 @@ // TODO(sergey): Look into avoid use of full Transform and use 3x3 matrix and // 3-vector which might be faster. -ccl_device_forceinline Transform bvh_unaligned_node_fetch_space(ccl_global const KernelGlobals *kg, +ccl_device_forceinline Transform bvh_unaligned_node_fetch_space(KernelGlobals kg, int node_addr, int child) { @@ -28,7 +28,7 @@ ccl_device_forceinline Transform bvh_unaligned_node_fetch_space(ccl_global const return space; } -ccl_device_forceinline int bvh_aligned_node_intersect(ccl_global const KernelGlobals *kg, +ccl_device_forceinline int bvh_aligned_node_intersect(KernelGlobals kg, const float3 P, const float3 idir, const float t, @@ -76,7 +76,7 @@ ccl_device_forceinline int bvh_aligned_node_intersect(ccl_global const KernelGlo #endif } -ccl_device_forceinline bool bvh_unaligned_node_intersect_child(ccl_global const KernelGlobals *kg, +ccl_device_forceinline bool bvh_unaligned_node_intersect_child(KernelGlobals kg, const float3 P, const float3 dir, const float t, @@ -102,7 +102,7 @@ ccl_device_forceinline bool bvh_unaligned_node_intersect_child(ccl_global const return tnear <= tfar; } -ccl_device_forceinline int bvh_unaligned_node_intersect(ccl_global const KernelGlobals *kg, +ccl_device_forceinline int bvh_unaligned_node_intersect(KernelGlobals kg, const float3 P, const float3 dir, const float3 idir, @@ -134,7 +134,7 @@ ccl_device_forceinline int bvh_unaligned_node_intersect(ccl_global const KernelG return mask; } -ccl_device_forceinline int bvh_node_intersect(ccl_global const KernelGlobals *kg, +ccl_device_forceinline int bvh_node_intersect(KernelGlobals kg, const float3 P, const float3 dir, const float3 idir, diff --git a/intern/cycles/kernel/bvh/bvh_shadow_all.h b/intern/cycles/kernel/bvh/bvh_shadow_all.h index 7e2edd2684c..42ab9eda37e 100644 --- a/intern/cycles/kernel/bvh/bvh_shadow_all.h +++ b/intern/cycles/kernel/bvh/bvh_shadow_all.h @@ -36,7 +36,7 @@ ccl_device #else ccl_device_inline #endif - bool BVH_FUNCTION_FULL_NAME(BVH)(ccl_global const KernelGlobals *kg, + bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals kg, ccl_private const Ray *ray, ccl_private Intersection *isect_array, const uint visibility, @@ -298,7 +298,7 @@ ccl_device_inline return false; } -ccl_device_inline bool BVH_FUNCTION_NAME(ccl_global const KernelGlobals *kg, +ccl_device_inline bool BVH_FUNCTION_NAME(KernelGlobals kg, ccl_private const Ray *ray, ccl_private Intersection *isect_array, const uint visibility, diff --git a/intern/cycles/kernel/bvh/bvh_traversal.h b/intern/cycles/kernel/bvh/bvh_traversal.h index 9f271a4730c..1c17ebf767f 100644 --- a/intern/cycles/kernel/bvh/bvh_traversal.h +++ b/intern/cycles/kernel/bvh/bvh_traversal.h @@ -31,7 +31,7 @@ * BVH_MOTION: motion blur rendering */ -ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(ccl_global const KernelGlobals *kg, +ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals kg, ccl_private const Ray *ray, ccl_private Intersection *isect, const uint visibility) @@ -228,7 +228,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(ccl_global const KernelGlob return (isect->prim != PRIM_NONE); } -ccl_device_inline bool BVH_FUNCTION_NAME(ccl_global const KernelGlobals *kg, +ccl_device_inline bool BVH_FUNCTION_NAME(KernelGlobals kg, ccl_private const Ray *ray, ccl_private Intersection *isect, const uint visibility) diff --git a/intern/cycles/kernel/bvh/bvh_util.h b/intern/cycles/kernel/bvh/bvh_util.h index 31aae389da0..d45eeec4815 100644 --- a/intern/cycles/kernel/bvh/bvh_util.h +++ b/intern/cycles/kernel/bvh/bvh_util.h @@ -139,8 +139,9 @@ ccl_device_inline void sort_intersections_and_normals(ccl_private Intersection * /* Utility to quickly get flags from an intersection. */ -ccl_device_forceinline int intersection_get_shader_flags( - ccl_global const KernelGlobals *ccl_restrict kg, const int prim, const int type) +ccl_device_forceinline int intersection_get_shader_flags(KernelGlobals kg, + const int prim, + const int type) { int shader = 0; @@ -159,8 +160,9 @@ ccl_device_forceinline int intersection_get_shader_flags( return kernel_tex_fetch(__shaders, (shader & SHADER_MASK)).flags; } -ccl_device_forceinline int intersection_get_shader_from_isect_prim( - ccl_global const KernelGlobals *ccl_restrict kg, const int prim, const int isect_type) +ccl_device_forceinline int intersection_get_shader_from_isect_prim(KernelGlobals kg, + const int prim, + const int isect_type) { int shader = 0; @@ -179,23 +181,21 @@ ccl_device_forceinline int intersection_get_shader_from_isect_prim( return shader & SHADER_MASK; } -ccl_device_forceinline int intersection_get_shader(ccl_global const KernelGlobals *ccl_restrict kg, - ccl_private const Intersection *ccl_restrict - isect) +ccl_device_forceinline int intersection_get_shader( + KernelGlobals kg, ccl_private const Intersection *ccl_restrict isect) { return intersection_get_shader_from_isect_prim(kg, isect->prim, isect->type); } ccl_device_forceinline int intersection_get_object_flags( - ccl_global const KernelGlobals *ccl_restrict kg, - ccl_private const Intersection *ccl_restrict isect) + KernelGlobals kg, ccl_private const Intersection *ccl_restrict isect) { return kernel_tex_fetch(__object_flag, isect->object); } /* TODO: find a better (faster) solution for this. Maybe store offset per object for * attributes needed in intersection? */ -ccl_device_inline int intersection_find_attribute(ccl_global const KernelGlobals *kg, +ccl_device_inline int intersection_find_attribute(KernelGlobals kg, const int object, const uint id) { diff --git a/intern/cycles/kernel/bvh/bvh_volume.h b/intern/cycles/kernel/bvh/bvh_volume.h index d3bfce2d96b..fa56bd02bef 100644 --- a/intern/cycles/kernel/bvh/bvh_volume.h +++ b/intern/cycles/kernel/bvh/bvh_volume.h @@ -35,7 +35,7 @@ ccl_device #else ccl_device_inline #endif - bool BVH_FUNCTION_FULL_NAME(BVH)(ccl_global const KernelGlobals *kg, + bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals kg, ccl_private const Ray *ray, ccl_private Intersection *isect, const uint visibility) @@ -221,7 +221,7 @@ ccl_device_inline return (isect->prim != PRIM_NONE); } -ccl_device_inline bool BVH_FUNCTION_NAME(ccl_global const KernelGlobals *kg, +ccl_device_inline bool BVH_FUNCTION_NAME(KernelGlobals kg, ccl_private const Ray *ray, ccl_private Intersection *isect, const uint visibility) diff --git a/intern/cycles/kernel/bvh/bvh_volume_all.h b/intern/cycles/kernel/bvh/bvh_volume_all.h index f0fe95924cf..1d7d942e736 100644 --- a/intern/cycles/kernel/bvh/bvh_volume_all.h +++ b/intern/cycles/kernel/bvh/bvh_volume_all.h @@ -35,7 +35,7 @@ ccl_device #else ccl_device_inline #endif - uint BVH_FUNCTION_FULL_NAME(BVH)(ccl_global const KernelGlobals *kg, + uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals kg, ccl_private const Ray *ray, Intersection *isect_array, const uint max_hits, @@ -289,7 +289,7 @@ ccl_device_inline return num_hits; } -ccl_device_inline uint BVH_FUNCTION_NAME(ccl_global const KernelGlobals *kg, +ccl_device_inline uint BVH_FUNCTION_NAME(KernelGlobals kg, ccl_private const Ray *ray, Intersection *isect_array, const uint max_hits, |